2010-01-29 Doug Kwan <dougkwan@google.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
e7eca48c
DK
12010-01-29 Doug Kwan <dougkwan@google.com>
2
3 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4 output_local_symbol_count_needs_update_.
5 (Arm_relobj::output_local_symbol_count_needs_update,
6 Arm_relobj::set_output_local_symbol_count_needs_update,
7 Arm_relobj::update_output_local_symbol_count): New methods.
8 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9 member.
10 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11 of pointed function as in a R_ARM_PREL31 relocation.
12 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
13 for output local symbol count updating.
14 (Target_arm::do_relax): Update output local symbol counts in objects
15 if necessary.
16 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
17
02961d7e
ILT
182010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
19
20 * arm.cc: Added support for the ARM relocations:
21 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
22 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
23 (Arm_relocate_functions::movw_rel_nc): Renamed (was
24 movw_prel_nc).
25 (Arm_relocate_functions::movw_rel): New method.
26 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
27 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
28 thm_movw_prel_nc).
29 (Arm_relocate_functions::thm_movw_rel): New method.
30 (Arm_relocate_functions::thm_movt_rel): Renamed (was
31 thm_movt_prel).
32 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
33 relocations.
34 (Target_arm::Scan::global): Likewise.
35 (Target_arm::Relocate::relocate): Likewise.
36 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
37 Likewise.
38
b10d2873
ILT
392010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
40
41 * arm.cc: Added support for ARM group relocations.
42 (Target_arm::reloc_needs_sym_origin): New method.
43 (Arm_relocate_functions::calc_grp_kn): New method.
44 (Arm_relocate_functions::calc_grp_residual): New method.
45 (Arm_relocate_functions::calc_grp_gn): New method.
46 (Arm_relocate_functions::arm_grp_alu): New Method.
47 (Arm_relocate_functions::arm_grp_ldr): New Method.
48 (Arm_relocate_functions::arm_grp_ldrs): New Method.
49 (Arm_relocate_functions::arm_grp_ldc): New Method.
50 (Target_arm::Scan::local): Handle the ARM group relocations.
51 (Target_arm::Scan::global): Likewise.
52 (Target_arm::Relocate::relocate): Likewise.
53 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
54 Likewise.
55
2b328d4e
DK
562010-01-26 Doug Kwan <dougkwan@google.com>
57
58 * arm.cc (set): Include.
59 (class Arm_exidx_fixup): Change type of last_input_section_ to const
60 pointer type.
61 (Arm_output_section::Text_section_list): New type.
62 (Arm_output_section::append_text_sections_to_list): New method.
63 (Arm_output_section::fix_exidx_coverage): Ditto.
64 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
65 (Arm_relobj::convert_input_section_to_relaxed_section): Use
66 Relobj::set_section_offset() instead of
67 Sized_relobj::invalidate_section_offset().
68 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
69 parameter for section headers. Ignore relocation sections for
70 unallocated sections and EXIDX sections.
71 (Target_arm::fix_exidx_coverage): New method.
72 (Target_arm::output_section_address_less_than): New type.
73 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
74 linked text section instead of the EXIDX section.
75 (Arm_output_section::create_stub_group): Add an assertion to check
76 that this is not an EXIDX output section.
77 (Arm_output_section::append_text_sections_to_list): New method.
78 (Arm_output_section::fix_exidx_coverage): Ditto.
79 (Arm_relobj::scan_sections_for_stubs): Adjust call to
80 Arm_relobj::section_needs_reloc_stub_scanning.
81 (Target_arm::do_relax): Fix EXIDX output section coverage in the
82 first pass.
83 (Target_arm::fix_exidx_coverage): New method.
84 * object.h (Relobj::set_output_section): New method.
85 (Sized_relobj::invalidate_section_offset): Remove method.
86 (Sized_relobj::do_invalidate_section_offset): Remove method.
87 (Sized_relobj::do_set_section_offset): Handle offset value -1.
88
c7f3c371
DK
892010-01-25 Doug Kwan <dougkwan@google.com>
90
91 * arm.cc (Arm_exidx_merged_section::do_output_offset):
92 Fix warning due to signed and unsigned comparison on a 32-bit host.
93
8923b24c
DK
942010-01-22 Doug Kwan <dougkwan@google.com>
95
96 * arm.cc (Target_arm::do_relax): Record an output section for section
97 offset adjustment it contains any stub table that has changed.
98 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
99 offsets in an output section if necessary.
100 * output.cc (Output_section::Output_section): Initialize
101 section_offsets_need_adjustments_.
102 (Output_section::add_input_section_for_script): Renamed to
103 Output_section::add_simple_input_section.
104 (Output_section::save_states): Add a comment.
105 (Output_section::discard_states): New method defintion.
106 (Output_section::adjust_section_offsets): Same.
107 * output.h (Output_section::add_input_section_for_script): Renamed to
108 Output_section::add_simple_input_section.
109 (Output_section::discard_states): New method declaration.
110 (Output_section::adjust_section_offsets): Same.
111 (Output_section::section_offsets_need_adjustment,
112 Output_section::set_section_offsets_need_adjustment): New method
113 definitions.
114 (Output_section::section_offsets_need_adjustment_): New data member.
115 * script-sections.cc
116 (Output_section_element_input::set_section_address): Adjust code for
117 renaming of Output_section::add_input_section_for_script.
118 (Orphan_output_section::set_section_address): Same.
119
9b2fd367
DK
1202010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
121
122 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
123 Fix_v4bx enum values .
124 * gold/options.h (General_options): New option definitions.
125 (General_options::fix_v4bx): New method.
126 (General_options::Fix_v4bx): New enum.
127 * gold/options.cc (General_options::parse_fix_v4bx): New method.
128 (General_options::parse_fix_v4bx_interworking): New method.
129
80d0d023
DK
1302010-01-22 Doug Kwan <dougkwan@google.com>
131
132 * arm.cc (Arm_exidx_fixup): New class.
133
af2cdeae
DK
1342010-01-21 Doug Kwan <dougkwan@google.com>
135
136 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
137 classes.
138 (Arm_exidx_section_offset_map): New type.
139
993d07c1
DK
1402010-01-21 Doug Kwan <dougkwan@google.com>
141
142 * arm.cc (Arm_exidx_input_section): New class.
143 (Arm_relobj::exidx_input_section_by_link,
144 Arm_relobj::exidx_input_section_by_shndx,
145 Arm_relobj::make_exidx_input_section): New methods.
146 (read_arm_attributes_section): Remove.
147 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
148 information about them.
149 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
150 to here.
151
5ac169d4
DK
1522010-01-20 Doug Kwan <dougkwan@google.com>
153
154 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
155 Input_section_specifier to Section_id.
156 (Target_arm::new_arm_input_section: Adjust code for change of key
157 type.
158 (Target_arm::find_arm_input_section): Ditto.
159 * gc.h (object.h): Include for Section_id nand Section_id_hash.
160 (Section_id): Remove.
161 (Garbage_collection::Section_id_hash): Remove.
162 * icf.h (object.h): Include for Section_id nand Section_id_hash.
163 (Section_id): Remove.
164 (Icf::Section_id_hash): Remove.
165 * object.h (Section_id, Const_section_id, Section_id_hash,
166 Const_section_id_hash): New type definitions.
167 * output.cc (Output_section::add_relaxed_input_section): Change to
168 use Const_section_id instead of Input_section_specifier as key type.
169 (Output_section::add_merge_input_section): Ditto.
170 (Output_section::build_relaxation_map): Change to use Section_id
171 instead of Input_section_specifier as key type.
172 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
173 Ditto.
174 (Output_section::convert_input_sections_to_relaxed_sections): Change
175 to use Const_section_id instead of Input_section_specifier as key type.
176 (Output_section::find_merge_section): Ditto.
177 (Output_section::find_relaxed_input_section): Ditto.
178 * output.h (Input_section_specifier): Remove class.
179 (Output_section::Output_section_data_by_input_section_map): Change
180 key type to Const_section_id.
181 (Output_section::Output_relaxed_input_section_by_input_section_map):
182 Ditto.
183 (Output_section::Relaxation_map): Change key type to Section_id.
184
a2162063
ILT
1852010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
186
187 * gold/arm.cc: Added support for R_ARM_V4BX relocation
188 (class Arm_v4bx_stub): New class.
189 (DEF_STUBS): Updated definition to support v4_veneer_bx.
190 (Stub_factory::make_arm_v4bx_stub): New method.
191 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
192 (Stub_table::empty): Handle v4bx stubs.
193 (Stub_table::add_arm_v4bx_stub): New method.
194 (Stub_table::find_arm_v4bx_stub): New method.
195 (Arm_relocate_functions::v4bx): New method.
196 (Target_arm::fix_v4bx): New method.
197 (Target_arm::Target_arm): Handle R_ARM_V4BX.
198 (Stub_table::relocate_stubs): Likewise.
199 (Stub_table::do_write): Likewise.
200 (Stub_table::update_data_size_and_addralign): Likewise.
201 (Stub_table::finalize_stubs): Likewise.
202 (Target_arm::Scan::local): Likewise.
203 (Target_arm::Scan::global): Likewise.
204 (Target_arm::do_finalize_sections): Likewise.
205 (Target_arm::Relocate::relocate): Likewise.
206 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
207 Likewise.
208 (Target_arm::scan_reloc_for_stub): Likewise.
209 (Target_arm::scan_reloc_section_for_stubs): Likewise.
210
5696ab0b
ILT
2112010-01-19 Ian Lance Taylor <iant@google.com>
212
213 * output.cc (Output_section_headers::do_sized_write): Write large
214 segment count to sh_info field.
215 (Output_file_header::do_sized_write): For large segment count,
216 write PN_XNUM to e_phnum field.
217
800d0f56
ILT
2182010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
219
220 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
221 (Arm_relocate_functions::thm_jump8): New function.
222 (Arm_relocate_functions::thm_jump11): New function.
223 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
224 R_ARM_THM_JUMP11.
225 (Target_arm::Scan::global): Likewise.
226 (Target_arm::Relocate::relocate): Likewise.
227 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
228 Likewise.
229
41263c05
DK
2302010-01-14 Doug Kwan <dougkwan@google.com>
231
232 * arm.cc (map, utility): Include headers.
233 (Target_arm::apply_cortex_a8_workaround): New method.
234 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
235 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
236 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
237 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
238 the --[no-]fix-cortex-a8 command line options.
239 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
240 (Target_arm::relocate_stub): Use addend in instruction template.
241 * options.h (DEFINE_bool): Set the user-set flag.
242 (General_options): Add --[no-]-fix-cortex options.
243 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
244 : Update fast look-up map after conversion.
245
459e9b03
ST
2462010-01-14 Sriraman Tallam <tmsriram@google.com>
247
248 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
249 in the first pass of do_layout.
250
b521dfe4
DK
2512010-01-13 Doug Kwan <dougkwan@google.com>
252
253 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
254 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
255 apparent compiler problem of not folding static constant integral
256 data members of elfcpp::Elf_sizes<32>.
257
44272192
DK
2582010-01-13 Doug Kwan <dougkwan@google.com>
259
260 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
261 Arm_relobj::section_needs_cortex_a8_stub_scanning,
262 Arm_relobj::scan_section_for_cortex_a8_erratum,
263 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
264 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
265 sections to scan for relocation stubs into a new method
266 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
267 relocation and Cortex-A8 stub scanning.
268 (Target_arm::do_relax): Force stubs to be after stubbed sections
269 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
270 the beginning of a new relaxation pass. Update a comment.
271 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
272
44b71ece
ILT
2732010-01-12 Ian Lance Taylor <iant@google.com>
274
275 * target-reloc.h (visibility_error): New inline function.
276 (relocate_section): Call visibility_error.
277 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
278 (MOSTLYCLEANFILES): Likewise.
279 (protected_4_pic.o, protected_3.err): New targets.
280 * testsuite/protected_4.cc: New file.
281
a120bc7f
DK
2822010-01-12 Doug Kwan <dougkwan@google.com>
283
284 * arm.cc (Cortex_a8_reloc): New class.
285 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
286 and cortex_a8_relocs_info_.
287 (Target_arm::fix_cortex_a8): New method definition.
288 (Target_arm::Cortex_a8_relocs_info): New type.
289 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
290 New data member declarations.
291 (Target_arm::scan_reloc_for_stub): Record information about
292 relocations for THUMB branches that might be exempted from the
293 Cortex-A8 workaround.
294 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
295 at the beginning of a relaxation pass.
296
20138696
DK
2972010-01-12 Doug Kwan <dougkwan@google.com>
298
299 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
300 (Arm_relobj::Mapping_symbol_position,
301 Arm_reloj::Mapping_symbol_position_less,
302 Arm_relobj::Mapping_symbols_info): New types.
303 (Target_arm::is_mapping_symbol_name): New method definition.
304 (Arm_relobj::do_count_local_symbols): Save information about mapping
305 symbols.
306
089d69dc
DK
3072010-01-11 Doug Kwan <dougkwan@google.com>
308
309 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
310 Arm_relocate_functions::thumb32_branch_upper,
311 Arm_relocate_functions::thumb32_branch_lower,
312 Arm_relocate_functions::thumb32_cond_branch_offset,
313 Arm_relocate_functions::thumb32_cond_branch_upper,
314 Arm_relocate_functions::thumb32_cond_branch_lower,
315 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
316 branch offset encoding.
317 (Arm_relocate_functions::thumb_branch_common): Use new branch
318 offset encoding methods to avoid code duplication.
319 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
320 (Stub_addend_reader::operator()): Use new branch encoding method
321 to avoid code duplication.
322
99e5bff2
DK
3232010-01-11 Doug Kwan <dougkwan@google.com>
324
325 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
326 (Target_arm::do_finalize_sections): Define special EXIDX section
327 symbols only if referenced.
328 * gc.h (Garbage_collection::add_reference): New method.
329 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
330 code duplication.
331
98e090bd
ILT
3322010-01-11 Ian Lance Taylor <iant@google.com>
333
d0a91bd8
ILT
334 * script.cc (Version_script_info::build_expression_list_lookup):
335 Change complaing about duplicate wildcard match from error to
336 warning.
337
98e090bd
ILT
338 * script.cc (class Lazy_demangler): Recreate--revert part of patch
339 of 2009-12-30.
340 (Version_script_info::Version_script_info): Initialize globs_,
341 default_version_, default_is_global_, and exact_. Don't
342 initialize globals_ or locals_.
343 (Version_script_info::build_lookup_tables): Build local symbols
344 first.
345 (Version_script_info::unquote): New function.
346 (Version_script_info::add_exact_match): New function.
347 (Version_script_info::build_expression_list_lookup): Remove lookup
348 parameter. Add is_global parameter. Change all callers. Handle
349 wildcard pattern specially. Unquote pattern. Call
350 add_exact_match.
351 (Version_script_info::get_name_to_match): New function.
352 (Version_script_info::get_symbol_version): New function.
353 (Version_script_info::get_symbol_version_helper): Remove.
354 (Version_script_info::check_unmatched_names): Call unquote.
355 * script.h (class Version_script_info): Change get_symbol_version
356 to be non-inline and add is_global parameter; change all callers.
357 Rewrite symbol_is_local. Update declarations. Define struct
358 Version_tree_match, Exact, Globs. Don't define struct Lookup.
359 Remove globals_ and locals_ members. Add exact_, globs_,
360 default_version_, is_global_.
361 (Version_script_info::Glob): Remove pattern, add expression and
362 is_global. Update constructor. Change all callers.
363 * dynobj.cc (Versions::finalize): Mark the version symbol as the
364 default version.
365 (Versions::symbol_section_contents): If a symbol is undefined, or
366 defined in a dynamic object, set the version index to
367 VER_NDX_LOCAL.
368 * symtab.cc (Symbol_table::add_from_relobj): Don't call
369 symbol_is_local.
370 (Symbol_table::add_from_pluginobj): Likewise.
371 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
372
d56962d3
DK
3732010-01-11 Doug Kwan <dougkwan@google.com>
374
375 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
376 (incremental_dump_LDADD): Add linking option for libintl.
377 * Makefile.in: Regenerate.
378
94e6ee91
L
3792010-01-11 H.J. Lu <hongjiu.lu@intel.com>
380
381 PR gold/11144
382 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
383 instead of -Ds.
384 * testsuite/Makefile.in: Regenerated.
385
e96c574b
DK
3862010-01-10 Doug Kwan <dougkwan@google.com>
387
388 * options.h (DEFINE_var): Use parentheses around argument varname__
389 in macro body to avoid any unintended subsequent substitutions.
390
7198066b
ILT
3912010-01-10 Ian Lance Taylor <iant@google.com>
392
ba4d53bf
ILT
393 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
394 candidates before doing symbol resolution.
395
7198066b
ILT
396 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
397 ODR candidates if only one is weak.
398
a2beed37
ILT
3992010-01-08 Ian Lance Taylor <iant@google.com>
400
401 * script.cc (Version_script_info::build_expression_list_lookup):
402 Don't warn about ambiguous version, just record the ambiguity.
403 (Version_script_info::get_symbol_version_helper): Give error if
404 version is ambiguous.
405
2fb7225c
DK
4062010-01-08 Doug Kwan <dougkwan@google.com>
407
408 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
409 prev_data_size_ and prev_addralign_. Remove initializer for
410 deleted data member has_been_changed_.
411 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
412 to determine if the table is empty.
413 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
414 Remove.
415 (Stub_table::add_reloc_stub): Define method in class definition
416 instead of just declaring it there.
417 (Stub_table::add_cortex_a8_stub): New method definition.
418 (Stub_table::update_data_size_and_addralign): Ditto.
419 (Stub_table::finalize_stubs): Ditto.
420 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
421 (Stub_table::do_addralign_): Return address alignment in the
422 (Stub_table::do_reset_address_and_file_offset): Define method in
423 class definition instead of declaring it there. Set current data
424 size to be the data size of the previous pass.
425 (Stub_table::set_final_data_size): Use current data size as the
426 final data size.
427 (Stub_table::relocate_stub): Change parameter type of stub from
428 Reloc_stub pointer to Stub pointer.
429 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
430 (Stub_table::Cortex_a8_stub_list): New typedef.
431 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
432 Stub_table::prev_addralign_): New data member.
433 (Arm_relobj::Arm_relobj): Initialize data member
434 section_has_cortex_a8_workaround_.
435 (Arm_relobj::section_has_cortex_a8_workaround,
436 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
437 definitions.
438 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
439 declarations.
440 (Target_arm::relocate_stub): Change parameter type of stub from
441 Reloc_stub pointer to Stub pointer.
442 (Insn_template::size, Insn_template::alignment): Handle
443 THUMB16_SPECIAL_TYPE.
444 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
445 Stub_table::update_data_size_and_addralign,
446 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
447 definitions.
448 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
449 (Stub_table::do_write): Ditto.
450 (Target_arm::do_relax): Adjust code for changes in Stub_table.
451
880cd20d
ILT
4522010-01-08 Ian Lance Taylor <iant@google.com>
453
454 PR 11108
455 * symtab.h (class Symbol): Remove fields is_target_special_ and
456 has_plt_offset_. Add field is_defined_in_discarded_section_.
457 (Symbol::is_defined_in_discarded_section): New function.
458 (Symbol::set_is_defined_in_discarded_section): New function.
459 (Symbol::has_plt_offset): Rewrite.
460 (Symbol::set_plt_offset): Verify that new offset is not -1U.
461 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
462 Don't initialize is_target_special_ or has_plt_offset_.
463 Initialize is_defined_in_discarded_section_.
464 (Symbol_table::add_from_relobj): If appropriate, set
465 is_defined_in_discarded_section.
466 * resolve.cc (Symbol::override_base_with_special): Don't test
467 is_target_special_. Change has_plt_offset_ to has_plt_offset().
468 * target-reloc.h (relocate_section): Do special handling for
469 symbols defined in discarded sections for global symbols as well
470 as local symbols.
471
2703e3eb
ILT
4722010-01-08 Ian Lance Taylor <iant@google.com>
473
474 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
475 the SHT_SYMTAB case.
476
339d40a3
ILT
4772010-01-08 Ian Lance Taylor <iant@google.com>
478
479 * object.cc (Sized_relobj::do_layout): Don't get confused if
480 layout_eh_frame returns NULL.
481
abecea76
ILT
4822010-01-08 Ian Lance Taylor <iant@google.com>
483
484 PR 11084
485 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
486 dynamic symbol table, use the normal symbol table.
487 (Sized_dynobj::do_read_symbols): Remove assertion about type of
488 symbol table.
489
6b7dd3f3
ILT
4902010-01-08 Ian Lance Taylor <iant@google.com>
491
492 PR 11072
493 * layout.cc (Layout::include_section): Remove .gnu_debuglink
494 sections.
495
36c50e63
L
4962010-01-08 H.J. Lu <hongjiu.lu@intel.com>
497
498 * version.cc (print_version): Change to "Copyright 2010".
499
e291e7b9
ILT
5002010-01-08 Ian Lance Taylor <iant@google.com>
501
502 PR 10287
503 PR 11063
504 * i386.cc (class Target_i386): Change return type of plt_section
505 to be non-const.
506 (class Output_data_plt_i386): Add tls_desc_rel_ field.
507 (Output_data_plt_i386::Output_data_plt_i386): Initialize
508 tls_desc_rel_ field.
509 (Output_data_plt_i386::rel_tls_desc): New function.
510 (Target_i386::rel_tls_desc_section): New function.
511 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
512 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
513 R_386_TLS_DESC reloc in rel_tls_desc_section.
514 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
515 Define struct Tlsdesc_info.
516 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
517 (Target_x86_64::do_reloc_symbol_index): New function.
518 (Target_x86_64::add_tlsdesc_info): New function.
519 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
520 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
521 tlsdesc_rel_ field.
522 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
523 all callers.
524 (Output_data_plt_x86_64::rela_tlsdesc): New function.
525 (Target_x86_64::rela_tlsdesc_section): New function.
526 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
527 handling.
528 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
529 (Target_x86_64::do_reloc_addend): New function.
530 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
531 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
532 declarations. Define TARGET_CODE. Add arg field to u1_ union.
533 (Output_reloc::type): New function.
534 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
535 (Output_reloc::is_target_specific): New function.
536 (Output_reloc::target_arg): New function.
537 (class Output_reloc) [SHT_RELA]: Add four new constructors for
538 absolute relocs and target specific relocs.
539 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
540 add_target_specific.
541 (class Output_data_reloc) [SHT_RELA]: Likewise.
542 * output.cc (Output_reloc::Output_reloc): Add four new versions
543 for absolute relocs and target specific relocs.
544 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
545 (Output_reloc::get_symbol_index): Likewise.
546 (Output_reloc::local_section_offset): Check that local_sym_index_
547 is not TARGET_CODE or 0.
548 (Output_reloc::symbol_value): Likewise.
549 (Output_reloc::write) [SHT_RELA]: Call target for target specific
550 reloc.
551 * target.h (class Target): Add reloc_symbol_index and reloc_addend
552 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
553 functions.
554 * layout.cc (add_target_dynamic_tags): Use output section for
555 DT_PLTRELSZ and DT_JMPREL.
556
3a44184e
ILT
5572010-01-07 Ian Lance Taylor <iant@google.com>
558
559 PR 11061
560 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
561 function.
562 (class Output_data_reloc_generic): Define.
563 (class Output_data_reloc_base): Change base class to
564 Output_data_reloc_generic. Change add() method to call
565 bump_relative_reloc_count for a relative reloc. Remove
566 sort_relocs_ field.
567 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
568 to sort_relocs().
569 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
570 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
571 appropriate.
572 * layout.h (class Layout): Update declaration.
573
ea715a34
ILT
5742010-01-07 Ian Lance Taylor <iant@google.com>
575
576 * output.h (class Output_data): Add const version of
577 output_section and do_output_section.
578 (class Output_section_data): Add const version of
579 do_output_section.
580 (class Output_section): Likewise.
581 * layout.cc (Layout::add_target_dynamic_tags): New function.
582 * layout.h (class Layout): Update declarations.
583 * arm.cc (Target_arm::do_finalize_sections): Use
584 add_target_dynamic_tags.
585 * i386.cc (Target_i386::do_finalize_sections): Likewise.
586 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
587 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
588 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
589
659948a4
ILT
5902010-01-07 Ian Lance Taylor <iant@google.com>
591
592 PR 11042
593 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
594 object as needed.
595
9d3b86f6
ILT
5962010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
597 Ian Lance Taylor <iant@google.com>
598
599 PR 11019
600 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
601 Xindex::read_symtab_xindex.
602
bb0d3eb0
DK
6032010-01-07 Doug Kwan <dougkwan@google.com>
604
605 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
606 (Insn_template::thumb16_bcond_insn): New method declaration.
607 (Insn_template): Fix spelling.
608 (Stub::thumb16_special): New method declaration.
609 (Stub::do_write): Define virtual method which was previously pure
610 virtual.
611 (Stub::do_thumb16_special): New method declaration.
612 (Stub::do_fixed_endian_write): New template member.
613 (Reloc_stub::do_write): Remove.
614 (Reloc_stub::do_fixed_endian_write): Remove.
615 (Cortex_a8_stub): New class definition.
616 (Stub_factory::make_cortex_a8_stub): New method definition.
617 (Stub_factory::Stub_factory): Add missing static storage class
618 qualifier for elf32_arm_stub_a8_veneer_blx.
619
ffeef7df
ILT
6202010-01-07 Ian Lance Taylor <iant@google.com>
621
dc3f80fe
ILT
622 PR 10980
623 * options.h (class General_options): Add --warn-unresolved-symbols
624 and --error-unresolved-symbols.
625 * errors.cc (Errors::undefined_symbol): Implement
626 --warn-unresolved-symbols.
627
ffeef7df
ILT
628 * options.h (class General_options): Add -z text and -z textoff.
629 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
630
f1ec9ded
ST
6312010-01-06 Sriraman Tallam <tmsriram@google.com>
632
633 * gc.h (Garbage_collection::Cident_section_map): New typedef.
634 (Garbage_collection::cident_sections): New function.
635 (Garbage_collection::add_cident_section): New function.
636 (Garbage_collection::cident_sections_): New member.
637 (gc_process_relocs): Add references to sections whose names are C
638 identifiers.
639 * gold.h (cident_section_start_prefix): New constant.
640 (cident_section_stop_prefix): New constant.
641 (is_cident): New function.
642 * layout.cc (Layout::define_section_symbols): Replace string constants
643 with the newly defined constants.
644 * object.cc (Sized_relobj::do_layout): Track sections whose names are
645 C identifiers.
646 * testsuite/Makefile.am: Add gc_orphan_section_test.
647 * testsuite/Makefile.in: Regenerate.
648 * testsuite/gc_orphan_section_test.cc: New file.
649 * testsuite/gc_orphan_section_test.sh: New file.
650
6eda8c29
ILT
6512010-01-06 Ian Lance Taylor <iant@google.com>
652
b9674e17
ILT
653 PR 10980
654 * options.h (class General_options): Add --warn-shared-textrel.
655 * layout.cc (Layout::finish_dynamic_section): Implement
656 --warn-shared-textrel.
657
6eda8c29
ILT
658 PR 10980
659 * options.h (class General_options): Add --warn-multiple-gp.
660
32dcd44e
ILT
6612010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
662
663 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
664 $(THREADSLIB) and $(LIBDL).
665 * Makefile.in: Rebuild.
666
a192ba05
ILT
6672010-01-06 Ian Lance Taylor <iant@google.com>
668
669 PR 10980
670 * options.cc (General_options::parse_section_start): New function.
671 (General_options::section_start): New function.
672 (General_options::General_options): Initialize all members.
673 * options.h: Include <map>
674 (class General_options): Add --section-start. Add section_starts_
675 member.
676 * layout.cc (Layout::attach_allocated_section_to_segment): If
677 --section-start was used, set the address of the segment. Remove
678 local sort_sections.
679 (Layout::relaxation_loop_body): If the address of the load segment
680 has been set by --section-start, don't use it.
681 * output.h (Output_segment::update_flags_for_output_section): New
682 function.
683 * output.cc (Output_segment::add_output_section): Call
684 update_flags_for_output_section.
685
dde3f402
ILT
6862010-01-05 Ian Lance Taylor <iant@google.com>
687
62dfdd4d
ILT
688 PR 10980
689 * options.h (class General_options): Add --undefined-version.
690 * script.cc (struct Version_expression): Add was_matched_by_symbol
691 field.
692 (Version_script_info::matched_symbol): New function.
693 (Version_script_info::get_symbol_version_helper): Call
694 matched_symbol.
695 (Version_script_info::check_unmatched_names): New function.
696 * script.h (class Version_script_info): Update declarations.
697 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
698
9c4ae156
ILT
699 * options.h (class General_options): Use DEFINE_bool_alias for
700 allow_multiple_definition.
701 * resolve.cc (Symbol_table::should_override): Don't test
702 allow_multiple_definition.
703
dde3f402
ILT
704 PR 10980
705 * options.h (class General_options): Add --cref.
706 * main.cc (main): Print cref table if --cref. Don't close mapfile
707 until after printing cref table.
708 * cref.cc: Include "symtab.h".
709 (class Cref_inputs): Define Cref_table_compare and Cref_table.
710 (Cref_table_compare::operator()): New function.
711 (Cref_inputs::gather_cref): New function.
712 (filecol): New static const.
713 (Cref_inputs::print_cref): New function.
714 (Cref::print_cref): New function.
715 * cref.h: Include <cstdio>.
716 (class Cref): Update declarations.
717 * mapfile.h (Mapfile::file): New function.
718 * object.h (class Object): Define Symbols. Declare virtual
719 do_get_global_symbols.
720 (Object::get_global_symbols): New function.
721 * object.cc (Input_objects::add_object): Pass object to cref_ if
722 --cref.
723 (Input_objects::archive_start): Likewise.
724 (Input_objects::archive_stop): Likewise.
725 (Input_objects::print_cref): New function.
726 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
727 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
728 --cref.
729 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
730 function.
731 * plugin.h (class Sized_pluginobj): Update declarations.
732
8781f709
ILT
7332010-01-05 Ian Lance Taylor <iant@google.com>
734
735 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
736 to is_default_version. Rename insdef to insdefault.
737 (Symbol_table::add_from_relobj): Rename def to is_default_version
738 and local to is_forced_local.
739 (Symbol_table::add_from_pluginobj): Likewise.
740 (Symbol_table::add_from_dynobj): Likewise.
741 (Symbol_table::define_special_symbol): Rename insdef to
742 insdefault.
743
fe35d28d
ILT
7442010-01-04 Ian Lance Taylor <iant@google.com>
745
30bc8c46
ILT
746 PR 10980
747 * options.h (class General_options): Add
748 --allow-multiple-definition and -z muldefs.
749 * resolve.cc (Symbol_table::should_override): Don't warn about a
750 multiple symbol definition if --allow-multiple-definition or -z
751 muldefs.
752
7eaea549
ILT
753 PR 10980
754 * options.h (class General_options): Add --add-needed and
755 --copy-dt-needed-entries. Tweak --as-needed help entry.
756 * object.cc (Input_objects::check_dynamic_dependencies): Give an
757 error if --copy-dt-needed-entries aka --add-needed is used and
758 would cause a change in behaviour.
759
fe35d28d
ILT
760 PR 10980
761 * options.h (class General_options): Add -G as a short version of
762 --shared. Add no-op options -assert, -g, and -i.
763
55a2bb35
ST
7642010-01-04 Sriraman Tallam <tmsriram@google.com>
765
766 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
767 check for .text or .gnu.linkonce.t sections.
768 * icf.cc (Icf::find_identical_sections): Ditto.
769 Change the detection for mangled function name within the section
770 name.
771 * icf.h (is_section_foldable_candidate): New function.
772
719328e1
ILT
7732009-12-30 Ian Lance Taylor <iant@google.com>
774
775 PR 10980
776 * options.h (class General_options): Permit two dashes with
777 --retain-symbols-file.
778
d7bb5745
ILT
7792009-12-30 Ian Lance Taylor <iant@google.com>
780
403a15dd
ILT
781 PR 10979
782 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
783 don't put the file header and segment headers in the text
784 segment.
785
eda294df
ILT
786 PR 10979
787 * common.cc (Sort_commons::operator()): Stabilize sort when both
788 entries are NULL.
789 (Symbol_table::do_allocate_commons_list): When allocating common
790 symbols, skip a symbol which is no longer common.
791 * symtab.h (Symbol::is_common): Test whether the symbol comes from
792 an object before checking its type.
793 * testsuite/common_test_2.c: New file.
794 * testsuite/common_test_3.c: New file.
795 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
796 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
797 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
798 (common_test_2_pic.o, common_test_2.so): New targets.
799 (common_test_3_pic.o, common_test_3.so): New targets.
800 * testsuite/Makefile.in: Rebuild.
801
d7bb5745
ILT
802 PR 10979
803 * script.cc (read_input_script): If we see a new SECTIONS clause,
804 and we have added an input section, give an error.
805 * layout.h (class Layout): Add have_added_input_section function.
806 Add have_added_input_section_ field.
807 * layout.cc (Layout::Layout): Initialize
808 have_added_input_section_.
809 (Layout::layout): Set have_added_input_section_.
810 (Layout::layout_eh_frame): Likewise.
811
fc59c572
ILT
8122009-12-30 Ian Lance Taylor <iant@google.com>
813
814 PR 10931
815 * options.h (class General_options): Add --sort-common option.
816 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
817 * common.cc (Sort_common): Add sort_order parameter to
818 constructor. Add sort_order_ field.
819 (Sort_commons::operator): Check sort_order_.
820 (Symbol_table::allocate_commons): Determine the sort order.
821 (Symbol_table::do_allocate_commons): Add sort_order parameter.
822 Change all callers.
823 (Symbol_table::do_allocate_commons_list): Likewise.
824
1c74fab0
ILT
8252009-12-30 Ian Lance Taylor <iant@google.com>
826
827 PR 10916
828 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
829 symbols from this object, don't change the visibility of an
830 undefined symbol.
831 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
832
6affe781
ILT
8332009-12-30 Ian Lance Taylor <iant@google.com>
834
835 PR 10861
836 * script.h (class Version_script_info): Define Language enum.
837 Update declarations. Define Glob, Exact, and Lookup types. Add
838 new fields globals_, locals_, and is_finalized_.
839 * script.cc: Various formatting fixes.
840 (class Parser_closure): Change language_stack_ from a vector of
841 std::string to one of Version_script_info::Language. Adjust all
842 uses accordingly.
843 (class Lazy_demangler): Remove.
844 (struct Version_expression): Change language from std::string to
845 Version_script_info::Language.
846 (Version_script_info::Version_script_info): New function.
847 (Version_script_info::~Version_script_info): Don't call clear.
848 (Version_script_info::finalize): New function.
849 (Version_script_info::build_lookup_tables): New function.
850 (Version_script_info::build_expression_list_lookup): New
851 function.
852 (Version_script_info::get_symbol_version_helper): Rewrite to use
853 lookup tables.
854 (Version_script_info::print_expression_list): Adjust to use
855 Version_script_info::Language.
856 (script_push_lex_into_version_mode): Check that the version script
857 has not been finalized.
858 (version_script_push_lang): Change language string to
859 Version_script_info::Language.
860 * options.cc (Command_line::version_script): New function.
861 * options.h (class General_options): Add finalize_dynamic_list
862 function. Change version_script from declaration to definition.
863 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
864 * testsuite/version_script.map: Remove duplicate def of foo.
865 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
866 version_script.map.
867 * testsuite/Makefile.in: Rebuild.
868
818bf354
ILT
8692009-12-30 Ian Lance Taylor <iant@google.com>
870
871 PR 10843
872 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
873 if the input symbol index is 0, make the output symbol index 0.
874
ebcc8304
ILT
8752009-12-30 Ian Lance Taylor <iant@google.com>
876
877 PR 10670
878 * options.h (class General_options): Add -x/--discard-all.
879 * object.cc (Sized_relobj::do_count_local_symbols): Handle
880 --discard-all. If the local symbol needs a dynamic entry, check
881 that before handling --discard-locals.
882
176fe33f
ILT
8832009-12-30 Ian Lance Taylor <iant@google.com>
884
bb321bb1
ILT
885 PR 10450
886 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
887 flags to PF_R.
888 (Output_segment::add_output_section): Don't change the flags if
889 the type is PT_TLS.
890
176fe33f
ILT
891 PR 10450
892 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
893 GNU hash table if they need a dynamic value. Otherwise, don't add
894 them if they are defined in a dynamic object or are forced local.
895
e8cd95c7
ILT
8962009-12-29 Ian Lance Taylor <iant@google.com>
897
1b81fb71
ILT
898 PR 10450
899 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
900 .gnu.hash table for a 32-bit target.
901
8d6d383d
ILT
902 PR 10450
903 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
904 regular and a dynamic object only needs a dynamic symbol table
905 entry if it is externally visible.
906
e785ec03
ILT
907 PR 10450
908 * i386.cc (class Target_i386): Initialize global_offset_table_ in
909 constructor. Add global_offset_table_ field.
910 (Target_i386::got_section): Set global_offset_table_.
911 (Target_i386::do_finalize_sections): Set global_offset_table_
912 size.
913 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
914 in constructor. Add global_offset_table_ field.
915 (Target_x86_64::got_section): Set global_offset_table_.
916 (Target_x86_64::do_finalize_sections): Set global_offset_table_
917 size.
918
1a2dff53
ILT
919 * layout.cc (Layout::Layout): Initialize increase_relro_.
920 (Layout::get_output_section): Add is_relro, is_last_relro, and
921 is_first_non_relro parameters. Change all callers.
922 (Layout::choose_output_section): Likewise.
923 (Layout::add_output_section_data): Likewise.
924 (Layout::make_output_section): Likewise.
925 (Layout::set_segment_offsets): Clear increase_relro when using a
926 linker script.
927 * layout.h (class Layout): Add increase_relro method. Add
928 increase_relro_ field. Update declarations.
929 * output.cc (Output_section::Output_section): Initialize
930 is_last_relro_ and is_first_non_relro_.
931 (Output_segment::add_output_section): Group relro sections is
932 do_sort is true. Handle is_last_relro and is_first_non_relro.
933 (Output_segment::maximum_alignment): Remove relro handling.
934 (Output_segment::set_section_addresses): Add increase_relro
935 parameter. Change all callers. Add initial alignment to align
936 relro sections on separate page. Remove old relro handling.
937 (Output_segment::set_section_list_addresses): Remove in_relro
938 parameter. Change all callers.
939 (Output_segment::set_offset): Add increase parameter. Change all
940 callers. Remove old relro handling.
941 * output.h (class Output_section): Add new methods: is_last_relro,
942 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
943 Add is_last_relro_ and is_first_non_relro_ fields.
944 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
945 Create separate .got.plt section. Call increase_relro.
946 * x86_64.cc (Target_x86_64::got_section): Likewise.
947 * testsuite/relro_script_test.t: Add .got.plt.
948
f0ba79e2
ILT
949 PR 10450
950 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
951 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
952 (Layout::finalize): Call set_dynamic_symbol_size.
953 (Layout::set_dynamic_symbol_size): New function.
954 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
955 set_dynamic_symbol_size.
956
e8cd95c7
ILT
957 PR 10450
958 * output.h (class Output_section): Add is_entsize_zero_ field.
959 * output.cc (Output_section::Output_section): Initialize
960 is_entsize_zero_.
961 (Output_section::set_entsize): If two different entsizes are
962 requested, force it to zero.
963 (Output_section::add_input_section): Set flags for .debug_str
964 before updating section flags. Set entsize.
965 (Output_section::update_flags_for_input_section): Set SHF_MERGE
966 and SHF_STRING if all input sections have those flags.
967
3e1b9a8a
RÁE
9682009-12-29 Rafael Espindola <espindola@google.com>
969
970 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
971 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
972 reporting.
3e1b9a8a 973
3dcad376
ST
9742009-12-29 Sriraman Tallam <tmsriram@google.com>
975
976 * options.cc (General_options::parse_version): Allow -v to exit
977 without an error if there is nothing to link.
978
084e2665
ILT
9792009-12-29 Ian Lance Taylor <iant@google.com>
980
981 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
982 using a version of gcc before 4.1.
983 * configure: Rebuild.
984
250acde3
CD
9852009-12-28 Chris Demetriou <cgd@google.com>
986
987 * attributes.cc (Output_attributes_section_data::do_write): Use
988 std::vector::front rather than std::vector::data.
989
99fff23b
ILT
9902009-12-28 Ian Lance Taylor <iant@google.com>
991
992 * symtab.h (class Symbol_table): Add enum Defined.
993 * resolve.cc (Symbol_table::should_override): Add defined
994 parameter. Change all callers. Test whether object is NULL
995 before calling a method on it.
996 (Symbol_table::report_resolve_problem): Add defined parameter.
997 Change all callers.
998 (Symbol_table::should_override_with_special): Likewise.
999 * symtab.cc (Symbol_table::define_in_output_data): Add defined
1000 parameter. Change all callers.
1001 (Symbol_table::do_define_in_output_data): Likewise.
1002 (Symbol_table::define_in_output_segment): Likewise.
1003 (Symbol_table::do_define_in_output_segment): Likewise.
1004 (Symbol_table::define_as_constant): Likewise.
1005 (Symbol_table::do_define_as_constant): Likewise.
1006 * script.h (class Symbol_assignment): Add is_defsym parameter to
1007 constructor; change all callers.
1008 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1009 parameter. Change all callers. Add is_defsym_ field.
1010 (class Parser_closure): Add parsing_defsym parameter to
1011 constructor; change all callers. Add parsing_defsym accessor
1012 function. Add parsing_defsym_ field.
1013
556bd683
ILT
10142009-12-28 Ian Lance Taylor <iant@google.com>
1015
1016 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 1017 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 1018
1782c879
ILT
10192009-12-23 Ian Lance Taylor <iant@google.com>
1020
1021 * i386.cc (Target_i386::do_calls_non_split): Recognize
1022 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
1023 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1024 -fsplit-stack prologue when using %r11.
1782c879 1025
329ca2b1
ST
10262009-12-21 Sriraman Tallam <tmsriram@google.com>
1027
1028 * options.cc (General_options::parse_version): Make -v continue and do
1029 the link like GNU ld does.
1030
d675ff46
RÁE
10312009-12-17 Rafael Avila de Espindola <espindola@google.com>
1032
1033 * Makefile.am (CCFILES): Add timer.cc.
1034 (HFILES): Add timer.h.
1035 * configure.ac: Check for sysconf and times.
1036 * main.cc: include timer.h.
1037 (main): Use Timer instead of get_run_time.
1038 * timer.cc: New.
1039 * timer.h: New.
1040 * workqueue.cc: include timer.h.
1041 (Workqueue::find_and_run_task):
1042 Report user, sys and wall time.
1043 * Makefile.in: Regenerate.
1044 * config.in: Regenerate.
1045 * configure: Regenerate.
1046
d6344fb5
DK
10472009-12-16 Doug Kwan <dougkwan@google.com>
1048
1049 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1050 sections.
1051 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1052 relaxed input sections.
1053 * output.cc (Output_section::find_relaxed_input_section): Change
1054 return type to Output_relaxed_input_section pointer. Adjust code
1055 for new type of relaxed_input_section_map_.
1056 * output.h (Output_section::find_relaxed_input_section): Change
1057 return type to Output_relaxed_input_section pointer.
1058 (Output_section::Output_relaxed_input_section_by_input_section_map):
1059 New type.
1060 (Output_section::relaxed_input_section_map_): Change type to
1061 Output_section::Output_relaxed_input_section_by_input_section_map.
1062 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1063 input section.
1064
0e0d5469
ILT
10652009-12-15 Ian Lance Taylor <iant@google.com>
1066
1067 * layout.cc (Layout::create_shstrtab): Only write out after input
1068 sections if we are compressing debug sections.
1069
0649a889
ILT
10702009-12-15 Ian Lance Taylor <iant@google.com>
1071
1072 * archive.cc (Archive::add_symbols): Only look up a symbol without
1073 a version if there is, in fact, a version.
1074
2ea97941
ILT
10752009-12-14 Ian Lance Taylor <iant@google.com>
1076
1077 Revert -Wshadow changes, all changes from:
1078 2009-12-11 Doug Kwan <dougkwan@google.com>
1079 2009-12-11 Nick Clifton <nickc@redhat.com>
1080 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1081
b0eec2cc
DK
10822009-12-11 Doug Kwan <dougkwan@google.com>
1083
1084 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1085 due to -Wshadow.
1086 * attributes.cc (Object_attribute::size): Ditto.
1087 (Attributes_section_data::size): Ditto.
1088 (Attributes_section_data::Attributes_section_data): Ditto.
1089 (Output_attributes_section_data::do_write): Ditto.
1090 * attributes.h (Object_attribute::set_type): Ditto.
1091 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1092
91d6fa6a
NC
10932009-12-11 Nick Clifton <nickc@redhat.com>
1094
1095 * archive.cc: Fix shadowed variable warnings.
1096 * arm.cc: Likewise.
1097 * compressed_output.cc: Likewise.
1098 * compressed_output.h: Likewise.
1099 * configure: Likewise.
1100 * dwarf_reader.cc: Likewise.
1101 * dynobj.cc: Likewise.
1102 * dynobj.h: Likewise.
1103 * ehframe.cc: Likewise.
1104 * ehframe.h: Likewise.
1105 * errors.cc: Likewise.
1106 * expression.cc: Likewise.
1107 * fileread.cc: Likewise.
1108 * fileread.h: Likewise.
1109 * freebsd.h: Likewise.
1110 * i386.cc: Likewise.
1111 * icf.cc: Likewise.
1112 * incremental.h: Likewise.
1113 * layout.cc: Likewise.
1114 * layout.h: Likewise.
1115 * mapfile.cc: Likewise.
1116 * merge.cc: Likewise.
1117 * merge.h: Likewise.
1118 * object.cc: Likewise.
1119 * object.h: Likewise.
1120 * options.h: Likewise.
1121 * output.cc: Likewise.
1122 * output.h: Likewise.
1123 * parameters.cc: Likewise.
1124 * plugin.cc: Likewise.
1125 * powerpc.cc: Likewise.
1126 * reduced_debug_output.cc: Likewise.
1127 * reduced_debug_output.h: Likewise.
1128 * reloc.cc: Likewise.
1129 * reloc.h: Likewise.
1130 * resolve.cc: Likewise.
1131 * script-sections.cc: Likewise.
1132 * script.cc: Likewise.
1133 * script.h: Likewise.
1134 * sparc.cc: Likewise.
1135 * symtab.cc: Likewise.
1136 * symtab.h: Likewise.
1137 * target-select.cc: Likewise.
1138 * target-select.h: Likewise.
1139 * token.h: Likewise.
1140 * workqueue.cc: Likewise.
1141 * workqueue.h: Likewise.
1142 * x86_64.cc: Likewise.
1143
a0351a69
DK
11442009-12-10 Doug Kwan <dougkwan@google.com>
1145
1146 * arm.cc (attributes.h): New include.
1147 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1148 (Arm_relobj::~Arm_relobj): Delete object pointed by
1149 attributes_section_data_.
1150 (Arm_relobj::attributes_section_data): New method definition.
1151 (Arm_relobj::attributes_section_data_): New data member declaration.
1152 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1153 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1154 attributes_section_data_.
1155 (Arm_dynobj::attributes_section_data): New method definition.
1156 (Arm_dynobj::attributes_section_data_): New data member declaration.
1157 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1158 initialization value of may_use_blx_ to false.
1159 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1160 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1161 object attributes to compute results instead of hard-coding.
1162 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1163 Target_arm::get_secondary_compatible_arch,
1164 Target_arm::set_secondary_compatible_arch
1165 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1166 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1167 New method declarations.
1168 (Target_arm::get_aeabi_object_attribute): New method definition.
1169 (Target_arm::attributes_section_data_): New data member declaration.
1170 (read_arm_attributes_section): New template definition.
1171 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1172 (Arm_dynobj::do_read_symbols): Ditto.
1173 (Target_arm::do_finalize_sections): Merge attributes sections from
1174 input. Check for BLX use after attributes section merging.
1175 Fix __exidx_start and __exidx_end visibility. Create an
1176 .ARM.attributes section if necessary.
1177 (Target_arm::get_secondary_compatible_arch,
1178 Target_arm::set_secondary_compatible_arch,
1179 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1180 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1181 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1182 New method definitions.
1183
b59befec
ILT
11842009-12-09 Ian Lance Taylor <iant@google.com>
1185
1186 * plugin.cc (Plugin::load): Don't cast from void* to a function
1187 pointer.
1188
1276bc89
ILT
11892009-12-09 Ian Lance Taylor <iant@google.com>
1190
1191 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1192 information fields.
1193
2f2de248
L
11942009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1195
1196 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1197 Replace two_file_shared_1.so with two_file_shared_2.so.
1198 * testsuite/Makefile.in: Regenerated.
1199
4f787271
DK
12002009-12-08 Doug Kwan <dougkwan@google.com>
1201
1202 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1203 (HFILES): Add attributes.h and int_encoding.h.
1204 * Makefile.in: Regenerate.
1205 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1206 function definitions to int_encoding.cc
1207 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1208 prototypes to int_encoding.h
1209 * reduced_debug_output.cc (int_encoding.h): New include.
1210 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1211 function definitions to int_encoding.cc
1212 (insert_into_vector, read_from_pointer): Move template definitions to
1213 int_encoding.h
1214 * attributes.cc: New file.
1215 * attributes.h: New file.
1216 * int_encoding.cc: New file.
1217 * int_encoding.h: New file.
1218
20b52f1a
RÁE
12192009-12-07 Rafael Avila de Espindola <espindola@google.com>
1220
1221 PR gold/11055
1222 * incremental-dump.cc (dump_incremental_inputs): New.
1223 (main): Use dump_incremental_inputs.
1224
53d7974c
L
12252009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1226
1227 PR gold/10893
1228 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1229 checking elfcpp::STT_FUNC.
1230 (Target_i386::Relocate::relocate): Likewise.
1231 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1232
1233 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1234 symbols from shared libraries into normal FUNC symbols.
1235
1236 * symtab.h (Symbol): Add is_func and use it.
1237
05a352e6
DK
12382009-12-05 Doug Kwan <dougkwan@google.com>
1239
1240 * arm.cc (Target_arm::arm_info): Initialize new fields
1241 attributes_section and attributes_vendor.
1242 * i386.cc (Target_i386::i386_info): Same.
1243 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1244 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1245 fields attributes_section and attributes_vendor.
53d7974c 1246 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
1247 * target.h (Target::attributes_section, Target::attributes_vendor,
1248 Target::is_attributes_section, Target::attribute_arg_type,
1249 Target::attributes_order): New method definitions.
1250 (Target::Target_info::attributes_section,
1251 Target::Target_info::attributes_vendor): New fields.
1252 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1253 virtual method definitions.
1254 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1255 attributes_section and attributes_vendor.
1256 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1257
f4e5969c
DK
12582009-12-05 Doug Kwan <dougkwan@google.com>
1259
1260 * arm.cc: Update comments about interworking and stub generation.
1261 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1262 considered as non-PIC.
1263 (Arm_relocate_functions::base_abs): Fix formatting.
1264 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1265 of function to use GOT entry address instead of offset.
1266 (Target_arm::Scan::global): Issue an error if a symbol would need a
1267 PLT does not get one because it is untyped. Remove code to create
1268 dynamic symbols for relative branches.
1269 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1270 takes unsigned integer instead of boolean.
1271
1abce4a6
L
12722009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1273
1274 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1275 (two_file_test_LDADD): Likewise.
1276 (common_test_1_LDADD): Likewise.
1277 (exception_test_LDADD) Likewise.
1278 (weak_test_LDADD): Likewise.
1279 (many_sections_test_LDADD): Likewise.
1280 (initpri1_LDADD): Likewise.
1281 (script_test_1_LDADD): Likewise.
1282 (script_test_2_LDADD): Likewise.
1283 (justsyms_LDADD): Likewise.
1284 (binary_test_LDADD): Likewise.
1285 (large_LDADD): Likewise.
1286 * testsuite/Makefile.in: Regenerated.
1287
adcf2816 12882009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 1289
adcf2816
L
1290 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1291 (Symbol_table::override_with_special): Likewise.
1292 (Symbol_table::add_from_object): Likewise.
1293
28e67f5d
RÁE
12942009-12-04 Rafael Avila de Espindola <espindola@google.com>
1295
1296 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1297 Don't set the data_offset twice.
1298
ae10a101
RÁE
12992009-12-04 Rafael Avila de Espindola <espindola@google.com>
1300
1301 * testsuite/Makefile.in: Regenerate.
1302
f59f41f3
DK
13032009-12-03 Doug Kwan <dougkwan@google.com>
1304
1305 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1306 (Target_arm::do_finalize_sections): Add parameter for symbol table
1307 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1308 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1309 parameter for symbol table pointer.
1310 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1311 an additional parameter for a pointer to symbol table.
1312 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1313 parameter for a symbol table pointer.
1314 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1315 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1316 Ditto.
1317 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1318 parameter for a symbol table pointer.
1319
ca55d848
RÁE
13202009-12-03 Rafael Avila de Espindola <espindola@google.com>
1321
1322 * incremental.cc (Incremental_inputs_header)
1323 (Incremental_inputs_header_write, Incremental_inputs_entry)
1324 (Incremental_inputs_entry_write): Move ...
1325 * incremental.h (Incremental_inputs_header)
1326 (Incremental_inputs_header_write, Incremental_inputs_entry)
1327 (Incremental_inputs_entry_write): here.
1328
3aec4f9c
RÁE
13292009-12-02 Rafael Avila de Espindola <espindola@google.com>
1330
1331 * incremental.cc (make_sized_incremental_binary): Set the target.
1332 Error if it is incompatible.
1333 * output.h (Output_file): Add filename method.
1334
9c0ae74d
RÁE
13352009-12-02 Rafael Avila de Espindola <espindola@google.com>
1336
1337 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1338 from the get_* methods.
1339
a45500ae
RÁE
13402009-12-02 Rafael Avila de Espindola <espindola@google.com>
1341
1342 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1343 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1344 Write 0 for the data_offset of scripts.
1345
325e6408
RÁE
13462009-12-02 Rafael Avila de Espindola <espindola@google.com>
1347
1348 * testsuite/Makefile.am: Add the incremental_test.sh test.
1349 * testsuite/incremental_test.sh: New.
1350 * testsuite/incremental_test_1.c: New.
1351 * testsuite/incremental_test_2.c: New.
1352
954c3e2e
RÁE
13532009-12-01 Rafael Avila de Espindola <espindola@google.com>
1354
1355 * incremental-dump.cc (main): Fix typos.
1356
f8086623
RÁE
13572009-11-27 Rafael Avila de Espindola <espindola@google.com>
1358
1359 PR gold/11025
1360 * incremental-dump.cc (main): Use llu to print 64 bit values.
1361
3b0dd6ac
L
13622009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1363 H.J. Lu <hongjiu.lu@intel.com>
1364
1365 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1366 $(LIBDL).
1367 (incremental_dump_LDADD): Likewise.
1368 * Makefile.in: Regenerated.
1369
a6d1ef57
DK
13702009-11-25 Doug Kwan <dougkwan@google.com>
1371
1372 Revert:
1373
1374 2009-11-25 Doug Kwan <dougkwan@google.com>
1375
1376 * arm.cc (Target_arm::Target_arm): Move method definition
1377 outside of class definition. Add code to handle
1378 --target1-rel, --target1-abs and --target2= options.
1379 (Target_arm::get_reloc_reloc_type): Change method to be
1380 non-static and const.
1381 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1382 New data member declaration.
1383 (Target_arm::Scan::local, Target_arm::Scan::global,
1384 Target_arm::Relocate::relocate,
1385 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1386 Adjust call to Target_arm::get_real_reloc_type.
1387 (Target_arm::get_real_reloc_type): Use command line options
1388 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1389 * options.h (--target1-rel, --target1-abs, --target2): New
1390 ARM-only options.
1391
50aeb7d4
DK
13922009-11-25 Doug Kwan <dougkwan@google.com>
1393
1394 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1395 class definition. Add code to handle --target1-rel, --target1-abs
1396 and --target2= options.
1397 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1398 and const.
1399 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1400 member declaration.
1401 (Target_arm::Scan::local, Target_arm::Scan::global,
1402 Target_arm::Relocate::relocate,
1403 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1404 call to Target_arm::get_real_reloc_type.
1405 (Target_arm::get_real_reloc_type): Use command line options to
1406 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1407 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1408 options.
1409
51938283
DK
14102009-11-25 Doug Kwan <dougkwan@google.com>
1411
1412 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1413 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1414 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1415 formatting.
1416 (Arm_relocate_functions::thm_call): Replace body with a call to
1417 Arm_relocate_functions::thumb_branch_common.
1418 (Arm_relocate_functions::thm_jump24,
1419 Arm_relocate_functions::thm_xpc22): New method definitions.
1420 (Arm_relocate_functions::thumb_branch_common): New method definition.
1421 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1422 operator.
1423 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1424 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1425
e2b8f3c4
RÁE
14262009-11-24 Rafael Avila de Espindola <espindola@google.com>
1427
1428 * Makefile.am: Build incremental-dump
1429 * Makefile.in: Regenerate.
1430 * incremental-dump.cc: New.
1431 * incremental.cc (Incremental_inputs_header_data,
1432 Incremental_inputs_entry_data): Move to incremental.h
1433 * incremental.h: (Incremental_inputs_header_data,
1434 Incremental_inputs_entry_data): Move from incremental.cc
1435
bcba9aec
RÁE
14362009-11-24 Rafael Avila de Espindola <espindola@google.com>
1437
1438 * incremental.cc (Incremental_inputs_header,
1439 Incremental_inputs_header_write, Incremental_inputs_entry,
1440 Incremental_inputs_entry_write): Add a typedef with the data type.
1441
7c3afe08
RÁE
14422009-11-24 Rafael Avila de Espindola <espindola@google.com>
1443
1444 * incremental.cc (Incremental_inputs_header,
1445 Incremental_inputs_header_write, Incremental_inputs_entry,
1446 Incremental_inputs_entry_write): Update comment about which
1447 type has the filed descriptions.
1448
d204b6e9
DK
14492009-11-15 Doug Kwan <dougkwan@google.com>
1450
1451 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1452 (Arm_relocate_functions::arm_branch_common): Change method defintion
1453 in class definition to a method declaration and update list of formal
1454 parameters.
1455 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1456 Arm_relocation_functions::jump24): Adjust call to
1457 Arm_relocate_functions::arm_branch_common. Update list of formal
1458 parameters.
1459 (Arm_relocate_functions::xpc25): New method definition.
1460 (Arm_relocate_functions::arm_branch_common): Move method defintion
1461 out from class definition. Use stubs for mode-switching and extending
1462 branch ranges.
1463 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1464 specially. Change code to enable use of stubs in ARM branches.
1465
43d12afe
DK
14662009-11-10 Doug Kwan <dougkwan@google.com>
1467
1468 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1469 in method declaration.
1470 (Target_arm::relocate_stub): New method declaration.
1471 (Target_arm::default_target): Change to return a pointer instead of
1472 a const reference.
1473 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1474 Target_arm::default_target.
1475 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1476 method definition.
1477 (Target_arm::relocate_section): Adjust view.
1478 (Target_arm::relocate_stub): New method definition.
1479
ac33a407
DK
14802009-11-10 Doug Kwan <dougkwan@google.com>
1481
1482 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1483 a format warning.
1484 * incremental.cc (open_incremental_binary): Initialized local
1485 variables to avoid warnings.
1486 * object.cc (make_elf_object): Ditto.
1487 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1488 a format warning.
1489
88ee28e9
L
1490009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1491
1492 PR gold/10930
1493 * testsuite/plugin_test.c: Include "config.h".
1494
2daedcd6
DK
14952009-11-09 Doug Kwan <dougkwan@google.com>
1496
1497 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1498 (arm_symbol_value): Remove.
1499 (Arm_relocate_functions::arm_branch_common,
1500 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1501 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1502 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1503 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1504 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1505 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1506 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1507 Arm_relocate_functions::thm_mobw_abs_nc,
1508 Arm_relocate_functions::thm_mov_abs,
1509 Arm_relocate_functions::movw_prel_nc,
1510 Arm_relocate_functions::thm_movt_abs,
1511 Arm_relocate_functions::movt_prel,
1512 Arm_relocate_functions::thm_movw_prel_nc,
1513 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1514 (Target_arm::Relocate::relocate): Only decompose address into two
1515 parts if relocation type uses the thumb-bit and pass the actual
1516 bit instead of a flag indicating that the thumb-bit is used. Adjust
1517 calls to methods in Arm_relocate_functions for this change.
1518
1276bc89 15192009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
1520
1521 PR 10925
1522 * reloc.cc: Instantiate
1523 Sized_relobj::initialize_input_to_output_maps and
1524 Sized_relobj:free_input_to_output_maps.
1525
e53ad1b5
ILT
15262009-11-06 Ian Lance Taylor <iant@google.com>
1527
1528 PR 10876
1529 * defstd.cc (in_segment): Set only_if_ref true for "end".
1530
eb44217c
DK
15312009-11-06 Doug Kwan <dougkwan@google.com>
1532
1533 * arm.cc (class Reloc_stub): Correct a comment.
1534 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1535 (Target_arm::scan_section_for_stubs): New method declaration.
1536 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1537 Change methods from private to protected.
1538 (Target_arm::do_may_relax): New method definition.
1539 (Target_arm::do_relax, Target_arm::group_sections,
1540 Target_arm::scan_reloc_for_stub,
1541 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1542 (Target_arm::arm_input_section_map_): New data member declaration.
1543 (Target_arm::scan_reloc_for_stub,
1544 Target_arm::scan_reloc_section_for_stubs,
1545 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1546 Target_arm::do_relax): New method definitions.
1547
5d329b7d
ILT
15482009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1549
1550 * configure.ac: Check for (struct stat)::st_mtim
1551 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1552 * config.in: Regenerate.
1553 * configure: Regenerate.
1554
96a0d71b
ILT
15552009-11-05 Ian Lance Taylor <iant@google.com>
1556
1557 PR 10910
1558 * output.cc (Output_segment::add_output_section): Add missing
1559 return statement.
1560
594c8e5e
ILT
15612009-11-04 Ian Lance Taylor <iant@google.com>
1562
1563 PR 10880
1564 * object.h (class Object): Add is_needed and set_is_needed
1565 methods. Add is_needed_ field. Make bool fields into bitfields.
1566 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1567 defined in a dynamic object and referenced by a regular object,
1568 set is_needed for the dynamic object.
1569 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1570 if the file is marked with as_needed and it is not needed.
1571
22b127cc
ILT
15722009-11-04 Ian Lance Taylor <iant@google.com>
1573
1574 PR 10887
1575 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1576 tags if data is discarded by linker script.
1577 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1578 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1579 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1580 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1581
f5c870d2
ILT
15822009-11-04 Ian Lance Taylor <iant@google.com>
1583
1584 * layout.cc (Layout::get_output_section): Add is_interp and
1585 is_dynamic_linker_section parameters. Change all callers.
1586 (Layout::choose_output_section): Likewise.
1587 (Layout::make_output_section): Likewise.
1588 (Layout::add_output_section_data): Add is_dynamic_linker_section
1589 parameter. Change all callers.
1590 * layout.h (class Layout): Update declarations.
1591 * output.h (class Output_section): Add is_interp, set_is_interp,
1592 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1593 Add is_interp_, is_dynamic_linker_section_ fields. Change
1594 generate_code_fills_at_write_ to a bitfield.
1595 * output.cc (Output_section::Output_sections): Initialize new
1596 fields.
1597 (Output_segment::add_output_section): Add do_sort parameter.
1598 Change all callers.
1599
1ae4d23b
ILT
16002009-11-03 Ian Lance Taylor <iant@google.com>
1601
1602 PR 10860
1603 * options.h (class General_options): Add --warn-common.
1604 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1605 merging two common symbols.
1606 (Symbol_table::should_override): Handle --warn-common when merging
1607 a common symbol with a defined symbol. Use report_resolve_problem
1608 for multiple definitions.
1609 (Symbol_table::report_resolve_problem): New function.
1610 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1611
55da9579
DK
16122009-11-03 Doug Kwan <dougkwan@google.com>
1613
1614 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1615 stub_factory_.
1616 (Target_arm::stub_factory): New method definition.
1617 (Target_arm::new_arm_input_section,
1618 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1619 Target_arm::reloc_uses_thumb_bit): New method declarations.
1620 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1621 New type definitions.
1622 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1623 member declarations.
1624 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1625 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1626 New method definitions.
1627
37a9ac43
ILT
16282009-11-03 Ian Lance Taylor <iant@google.com>
1629
1630 * options.h (class General_options): Add --warn_constructors.
1631
b3d6a3d4
ILT
16322009-11-03 Ian Lance Taylor <iant@google.com>
1633
1634 PR 10893
1635 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1636 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1637
934b01dd
ILT
16382009-11-03 Ian Lance Taylor <iant@google.com>
1639
1640 PR 10895
1641 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1642 --msgid-bugs-address.
1643 (install-pdf): New target.
1644 (install-data_yes): Look up one directory to find mkinstalldirs.
1645
03c1939b
L
16462009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1647
1648 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1649 tree.
1650
ebd95253
DK
16512009-10-30 Doug Kwan <dougkwan@google.com>
1652
1653 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1654
e9bbb538
DK
16552009-10-30 Doug Kwan <dougkwan@google.com>
1656
1657 * arm.cc (Stub_addend_reader): New struct template definition
1658 and partial specializations.
1659 (Stub_addend_reader::operator()): New method definition for a
1660 partially specialized template.
1661
d5b40221
DK
16622009-10-30 Doug Kwan <dougkwan@google.com>
1663
1664 * arm.cc (Arm_relobj::processor_specific_flags): New method
1665 definition.
1666 (Arm_relobj::do_read_symbols): New method declaration.
1667 (Arm_relobj::processor_specific_flags_): New data member declaration.
1668 (Arm_dynobj): New class definition.
1669 (Target_arm::do_finalize_sections): Add input_objects parameter.
1670 (Target_arm::do_adjust_elf_header): New method declaration.
1671 (Target_arm::are_eabi_versions_compatible,
1672 (Target_arm::merge_processor_specific_flags): New method declaration.
1673 (Target_arm::do_make_elf_object): New overloaded method definitions
1674 and declaration.
1675 (Arm_relobj::do_read_symbols): New method definition.
1676 (Arm_dynobj::do_read_symbols): Ditto.
1677 (Target_arm::do_finalize_sections): Add input_objects parameters.
1678 Merge processor-specific flags from all input objects.
1679 (Target_arm::are_eabi_versions_compatible,
1680 Target_arm::merge_processor_specific_flags,
1681 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1682 New method definitions.
1683 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1684 Input_objects pointer type parameter.
1685 * layout.cc (Layout::finalize): Pass input objects to target's.
1686 finalize_sections function.
1687 * output.cc (Output_file_header::do_sized_write): Set ELF file
1688 header's processor-specific flags.
1689 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1690 Input_objects pointer type parameter.
1691 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1692 * target.h (Input_objects): New forward class declaration.
1693 (Target::processor_specific_flags,
1694 Target::are_processor_specific_flags_sect): New method definitions.
1695 (Target::finalize_sections): Add input_objects parameter.
1696 (Target::Target): Initialize processor_specific_flags_ and
1697 are_processor_specific_flags_set_.
1698 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1699 parameter.
1700 (Target::set_processor_specific_flags): New method definition.
1701 (Target::processor_specific_flags_,
1702 Target::are_processor_specific_flags_set_): New data member
1703 declarations.
1704 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1705 Input_objects pointer type parameter.
1706
ebabffbd
DK
17072009-10-30 Doug Kwan <dougkwan@google.com>
1708
1709 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1710
ad0f2072
ILT
17112009-10-28 Ian Lance Taylor <iant@google.com>
1712
1713 * object.h (class Relobj): Drop options parameter from
1714 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1715 do_scan_relocs, do_relocate. Change all callers.
1716 (class Sized_relobj): Drop options parameters from
1717 do_gc_process_relocs, do_scan_relocs, do_relocate,
1718 do_relocate_sections, relocate_sections, emit_relocs_scan,
1719 emit_relocs_scan_reltype. Change all callers.
1720 (struct Relocate_info): Remove options field and all references to
1721 it.
1722 * reloc.h (class Read_relocs): Remove options constructor
1723 parameter and options_ field. Change all callers.
1724 (class Gc_process_relocs, class Scan_relocs): Likewise.
1725 (class Relocate_task): Likewise.
1726 * target-reloc.h (scan_relocs): Remove options parameter. Change
1727 all callers.
1728 (scan_relocatable_relocs): Likewise.
1729 * target.h (class Sized_target): Remove options parameter from
1730 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1731 all callers.
1732 * gc.h (gc_process_relocs): Remove options parameter. Change all
1733 callers.
1734 * arm.cc: Update functions to remove options parameters.
1735 * i386.cc: Likewise.
1736 * powerpc.cc: Likewise.
1737 * sparc.cc: Likewise.
1738 * x86_64.cc: Likewise.
1739 * testsuite/testfile.cc: Likewise.
1740
8ffa3667
DK
17412009-10-28 Doug Kwan <dougkwan@google.com>
1742
1743 * arm.cc (Arm_relobj): New class definition.
1744 (Arm_relobj::scan_sections_for_stubs,
1745 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1746 New method definitions.
1747
40f36857
CC
17482009-10-28 Cary Coutant <ccoutant@google.com>
1749
1750 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1751 (Plugin::cleanup_done_): New member.
1752 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1753 (Plugin_manager::cleanup_done_): Remove.
1754 (Plugin_manager::add_input_file): Edit error message.
1755 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1756 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1757
2c849493
ILT
17582009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1759
1760 * fileread.cc: (File_read::View::~View): Use the new
1761 data_ownership_ filed.
1762 (File_read::~File_read): Dispose the new whole_file_view_.
1763 (File_read::open): Mmap the whole file if needed.
1764 (File_read::open): Use whole_file_view_ instead of contents_.
1765 (File_read::find_view): Use whole_file_view_ if applicable.
1766 (File_read::do_read): Use whole_file_view_ instead of contents_.
1767 (File_read::make_view): Use whole_file_view_ instead of contents_,
1768 update File_read::View::View call.
1769 (File_read::find_or_make_view): Update File_read::View::View
1770 call.
1771 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1772 remove contents_
1773 (File_read::View::Data_ownership): New enum.
1774 (File_read::View::View): Replace bool mapped_ with Data_ownership
1775 argument.
1776 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1777 (File_read::View::data_ownership_): New field.
1778 (File_read::contents_): Remove (replaced by whole_file_view_).
1779 (File_read::whole_file_view_): New field.
1780 * options.h (class General_options): Add --keep-files-mapped.
1781
24998053
CC
17822009-10-27 Cary Coutant <ccoutant@google.com>
1783
1784 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1785 * testsuite/Makefile.am (plugin_test_5): New test case.
1786 * testsuite/Makefile.in: Regenerate.
1787
72adc4fa
DK
17882009-10-25 Doug Kwan <dougkwan@google.com>
1789
1790 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1791 from private to protected to allow access by child class.
1792 (Sized_relobj::do_relocate_sections): New method declaration.
1793 (Sized_relobj::relocate_sections): Virtualize.
1794 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1795 Sized_relobj::relocate_sections. Instantiate template explicitly
1796 for different target sizes and endianity.
1797
07f508a2
DK
17982009-10-24 Doug Kwan <dougkwan@google.com>
1799
1800 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1801 (Arm_input_section::as_arm_input_section): New method.
1802 (Arm_output_section): New class definition.
1803 (Arm_output_section::create_stub_group,
1804 Arm_output_section::group_sections): New method definitions.
1805
10ad9fe5
DK
18062009-10-22 Doug Kwan <dougkwan@google.com>
1807
1808 * arm.cc (Arm_input_section): New class definition.
1809 (Arm_input_section::init, Arm_input_section:do_write,
1810 Arm_input_section::set_final_data_size,
1811 Arm_input_section::do_reset_address_and_file_offset): New method
1812 definitions.
1813
56ee5e00
DK
18142009-10-21 Doug Kwan <dougkwan@google.com>
1815
1816 * arm.cc (Stub_table, Arm_input_section): New forward class
1817 declarations.
1818 (Stub_table): New class defintion.
1819 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1820 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1821 New method definition.
1822
b569affa
DK
18232009-10-21 Doug Kwan <dougkwan@google.com>
1824
1825 * arm.cc: Update copyright comments.
1826 (Target_arm): New forward class template declaration.
1827 (Arm_address): New type.
1828 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1829 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1830 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1831 constants.
1832 (Insn_template): Same.
1833 (DEF_STUBS): New macro.
1834 (Stub_type): New enum type.
1835 (Stub_template): New class definition.
1836 (Stub): Same.
1837 (Reloc_stub): Same.
1838 (Stub_factory): Same.
1839 (Target_arm::Target_arm): Initialize may_use_blx_ and
1840 should_force_pic_veneer_.
1841 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1842 Target_arm::should_force_pic_veneer,
1843 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1844 Target_arm::using_thumb_only, Target_arm:;default_target): New
1845 method defintions.
1846 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1847 New data member declarations.
1848 (Insn_template::size, Insn_template::alignment): New method defintions.
1849 (Stub_template::Stub_template): New method definition.
1850 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1851 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1852 (Stub_factory::Stub_factory): New method definition.
1853 * gold.h (string_hash): New template.
1854 * output.h (Input_section_specifier::hash_value): Use
1855 gold::string_hash.
1856 (Input_section_specifier::string_hash): Remove.
1857 * stringpool.cc (Stringpool_template::string_hash): Use
1858 gold::string_hash.
1859
6c172549
DK
18602009-10-20 Doug Kwan <dougkwan@google.com>
1861
1862 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1863 symbols of relaxed input sections.
1864 * output.h (Output_section::find_relaxed_input_section): Make
1865 method public.
1866
c5617f2f
DK
18672009-10-16 Doug Kwan <dougkwan@google.com>
1868
1869 * dynobj.cc (Versions::Versions): Initialize version_script_.
1870 Only insert base version symbol definition for a shared object
1871 if version script defines any version versions.
1872 (Versions::define_base_version): New method definition.
1873 (Versions::add_def): Check that base version is not needed.
1874 (Versions::add_need): Define base version lazily.
1875 * dynobj.h (Versions::define_base_version): New method declaration.
1876 (Versions::needs_base_version_): New data member declaration.
1877 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1878 (check_DATA): Add no_version_test.stdout.
1879 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1880 New make rules.
1881 * testsuite/Makefile.in: Regenerate.
1882 * testsuite/no_version_test.c: New file.
1883 * testsuite/no_version_test.sh: Ditto.
1884
3c12dcdb
DK
18852009-10-16 Doug Kwan <dougkwan@google.com>
1886
1887 * expression.cc (class Segment_start_expression): New class definition.
1888 (Segment_start_expression::value): New method definition.
1889 (script_exp_function_segment_start): Return a new
1890 Segment_start_expression.
1891 * gold/script-c.h (script_saw_segment_start_expression): New function
1892 prototype.
1893 * script-sections.cc (Script_sections::Script_sections): Initialize
1894 SAW_SEGMENT_START_EXPRESSION_ to false.
1895 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1896 and -Tbbs options to specify section addresses if given in
1897 command line and no SEGMENT_START expression is seen in a script.
1898 * script-sections.h (Script_sections::saw_segment_start_expression,
1899 Script_sections::set_saw_segment_start_expression): New method
1900 definition.
1901 (Script_sections::saw_segment_start_expression_): New data member
1902 declaration.
1903 * script.cc (script_saw_segment_start_expression): New function.
1904 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1905 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1906 script_test_7.sh and script_test_8.sh.
1907 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1908 script_test_8.stdout.
1909 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1910 (script_test_6, script_test_6.stdout, script_test_7,
1911 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1912 * Makefile.in: Regenerate.
1913 * testsuite/script_test_6.sh: New file.
1914 * testsuite/script_test_6.t: Same.
1915 * testsuite/script_test_7.sh: Same.
1916 * testsuite/script_test_7.t: Same.
1917 * testsuite/script_test_8.sh: Same.
1918
64b1ae37
DK
19192009-10-16 Doug Kwan <dougkwan@google.com>
1920
1921 * output.cc (Output_segment::set_section_list_address): Cast
1922 expressions to unsigned long long type to avoid format warnings.
1923
661be1e2
ILT
19242009-10-15 Ian Lance Taylor <iant@google.com>
1925
12edd763 1926 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 1927 dot assignment to script_sections_.
12edd763
ILT
1928 * script-sections.cc (Script_sections::add_dot_assignment):
1929 Initialize if necessary.
1930
68b6574b
ILT
1931 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1932 program headers with no load segment if there is a linker script.
1933
661be1e2
ILT
1934 * layout.cc (Layout::set_segment_offsets): Align the file offset
1935 to the segment aligment for -N or -n with no load segment.
1936 * output.cc (Output_segment::add_output_section): Don't crash if
1937 the first section is a TLS section.
1938 (Output_segment::set_section_list_addresses): Print an error
1939 message if the address moves backward in a linker script.
1940 * script-sections.cc
1941 (Output_section_element_input::set_section_addresses): Don't
1942 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1943 (Orphan_output_section::set_section_addresses): Likewise.
1944
f15f61a7
DK
19452009-10-15 Doug Kwan <dougkwan@google.com>
1946
1947 * layout.cc (Layout::finish_dynamic_section): Generate tags
1948 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1949 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1950 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1951
82bb573a
ILT
19522009-10-14 Ian Lance Taylor <iant@google.com>
1953
1954 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1955 fields.
1956 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1957 data_shdr fields of relinfo.
1958 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1959 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1960 R_386_TLS_LDO_32, adjust based on section flags.
1961 (Target_i386::Relocate::fix_up_ldo): Remove.
1962
374ad285
ILT
19632009-10-13 Ian Lance Taylor <iant@google.com>
1964
1965 Add support for -pie.
1966 * options.h (class General_options): Add -pie and
1967 --pic-executable.
1968 (General_options::output_is_position_independent): Test -pie.
1969 (General_options::output_is_executable): Return true if not shared
1970 and not relocatable.
1971 (General_options::output_is_pie): Remove.
1972 * options.cc (General_options::finalize): Reject incompatible uses
1973 of -pie.
1974 * gold.cc (queue_middle_tasks): A -pie link is not static.
1975 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1976 * symtab.cc (Symbol::final_value_is_known): Return false if
1977 output_is_position_independent.
1978 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1979 output_is_position_independent.
1980 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1981 output_is_position_independent.
1982 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1983 output_is_position_independent.
1984 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1985 two_file_pie_test.
1986 (basic_pie_test.o, basic_pie_test): New targets.
1987 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1988 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1989 (two_file_pie_test): New target.
1990 * testsuite/Makefile.in: Rebuild.
1991 * README: Remove note saying that -pie is not supported.
1992
c6585162
ILT
19932009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1994
1995 * options.h (class General_options): Add -init and -fini.
1996 * layout.cc (Layout::finish_dynamic_section): Emit
1997 given init and fini functions.
1998
032ce4e9
ST
19992009-10-13 Sriraman Tallam <tmsriram@google.com>
2000
2001 * gc.h (gc_process_relocs): Check if icf is enabled using new
2002 function.
2003 * gold.cc (queue_initial_tasks): Likewise.
2004 (queue_middle_tasks): Likewise.
2005 * object.cc (do_layout): Likewise.
2006 * symtab.cc (is_section_folded): Likewise.
2007 * main.cc (main): Likewise.
2008 * reloc.cc (Read_relocs::run): Likewise.
2009 (Sized_relobj::do_scan_relocs): Likewise.
2010 * icf.cc (is_function_ctor_or_dtor): New function.
2011 (Icf::find_identical_sections): Check if function is ctor or dtor when
2012 safe icf is chosen.
2013 * options.h (General_options::icf): Change option to be an enum.
2014 (Icf_status): New enum.
2015 (icf_enabled): New method.
2016 (icf_safe_folding): New method.
2017 (set_icf_status): New method.
2018 (icf_status_): New variable.
2019 * (options.cc) (General_options::finalize): Set icf_status_.
2020 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2021 icf_test and icf_keep_unique_test to use the --icf enum flag.
2022 * testsuite/icf_safe_test.sh: New file.
2023 * testsuite/icf_safe_test.cc: New file.
2024
f345227a
ST
20252009-10-12 Sriraman Tallam <tmsriram@google.com>
2026
2027 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2028 includes to gc.h and icf.h.
2029 * arm.cc: Include gc.h.
2030 * gold.cc: Likewise.
2031 * i386.cc: Likewise.
2032 * powerpc.cc: Likewise.
2033 * sparc.cc: Likewise.
2034 * x86_64.cc: Likewise.
2035 * gc.h: Include icf.h.
2036
1c7814ed
ILT
20372009-10-11 Ian Lance Taylor <iant@google.com>
2038
2039 * plugin.cc: Include "gold.h" before other header files.
2040
ae3b5189
CD
20412009-10-10 Chris Demetriou <cgd@google.com>
2042
2043 * options.h (Input_file_argument::Input_file_type): New enum.
2044 (Input_file_argument::is_lib_): Replace with...
2045 (Input_file_argument::type_): New member.
2046 (Input_file_argument::Input_file_argument): Take Input_file_type
2047 'type' rather than boolean 'is_lib' as second argument.
2048 (Input_file_argument::is_lib): Use type_.
2049 (Input_file_argument::is_searched_file): New function.
2050 (Input_file_argument::may_need_search): Handle is_searched_file.
2051 * options.cc (General_options::parse_library): Support -l:filename.
2052 (General_options::parse_just_symbols): Update for Input_file_argument
2053 changes.
2054 (Command_line::process): Likewise.
2055 * archive.cc (Archive::get_file_and_offset): Likewise.
2056 * plugin.cc (Plugin_manager::release_input_file): Likewise.
2057 * script.cc (read_script_file, script_add_file): Likewise.
2058 * fileread.cc (Input_file::Input_file): Likewise.
2059 (Input_file::will_search_for): Handle is_searched_file.
2060 (Input_file::open): Likewise.
2061 * readsyms.cc (Read_symbols::get_name): Likewise.
2062 * testsuite/Makefile.am (searched_file_test): New test.
2063 * testsuite/Makefile.in: Regenerate.
2064 * testsuite/searched_file_test.cc: New file.
2065 * testsuite/searched_file_test_lib.cc: New file.
2066
f3048a1d
ILT
20672009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2068 Ian Lance Taylor <iant@google.com>
2069
2070 * descriptor.cc: Include <cstdio> and "binary-io.h".
2071 (Descriptors::open): Open the files in binary mode always.
2072 * script.cc (Lex::get_token): Treat \r as whitespace.
2073
d4780e57
ILT
20742009-10-09 Ian Lance Taylor <iant@google.com>
2075
2076 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2077
d9a893b8
ILT
20782009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2079 Ian Lance Taylor <iant@google.com>
2080
2081 * configure.ac: Check for readv function also.
2082 * fileread.cc (readv): Define if not HAVE_READV.
2083 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2084 does not exist.
2085 * config.in: Regenerate.
2086 * configure: Regenerate.
2087
c0a62865
DK
20882009-10-09 Doug Kwan <dougkwan@google.com>
2089
2090 * layout.cc (Layout::make_output_section): Call target hook to make
2091 ordinary output section.
2092 (Layout::finalize): Adjust parameter list of call the
2093 Target::may_relax().
2094 * layout.h (class Layout::section_list): New method.
2095 * merge.h (Output_merge_base::entsize): Change visibility to public.
2096 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2097 New methods.
2098 (Output_merge_string::do_is_string): New method.
2099 * object.cc (Sized_relobj::do_setup): renamed from
2100 Sized_relobj::set_up.
2101 * object.h (Sized_relobj::adjust_shndx,
2102 Sized_relobj::initializ_input_to_output_maps,
2103 Sized_relobj::free_input_to_output_maps): Change visibilities to
2104 protected.
2105 (Sized_relobj::setup): Virtualize.
2106 (Sized_relobj::do_setup): New method declaration.
2107 (Sized_relobj::invalidate_section_offset,
2108 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2109 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2110 * options.cc (parse_int): New function.
2111 * options.h (parse_int): New declaration.
2112 (DEFINE_int): New macro.
2113 (stub_group_size): New option.
2114 * output.cc (Output_section::Output_section): Initialize memebers
2115 merge_section_map_, merge_section_by_properties_map_,
2116 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2117 (Output_section::add_input_section): Handled deferred code-fill
2118 generation and remove an old comment.
2119 (Output_section::add_relaxed_input_section): New method definition.
2120 (Output_section::add_merge_input_section): Use merge section by
2121 properties map to speed to search. Update merge section maps
2122 as appropriate.
2123 (Output_section::build_relaxation_map): New method definition.
2124 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2125 Same.
2126 (Output_section::relax_input_section): Renamed to
2127 Output_section::convert_input_sections_to_relaxed_sections and change
2128 interface to take a vector of pointers to relaxed sections.
2129 (Output_section::find_merge_section,
2130 Output_section::find_relaxed_input_section): New method definitions.
2131 (Output_section::is_input_address_mapped,
2132 Output_section::output_offset, Output_section::output_address):
2133 Use output section data maps to speed up searching.
2134 (Output_section::find_starting_output_address): Add comments.
2135 (Output_section::do_write,
2136 Output_section::write_to_postprocessing_buffer): Do code-fill
2137 generation as appropriate.
2138 (Output_section::get_input_sections): Invalidate relaxed input section
2139 map.
2140 (Output_section::restore_states): Adjust type of checkpoint .
2141 Invalidate relaxed input section map.
2142 * output.h (Output_merge_base): New class declaration.
2143 (Input_section_specifier): New class defintion.
2144 (class Output_relaxed_input_section) Change base class to
2145 Output_section_data_build.
2146 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2147 base class initializer.
2148 (Output_section::add_relaxed_input_section): New method declaration.
2149 (Output_section::Input_section): Change visibility to protected.
2150 (Output_section::Input_section::relobj,
2151 Output_section::Input_section::shndx): Handle relaxed input sections.
2152 Output_section::input_sections) Change visibility to protected. Also
2153 define overload to return a non-const pointer.
2154 (Output_section::Merge_section_properties): New class defintion.
2155 (Output_section::Merge_section_by_properties_map,
2156 Output_section::Output_section_data_by_input_section_map,
2157 Output_section::Relaxation_map): New types.
2158 (Output_section::relax_input_section): Rename method to
2159 Output_section::convert_input_sections_to_relaxed_sections and change
2160 interface to take a vector of relaxed section pointers.
2161 (Output_section::find_merge_section,
2162 Output_section::find_relaxed_input_section,
2163 Output_section::build_relaxation_map,
2164 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2165 New method declarations.
2166 (Output_section::merge_section_map_
2167 Output_section::merge_section_by_properties_map_,
2168 Output_section::relaxed_input_section_map_,
2169 Output_section::is_relaxed_input_section_map_valid_,
2170 Output_section::generate_code_fills_at_write_): New data members.
2171 * script-sections.cc
2172 (Output_section_element_input::set_section_addresses): Call
2173 current_data_size and addralign methods of relaxed input sections.
2174 (Orphan_output_section::set_section_addresses): Call current_data_size
2175 and addralign methods of relaxed input sections.
2176 * symtab.cc (Symbol_table::compute_final_value): Extract template
2177 from the body of Symbol_table::sized_finalize_symbol.
2178 (Symbol_table::sized_finalized_symbol): Call
2179 Symbol_table::compute_final_value.
2180 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2181 (Symbol_table::compute_final_value): New templated method declaration.
2182 * target.cc (Target::do_make_output_section): New method defintion.
2183 * target.h (Target::make_output_section): New method declaration.
2184 (Target::relax): Add more parameters for input objects, symbol table
2185 and layout. Adjust call to do_relax.
2186 (Target::do_make_output_section): New method declaration.
2187 (Target::do_relax): Add parameters for input objects, symbol table
2188 and layout.
2189
d446d6c4
ILT
21902009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2191
2192 * pread.c: Include stdio.h.
2193
bc06c745
ILT
21942009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2195
2196 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2197 defined.
2198
75aea3d0
ILT
21992009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2200
2201 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2202 Change read_shndx type to unsigned int.
2203 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2204 int.
2205 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2206 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2207 Change read_shndx type to unsigned int.
2208 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2209 int.
2210 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2211 * layout.cc (Layout::create_symtab_sections): Cast the result of
2212 local_symcount * symsize to off_t in the gold_assert.
2213
be8fcb75
ILT
22142009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2215
2216 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2217 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2218 R_ARM_BASE_ABS.
2219 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2220 (Arm_relocate_functions::thm_abs5): New function.
2221 (Arm_relocate_functions::abs12): New function.
2222 (Arm_relocate_functions::abs16): New function.
2223 (Arm_relocate_functions::base_abs): New function.
2224 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2225 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2226 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2227 R_ARM_BASE_ABS.
2228 (Scan::global): Likewise.
2229 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2230 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2231 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2232 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2233 R_ARM_BASE_ABS.
2234
c2a122b6
ILT
22352009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2236
2237 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2238 (Arm_relocate_functions::movt_prel): New function.
2239 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2240 (Arm_relocate_functions::thm_movt_prel): New function.
2241 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2242 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2243 (Scan::global, Relocate::relocate): Likewise.
2244 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2245
c4aa1e2d
ILT
22462009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2247
2248 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2249 Incremental_checker.
2250 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2251 unsigned int.
2252 (class Incremental_inputs_header): New class.
2253 (Incremental_inputs_header_writer): Edit comment.
2254 (Incremental_inputs_entry): New class.
2255 (Incremental_inputs_entry_writer): Edit comment.
2256 (Sized_incremental_binary::do_find_incremental_inputs_section):
2257 Add *strtab_shndx parameter, fill it.
2258 (Sized_incremental_binary::do_check_inputs): New method.
2259 (Incremental_checker::can_incrementally_link_output_file): Use
2260 Sized_incremental_binary::check_inputs.
2261 (Incremental_inputs::report_command_line): Save command line in
2262 command_line_.
2263 * incremental.h:
2264 (Incremental_binary::find_incremental_inputs_section): New
2265 method.
2266 (Incremental_binary::do_find_incremental_inputs_section): Add
2267 strtab_shndx parameter.
2268 (Incremental_binary::do_check_inputs): New pure virtual method.
2269 (Sized_incremental_binary::do_check_inputs): Declare.
2270 (Incremental_checker::Incremental_checker): Add incremental_inputs
2271 parameter, use it to initialize incremental_inputs_.
2272 (Incremental_checker::incremental_inputs_): New field.
2273 (Incremental_checker::command_line): New method.
2274 (Incremental_checker::inputs): New method.
2275 (Incremental_checker::command_line_): New field.
2276
c549a694
ILT
22772009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2278
2279 * incremental.cc: Include <cstdarg> and "target-select.h".
2280 (vexplain_no_incremental): New function.
2281 (explain_no_incremental): New function.
2282 (Incremental_binary::error): New method.
2283 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2284 method.
2285 (make_sized_incremental_binary): New function.
2286 (open_incremental_binary): New function.
2287 (can_incrementally_link_file): Add checks if output is ELF and has
2288 inputs section.
2289 * incremental.h: Include "elfcpp_file.h" and "output.h".
2290 (Incremental_binary): New class.
2291 (Sized_incremental_binary): New class.
2292 (open_incremental_binary): Declare.
2293 * object.cc (is_elf_object): Use
2294 elfcpp::Elf_recognizer::is_elf_file.
2295 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2296 * output.h (Output_file::filesize): New method.
2297
fd3c5f0b
ILT
22982009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2299
2300 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2301 New function.
2302 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2303 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2304 function.
2305 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2306 function.
2307 (Arm_relocate_functions::movw_abs_nc): New function.
2308 (Arm_relocate_functions::movt_abs): New function.
2309 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2310 (Arm_relocate_functions::thm_movt_abs): New function.
2311 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2312 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2313 (Scan::global): Likewise.
2314 (Relocate::relocate): Likewise.
2315 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2316
7f5309a5
ILT
23172009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2318
2319 * arm.cc (Arm_relocate_functions::got_prel) New function.
2320 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2321 (Relocate::relocate): Likewise.
2322 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2323
364c7fa5
ILT
23242009-10-06 Ian Lance Taylor <iant@google.com>
2325
2326 * options.h (class General_options): Define
2327 split_stack_adjust_size parameter.
2328 * object.h (class Object): Add uses_split_stack_ and
2329 has_no_split_stack_ fields. Add uses_split_stack and
2330 has_no_split_stack accessor functions. Declare
2331 handle_split_stack_section.
2332 (class Reloc_symbol_changes): Define.
2333 (class Sized_relobj): Define Function_offsets. Declare
2334 split_stack_adjust, split_stack_adjust_reltype, and
2335 find_functions.
2336 * object.cc (Object::handle_split_stack_section): New function.
2337 (Sized_relobj::do_layout): Call handle_split_stack_section.
2338 * dynobj.cc (Sized_dynobj::do_layout): Call
2339 handle_split_stack_section.
2340 * reloc.cc (Sized_relobj::relocate_sections): Call
2341 split_stack_adjust for executable sections in split_stack
2342 objects. Pass reloc_map to relocate_section.
2343 (Sized_relobj::split_stack_adjust): New function.
2344 (Sized_relobj::split_stack_adjust_reltype): New function.
2345 (Sized_relobj::find_functions): New function.
2346 * target-reloc.h: Include "object.h".
2347 (relocate_section): Add reloc_symbol_changes parameter. Change
2348 all callers.
2349 * target.h (class Target): Add calls_non_split method. Declare
2350 do_calls_non_split virtual method. Declare match_view and
2351 set_view_to_nop.
2352 * target.cc: Include "elfcpp.h".
2353 (Target::do_calls_non_split): New function.
2354 (Target::match_view): New function.
2355 (Target::set_view_to_nop): New function.
2356 * gold.cc (queue_middle_tasks): Give an error if mixing
2357 split-stack and non-split-stack objects with -r.
2358 * i386.cc (Target_i386::relocate_section): Add
2359 reloc_symbol_changes parameter.
2360 (Target_i386::do_calls_non_split): New function.
2361 * x86_64.cc (Target_x86_64::relocate_section): Add
2362 reloc_symbol_changes parameter.
2363 (Target_x86_64::do_calls_non_split): New function.
2364 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2365 parameter.
2366 * powerpc.cc (Target_powerpc::relocate_section): Add
2367 reloc_symbol_changes parameter.
2368 * sparc.cc (Target_sparc::relocate_section): Add
2369 reloc_symbol_changes parameter.
2370 * configure.ac: Call AM_CONDITIONAL for the default target.
2371 * configure: Rebuild.
2372 * testsuite/Makefile.am (TEST_AS): New variable.
2373 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2374 (check_DATA): Add split_i386 and split_x86_64 files.
2375 (SPLIT_DEFSYMS): Define.
2376 (split_i386_[1234n].o): New targets.
2377 (split_i386_[124]): New targets.
2378 (split_i386_[1234r].stdout): New targets.
2379 (split_x86_64_[1234n].o): New targets.
2380 (split_x86_64_[124]): New targets.
2381 (split_x86_64_[1234r].stdout): New targets.
2382 (MOSTLYCLEANFILES): Add new executables.
2383 * testsuite/split_i386.sh: New file.
2384 * testsuite/split_x86_64.sh: New file.
2385 * testsuite/split_i386_1.s: New file.
2386 * testsuite/split_i386_2.s: New file.
2387 * testsuite/split_i386_3.s: New file.
2388 * testsuite/split_i386_4.s: New file.
2389 * testsuite/split_i386_n.s: New file.
2390 * testsuite/split_x86_64_1.s: New file.
2391 * testsuite/split_x86_64_2.s: New file.
2392 * testsuite/split_x86_64_3.s: New file.
2393 * testsuite/split_x86_64_4.s: New file.
2394 * testsuite/split_x86_64_n.s: New file.
2395 * testsuite/testfile.cc (Target_test): Update relocation_section
2396 function.
2397 * testsuite/Makefile.in: Rebuild.
2398
e8a9fcda
ILT
23992009-10-06 Ian Lance Taylor <iant@google.com>
2400
2401 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2402 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2403 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2404 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2405 the address on ldo_addrs_.
2406 (Target_i386::Relocate::fix_up_ldo): New function.
2407
e99daf92
ILT
24082009-10-06 Rafael Espindola <espindola@google.com>
2409
2410 * plugin.cc (add_input_library): New.
2411 (Plugin::load): Add add_input_library to tv.
2412 (Plugin_manager::add_input_file): Add the is_lib argument.
2413 (add_input_file): Update call to Plugin_manager::add_input_file.
2414 (add_input_library): New.
2415 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2416
966d4097
DK
24172009-09-30 Doug Kwan <dougkwan@google.com>
2418
2419 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2420 symbol and call Symbol::may_need_copy_reloc to determine if
2421 a copy reloc is needed.
2422 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2423 nocopyreloc is given in command line.
2424 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2425 given in command line.
2426 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2427 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2428 of the removed Target_i386::may_need_copy_reloc.
2429 * options.h (copyreloc): New option with default value false.
2430 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2431 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2432 instead of the removed Target_powerpc::may_need_copy_reloc.
2433 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2434 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2435 instead of the removed Target_sparc::may_need_copy_reloc.
2436 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2437 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2438 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2439 instead of the removed Target_x86_64::may_need_copy_reloc.
2440
029ba973
ILT
24412009-09-30 Ian Lance Taylor <iant@google.com>
2442
2443 * object.h (class Object): Remove target_ field, and target,
2444 sized_target, and set_target methods.
2445 (Object::sized_target): Remove.
2446 (class Sized_relobj): Update declarations. Remove sized_target.
2447 * object.cc (Sized_relobj::setup): Remove target parameter.
2448 Change all callers.
2449 (Input_objects::add_object): Don't do anything with the target.
2450 (make_elf_sized_object): Add punconfigured parameter. Change all
2451 callers. Set or test parameter target.
2452 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2453 Change all callers.
2454 * parameters.cc (Parameters::set_target): Change parameter type to
2455 be non-const.
2456 (Parameters::default_target): Remove.
2457 (set_parameters_target): Change parameter type to be non-const.
2458 (parameters_force_valid_target): New function.
2459 (parameters_clear_target): New function.
2460 * parameters.h (class Parameters): Update declarations. Remove
2461 default_target method. Add sized_target and clear_target
2462 methods. Change target_ to be non-const.
2463 (set_parameters_target): Update declaration.
2464 (parameters_force_valid_target): Declare.
2465 (parameters_clear_target): Declare.
2466 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2467 as NULL if we aren't searching.
2468 (Add_symbols::run): Don't check for compatible target.
2469 * fileread.cc (Input_file::open_binary): Call
2470 parameters_force_valid_target.
2471 * gold.cc (queue_middle_tasks): Likewise.
2472 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2473 set_target on object.
2474 * dynobj.h (class Sized_dynobj): Update declarations.
2475 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2476 make_elf_object returns NULL.
2477 (Archive::include_member): Don't check whether object target is
2478 compatible.
2479 * output.cc (Output_section::add_input_section): Get target from
2480 parameters.
2481 (Output_section::relax_input_section): Likewise.
2482 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2483 parameters.
2484 (Sized_relobj::do_scan_relocs): Likewise.
2485 (Sized_relobj::relocate_sections): Likewise.
2486 * resolve.cc (Symbol_table::resolve): Likewise.
2487 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2488 parameter. Change all callers.
2489 (Symbol_table::add_from_object): Get target from parameters.
2490 (Symbol_table::add_from_relobj): Don't check object target.
2491 (Symbol_table::add_from_dynobj): Likewise.
2492 (Symbol_table::define_special_symbol): Get target from
2493 parameters.
2494 * symtab.h (class Symbol_table): Update declaration.
2495 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2496 parameter. Change all callers. Clear parameter target.
2497 (Binary_test): Test target here.
2498 * testsuite/object_unittest.cc (gold_testsuite): Remove
2499 target_test_pointer parameter. Change all callers.
2500 (Object_test): Test target here.
2501
a6a22b83
ILT
25022009-09-26 Ian Lance Taylor <iant@google.com>
2503
2504 * testsuite/initpri1.c: Don't try to use constructor priorities if
2505 compiling with gcc before 4.3.
2506
6a8f49fe
ILT
25072009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2508
2509 * testsuite/retain_symbols_file_test.sh (check_present): Change
2510 output file name to retain_symbols_file_test.stdout.
2511 (check_absent): Likewise.
2512
8c604651
CS
25132009-09-18 Craig Silverstein <csilvers@google.com>
2514
2515 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2516 * options.cc: Include <cerrno> and <fstream>.
2517 (General_options::finalize): Parse -retain-symbols-file tag.
2518 * options.h: New flag.
2519 (General_options): New method should_retain_symbol, new
2520 variable symbols_to_retain.
2521 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2522 should_retain_symbol map.
2523 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2524 * testsuite/Makefile.in: Regenerate.
2525 * testsuite/retain_symbols_file_test.sh: New file.
2526
ca58b19f
NC
25272009-09-18 Nick Clifton <nickc@redhat.com>
2528
2529 * po/es.po: Updated Spanish translation.
2530
20e6d0d6
DK
25312009-09-17 Doug Kwan <dougkwan@google.com>
2532
2533 * debug.h (DEBUG_RELAXATION): New constant.
2534 (DEBUG_ALL): Add DEBUG_RELAXATION.
2535 (debug_string_to_enum): Add relaxation debug option.
2536 * layout.cc
2537 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2538 Layout::Relaxation_debug_check::read_sections,
2539 Layout::Relaxation_debug_check::read_sections): New method definitions.
2540 (Layout::Layout): Initialize data members
2541 record_output_section_data_from_scrips_,
2542 script_output_section_data_list_ and relaxation_debug_check_.
2543 (Layout::save_segments, Layout::restore_segments,
2544 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2545 Layout::relaxation_loop_body): New method definitions.
2546 (Layout::finalize): Support relaxation. Move section layout code to
2547 Layout::relaxation_loop_body.
2548 (Layout::set_asection_address_from_script): Move code for orphan
2549 section placement out.
2550 (Layout::place_orphan_sections_in_script): New method definition.
2551 * layout.h (Output_segment_headers, Output_file_header):
2552 New forward class declarations.
2553 (Layout::~Layout): Define.
2554 (Layout::new_output_section_data_from_script): New method definition.
2555 (Layout::place_orphan_sections_in_script): New method declaration.
2556 (Layout::Segment_states): New type declaration.
2557 (Layout::save_segments, Layout::restore_segments,
2558 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2559 Layout::relaxation_loop_body): New method declarations.
2560 (Layout::Output_section_data_list): New type declaration.
2561 (Layout::Relaxation_debug_check): New class definition.
2562 (Layout::record_output_section_data_from_script_,
2563 Layout::script_output_section_data_list_, Layout::segment_states_,
2564 Layout::relaxation_debug_check_): New data members.
2565 * output.cc: (Output_section_headers::do_size): New method definition.
2566 (Output_section_headers::Output_section_headers): Move size
2567 computation to Output_section_headers::do_size.
2568 (Output_segment_headers::do_size): New method definition.
2569 (Output_file_header::Output_file_header): Move size computation to
2570 Output_file_header::do_size and call it.
2571 (Output_file_header::do_size): New method definition.
2572 (Output_data_group::Output_data_group): Adjust call to
2573 Output_section_data.
2574 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2575 (Output_symtab_xindex::do_write): Add array bound check.
2576 (Output_section::Input_section::print_to_mapfile): Handle
2577 RELAXED_INPUT_SECTION_CODE.
2578 (Output_section::Output_section): Initialize data member checkpoint_.
2579 (Output_section::~Output_section): Delete checkpoint object pointed
2580 by checkpoint_.
2581 (Output_section::add_input_section): Always add an Input_section if
2582 relaxing.
2583 (Output_section::add_merge_input_section): Add assert.
2584 (Output_section::relax_input_section): New method definition.
2585 (Output_section::set_final_data_size): Set load address to zero for
2586 an unallocated section.
2587 (Output_section::do_address_and_file_offset_have_reset_values):
2588 New method definition.
2589 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2590 Handle relaxed input section.
2591 (Output_section::sort_attached_input_sections): Checkpoint input
2592 section list lazily.
2593 (Output_section::get_input_sections): Change type of input_sections to
2594 list of Simple_input_section pointers. Checkpoint input section list
2595 lazily. Also handle relaxed input sections.
2596 (Output_section::add_input_section_for_script): Take a reference to
2597 a Simple_input_section object instead of Relobj pointer and section
2598 index as parameter. Handle relaxed input sections.
2599 (Output_section::save_states, Output_section::restore_states): New
2600 method definitions.
2601 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2602 (Output_data::is_data_size_fixed): New method definition.
2603 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2604 if it is fixed.
2605 (Output_data::address_and_file_offset_have_reset_values): New method
2606 definition.
2607 (Output_data::do_address_and_file_offset_have_reset_values): New method
2608 definition.
2609 (Output_data::set_data_size): Check that data size is not fixed.
2610 (Output_data::fix_data_size): New method definition.
2611 (Output_data::is_data_size_fixed_): New data member.
2612 (Output_section_headers::set_final_data_size): New method definition.
2613 (Output_section_headers::do_size): New method declaration.
2614 (Output_segment_headers::set_final_data_size): New method definition.
2615 (Output_segment_headers::do_size): New method declaration.
2616 (Output_file_header::set_final_data_size)::New method definition.
2617 (Output_file_header::do_size)::New method declaration.
2618 (Output_section_data::Output_section_data): Add new parameter
2619 is_data_size_fixed and use it to fix data size.
2620 (Output_data_const::Output_data_const): Adjust call to base class
2621 constructor and fix data size.
2622 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2623 base class constructor and fix data size.
2624 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2625 base class constructor and fix data size.
2626 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2627 class constructor and fix data size.
2628 (Output_data_group::set_final_data_size): New method definition.
2629 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2630 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2631 class constructor and fix data size.
2632 (Output_relaxed_input_section): New class definition.
2633 (Output_section::Simple_input_section): New class definition.
2634 (Output_section::get_input_sections): Adjust parameter list.
2635 (Output_section::add_input_section_for_script): Same.
2636 (Output_section::save_states, Output_section::restore_states,
2637 Output_section::do_address_and_file_offset_have_reset_values,
2638 (Output_section::Input_section::Input_section): Handle
2639 RELAXED_INPUT_SECTION_CODE. Add new overload for
2640 Output_relaxed_input_section.
2641 (Output_section::Input_section::is_input_section,
2642 Output_section::Input_section::set_output_section): Handle relaxed
2643 input section.
2644 (Output_section::Input_section::is_relaxed_input_section,
2645 Output_section::Input_section::output_section_data,
2646 Output_section::Input_section::relaxed_input_section): New method
2647 definitions.
2648 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2649 value.
2650 (Output_section::Input_section::u1_): Update comments.
2651 (Output_section::Input_section::u2_): Add new union member poris.
2652 (Output_section::Checkpoint_output_section): New classs definition.
2653 (Output_section::relax_input_section): New method declaration.
2654 (Output_section::checkpoint_): New data member.
2655 (Output_segment): Update comments.
2656 (Output_segment::Output_segment): Un-privatize copy constructor.
2657 (Output_segment::operator=): Un-privatize.
2658 * script-sections.cc (Output_section_element::Input_section_list):
2659 Change element type to Output_section::Simple_input_section.
2660 (Output_section_element_dot_assignment::set_section_addresses):
2661 Register output section data for relaxation clean up.
2662 (Output_data_exression::Output_data_expression): Adjust call to base
2663 constructor to fix data size.
2664 (Output_section_element_data::set_section_addresses): Register
2665 Output_data_expression object for relaxation clean up.
2666 (struct Input_section_info): Replace Relobj pointer and section index
2667 pair with Output_section::Simple_input_section and Convert struct to a
2668 class.
2669 (Input_section_sorter::operator()): Adjust access to
2670 Input_section_info data member to use accessors.
2671 (Output_section_element_input::set_section_addresses): Use layout
2672 parameter. Adjust code to use Output_section::Simple_input_section
2673 and Input_secction_info classes. Register filler for relaxation
2674 clean up.
2675 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2676 and section index pair with Output_section::Simple_input_section
2677 class. Adjust code accordingly.
2678 (Phdrs_element::release_segment): New method definition.
2679 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2680 segment list.
2681 (Script_sections::release_segments): New method definition.
2682 * gold/script-sections.h (Script_sections::release_segments): New
2683 method declaration.
2684 * gold/target.h (Target::may_relax, Target::relax,
2685 Target::do_may_relax, Target::do_relax): New method definitions.
2686
5e445df6
ILT
26872009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2688
2689 * arm.cc (has_signed_unsigned_overflow): New function.
2690 (Arm_relocate_functions::abs8): New function.
2691 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2692 (Target_arm::Scan::global): Likewise.
2693 (Target_arm::relocate::relocate): Likewise.
2694 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2695 Likewise.
2696
8c604651 26972009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
2698
2699 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2700 * testsuite/Makefile.in: Regenerate.
2701
1e9cc1c2
NC
27022009-09-11 Nick Clifton <nickc@redhat.com>
2703
2704 * po/gold.pot: Updated by the Translation project.
2705
6a89f575
CC
27062009-09-08 Cary Coutant <ccoutant@google.com>
2707
2708 * output.cc (Output_file::open): Add execute permission to empty file.
2709 * testsuite/Makefile.am (permission_test): New test.
2710 * testsuite/Makefile.in: Regenerate.
2711
fdcac5af
ILT
27122009-09-02 Ian Lance Taylor <iant@google.com>
2713
2714 * output.cc (Output_file::resize): Call map_no_anonymous rather
2715 than map.
2716
44453f85
ILT
27172009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2718
2719 * gold.cc: Include "incremental.h".
2720 (queue_initial_tasks): Call Incremental_checker methods.
2721 * incremental.cc: Include "output.h".
2722 (Incremental_checker::can_incrementally_link_output_file): New
2723 method.
2724 * incremental.h (Incremental_checker): New class.
2725
2726 * output.cc (Output_file::open_for_modification): New method.
2727 (Output_file::map_anonymous): Changed return type to bool. Record
2728 map in base_ field.
2729 (Output_file::map_no_anonymous): New method, broken out of map.
2730 (Output_file::map): Use map_no_anonymous and map_anonymous.
2731 * output.h (class Output_file): Update declarations.
2732
293c1386
CC
27332009-08-24 Cary Coutant <ccoutant@google.com>
2734
2735 * options.h (Command_line::Pre_options): New class.
2736 (Command_line::pre_options): New member.
2737 * options.cc (gold::options::ready_to_register): New variable.
2738 (One_option::register_option): Do nothing if not registering options.
2739 Assert if same short option registered twice.
2740 (General_options::General_options): Turn off option registration when
2741 done constructing.
2742 (Command_line::Pre_options::Pre_options): New constructor.
2743
f773f3d2
CC
27442009-08-24 Cary Coutant <ccoutant@google.com>
2745
06a73cfe
CC
2746 * options.h (General_options::no_keep_memory): Remove incorrect
2747 short option.
f773f3d2 2748
a15af8e2
RW
27492009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2750
2751 * Makefile.am (am__skiplex, am__skipyacc): New.
2752 * Makefile.in: Regenerate.
2753
c462b41b
RW
27542009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2755
14ec8efd
RW
2756 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2757 (INCLUDES): ... this.
2758 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2759 (AM_CPPFLAGS): Renamed from ...
2760 (INCLUDE): ... this.
2761 * Makefile.in, testsuite/Makefile.in: Regenerate.
2762
81ecdfbb
RW
2763 * Makefile.in: Regenerate.
2764 * aclocal.m4: Likewise.
2765 * config.in: Likewise.
2766 * configure: Likewise.
2767 * testsuite/Makefile.in: Likewise.
2768
c462b41b
RW
2769 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2770 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2771 * Makefile.in: Regenerate.
2772 * testsuite/Makefile.in: Regenerate.
2773
2da73f13
CC
27742009-08-19 Cary Coutant <ccoutant@google.com>
2775
2776 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2777 symbols in shared libraries overridden by hidden or internal symbols
2778 in the main program.
2779
2db70501
CD
27802009-08-19 Chris Demetriou <cgd@google.com>
2781
2782 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2783 checking source file names in error messages.
2784
f733487b
DK
27852009-08-18 Doug Kwan <dougkwan@google.com>
2786
2787 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2788 an elcpp::Ehdr as parameter. Adjust call to set_target.
2789 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2790 an elfcpp::Ehdr as parameter.
2791 * object.cc (Object::set_target): Remove the version that looks up
2792 a target and sets it.
2793 (Sized_relobj::setup): Take a Target object instead of
2794 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2795 (make_elf_sized_object): Find target and ask target to
2796 make an ELF object.
2797 * object.h: (Object::set_target): Remove the version that looks up
2798 a target and sets it.
2799 (Sized_relobj::setup): Take a Target object instead of
2800 an elfcpp:Ehdr as parameter.
2801 * target.cc: Include dynobj.h.
2802 (Target::do_make_elf_object_implementation): New.
2803 (Target::do_make_elf_object): New.
2804 * target.h (Target::make_elf_object): New template declaration.
2805 (Target::do_make_elf_object): New method declarations.
2806 (Target::do_make_elf_object_implementation): New template declaration.
2807
cc70f101
ILT
28082009-08-14 Ian Lance Taylor <iant@google.com>
2809
2810 * gold.h (FUNCTION_NAME): Define.
2811 (gold_unreachable): Use FUNCTION_NAME.
2812
ef5e0cb1
ST
28132009-08-12 Sriraman Tallam <tmsriram@google.com>
2814
2815 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2816 symbol in the --keep-unique list is not found.
2817
48c187ce
ST
28182009-08-12 Sriraman Tallam <tmsriram@google.com>
2819
2820 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2821 been maked as --keep-unique.
2822 (Icf::unfold_section): New function.
2823 * icf.h (Icf::unfold_section): New function.
2824 * options.h (General_options::keep_unique): New option.
2825 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2826 * testsuite/Makefile.in: Regenerate.
2827 * testsuite/icf_keep_unique_test.sh: New file.
2828 * testsuite/icf_keep_unique_test.cc: New file.
2829
645afe0c
CC
28302009-08-12 Cary Coutant <ccoutant@google.com>
2831
2832 PR 10471
2833 * resolve.cc (Symbol_table::resolve): Check for references from
2834 dynamic objects to hidden and internal symbols.
2835 * testsuite/Makefile.am (hidden_test.sh): New test.
2836 * testsuite/Makefile.in: Regenerate.
2837 * testsuite/hidden_test.sh: New script.
2838 * testsuite/hidden_test_1.c: New test source.
2839 * testsuite/hidden_test_main.c: New test source.
2840
11af873f
DK
28412009-08-11 Doug Kwan <dougkwan@google.com>
2842
2843 * arm.cc: Update comments.
2844 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2845 segment to locate the .ARM.exidx section if present.
2846
b9f7d72d
DK
28472009-08-09 Doug Kwan <dougkwan@google.com>
2848
2849 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2850 patch.
2851
ddd3c53c
ST
28522009-08-07 Sriraman Tallam <tmsriram@google.com>
2853 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2854 compiler warnings.
2855
27721062
ST
28562009-08-06 Sriraman Tallam <tmsriram@google.com>
2857
2858 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2859 valid tls_segment only for non-debug-section relocations.
2860 * testsuite/Makefile.am: Add gc_tls_test.
2861 * testsuite/Makefile.in: Regenerate.
2862 * testsuite/gc_tls_test.cc: New file.
2863 * testsuite/gc_tls_test.sh: New file.
2864
ef15dade
ST
28652009-08-05 Sriraman Tallam <tmsriram@google.com>
2866
2867 * icf.cc: New file.
2868 * icf.h: New file.
2869 * Makefile.am (CCFILES): Add icf.cc.
2870 (HFILES): Add icf.h
2871 * Makefile.in: Regenerate.
2872 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2873 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2874 section, symbol and addend information for the relocs.
2875 * gold.cc (queue_middle_tasks): Call identical code folding.
2876 * gold.h: Add defines for multimap.
2877 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2878 to the call of finalize_local_symbols.
2879 * main.cc (main): Create object of class Icf.
2880 * object.cc (Sized_relobj::do_layout): Allow this function to be
2881 called twice during icf.
2882 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2883 to sections marked as identical by icf.
2884 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2885 when available.
2886 (Sized_relobj::do_section_entsize): New function.
2887 * object.h (Object::section_entsize): New function.
2888 (Object::do_section_entsize): New pure virtual function.
2889 (Relobj::finalize_local_symbols): Add new parameter.
2890 (Relobj::do_section_entsize): New function.
2891 * options.h (General_options::icf): New option.
2892 (General_options::icf_iterations): New option.
2893 (General_options::print_icf_sections): New option.
2894 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2895 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2896 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2897 icf.
2898 * symtab.cc (Symbol_table::is_section_folded): New function.
2899 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2900 to sections marked as identical by icf.
2901 * symtab.h (Symbol_table::set_icf): New function.
2902 (Symbol_table::icf): New function.
2903 (Symbol_table::is_section_folded): New function.
2904 (Symbol_table::icf_): New data member.
2905 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2906 * testsuite/Makefile.am: Add commands to build icf_test.
2907 * testsuite/Makefile.in: Regenerate.
2908 * testsuite/icf_test.sh: New file.
2909 * testsuite/icf_test.cc: New file.
2910
c3b65ac4
CD
29112009-07-24 Chris Demetriou <cgd@google.com>
2912
2913 * layout.cc (is_compressible_debug_section): Fix incorrect
2914 comment about compressed section names.
2915
1caf2c51
ILT
29162009-07-20 Ian Lance Taylor <ian@airs.com>
2917
2918 PR 10419
2919 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2920
1ef4d87f
ILT
29212009-07-16 Ian Lance Taylor <iant@google.com>
2922
2923 PR 10400
2924 * layout.h: #include <map>.
2925 (class Kept_section): Change from struct to class. Add accessors
2926 and setters. Add section size to Comdat_group mapping. Change
2927 Comdat_group to std::map. Add is_comdat_ field. Add
2928 linkonce_size field in union.
2929 (class Layout): Update declaration of find_or_add_kept_section.
2930 Don't declare find_kept_object.
2931 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2932 parameter. Add object, shndx, is_comdat, and is_group_name
2933 parameters. Change all callers. Adjust for new Kept_section.
2934 (Layout::find_kept_object): Remove.
2935 * object.cc (Sized_relobj::include_section_group): Update use of
2936 Kept_section. Rename secnum to shndx. Only record
2937 Kept_comdat_section if sections are the same size.
2938 (Sized_relobj::include_linkonce_section): Update use of
2939 Kept_section. Only record Kept_comdat_section if sections are the
2940 same size. Set size of linkonce section.
2941 (Sized_relobj::map_to_kept_section): Update call to
2942 get_kept_comdat_section.
2943 * object.h (class Sized_relobj): Rename fields in
2944 Kept_comdat_section to drop trailing underscores; change object
2945 field to Relobj*. Change Kept_comdat_section_table to store
2946 struct rather than pointer.
2947 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2948 Add kept_object and kept_shndx parameters. Change all callers.
2949 (Sized_relobj::get_kept_comdat_section): Change return type to
2950 bool. Add kept_object and kept_shndx parameters. Change all
2951 callers.
2952 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2953 Layout::find_or_add_kept_section.
2954
37c3b7b0
ILT
29552009-07-09 Ian Lance Taylor <iant@google.com>
2956
2957 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2958 Reserve space in the hash table.
2959
98fa85cb
ILT
29602009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2961
2962 * fileread.cc (File_read::get_mtime): New method.
2963 * fileread.h (Timespec): New structure.
2964 (File_read::get_mtime): New method.
2965 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2966 Renamed from timestamp_nsec.
2967 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2968 Elf_Xword.
2969 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2970 timestamp_nsec.
2971 (Incremental_inputs::report_archive): Save mtime; style fix.
2972 (Incremental_inputs::report_obejct): Save mtime; style fix.
2973 (Incremental_inputs::report_script): Save mtime; style fix.
2974 (Incremental_inputs::finalize_inputs): Style fix.
2975 (Incremental_inputs::finalize): Style fix.
2976 (Incremental_inputs::create_input_section_data): Store inputs
2977 mtime.
2978 * incremental.h (Incremental_inputs::report_script): Add mtime
2979 argument.
2980 (Incremental_inputs::Input_info::Input_info): Intialize only one
2981 union member.
2982 (Incremental_inputs::Input_info::archive): Move to nameless
2983 union.
2984 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2985 (Incremental_inputs::Input_info::script): Move to nameless union.
2986 (Incremental_inputs::mtime): New field.
2987 * script.cc (read_input_script): Pass file mtime to
2988 Incremental_input.
2989 * script.h (Script_info::inputs): Style fix.
2990
c9d70757
ILT
29912009-07-01 Ian Lance Taylor <ian@airs.com>
2992
2993 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2994 instead of 32.
2995
9c547ec3
ILT
29962009-06-24 Ian Lance Taylor <iant@google.com>
2997
2998 PR 10156
2999 * layout.cc (Layout::choose_output_section): If we find an
3000 existing section, update the flags.
3001 (Layout::create_notes): New function, broken out of
3002 Layout::finalize.
3003 (Layout::finalize): Don't create note sections.
3004 (Layout::create_note): Don't crash if linker script discards
3005 section.
3006 (Layout::create_gold_note): Likewise.
3007 (Layout::create_build_id): Likewise. Don't set
3008 after_input_sections on the section.
3009 (Layout::create_executable_stack_info): Remove target parameter.
3010 Change caller.
3011 * layout.h (class Layout): Declare create_notes. Update
3012 declaration of create_executable_stack_info.
3013 * gold.cc (queue_middle_tasks): Call create_notes.
3014 * output.cc (Output_section::update_flags_for_input_section): Move
3015 here from output.h. If SHF_ALLOC flag is newly set, mark address
3016 invalid.
3017 * output.h (Output_data::mark_address_invalid): New function.
3018 (class Output_section): Only declare, not define,
3019 update_flags_for_input_section. Remove set_flags.
3020
55458500
ILT
30212009-06-24 Ian Lance Taylor <iant@google.com>
3022
3023 * script-sections.cc (Output_section_definition::
3024 set_section_addresses): Rename shadowing local load_address to
3025 laddr.
3026
1307d6cd
ILT
30272009-06-24 Ian Lance Taylor <iant@google.com>
3028
3029 PR 10244
3030 * reloc.cc (relocate_sections): Skip empty relocation sections.
3031
ec3f783e
ILT
30322009-06-23 Ian Lance Taylor <iant@google.com>
3033
3034 PR 10156
3035 * layout.cc (Layout::create_note): Use choose_output_section
3036 rather than make_output_section.
3037
459c9f1c
ILT
30382009-06-23 Ian Lance Taylor <iant@google.com>
3039
3040 PR 10237
3041 * options.cc (General_options::parse_V): Set printed_version_.
3042 (General_options::General_options): Initialize printed_version_.
3043 * options.h (class General_options): Add printed_version_ field.
3044 * gold.cc (queue_initial_tasks): If there are no input files,
3045 don't give a fatal error if we printed the version information.
3046 (queue_middle_tasks): If using -r with a shared object, give a
3047 fatal error rather than an ordinary error.
3048
1518dc8f
ILT
30492009-06-23 Ian Lance Taylor <iant@google.com>
3050
3051 PR 10219
3052 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3053 (Layout::make_output_section): Set have_stabstr_section_ if we see
3054 a .stab*str section.
3055 (Layout::finalize): Call link_stabs_sections.
3056 (Layout::link_stabs_sections): New file.
3057 * layout.h (class Layout): Add have_stabstr_section_ field.
3058 Declare link_stabs_sections.
3059
3d857b98
DK
30602009-06-23 Doug Kwan <dougkwan@google.com>
3061
3062 * Makefile.am (libgold_a_LIBADD): New.
3063 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3064 * Makefile.in: Regenerate.
3065 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3066 * configure: Regenerate.
3067 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3068 * fileread.cc: Include sys/state.h
3069 * gold.h: Declare memmem and strndup if found missing.
3070 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3071
0639a6f6
ILT
30722009-06-23 Ian Lance Taylor <iant@google.com>
3073
3074 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3075 * configure: Rebuild.
3076
8d63875c
ILT
30772009-06-23 Ian Lance Taylor <iant@google.com>
3078
3079 PR 10147
3080 * object.cc (Object::section_contents): Don't try to get a view if
3081 the section has length zero.
3082 (Object::handle_gnu_warning_section): If the section is empty, use
3083 the name of the section as the warning.
3084
f7c8a183
ILT
30852009-06-23 Ian Lance Taylor <iant@google.com>
3086
3087 PR 10133
3088 * stringpool.h (class Stringpool_template): Add optimize_ field.
3089 (Stringpool_template::set_optimize): New function.
3090 * stringpool.cc (Stringpool_template::Stringpool_template):
3091 Initialize optimize_ field.
3092 (Stringpool_template::set_string_offsets): Test local optimize
3093 fild rather than parameter.
3094 * layout.cc (Layout::Layout): Call set_optimize on the section
3095 name stringpool.
3096
e6a307ba
ILT
30972009-06-22 Ian Lance Taylor <iant@google.com>
3098
3099 PR 10030
3100 * yyscript.y: Parse TARGET.
3101 * script.cc (script_set_target): New function.
3102 * script-c.h (script_set_target): Declare.
3103 * options.cc (General_options::string_to_object_format): Rename
3104 from string_to_object_format in anonymous namespace. Change
3105 callers.
3106 * options.h (class General_options): Declare
3107 string_to_object_format.
3108
3ee173de
ILT
31092009-06-22 Ian Lance Taylor <iant@google.com>
3110
3111 * script-sections.cc (Script_sections::create_segments): Don't put
3112 program headers in a PT_LOAD segment if -n or -N.
3113
31142009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
3115
3116 PR 10141
3117 * options.h (class General_options): Add -z lazy and -z now. Sort
3118 -z options into alphabetical order.
3119 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3120
cd6739a1 31212009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
3122
3123 * layout.cc (Layout::make_output_section): Call
3124 Target::new_output_section.
3125 (Layout::attach_allocated_section_to_segment): Put large section
3126 sections in a separate load segment with the large segment flag
3127 set.
3128 (Layout::segment_precedes): Sort large data segments after other
3129 load segments.
3130 (align_file_offset): New static function.
3131 (Layout::set_segment_offsets): Use align_file_offset.
3132 * output.h (class Output_section): Add is_small_section_ and
3133 is_large_section_ fields.
3134 (Output_section::is_small_section): New function.
3135 (Output_section::set_is_small_section): New function.
3136 (Output_section::is_large_section): New function.
3137 (Output_section::set_is_large_section): New function.
3138 (Output_section::is_large_data_section): New function.
3139 (class Output_segment): Add is_large_data_segment_ field.
3140 (Output_segment::is_large_data_segment): New function.
3141 (Output_segment::set_is_large_data_segment): New function.
3142 * output.cc (Output_section::Output_section): Initialize new
3143 fields.
3144 (Output_segment::Output_segment): Likewise.
3145 (Output_segment::add_output_section): Add assertion that large
3146 data sections always go in large data segments. Force small data
3147 sections to the end of the list of data sections. Force small BSS
3148 sections to the start of the list of BSS sections. For large BSS
3149 sections to the end of the list of BSS sections.
3150 * symtab.h (class Symbol): Declare is_common_shndx.
3151 (Symbol::is_defined): Check Symbol::is_common_shndx.
3152 (Symbol::is_common): Likewise.
3153 (class Symbol_table): Define enum Commons_section_type. Update
3154 declarations. Add small_commons_ and large_commons_ fields.
3155 * symtab.cc (Symbol::is_common_shndx): New function.
3156 (Symbol_table::Symbol_table): Initialize new fields.
3157 (Symbol_table::add_from_object): Put small and large common
3158 symbols in the right list.
3159 (Symbol_table::sized_finalized_symbol): Check
3160 Symbol::is_common_shndx.
3161 (Symbol_table::sized_write_globals): Likewise.
3162 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3163 common symbol lists. Don't call do_allocate_commons_list if the
3164 list is empty.
3165 (Symbol_table::do_allocate_commons_list): Remove is_tls
3166 parameter. Add comons_section_type parameter. Change all
3167 callers. Handle small and large common symbols.
3168 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3169 Symbol::is_common_shndx.
3170 * resolve.cc (symbol_to_bits): Likewise.
3171 * target.h (Target::small_common_shndx): New function.
3172 (Target::small_common_section_flags): New function.
3173 (Target::large_common_shndx): New function.
3174 (Target::large_common_section_flags): New function.
3175 (Target::new_output_section): New function.
3176 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3177 small_common_section_flags, and large_common_section_flags
3178 fields.
3179 (Target::do_new_output_section): New virtual function.
3180 * arm.cc (Target_arm::arm_info): Initialize new fields.
3181 * i386.cc (Target_i386::i386_info): Likewise.
3182 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3183 Likewise.
3184 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3185 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3186 (Target_x86_64::do_new_output_section): New function.
3187 * configure.ac: Define conditional MCMODEL_MEDIUM.
3188 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3189 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3190 (large_LDFLAGS): Define.
3191 * testsuite/large.c: New file.
3192 * testsuite/testfile.cc (Target_test::test_target_info):
3193 Initialize new fields.
3194 * configure, testsuite/Makefile.in: Rebuild.
3195
bb04269c
DK
31962009-06-05 Doug Kwan <dougkwan@google.com>
3197
3198 * Makefile.am (CCFILES): Add target.cc.
3199 * Makefile.in: Regenerate.
3200 * i386.cc (class Target_i386): Define new virtual method to
3201 override do_is_local_label_name in parent.
3202 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3203 local symbols if --discard-locals or -X is given.
3204 * options.h (class General_options): Declare new options
3205 '--discard-locals' and '-X' for discarding locals.
3206 * target.h (class Target): Define new methods is_local_label_name.
3207 Declare new virtual method do_is_local_label_name.
3208 * target.cc: New file.
3209 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3210 (check_SCRIPTS): Add discard_locals_test.sh.
3211 (check_DATA): Add discard_local_tests.syms.
3212 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3213 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3214 * testsuite/Makefile.in: Regenerate.
3215 * testsuite/discard_locals_test.c: New file.
3216 * testsuite/discard_locals_test.sh: Same.
3217
805bb01c
DK
32182009-06-05 Doug Kwan <dougkwan@google.com>
3219
3220 * object.cc (Sized_relobj::Sized_relobj): Initialize
3221 discarded_eh_frame_shndx_ to -1U.
3222 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3223 section.
3224 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3225 a discarded .eh_frame section.
3226 (Sized_relobj::do_finalize_local_symbols): Ditto.
3227 * object.h (class Sized_relobj): Declare new member
3228 discarded_eh_frame_shndx_.
3229 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3230 (local_labels_test.o, local_labels_test): New rules.
3231 * testsuite/Makefile.in: Regenerate.
3232
1dcd334d
DK
32332009-06-04 Doug Kwan <dougkwan@google.com>
3234
3235 * layout.cc (Layout::section_name_mapping): Add mapping for
3236 special ARM sections.
3237
96d49306
DK
32382009-06-03 Doug Kwan <dougkwan@google.com>
3239
3240 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3241 (utils::has_overflow): Same.
3242
dff16297
ILT
32432009-06-03 Ian Lance Taylor <iant@google.com>
3244
3245 * layout.cc (Layout::section_name_mapping): New array, replacing
3246 Layout::linkonce_mapping.
3247 (Layout::section_name_mapping_count): New variable, replacing
3248 Layout::linkonce_mapping_count.
3249 (Layout::linkonce_output_name): Remove.
3250 (Layout::output_section_name): Rewrite.
3251 * layout.h (class Layout): Rename Linkonce_mapping to
3252 Section_name_mapping, linkonce_mapping to section_name_mapping,
3253 linkonce_mapping_count to section_name_mapping_count. Don't
3254 declare linkonce_output_name.
3255
c121c671
DK
32562009-06-03 Doug Kwan <dougkwan@google.com>
3257
3258 * gold/arm.cc (namespace utils): New.
3259 (Target_arm::reloc_is_non_pic): Define new method.
3260 (class Arm_relocate_functions): New.
3261 (Target_arm::Relocate::relocate): Handle relocation types used by
3262 Android.
3263
07800fab
ILT
32642009-06-03 Ian Lance Taylor <iant@google.com>
3265
3266 * arm.cc (Target_arm::scan::global): Use || instead of |.
3267
c121c671
DK
32682009-06-02 Doug Kwan <dougkwan@google.com>
3269
3270 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3271 issued_non_pic_error_.
3272 (class Target_arm::Scan): Declare new method check_non_pic.
3273 Define new method symbol_needs_plt_entry.
3274 Declare new data member issued_non_pic_error_.
3275 (class Target_arm::Relocate): Declare new method
3276 should_apply_static_reloc.
3277 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3278 (Target_arm::Scan::check_non_pic): Define new method.
3279 (Target_arm::Scan::local): Handle a small subset of reloc types used
3280 by Android.
3281 (Target_arm::Scan::local): Same.
3282 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3283
b19b0c6d
ILT
32842009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3285
3286 * incremental.cc (Incremental_inputs::report_command_line): Filter
3287 out --incremental-* options.
3288
94cdfcff
DK
32892009-05-29 Doug Kwan <dougkwan@google.com>
3290
3291 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3292 template class.
3293 (class Target_arm): Update comment.
3294 (Target_arm::Target_arm): Initialize new data members GOT_,
3295 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3296 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3297 and Target_arm::rel_dyn_section.
3298 Declare new_enum Target_arm::Got_type.
3299 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3300 and DYNBSS_.
3301 Update commments for member do_dynsym_value.
3302 (Target_arm::got_size, Target_arm::plt_section,
3303 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3304 new methods inside class defintion.
3305 (Target_arm::got_section): Define new method.
3306 (Target_arm::rel_dyn_section): Same.
3307 (Output_data_plt_arm): New template class.
3308 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3309 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3310 (Output_data_plt_arm::add_entry): Same.
3311 (Output_data_plt_arm::first_plt_entry): Define new
3312 static data member for PLT instruction template.
3313 (Output_data_plt_arm::plt_entry): Same.
3314 (Output_data_plt_arm::do_write): Define new method.
3315 (Target_arm::make_plt_entry): Same.
3316 (Target_arm::do_finalize_sections): Same.
3317 (Target_arm::do_dynsym_value): Same.
3318
4a657b0d
DK
33192009-05-28 Doug Kwan <dougkwan@google.com>
3320
3321 * Makefile.am (TARGETSOURCES): Add arm.cc.
3322 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3323 * Makefile.in: Regenerate.
3324 * arm.cc: New file.
3325 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3326
e7ae8c36
DK
33272009-05-26 Doug Kwan <dougkwan@google.com>
3328
3329 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3330 (General_options::check_excluded_libs): Strip off directories in
3331 archive name before matching like GNU ld does.
3332 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3333 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3334 (exclude_libs_test_LDFLAGS): Add linker option
3335 -Wl,--exclude-libs,libexclude_libs_test_3
3336 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3337 an explicit archive without using -l.
3338 (alt/libexclude_libs_test_3.a): New make rule.
3339 * testsuite/Makefile.in: Regenerate.
3340 * testsuite/exclude_libs_test.c : Declare lib3_default().
3341 (main): Call it.
3342 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3343 * exclude_libs_test_3.c: New file.
3344
f12e7348
NC
33452009-05-26 Nick Clifton <nickc@redhat.com>
3346
3347 * po/id.po: New Indonesian translation.
3348 * po/gold.pot: Updated template file.
3349
4daadc0d
ST
33502009-05-22 Sriraman Tallam <tmsriram@google.com>
3351
3352 * testsuite/Makefile.am: Add -ffunction-sections to compile
3353 gc_comdat_test files. Add -Wl,--gc-sections to build
3354 gc_comdat_test.
3355 * testsuite/Makefile.in: Regenerate.
3356 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3357
531813ad
ST
33582009-05-21 Sriraman Tallam <tmsriram@google.com>
3359
3360 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3361 kept comdat section was garbage collected.
3362 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3363 * testsuite/Makefile.in: Regenerate.
3364 * testsuite/gc_comdat_test.sh: New file.
3365 * testsuite/gc_comdat_test_1.cc: New file.
3366 * testsuite/gc_comdat_test_2.cc: New file.
3367
65514900
CC
33682009-05-19 Doug Kwan <dougkwan@google.com>
3369
3370 * archive.cc (Archive::Archive): Move constructor from archive.h
3371 to here. Initialize no_export_.
3372 (Archive::get_elf_object_for_member): Set no_export flag of object.
3373 * archive.h (Archive::Archive): Move constructor body to
3374 archive.cc.
3375 (Archive::no_export): New method.
3376 (Archive::no_export_): New field.
3377 * object.h (Object::Object): Initialize no_export_ to false.
3378 (Object::no_export, Object::set_no_export): New methods.
3379 (Object::no_export_): New field.
3380 * options.cc (General_options::parse_exclude_libs): New method.
3381 (General_options::check_excluded_libs) Same.
3382 * options.h (exclude_libs): New option.
3383 (General_options::check_excluded_libs): New method declaration.
3384 (General_options::excluded_libs_): New field.
3385 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3386 default or protected visibility if an object has no-export flag set.
3387 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3388 (check_SCRIPTS): Add exclude_libs_test.sh.
3389 (check_DATA): Add exclude_libs_test.syms.
3390 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3391 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3392 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3393 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3394 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3395 libexclude_libs_test_2.a): New rules.
3396 * testsuite/Makefile.in: Regenerate.
3397 * testsuite/exclude_libs_test.c: New file.
3398 * testsuite/exclude_libs_test.sh: Ditto.
3399 * testsuite/exclude_libs_test_1.c: Ditto.
3400 * testsuite/exclude_libs_test_2.c: Ditto.
3401
1b77ea50
ILT
34022009-05-15 Ian Lance Taylor <iant@google.com>
3403
3404 * configure.ac: Check for declarations for cases where libiberty.h
3405 checks HAVE_DECL_xxx.
3406 * configure, config.in: Rebuild.
3407
072fe7ce
ILT
34082009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3409
3410 * gold.h (Incremental_argument_list): Remove (invalid) forward
3411 declaration.
3412 * incremental.cc (Incremental_inputs::report_achive): New method.
3413 (Incremental_inputs::report_object): New method.
3414 (Incremental_inputs::report_script): New method.
3415 (Incremental_inputs::finalize_inputs): New method.
3416 (Incremental_inputs::finalize): Call finalize_inputs().
3417 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3418 Create inputs entries.
3419 * incremental.h (Incremental_input_type): New enum.
3420 (Incremental_inputs::Incremental_input): Initialize new fields.
3421 (Incremental_inputs::report_inputs): New method.
3422 (Incremental_inputs::report_achive): New method.
3423 (Incremental_inputs::report_object): New method.
3424 (Incremental_inputs::report_script): New method.
3425 (Incremental_inputs::finalize_inputs): New method.
3426 (Incremental_inputs::Input_info): New struct.
3427 (Incremental_inputs::Input_info_map): New typedef.
3428 (Incremental_inputs::lock_): New field.
3429 (Incremental_inputs::Inputs_): New field.
3430 (Incremental_inputs::Inputs_map): New field.
3431 * main.cc (main): Call Incremental_input::report_inputs.
3432 * options.h (Input_argument_list): Typedef moved from
3433 Input_arguments.
3434 (Input_file_group::Files): Remove, use ::Input_argument_list.
3435 (Input_file_group::Input_argument_list): Remove, use
3436 ::Input_argument_list.
3437 * plugin.cc (Plugin_manager::add_input_file): Add error in
3438 incremental build.
3439 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3440 functions.
3441 * script.cc (read_input_script): Call
3442 Incremental_input::report_script.
3443 * script.h (Script_info): New class.
3444
b0481b0b
ILT
34452009-04-27 Ian Lance Taylor <iant@google.com>
3446
3447 * x86_64.cc (do_adjust_output_section): Set entsize to
3448 plt_entry_size.
3449
b22a5a41 34502009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
3451
3452 * output.cc (Output_file::close): After short writes, continue
3453 writing from the correct offset in the buffer being written.
3454
40fde488
CD
34552009-04-23 Chris Demetriou <cgd@google.com>
3456
3457 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3458 * configure: Regenerate.
3459 * config.in: Regenerate.
3460 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3461 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3462
3ce2c28e
ILT
34632009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3464
3465 * incremental.cc (Incremental_inputs_header_data): Renamed from
3466 Incremental_input_header_data.
3467 (Incremental_inputs_header_data::data_size): New field.
3468 (Incremental_inputs_header_data::put_input_file_count): Renamed
3469 from input_file_count.
3470 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3471 from command_line_offset.
3472 (Incremental_inputs_header_data::put_reserved): Renamed from
3473 put_reserved.
3474 (Incremental_inputs_entry_data): Renamed from
3475 Incremental_input_entry_data.
3476 (Incremental_inputs_entry_data::data_size): New field.
3477 (Incremental_inputs::report_command_line): New method.
3478 (Incremental_inputs::finalize): New method.
3479 (Incremental_inputs::create_incremental_inputs_data): New method.
3480 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3481 * incremental.h: New file.
3482 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3483 (Layout::finalize): Create incremental inputs section in
3484 incremental builds.
3485 (Layout::create_incremental_info_sections): New method.
3486 * layout.h (Layout::incremental_inputs): New method.
3487 (Layout::create_incremental_info_sections): New method.
3488 (Layout::incremental_inputs_): New field.
3489 * main.cc (main): Notify Incremental_input of the command line.
3490
e55bde5e
ILT
34912009-04-01 Ian Lance Taylor <iant@google.com>
3492 Mikolaj Zalewski <mikolajz@google.com>
3493
3494 * gold.h (reserve_unordered_map): Define, three versions, one for
3495 each version of Unordered_map.
3496 * layout.cc (Layout::Layout): Remove options parameter. Add
3497 number_of_input_files parameter. Don't initialize options_.
3498 Initialize number_of_input_files_ and resized_signatures_. Move
3499 sections_are_attached_.
3500 (Layout::layout_group): Reserve space for group_signatures_.
3501 (Layout::find_or_add_kept_section): Change name parameter to be a
3502 reference. Resize signatures_ map when it gets large enough.
3503 (Layout::layout_eh_frame): Use parameters->options() instead of
3504 this->options_.
3505 (Layout::make_output_section): Likewise.
3506 (Layout::attach_allocated_section_to_segment): Likewise.
3507 (Layout::finalize, Layout::create_executable_stack): Likewise.
3508 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3509 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3510 * layout.h (class Layout): Update declarations. Remove options_
3511 field. Add number_of_input_files_ and resized_signatures_
3512 fields. Move sections_are_attached_ field.
3513 * main.cc (main): Pass number of input files to Layout
3514 constructor. Don't pass options.
3515
154b857c
ILT
35162009-03-30 Ian Lance Taylor <iant@google.com>
3517
3518 * ffsll.c (ffsll): Correct implementation.
3519
2f35ab9b
ILT
35202009-03-27 Ian Lance Taylor <iant@google.com>
3521
fd03461a
ILT
3522 * ffsll.c: New file.
3523 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3524 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3525 * ftruncate.c (ftruncate): Declare before definition.
3526 * mremap.c (mremap): Likewise.
3527 * pread.c (pread): Likewise.
3528 * configure, Makefile.in, config.in: Rebuild.
3529
2f35ab9b
ILT
3530 * mremap.c: New file.
3531 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3532 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3533 (mremap): Declare if HAVE_MREMAP is not defined.
3534 * configure, Makefile.in, config.in: Rebuild.
3535
33aea2fd
CC
35362009-03-27 Cary Coutant <ccoutant@google.com>
3537
3538 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3539 position independent.
3540 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3541 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3542
6d479619
CC
35432009-03-24 Cary Coutant <ccoutant@google.com>
3544
3545 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3546 an executable.
3547 (needs_dynamic_reloc): Likewise.
3548
afc06bb8
ILT
35492009-03-24 Ian Lance Taylor <iant@google.com>
3550
3551 * yyscript.y (file_cmd): Recognize EXTERN.
3552 (extern_name_list, extern_name_list_body): New nonterminals.
3553 * script.cc (script_add_extern): Define.
3554 * script-c.h (script_add_extern): Declare.
3555
f6060a4d
ILT
35562009-03-24 Rafael Avila de Espindola <espindola@google.com>
3557
3558 * object.cc (is_elf_object): Define.
3559 * object.h (is_elf_object): Declare.
3560 * archive.cc (Archive::get_elf_object_for_member): Call
3561 is_elf_object.
33aea2fd 3562 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 3563
26736d8e
ILT
35642009-03-24 Elliott Hughes <enh@google.com>
3565
3566 * output.cc (Output_file::map_anonymous): Define.
3567 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3568 try an anonymous one. Report the size if the mmap fails.
3569 * output.h (class Output_file): Declare map_anonymous.
3570
22fd9730
ILT
35712009-03-24 Ian Lance Taylor <iant@google.com>
3572
3573 * target-select.cc (instantiate_target): Don't acquire the lock if
3574 the instantiated_target_ field has already been set.
3575
cb010894
ILT
35762009-03-23 Ian Lance Taylor <iant@google.com>
3577
7f055c20
ILT
3578 * gold-threads.h (class Initialize_lock): Define.
3579 * gold-threads.cc (class Initialize_lock_once): Define.
3580 (initialize_lock_control): New static variable.
3581 (initialize_lock_pointer): New static variable.
3582 (initialize_lock_once): New static function.
3583 (Initialize_lock::Initialize_lock): Define.
3584 (Initialize_lock::initialize): Define.
3585 * target-select.h: Include "gold-threads.h".
3586 (class Target_selector): Add lock_ and initialize_lock_ fields.
3587 Don't define instantiate_target, just declare it.
3588 * target-select.cc (Target_selector::Target_selector): Initialize
3589 new fields.
3590 (Target_selector::instantiate_target): Define.
3591 * descriptors.h: Include "gold-threads.h".
3592 (class Descriptors): Add initialize_lock_ field.
3593 * descriptors.cc (Descriptors::Descriptors): Initialize new
3594 field.
3595 (Descriptors::open): Use initialize_lock_ field
3596 * errors.h (class Errors): Add initialize_lock_ field.
3597 * errors.cc (Errors::Errors): Initialize new field.
3598 (Errors::initialize_lock): Use initialize_lock_ field.
3599 * powerpc.cc (class Target_selector_powerpc): Remove
3600 instantiated_target_ field. In do_recognize call
3601 instantiate_target rather than do_instantiate_target. In
3602 do_instantiate_target just allocate a new target.
3603 * sparc.cc (class Target_selector_sparc): Likewise.
3604
36959681
ILT
3605 * freebsd.h: New file.
3606 * i386.cc: Include "freebsd.h".
3607 (Target_i386): Derive from Target_freebsd rather than
3608 Sized_target.
3609 (Target_selector_i386): Derive from Target_selector_freebsd rather
3610 than Target_selector.
3611 * x86_64.cc: Include "freebsd.h".
3612 (Target_x86_64): Derive from Target_freebsd rather than
3613 Sized_target.
3614 (Target_selector_x86_64): Derive from Target_selector_freebsd
3615 rather than Target_selector.
3616 * target.h (class Target): Add adjust_elf_header and
3617 do_adjust_elf_header.
3618 * output.cc (Output_file_header:: do_sized_write): Call target
3619 adjust_elf_header routine.
3620 * configure.tgt: Set targ_osabi.
3621 * configure.ac: Define GOLD_DEFAULT_OSABI.
3622 * parameters.cc (Parameters::default_target): Pass
3623 GOLD_DEFAULT_OSABI to select_target.
3624 * target-select.h (class Target_selector): Make instantiate_target
3625 protected rather than private.
3626 * Makefile.am (HFILES): Add freebsd.h.
3627 * configure, Makefile.in, config.in: Rebuild.
3628
cb010894
ILT
3629 * merge.cc (do_add_input_section): Correct pend value. Change
3630 message about last entry not being null terminated from error to
3631 warning.
3632
0e879927
ILT
36332009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3634
3635 * incremental.cc: New file.
3636 * Makefile.am (CCFILES): Add incremental.cc.
3637 * Makefile.in: Rebuild.
3638
41105937
PP
36392009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3640
3641 * layout.cc (Layout::output_section_name): Preserve names
3642 of '.note.' sections.
3643
60439920
ILT
36442009-03-19 Ian Lance Taylor <iant@google.com>
3645
3646 * descriptors.cc (Descriptors::open): Check that the options are
3647 valid before using them.
3648
0d371ad3
ILT
36492009-03-18 Ian Lance Taylor <iant@google.com>
3650
3651 * script-sections.h: Include <list>.
3652 (class Script_sections): Change Sections_elements from std::vector
3653 to std::list. Typedef public Elements_iterator. Add
3654 orphan_section_placement_, data_segment_align_start_, and
3655 saw_data_segment_align_ fields. Remove data_segment_align_index_
3656 field.
3657 * script-sections.cc (class Orphan_section_placement): New class.
3658 (class Sections_element): Add virtual functions is_relro and
3659 orphan_section_init. Remove virtual function place_orphan_here.
3660 (class Output_section_definition): Add is_relro and
3661 orphan_section_init. Remove place_orphan_here.
3662 (class Orphan_output_section): Likewise.
3663 (Script_sections::Script_sections): Update for field changes.
3664 (Script_sections::data_segment_align): Set saw_data_segment_align_
3665 and data_segment_align_start_, not data_segment_align_index.
3666 (Script_sections::data_segment_relro_end): Check
3667 saw_data_segment_align_. Use data_segment_align_start_ rather
3668 than data_segment_align_index_.
3669 (Script_sections::place_orphan): Rewrite to use
3670 Orphan_section_placement.
3671
9201d894
ILT
36722009-03-17 Ian Lance Taylor <iant@google.com>
3673
9c5b8369
ILT
3674 * archive.cc (Archive::add_symbols): Check for a version attached
3675 to the symbol name in the archive map.
3676 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3677 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3678 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3679 (ver_test_11.a): New target.
3680 * testsuite/Makefile.in: Rebuild.
3681
9201d894
ILT
3682 * configure.ac: Check for chsize and posix_fallocate. Replace
3683 ftruncate.
3684 * ftruncate.c: New file, from gnulib.
3685 * output.cc (posix_fallocate): Define dummy version if not
3686 HAVE_POSIX_FALLOCATE.
3687 (Output_file::map): Call posix_fallocate rather than lseek and
3688 write.
3689 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3690 * configure, Makefile.in, config.in: Rebuild.
3691
ef4ab7a8
PP
36922009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3693
3694 * layout.h (Layout::create_note): Add section_name parameter.
3695 * layout.cc (Layout::create_note): Likewise.
3696 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3697
8c500701
ILT
36982009-03-17 Ian Lance Taylor <iant@google.com>
3699
e85b18e1
ILT
3700 * descriptors.cc: Include "options.h".
3701 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3702 (Descriptors::open): Always use O_CLOEXEC when opening a new
3703 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3704 then set FD_CLOEXEC.
3705
9efe6174
ILT
3706 * sparc.cc (class Target_sparc): Add has_got_section.
3707 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3708 make sure we have a GOT section.
3709
3710 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3711 (Target_sparc::Scan::local): Likewise.
3712 (Target_sparc::Scan::global): Likewise.
3713 (Target_sparc::Relocate::relocate): Likewise.
3714 (Target_sparc::Relocate::relocate_tls): Likewise.
3715
8c500701
ILT
3716 * symtab.cc (Symbol_table::define_default_version): New function,
3717 broken out of add_from_object.
3718 (Symbol_table::add_from_object): Call define_default_version.
3719 (Symbol_table::define_special_symbol): Add resolve_oldsym
3720 parameter. Change all callers. If the version for a symbol comes
3721 from a version script, resolve it with the symbol with the same
3722 name with no version. Also add the symbol without a version if
3723 appropriate.
3724 (do_define_in_output_data): If resolving with oldsym, don't delete
3725 sym.
3726 (do_define_in_output_segment): Likewise.
3727 (do_define_as_constant): Likewise.
3728 * symtab.h (class Symbol_table): Update declarations.
3729
f1ed28fb
ILT
37302009-03-13 Ian Lance Taylor <iant@google.com>
3731
15f8229b
ILT
3732 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3733 (Read_symbols::requeue): New function.
3734 (Read_symbols::do_read_symbols): If make_elf_object fails because
3735 the target type is not configured, and the file was searched for,
3736 issue a warning and retry with the next directory.
3737 (Add_symbols::run): If the file has an incompatible format, and
3738 it was searched for, requeue the Read_symbols task. On error,
3739 release the object.
3740 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3741 dirindex parameter to constructor. Change all callers. Declare
3742 incompatible_warning and requeue.
3743 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3744 input_argument_ and input_group_ fields. Add them to
3745 constructor. Change all callers.
3746 (class Read_script): Add dirindex_ field. Add it to constructor.
3747 Change all callers.
3748 * archive.cc (Archive::setup): Remove input_objects parameter.
3749 Change all callers.
3750 (Archive::get_file_and_offset): Likewise.
3751 (Archive::read_all_symbols): Likewise.
3752 (Archive::read_symbols): Likewise.
3753 (Archive::get_elf_object_for_member): Remove input_objects
3754 parameter. Add punconfigured parameter. Change all callers.
3755 (Archive::add_symbols): Change return type to bool. Check return
3756 value of include_member.
3757 (Archive::include_all_members): Likewise.
3758 (Archive::include_member): Change return type to bool. Return
3759 false if first included object has incompatible target. Set
3760 included_member_ field.
3761 (Add_archive_symbols::run): If add_symbols returns false, requeue
3762 Read_symbols task.
3763 * archive.h (class Archive): Add included_member_ field.
3764 Initialize it in constructor. Add input_file and searched_for
3765 methods. Update declarations.
3766 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3767 input_argument_ fields. Add them to constructor. Change all
3768 callers.
3769 * script.cc: Include "target-select.h".
3770 (class Parser_closure): Add skip_on_incompatible_target_ and
3771 found_incompatible_target_ fields. Add
3772 skip_on_incompatible_target parameter to constructor. Change all
3773 callers. Add methods skip_on_incompatible_target,
3774 clear_skip_on_incompatible_target, found_incompatible_target, and
3775 set_found_incompatible_target.
3776 (read_input_script): Add dirindex parameter. Change all callers.
3777 If parser finds an incompatible target, requeue Read_symbols
3778 task.
3779 (script_set_symbol): Clear skip_on_incompatible_target in
3780 closure.
3781 (script_add_assertion, script_parse_option): Likewise.
3782 (script_start_sections, script_add_phdr): Likewise.
3783 (script_check_output_format): New function.
3784 * script.h (read_input_script): Update declaration.
3785 * script-c.h (script_check_output_format): Declare.
3786 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3787 (ignore_cmd): Remove OUTPUT_FORMAT.
3788 * fileread.cc (Input_file::Input_file): Add explicit this.
3789 (Input_file::will_search_for): New function.
3790 (Input_file::open): Add pindex parameter. Change all callers.
3791 * fileread.h (class Input_file): Add input_file_argument method.
3792 Declare will_search_for. Update declarations.
3793 * object.cc (make_elf_object): Add punconfigured parameter.
3794 Change all callers.
3795 * object.h (class Object): Make input_file public. Add
3796 searched_for method.
3797 (make_elf_object): Update declaration.
3798 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3799 restart search.
3800 * dirsearch.h (class Dirsearch): Update declaration.
3801 * options.h (class General_options): Add --warn-search-mismatch.
3802 * parameters.cc (Parameters::is_compatible_target): New function.
3803 * parameters.h (class Parameters): Declare is_compatible_target.
3804 * workqueue.cc (Workqueue::add_blocker): New function.
3805 * workqueue.h (class Workqueue): Declare add_blocker.
3806
f1ed28fb
ILT
3807 * fileread.cc (Input_file::open): Remove options parameter.
3808 Change all callers.
3809 (Input_file::open_binary): Likewise.
3810 * script.cc (read_input_script): Likewise.
3811 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3812 options parameter from constructor. Change all callers.
3813 (class Read_script): Likewise.
3814 * fileread.h (class Input_file): Update declarations.
3815 * script.h (read_input_script): Update declaration.
3816
34dd024a
NC
38172009-03-10 Nick Clifton <nickc@redhat.com>
3818
3819 * po/es.po: New Spanish translation.
3820
6d71b17c
CC
38212009-03-06 Cary Coutant <ccoutant@google.com>
3822
3823 * options.cc (parse_short_option): Keep dash_z from registering itself.
3824
031cdbed
ILT
38252009-03-03 Ian Lance Taylor <iant@google.com>
3826
3827 PR 9918
3828 * target-reloc.h (relocate_section): Pass output_section to
3829 relocate.
3830 * i386.cc (Target_i386::should_apply_static_reloc): Add
3831 output_section parameter. Change all callers.
3832 (Target_i386::Relocate::relocate): Add output_section parameter.
3833 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3834 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3835 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3836 * testsuite/two_file_shared.sh: New script.
3837 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3838 (check_DATA): Add two_file_shared.dbg.
3839 (two_file_shared.dbg): New target.
3840 * testsuite/Makefile.in: Rebuild.
3841
15d5fa16
ILT
38422009-03-01 Ian Lance Taylor <iant@google.com>
3843
3844 * configure.ac: Check for byteswap.h.
3845 * configure: Rebuild.
3846 * config.in: Rebuild.
3847
8a4c0b0d
ILT
38482009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3849
3850 * layout.cc (Layout::find_or_add_kept_section): New function.
3851 (Layout::add_comdat): Removed.
3852 * layout.h (struct Kept_section): Move out of class Layout.
3853 Remove trailing underscores from field names. Add group_sections
3854 field. Rename group_ field to is_group. Change all uses.
3855 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3856 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3857 comdat_groups_ field.
3858 (Sized_relobj::include_section_group): Use
3859 find_or_add_kept_section and Kept_section::group_sections.
3860 (Sized_relobj::include_linkonce_section): Likewise.
3861 * object.cc (class Sized_relobj): Don't define Comdat_group or
3862 Comdat_group_table. Remove find_comdat_group and
3863 add_comdat_group. Remove comdat_groups_ field.
3864 * plugin.cc (include_comdat_group): Use
3865 Layout::find_or_add_kept_section.
3866
b4ecf66b
ILT
38672009-02-28 Ian Lance Taylor <iant@google.com>
3868
14359ca0
ILT
3869 * README: --gc-sections and map files are now supported. Document
3870 some build requirements.
3871
b4ecf66b
ILT
3872 PR 6992
3873 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3874 relocatable link set the value of the section symbol to zero.
3875 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3876 relocatable link don't include the section address in the local
3877 symbol value.
3878
0602e05a
ILT
38792009-02-27 Ian Lance Taylor <iant@google.com>
3880
fd9d194f
ILT
3881 PR 6811
3882 * options.h (class Search_directory): Add is_system_directory.
3883 (class General_options): Declare is_in_system_directory.
3884 * options.cc (get_relative_sysroot): Make static.
3885 (get_default_sysroot): Make static.
3886 (General_optoins::is_in_system_directory): New function.
3887 * fileread.cc (Input_file::is_in_system_directory): New function.
3888 * fileread.h (class Input_file): Declare is_in_system_directory.
3889 * object.h (class Object): Add is_in_system_directory.
3890 (class Input_objects): Remove system_library_directory_ field.
3891 * object.cc (Input_objects::add_object): Don't set
3892 system_library_directory_.
3893 (input_objects::found_in_system_library_directory): Remove.
3894 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3895 parameter. Change all callers.
3896 (Symbol_table::sized_write_globals): Likewise.
3897 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3898 Call Object::is_in_system_directory.
3899 * symtab.h (class Symbol_table): Update declarations.
3900
61edd21f
ILT
3901 PR 5990
3902 * descriptors.h (Open_descriptor): Add is_on_stack field.
3903 * descriptors.cc (Descriptors::open): If the descriptor is on the
3904 top of the stack, remove it. Initialize is_on_stack field.
3905 (Descriptors::release): Only add pod to stack if it is not on the
3906 stack already.
3907 (Descriptors::close_some_descriptor): Clear stack_next and
3908 is_on_stack fields.
3909
e29e076a
ILT
3910 PR 7091
3911 * output.cc (Output_section::find_starting_output_address): Rename
3912 from starting_output_address; add PADDR parameter; change return
3913 type.
3914 * output.h (class Output_section): Declare
3915 find_starting_output_address instead of starting_output_address.
3916 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3917 section symbol for which we can't find a merge section.
3918
0602e05a
ILT
3919 PR 9836
3920 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3921 hidden or internal, force the symbol to be local.
3922 * resolve.cc (Symbol::override_visibility): Define.
3923 (Symbol::override_base): Use override_visibility.
3924 (Symbol_table::resolve): Likewise.
3925 (Symbol::override_base_with_special): Likewise.
3926 (Symbol_table::override_with_special): If the visibility is hidden
3927 or internal, force the symbol to be local.
3928 * symtab.h (class Symbol): Add set_visibility and
3929 override_visibility.
3930 * testsuite/ver_test_1.sh: New file.
3931 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3932 (check_DATA): Add ver_test_1.syms.
3933 (ver_test_1.syms): New target.
3934 * testsuite/Makefile.in: Rebuild.
3935
401a9a73
CC
39362009-02-25 Cary Coutant <ccoutant@google.com>
3937
3938 * layout.cc (Layout::choose_output_section): Don't rename sections
3939 when using a linker script that has a SECTIONS clause.
3940 * Makefile.in: Regenerate.
3941
3942 * testsuite/Makefile.am (script_test_5.sh): New test case.
3943 * testsuite/Makefile.in: Regenerate.
3944 * testsuite/script_test_5.cc: New file.
3945 * testsuite/script_test_5.sh: New file.
3946 * testsuite/script_test_5.t: New file.
3947
f488e4b0
CC
39482009-02-13 Rafael Avila de Espindola <espindola@google.com>
3949
3950 * archive.cc (Archive::include_member): Update calls to add_symbols.
3951 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3952 the Layout argument.
3953 * dynobj.h (do_add_symbols): Add the Layout argument.
3954 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3955 Layout argument.
3956 * object.h (Object::add_symbols): Add the Layout argument.
3957 (Object::do_add_symbols): Add the Layout argument.
3958 (Sized_relobj::do_add_symbols): Add the Layout argument.
3959 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3960 Unify the two versions.
3961 (Add_plugin_symbols): Remove.
3962 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3963 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3964 (Add_plugin_symbols): Remove.
3965 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3966 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3967 (Add_symbols::run): Make it work with Pulginobj.
3968
89dd1680
ILT
39692009-02-06 Ian Lance Taylor <iant@google.com>
3970
3971 * object.cc (Sized_relobj::do_layout): Make info message start
3972 with lower case letter.
3973
266d0a74
ILT
39742009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3975
602b464e
ILT
3976 * binary.cc: Fix file comment.
3977
266d0a74
ILT
3978 * options.h (enum Incremental_disposition): Define.
3979 (class General_options): Add new options: --incremental,
3980 --incremental_changed, --incremental_unchanged,
3981 --incremental_unknown. Add incremental_disposition_ and
3982 implicit_incremental_ fields.
3983 (General_options::incremental_disposition): New function.
3984 (class Position_dependent_options): Add incremental_disposition
3985 option.
3986 (Position_dependent_options::copy_from_options): Set incremental
3987 dispositions.
3988 * options.cc (General_options::parse_incremental_changed): New
3989 function.
3990 (General_options::parse_incremental_unchanged): New function.
3991 (General_options::parse_incremental_unknown): New function.
3992 (General_options::General_options): Initialize new fields
3993 incremental_disposition_ and implicit_incremental_.
3994 (General_options::finalize): Check for uasge of --incremental-*
3995 without --incremental.
3996
f073bbf7
CD
39972009-02-06 Chris Demetriou <cgd@google.com>
3998
3999 * gold.h (gold_undefined_symbol): Change to take only a Symbol
4000 pointer and to report location as the file name associated with
4001 the symbol.
4002 (gold_undefined_symbol_at_location): New function to replace the
4003 old gold_undefined_symbol functionality.
4004 * target-reloc.h (relocate_section): Update to use
4005 gold_undefined_symbol_at_location.
4006 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4007 Call gold_undefined_symbol function rather than gold_error.
4008 * errors.h (Errors::undefined_symbol): Take location as a
4009 string, rather than calculating it from a relocation.
4010 * errors.cc (Errors::fatal): Print "fatal error:" before the
4011 formatted message.
4012 (Errors::error, Errors::error_at_location): Print "error: "
4013 before the formatted message.
4014 (Errors::undefined_symbol): Take location as a string, rather
4015 than calculating it from a relocation.
4016 (gold_undefined_symbol_at_location): New function akin to
4017 old gold_undefined_symbol, calculates location from relocation.
4018 (gold_undefined_symbol): Change to take only a Symbol pointer
4019 and to report location as the file name associated with the symbol.
4020 * testsuite/debug_msg.sh: Update for changed error messages.
4021 * testsuite/undef_symbol.sh: Likewise.
4022
8e94a90c
ILT
40232009-02-04 Duncan Sands <baldrick@free.fr>
4024
4025 PR 9812
4026 * reduced_debug_output.h
4027 (Output_reduced_debug_abbrev_section::failed): Use format for
4028 gold_warning.
4029 (Output_reduced_debug_info_section::faild): Likewise.
4030
88a0e15b
ILT
40312009-01-31 Mikolaj Zalewski <mikolajz@google.com>
4032
4033 * script.cc (Lazy_demangler): New class.
4034 (Version_script_info::get_symbol_version_helper): Demangle a
4035 symbol only once.
4036
5efc7cd2
CC
40372009-01-29 Cary Coutant <ccoutant@google.com>
4038
4039 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4040 to __tls_get_addr.
4041 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4042
e0ebcf42
ILT
40432009-01-28 Ian Lance Taylor <iant@google.com>
4044
5efc7cd2 4045 * version.cc (version_string): Bump to 1.9.
75fe7426 4046
e0ebcf42
ILT
4047 * gold.h: Include <cstring> and <stdint.h>.
4048 * version.cc: Include <cstdio>.
4049 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4050 warning.
4051 * reduced_debug_output.cc (insert_into_vector): Rename from
4052 Insert_into_vector; change all callers. Use Swap_unaligned to
4053 avoid aliasing issue; remove union since it is unnecessary.
4054
8e2813be 40552009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
4056
4057 * Makefile.am (CCFILES): Add gc.cc.
4058 (HFILES): Add gc.h.
4059 * Makefile.in: Regenerate.
4060 * gold.cc (Gc_runner): New class.
4061 (queue_initial_tasks): Call garbage collection related tasks
4062 when corresponding options are invoked.
4063 (queue_middle_gc_tasks): New function.
4064 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4065 processed early before laying out sections during garbage collection.
4066 * gold.h (queue_middle_gc_tasks): New function.
4067 (is_prefix_of): Move from "layout.cc".
4068 * i386.cc (Target_i386::gc_process_relocs): New function.
4069 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4070 * main.cc (main): Create object of class "Garbage_collection".
4071 * object.cc (Relobj::copy_symbols_data): New function.
4072 (Relobj::is_section_name_included): New function.
4073 (Sized_relobj::do_layout): Allow this function to be called twice
4074 during garbage collection and defer layout of section during the
4075 first call.
4076 * object.h (Relobj::get_symbols_data): New function.
4077 (Relobj::is_section_name_included): New function.
4078 (Relobj::copy_symbols_data): New function.
4079 (Relobj::set_symbols_data): New function.
4080 (Relobj::get_relocs_data): New function.
4081 (Relobj::set_relocs_data): New function.
4082 (Relobj::is_output_section_offset_invalid): New pure virtual function.
4083 (Relobj::gc_process_relocs): New function.
4084 (Relobj::do_gc_process_relocs): New pure virtual function.
4085 (Relobj::sd_): New data member.
4086 (Sized_relobj::is_output_section_offset_invalid): New function.
4087 (Sized_relobj::do_gc_process_relocs): New function.
4088 * options.h (General_options::gc_sections): Modify to not be a no-op.
4089 (General_options::print_gc_sections): New option.
4090 * plugin.cc (Plugin_finish::run): Remove function call to
4091 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4092 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4093 * reloc.cc (Read_relocs::run): Add task to process relocs and
4094 determine unreferenced sections when doing garbage collection.
4095 (Gc_process_relocs): New class.
4096 (Sized_relobj::do_gc_process_relocs): New function.
4097 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4098 sections that are garbage collected.
4099 * reloc.h (Gc_process_relocs): New class.
4100 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4101 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4102 symbols whose corresponding sections are garbage collected.
4103 (Symbol_table::Symbol_table): Add new parameter for the garbage
4104 collection object.
4105 (Symbol_table::gc_mark_undef_symbols): New function.
4106 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4107 (Symbol_table::gc_mark_dyn_syms): New function.
4108 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4109 as garbage.
4110 (Symbol_table::add_from_object): Likewise.
4111 (Symbol_table::add_from_relobj): When building shared objects, do not
4112 treat externally visible symbols as garbage.
4113 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4114 table information for static and relocatable links.
4115 * symtab.h (Symbol_table::set_gc): New function.
4116 (Symbol_table::gc): New function.
4117 (Symbol_table::gc_mark_undef_symbols): New function.
4118 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4119 (Symbol_table::gc_mark_dyn_syms): New function.
4120 (Symbol_table::gc_): New data member.
4121 * target.h (Sized_target::gc_process_relocs): New pure virtual
4122 function.
4123 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4124 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4125
3b293544
CF
41262009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4127
4128 * options.h (General_options::gc_sections): Define as a no-op for now.
4129 (General_options::no_keep_memory): Ditto.
4130 (General_options::Bshareable): Define.
4131 * options.cc (General_options::finalize): Honor -Bshareable.
4132
83d22aa8
AS
41332009-01-20 Andreas Schwab <schwab@suse.de>
4134
4135 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4136 read the value in the contents, since we don't use it. Use the
4137 template endianness when writing.
4138 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4139
cd536b21
AS
41402009-01-19 Andreas Schwab <schwab@suse.de>
4141
4142 * configure.tgt (powerpc64-*): Fix targ_obj.
4143
99e9a495
ILT
41442009-01-15 Ian Lance Taylor <iant@google.com>
4145
4146 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4147 local symbols when stripping all symbols.
4148
bbbfea06
CC
41492009-01-14 Cary Coutant <ccoutant@google.com>
4150
99e9a495 4151 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 4152
0f7c0701
CC
41532009-01-14 Cary Coutant <ccoutant@google.com>
4154
4155 * archive.cc (Archive::get_elf_object_for_member): Remove call
4156 to File_read::claim_for_plugin.
4157 * descriptors.cc (Descriptors::open): Remove reference to
4158 is_claimed.
4159 (Descriptors::claim_for_plugin): Remove.
4160 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4161 (Descriptors::is_claimed): Remove.
4162 (claim_descriptor_for_plugin): Remove.
4163 * fileread.cc (File_read::claim_for_plugin): Remove.
4164 * fileread.h (File_read::claim_for_plugin): Remove.
4165 (File_read::descriptor): Reopen descriptor if necessary.
4166 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4167 (Plugin_manager::all_symbols_read): Add task parameter. Change
4168 all callers.
4169 (Plugin_manager::get_input_file): New function.
4170 (Plugin_manager::release_input_file): New function.
4171 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4172 corresponding data member.
4173 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4174 and pass to base constructor. Change all callers.
4175 (get_input_file, release_input_file): New functions.
4176 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4177 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4178 (Plugin_manager::all_symbols_read): Add task parameter.
4179 (Plugin_manager::get_input_file): New function.
4180 (Plugin_manager::release_input_file): New function.
4181 (Plugin_manager::task_): New data member.
4182 (Pluginobj::Pluginobj): Add filesize parameter.
4183 (Pluginobj::filename): New function.
4184 (Pluginobj::descriptor): New function.
4185 (Pluginobj::filesize): New function.
4186 (Pluginobj::filesize_): New data member.
4187 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4188 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4189 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4190
4191 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4192 with archive libraries.
4193 * testsuite/Makefile.in: Regenerate.
4194 * testsuite/plugin_test.c (struct sym_info): New type.
4195 (get_input_file, release_input_file): New static variables.
4196 (onload): Capture new transfer vector entries.
4197 (claim_file_hook): Stop reading at end of file according to filesize.
4198 Factor out parsing of readelf output into separate function.
4199 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4200 APIs and get the source file name from the symbol table. Convert
4201 source file name to corresponding object file name. Print info
4202 message when adding new input files.
4203 (parse_readelf_line): New function.
4204 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4205 * testsuite/plugin_test_2.sh: Likewise.
4206 * testsuite/plugin_test_3.sh: Likewise.
4207 * testsuite/plugin_test_4.sh: New test case.
4208
62a6d109
ILT
42092009-01-07 Ian Lance Taylor <iant@google.com>
4210
4211 * version.cc (version_string): Bump to 1.8.
4212
483620e8
CC
42132008-12-23 Cary Coutant <ccoutant@google.com>
4214
4215 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4216 * plugin.cc (Plugin_manager::finish): Rename as
4217 layout_deferred_objects. Move cleanup to separate function.
4218 (Plugin_manager::cleanup): New function.
4219 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4220 separately.
4221 * plugin.h (Plugin_manager::finish): Rename as
4222 layout_deferred_objects.
4223 (Plugin_manager::cleanup): New function.
4224 (Plugin_manager::cleanup_done): New field.
4225
d66a9eb3
CC
42262008-12-23 Cary Coutant <ccoutant@google.com>
4227
4228 * plugin.cc (is_visible_from_outside): New function.
4229 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4230 so we don't return "IR only" status for exported symbols or -r links.
4231
4232 * testsuite/Makefile.am (plugin_test_3): New test case.
4233 * testsuite/Makefile.in: Regenerate.
4234 * testsuite/plugin_test_3.sh: New file.
4235
5995b570
CC
42362008-12-22 Cary Coutant <ccoutant@google.com>
4237
4238 * object.cc (Sized_relobj::layout_section): New function.
4239 (Sized_relobj::do_layout): Defer layout of input sections until after
4240 plugin has provided replacement files.
4241 (Sized_relobj::do_layout_deferred_sections): New function.
4242 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4243 (Relobj::layout_deferred_sections): New function.
4244 (Relobj::do_layout_deferred_sections): New function.
4245 (Sized_relobj::do_layout_deferred_sections): New function.
4246 (Sized_relobj::layout_section): New function.
4247 (Sized_relobj::Deferred_layout): New structure.
4248 (Sized_relobj::deferred_layout_): New field.
4249 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4250 Change all callers. Layout deferred sections.
4251 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4252 references.
4253 (Plugin_hook::run): Move code from do_plugin_hook inline.
4254 (Plugin_hook::do_plugin_hook): Remove.
4255 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4256 (Plugin_manager::finish): Renamed, was cleanup.
4257 (Plugin_manager::should_defer_layout): New function.
4258 (Plugin_manager::add_deferred_layout_object): New function.
4259 (Plugin_manager::Deferred_layout_list): New type.
4260 (Plugin_manager::deferred_layout_objects_): New field.
4261 (Plugin_hook::do_plugin_hook): Remove.
4262
ee769c88
ILT
42632008-12-17 Ian Lance Taylor <iant@google.com>
4264
4265 * options.h (class General_options): Add --no case for
4266 --export-dynamic.
4267
abc8dcba
CC
42682008-12-16 Cary Coutant <ccoutant@google.com>
4269
4270 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4271 vector.
4272 (Plugin_manager::claim_file): Create plugin object even if
4273 plugin did not call the add_symbols callback.
4274 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4275 asking for more symbols than were added.
4276 * testsuite/Makefile.am (plugin_test_1): Add test case with
4277 no global symbols.
4278 (empty.syms): New target.
4279 * testsuite/Makefile.in: Regenerate.
4280 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4281 message. Don't call add_symbols if no globals.
4282 (all_symbols_read_hook): Don't provide replacement for empty
4283 claimed file.
4284
b0074644
ILT
42852008-12-12 Ian Lance Taylor <iant@google.com>
4286
68943102
ILT
4287 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4288 r_type == 0 for a local symbol with r_sym == 0.
4289 (scan_relocatable_relocs): Pass r_sym to
4290 local_non_section_strategy.
4291 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4292 r_sym parameter.
4293
b0074644
ILT
4294 * configure.ac: Update test for TLS descriptors: they are
4295 supported as of glibc 2.9.
4296 * configure: Rebuild.
4297
c2508178
ILT
42982008-12-11 Ian Lance Taylor <iant@google.com>
4299
4300 PR 7091
4301 * target-reloc.h (Default_scan_relocatable_relocs): For each
4302 function, map r_type == 0 to RELOC_DISCARD.
4303
2756a258
CC
43042008-12-10 Cary Coutant <ccoutant@google.com>
4305
4306 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4307 object to override a kept COMDAT group from a plugin object.
4308
bb6f53d3
ILT
43092008-12-09 Ian Lance Taylor <iant@google.com>
4310
fbc558e1
ILT
4311 PR 7088
4312 * yyscript.y (file_cmd): Handle INPUT.
4313
bb6f53d3
ILT
4314 * testsuite/initpri1.c: Change all declarations to be full
4315 prototypes by adding void, to avoid compiler warnings.
4316
4674ecfc
CC
43172008-12-05 Rafael Avila de Espindola <espindola@google.com>
4318
4319 * options.cc (General_options::parse_plugin_opt): New.
4320 (General_options::add_plugin): The argument now is just the filename.
4321 (General_options::add_plugin_option): New.
4322 * options.h (plugin_opt): New.
4323 (add_plugin): Change argument name.
4324 (add_plugin_option): New.
4325 * plugin.cc (Plugin::load): Don't parse the plugin option.
4326 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4327 (Plugin::add_option): New.
4328 (Plugin::args_): Change type.
4329 (Plugin::filename_): New.
4330 (Plugin_manager::add_plugin_option): New.
4331 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4332 * testsuite/Makefile.in: Regenerate.
4333
fd06b4aa
CC
43342008-12-05 Cary Coutant <ccoutant@google.com>
4335
4336 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4337 Handle --strip-lto-sections option.
4338 * options.h (strip_lto_sections): New option.
4339
6c52134c
CC
43402008-12-01 Cary Coutant <ccoutant@google.com>
4341
4342 * plugin.cc (ld_plugin_message): Change format parameter to const.
4343 Fix mismatch between new[] and delete.
4344
a45248e0
CC
43452008-11-14 Cary Coutant <ccoutant@google.com>
4346
4347 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4348 instead of -1U.
4349
c82fbeee
CS
43502008-11-05 Craig Silverstein <csilvers@google.com>
4351
4352 * options.cc (General_options::parse_dynamic_list): New function.
4353 * options.h (General_options): New flags dynamic_list,
4354 dynamic_list_data, dynamic_list_cpp_new, and
4355 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4356 (General_options::in_dynamic_list): New function.
4357 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4358 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4359 (Lex::can_continue_name): Likewise.
4360 (yylex): Likewise.
4361 (read_script_file): New parameter script_options.
4362 (read_dynamic_list): New function.
4363 (Script_options::define_dynamic_list): New function.
4364 (dynamic_list_keyword_parsecodes): New variable.
4365 (dynamic_list_keywords): New variable.
4366 * script.h (Script_options::define_dynamic_list): New function
4367 prototype.
4368 (read_dynamic_list): New function prototype.
4369 * symtab.cc (strprefix): New macro.
4370 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4371 dynamic_list_data, dynamic_list_cpp_new, and
4372 dynamic_list_cpp_typeinfo.
4373 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4374 (dynamic_list_expr): New rule.
4375 (dynamic_list_nodes): Likewise.
4376 (dynamic_list_node): Likewise.
4377 * testsuite/Makefile.am (dynamic_list): New test.
4378 * testsuite/Makefile.in: Regenerated.
4379 * testsuite/dynamic_list.t: New file.
4380 * testsuite/dynamic_list.sh: New file.
4381
e0bb29a5
CS
43822008-11-05 Craig Silverstein <csilvers@google.com>
4383
4384 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4385 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4386 (t11_last): Likewise.
4387 * testsuite/ver_test_6.c (main): Likewise.
4388
4e1e25e0
CC
43892008-10-07 Cary Coutant <ccoutant@google.com>
4390
4391 * options.c (General_options::finalize): Add check for -static and
4392 -shared.
4393 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4394 is not empty.
4395
92f03fcb
CC
43962008-10-02 Cary Coutant <ccoutant@google.com>
4397
4398 * plugin.cc (make_sized_plugin_object): Fix conditional
4399 compilation to work when not all targets are enabled.
4400
fbd8a257
CC
44012008-09-29 Cary Coutant <ccoutant@google.com>
4402
4403 * archive.cc (Archive::get_file_and_offset): Use filename instead
4404 of name to get library path.
4405 (Archive::include_member): Unlock external member of a thin archive.
4406
4407 * testsuite/Makefile.am (TEST_AR): New variable.
4408 (thin_archive_test_1): New test.
4409 (thin_archive_test_2): New test.
81636b3f
CC
4410 * testsuite/Makefile.in: Regenerate.
4411 * testsuite/thin_archive_main.cc: New file.
4412 * testsuite/thin_archive_test_1.cc: New file.
4413 * testsuite/thin_archive_test_2.cc: New file.
4414 * testsuite/thin_archive_test_3.cc: New file.
4415 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 4416
eff45813
CC
44172008-09-29 Cary Coutant <ccoutant@google.com>
4418
4419 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4420 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4421 instead of -1U.
4422 (Sized_relobj::do_finalize_local_symbols): Likewise.
4423 (Sized_relobj::map_to_kept_section): Likewise.
4424 * object.h (Sized_relobj::invalid_address): New constant.
4425 (Sized_relobj::do_output_section_offset): Check for invalid_address
4426 and return -1ULL.
4427 * output.cc (Output_reloc::local_section_offset): Use constant
4428 invalid_address instead of -1U.
4429 (Output_reloc::get_address): Likewise.
4430 (Output_section::output_address): Change -1U to -1ULL.
4431 * output.h (Output_reloc::invalid_address): New constant.
4432 * reloc.cc (Sized_relobj::write_sections): Use constant
4433 invalid_address instead of -1U.
4434 (Sized_relobj::relocate_sections): Likewise.
4435 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4436 values for merge sections.
4437 * target-reloc.h (relocate_for_relocatable): Use constant
4438 invalid_address instead of -1U.
4439
89fc3421
CC
44402008-09-19 Cary Coutant <ccoutant@google.com>
4441
4442 Add plugin functionality for link-time optimization (LTO).
4443 * configure.ac (plugins): Add --enable-plugins option.
4444 * configure: Regenerate.
4445 * config.in: Regenerate.
4446 * Makefile.am (LIBDL): New variable.
4447 (CCFILES): Add plugin.cc.
4448 (HFILES): Add plugin.h.
4449 (ldadd_var): Add LIBDL.
4450 * Makefile.in: Regenerate.
4451
4452 * archive.cc: Include "plugin.h".
4453 (Archive::setup): Don't preread archive symbols when using a plugin.
4454 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4455 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4456 files.
4457 (Archive::include_member): Add symbols from plugin objects.
4458 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4459 * descriptors.cc (Descriptors::open): Check for file descriptors
4460 abandoned by plugins.
4461 (Descriptors::claim_for_plugin): New function.
4462 * descriptors.h (Descriptors::claim_for_plugin): New function.
4463 (Open_descriptor::is_claimed): New field.
4464 (claim_descriptor_for_plugin): New function.
4465 * fileread.cc (File_read::claim_for_plugin): New function.
4466 * fileread.h (File_read::claim_for_plugin): New function.
4467 (File_read::descriptor): New function.
4468 * gold.cc: Include "plugin.h".
4469 (queue_initial_tasks): Add task to call plugin hooks for generating
4470 new object files.
4471 * main.cc: Include "plugin.h".
4472 (main): Load plugin libraries.
4473 * object.h (Pluginobj): Declare.
4474 (Object::pluginobj): New function.
4475 (Object::do_pluginobj): New function.
4476 (Object::set_target): New function.
4477 * options.cc: Include "plugin.h".
4478 (General_options::parse_plugin): New function.
4479 (General_options::General_options): Initialize plugins_ field.
4480 (General_options::add_plugin): New function.
4481 * options.h (Plugin_manager): Declare.
4482 (General_options): Add --plugin option.
4483 (General_options::has_plugins): New function.
4484 (General_options::plugins): New function.
4485 (General_options::add_plugin): New function.
4486 (General_options::plugins_): New field.
4487 * plugin.cc: New file.
4488 * plugin.h: New file.
4489 * readsyms.cc: Include "plugin.h".
4490 (Read_symbols::do_read_symbols): Check for archive before checking
4491 for ELF file. Call plugin hooks to claim files.
4492 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4493 from a real object file; force override when processing replacement
4494 files.
4495 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4496 (Symbol::init_base_object): Likewise.
4497 (Symbol::init_base_output_data): Likewise.
4498 (Symbol::init_base_output_segment): Likewise.
4499 (Symbol::init_base_constant): Likewise.
4500 (Symbol::init_base_undefined): Likewise.
4501 (Symbol::output_section): Assert that object is not a plugin.
4502 (Symbol_table::add_from_pluginobj): New function.
4503 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4504 undefined.
4505 (Symbol_table::sized_write_globals): Likewise.
4506 (Symbol_table::add_from_pluginobj): Instantiate template.
4507 * symtab.h (Sized_pluginobj): Declare.
4508 (Symbol::in_real_elf): New function.
4509 (Symbol::set_in_real_elf): New function.
4510 (Symbol::in_real_elf_): New field.
4511 (Symbol_table::add_from_pluginobj): New function.
4512
4513 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4514 (LIBDL): New variable.
4515 (LDADD): Add LIBDL.
4516 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4517 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4518 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4519 (MOSTLYCLEANFILES): Likewise.
4520 * testsuite/Makefile.in: Regenerate.
4521 * testsuite/plugin_test.c: New file.
4522 * testsuite/plugin_test_1.sh: New file.
4523 * testsuite/plugin_test_2.sh: New file.
4524
de31bda5
ILT
45252008-09-16 Ian Lance Taylor <iant@google.com>
4526
9c2d0ef9
ILT
4527 * target-reloc.h (relocate_section): Check whether a symbol is
4528 defined by the ABI before reporting an undefined symbol error.
4529 * target.h (Target::is_defined_by_abi): Make parameter const.
4530 (Target::do_is_defined_by_abi): Likewise.
4531 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4532 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4533 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4534 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4535 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4536 * testsuite/Makefile.in: Rebuild.
4537
de31bda5
ILT
4538 * fileread.cc (make_view): Add casts to avoid warning.
4539
9fa33bee
AO
45402008-09-16 Alexandre Oliva <aoliva@redhat.com>
4541
4542 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4543 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4544
183fd0e3
AO
45452008-09-16 Alexandre Oliva <aoliva@redhat.com>
4546
4547 * options.h (General_options::output_is_executable): New.
4548 (General_options::output_is_pie): New.
4549 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4550 for shared libraries.
4551 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4552
7be8330a
CD
45532008-09-11 Chris Demetriou <cgd@google.com>
4554
4555 * options.h (origin): New -z option.
4556 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4557 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4558 in DT_FLAGS_1.
4559
a9caad02
CC
45602008-09-05 Cary Coutant <ccoutant@google.com>
4561
4562 * fileread.cc (File_read::make_view): Add check for attempt to map
4563 beyond end of file.
4564
ae6dce4d
CC
45652008-09-05 Cary Coutant <ccoutant@google.com>
4566
4567 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4568 explicit instantiations.
4569
d7ab2a47
KVH
45702008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4571
4572 PR gold/6858
4573 * options.cc (General_options::finalize): Allow undefined symbols
4574 in shlibs if linking -shared.
4575
4576 PR gold/6859
4577 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4578 symbols as not needing a dynsym entry.
4579
1e52a9c1
CS
45802008-08-20 Craig Silverstein <csilvers@google.com>
4581
4582 * fileread.cc (File_read::open): Do not lock the file unless it
4583 was successfully opened.
4584
d85c80a3
CC
45852008-08-14 Cary Coutant <ccoutant@google.com>
4586
4587 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4588 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4589 * testsuite/tls_test.cc (struct int128): 128-bit struct
4590 for testing TLS relocs with non-zero addend.
4591 (v12): New TLS variable.
4592 (t12): New test.
4593 (t_last): Add check for v12.
4594 * testsuite/tls_test.h (t12): New function.
4595 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4596
2d924fd9
ILT
45972008-08-13 Ian Lance Taylor <iant@google.com>
4598
4599 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4600 set tls_segment_ or relro_segment_.
4601 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4602 when appropriate.
4603 * output.h (Output_section::clear_is_relro): New function.
4604 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4605 sections specially even when output_data_ is empty.
4606 (Output_segment::maximum_alignment): When first section is relro,
4607 only force alignment for PT_LOAD segments.
4608 * script.cc (script_data_segment_align): New function.
4609 (script_data_segment_relro_end): New function.
4610 * script-c.h (script_data_segment_align): Declare.
4611 (script_data_segment_relro_end): Declare.
4612 * script-sections.h (class Script_sections): Declare
4613 data_segment_align and data_segment_relro_end. Add fields
4614 segment_align_index_ and saw_relro_end_.
4615 * script-sections.cc (class Sections_element): Add set_is_relro
4616 virtual function. Add new bool* parameter to place_orphan_here.
4617 Add get_output_section virtual function.
4618 (class Output_section_definition): Add set_is_relro. Add new
4619 bool* parameter to place_orphan_here. Add get_output_section.
4620 Add is_relro_ field.
4621 (Output_section_definition::Output_section_definition): Initialize
4622 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4623 and is_relro_ fields.
4624 (Output_section_definition::place_orphan_here): Add is_relro
4625 parameter.
4626 (Output_section_definition::set_section_addresses): Set relro for
4627 output section.
4628 (Output_section_definition::alternate_constraint): Likewise.
4629 (class Orphan_output_section): Add new bool* parameter to
4630 place_orphan_here. Add get_output_section.
4631 (Orphan_output_section::place_orphan_here): Add is_relro
4632 parameter.
4633 (Script_sections::Script_sections): Initialize
4634 data_segment_align_index_ and saw_relro_end_.
4635 (Script_sections::data_segment_align): New function.
4636 (Script_sections::data_segment_relro_end): New function.
4637 (Script_sections::place_orphan): Set or clear is_relro.
4638 (Script_sections::set_section_addresses): Force alignment of first
4639 TLS section.
4640 * yyscript.y (exp): Call script_data_segment_align and
4641 script_data_segment_relro_end.
4642 * testsuite/relro_script_test.t: New file.
4643 * testsuite/relro_test.cc (using_script): Declare.
4644 (t1, t2): Test using_script.
4645 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4646 (relro_script_test_SOURCES): Define.
4647 (relro_script_test_DEPENDENCIES): Define.
4648 (relro_script_test_LDFLAGS): Define.
4649 (relro_script_test_LDADD): Define.
4650 (relro_script_test.so): New target.
4651 * testsuite/Makefile.in: Rebuild.
4652
f827c9a9
CC
46532008-08-06 Cary Coutant <ccoutant@google.com>
4654
4655 * archive.cc (Archive::total_archives, Archive::total_members)
4656 (Archive::total_members_loaded): New variables.
4657 (Archive::setup): Add parameter. Add option to preread
4658 archive symbols.
4659 (Archive::read_armap): Add counter.
4660 (Archive::get_file_and_offset): New function.
4661 (Archive::get_elf_object_for_member): New function.
4662 (Archive::read_all_symbols): New function.
4663 (Archive::read_symbols): New function.
4664 (Archive::add_symbols): Add counters.
4665 (Archive::include_all_members): Use armap to find members if it's
4666 already built.
4667 (Archive::include_member): Skip reading symbols if already read.
4668 Factored code into Archive::get_file_and_offset and
4669 Archive::get_elf_object_for_member. Changed call to
4670 Mapfile::report_include_archive_member.
4671 (Archive::print_stats): New function.
4672 * archive.h: Declare Object and Read_symbols_data classes.
4673 (Archive::Archive): Add initializers for new members.
4674 (Archive::setup): Add parameter.
4675 (Archive::print_stats): New function.
4676 (Archive::total_archives, Archive::total_members)
4677 (Archive::total_members_loaded): New variables.
4678 (Archive::get_file_and_offset): New function.
4679 (Archive::get_elf_object_for_member): New function.
4680 (Archive::read_all_symbols): New function.
4681 (Archive::read_symbols): New function.
4682 (Archive::Archive_member): New class.
4683 (Archive::members_): New member.
4684 (Archive::num_members_): New member.
4685 * main.cc: Include archive.h.
4686 (main): Call Archive::print_stats.
4687 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4688 archive parameter; member_name is now the fully-decorated name.
4689 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4690 * options.h: (General_options): Add --preread-archive-symbols option.
4691 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4692 Archive::setup.
4693
de4c45bd
ILT
46942008-08-04 Ian Lance Taylor <iant@google.com>
4695
4696 * symtab.h (Symbol::use_plt_offset): New function.
4697 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4698 * powerpc.cc (Relocate::relocate): Likewise.
4699 * sparc.cc (Relocate::relocate): Likewise.
4700 * x86_64.cc (Relocate::relocate): Likewise.
4701 * testsuite/weak_plt.sh: New test.
4702 * testsuite/weak_plt_main.cc: New test.
4703 * testsuite/weak_plt_shared.cc: New test.
4704 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4705 (check_PROGRAMS): Add weak_plt.
4706 (check_DATA): Add weak_plt_shared.so.
4707 (weak_plt_main_pic.o, weak_plt): New targets.
4708 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4709 * testsuite/Makefile.in: Rebuild.
4710
4711 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4712 gcctestdir/ld.
4713 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4714 * testsuite/Makefile.in: Rebuild.
4715
323ee3f4
AM
47162008-08-04 Alan Modra <amodra@bigpond.net.au>
4717
4718 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4719 * Makefile.in: Regenerate.
4720 * po/POTFILES.in: Regenerate.
4721
7c07ecec
ILT
47222008-07-29 Ian Lance Taylor <iant@google.com>
4723
4724 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4725 symbols before other symbols.
4726 * testsuite/script_test_2.cc (test_addr): Declare.
4727 (test_addr_alias): Declare.
4728 (main): Check that test_addr and test_addr_alias have the right
cd536b21 4729 values.
7c07ecec
ILT
4730 * testsuite/script_test_2.t: Define test_addr_alias and
4731 test_addr.
4732
5778530e
ILT
47332008-07-24 Ian Lance Taylor <iant@google.com>
4734
2a00e4fb
ILT
4735 PR 5990
4736 * descriptors.cc: New file.
4737 * descriptors.h: New file.
4738 * gold-threads.h (class Hold_optional_lock): New class.
4739 * fileread.cc: Include "descriptors.h".
4740 (File_read::~File_read): Release descriptor rather than closing
4741 it.
4742 (File_read::open) [file]: Call open_descriptor rather than open.
4743 Set is_descriptor_opened_.
4744 (File_read::open) [memory]: Assert that descriptor is not open.
4745 (File_read::reopen_descriptor): New function.
4746 (File_read::release): Release descriptor.
4747 (File_read::do_read): Make non-const. Reopen descriptor.
4748 (File_read::read): Make non-const.
4749 (File_read::make_view): Reopen descriptor.
4750 (File_read::do_readv): Likewise.
4751 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4752 Update declarations.
4753 * layout.cc: Include "descriptors.h".
4754 (Layout::create_build_id): Use open_descriptor rather than open.
4755 * output.cc: Include "descriptors.h".
4756 (Output_file::open): Use open_descriptor rather than open.
4757 * archive.cc (Archive::const_iterator): Change Archive to be
4758 non-const.
4759 (Archive::begin, Archive::end): Make non-const.
4760 (Archive::count_members): Likewise.
4761 * archive.h (class Archive): Update declarations.
4762 * object.h (Object::read): Make non-const.
4763 * Makefile.am (CCFILES): Add descriptors.cc.
4764 (HFILES): Add descriptors.h.
4765 * Makefile.in: Rebuild.
4766
801647d1
ILT
4767 PR 6716
4768 * gold.h: Always include <clocale>. Add Solaris workarounds
4769 following code in binutils/sysdep.h.
4770
5edd166e
ILT
4771 PR 6048
4772 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4773 this->eh_frame_hdr_ is NULL before using it.
4774
c89ad728
ILT
4775 * dynobj.cc (Versions::Versions): Update comment.
4776
aa86f06b
ILT
4777 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4778 the base version name.
4779
5778530e
ILT
4780 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4781 array size plus one.
4782 (Stringpool_template::set_string_offsets): Subtract one from key
4783 before using it as an array index.
4784 (Stringpool_template::get_offset_with_length): Likewise.
4785 (Stringpool_template::write_to_buffer): Likewise.
4786 * stringpool.h (Stringpool_template::get_offset_from_key):
4787 Likewise.
4788
057ead22
ILT
47892008-07-23 Ian Lance Taylor <iant@google.com>
4790
7f649c59
ILT
4791 PR 6658
4792 * object.h (Merged_symbol_value::value): Do our best to handle a
4793 negative addend.
4794
057ead22
ILT
4795 PR 6647
4796 * script.cc (Version_script_info::get_versions): Don't add empty
4797 version tag to return value.
4798 (Version_script_info::get_symbol_version_helper): Change return
4799 type to bool. Add pversion parameter. Change all callers.
4800 (script_register_vers_node): Don't require a non-NULL tag.
4801 * script.h (class Version_script_info): Update declarations.
4802 (Version_script_info::get_symbol_version): Change return type to
4803 bool. Add version parameter. Change all callers.
4804 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4805 handling. Handle an empty version from a version script.
4806 (Symbol_table::define_special_symbol): Likewise.
4807 * testsuite/ver_test_10.script: New file.
4808 * testsuite/ver_test_10.sh: New file.
4809 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4810 (check_DATA): Add ver_test_10.syms.
4811 (ver_test_10.syms, ver_test_10.so): New target.
4812 * testsuite/Makefile.in: Rebuild.
4813
58e54ac2
CD
48142008-07-23 Simon Baldwin <simonb@google.com>
4815
4816 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4817 to zero for undefined symbols from dynamic libraries.
4818
95d14cd3
ILT
48192008-07-23 Ian Lance Taylor <iant@google.com>
4820
4821 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4822 Change all callers.
4823 * symtab.h (class Symbol_table): Update declaration.
4824 * testsuite/ver_test_9.cc: New file.
4825 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4826 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4827 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4828 (ver_test_9.so, ver_test_9.o): New targets.
4829 * testsuite/Makefile.in: Rebuild.
4830
92de84a6
ILT
48312008-07-22 Ian Lance Taylor <iant@google.com>
4832
34810851
ILT
4833 * options.h (class General_options): Define --check-sections.
4834 * layout.cc (Layout::set_segment_offsets): Handle
4835 --check-sections.
4836
af6156ef
ILT
4837 * options.h (class General_options): Define -n/--nmagic and
4838 -N/--omagic.
4839 * options.cc (General_options::finalize): For -n/--nmagic or
4840 -N/--omagic, set -static.
4841 * layout.cc (Layout::attach_allocated_section_to_segment): If
4842 -N/--omagic, don't put read-only and read-write sections in
4843 different segments.
4844 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4845 finding a read-only segment.
4846 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4847 don't set the minimum segment alignment to the common page size,
4848 and don't set the file offset to the address modulo the page size.
4849 * script-sections.cc (Script_sections::create_segments): If
4850 -n/--omagic, don't put read-only and read-write sections in
4851 different segments.
4852
92de84a6
ILT
4853 * cref.cc: New file.
4854 * cref.h: New file.
4855 * options.h (class General_options): Add --print-symbol-counts.
4856 * main.cc (main): Issue defined symbol report if requested.
4857 * archive.cc (Archive::interpret_header): Make into a const member
4858 function.
4859 (Archive::add_symbols): Call Input_objects::archive_start and
4860 archive_stop.
4861 (Archive::const_iterator): Define new class.
4862 (Archive::begin, Archive::end): New functions.
4863 (Archive::include_all_members): Rewrite to use iterator.
4864 (Archive::count_members): New function.
4865 * archive.h (class Archive): Update declarations.
4866 (Archive::filename): New function.
4867 * object.cc: Include "cref.h".
4868 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4869 (Sized_relobj::do_get_global_symbol_counts): New function.
4870 (Input_objects::add_object): Add object to cross-referencer.
4871 (Input_objects::archive_start): New function.
4872 (Input_objects::archive_stop): New function.
4873 (Input_objects::print_symbol_counts): New function.
4874 * object.h: Declare Cref and Archive.
4875 (Object::get_global_symbol_counts): New function.
4876 (Object::do_get_global_symbol_counts): New pure virtual function.
4877 (class Sized_relobj): Add defined_count_ field. Update
4878 declarations.
4879 (class Input_objects): Add cref_ field. Update constructor.
4880 Update declarations.
4881 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4882 defined_count_.
4883 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4884 symbol counts.
4885 (Sized_dynobj::do_get_global_symbol_counts): New function.
4886 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4887 defined_count_. Update declarations. Define Symbols typedef.
4888 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4889 parameter. Change all callers.
4890 (Symbol_table::add_from_dynobj): Add sympointers and defined
4891 parameters. Change all callers.
4892 * symtab.h (class Symbol_table): Update declarations.
4893 * Makefile.am (CCFILES): Add cref.cc.
4894 (HFILES): Add cref.h.
4895 * Makefile.in: Rebuild.
4896
3f7c5e1d
CD
48972008-07-22 Simon Baldwin <simonb@google.com>
4898
4899 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4900 to zero when writing undefined symbols.
4901
e0b64032
ILT
49022008-07-22 Ian Lance Taylor <iant@google.com>
4903
4904 * output.cc (Output_section::add_input_section): Don't try to
4905 merge empty merge sections.
4906
096b02cf
CS
49072008-07-21 Craig Silverstein <csilvers@google.com>
4908
4909 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4910 Include symbol version in error message.
cd536b21 4911
1d1f116d
CD
49122008-07-20 Chris Demetriou <cgd@google.com>
4913
cd536b21 4914 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
4915 (RANDOM_SEED_CFLAGS): New substituted variable.
4916 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4917 * configure: Rebuild.
4918 * Makefile.in: Likewise.
4919 * testsuite/Makefile.in: Likewise.
4920
a18f591e
ILT
49212008-07-18 Ian Lance Taylor <iant@google.com>
4922
4923 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4924 where we see NAME/NULL and NAME/VERSION as separate symbols.
4925 * testsuite/ver_test_main.cc (main): Call t4.
4926 (t4, t4_2a): Define.
4927 * testsuite/ver_test_2.cc (t4_2): Define.
4928 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4929 * testsuite/ver_test_4.cc (t4_2a): Define.
4930 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4931 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4932
c6e3f6ed
ILT
49332008-07-17 Ian Lance Taylor <iant@google.com>
4934
4935 * dynobj.cc (Versions::add_def): If we give an error about a
4936 missing version, go ahead and create the version anyhow.
4937
ef9beddf
ILT
49382008-07-10 Ian Lance Taylor <iant@google.com>
4939
4940 Handle output sections with more than 0x7fffffff bytes.
4941 * object.h (class Relobj): Change map_to_output_ to
4942 output_sections_, and just keep a section pointer. Change all
4943 uses. Move comdat group support to Sized_relobj.
4944 (Relobj::is_section_specially_mapped): Remove.
4945 (Relobj::output_section): Remove poff parameter. Change all
4946 callers.
4947 (Relobj::output_section_offset): New function.
4948 (Relobj::set_section_offset): Rewrite.
4949 (Relobj::map_to_output): Remove.
4950 (Relobj::output_sections): New function.
4951 (Relobj::do_output_section_offset): New pure virtual function.
4952 (Relobj::do_set_section_offset): Likewise.
4953 (class Sized_relobj): Add section_offsets_ field. Add comdat
4954 group support from Relobj. Update declarations.
4955 (Sized_relobj::get_output_section_offset): New function.
4956 (Sized_relobj::do_output_section_offset): New function.
4957 (Sized_relobj::do_set_section_offset): New function.
4958 * object.cc (Relobj::output_section_address): Remove.
4959 (Sized_relobj::Sized_relobj): Initialize new fields.
4960 (Sized_relobj::include_section_group): Cast find_kept_object to
4961 Sized_relobj.
4962 (Sized_relobj::include_linkonce_section): Likewise.
4963 (Sized_relobj::do_layout): Use separate arrays for output section
4964 and output offset.
4965 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4966 output_sections.
4967 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4968 output_sections and section_offsets.
4969 (Sized_relobj::write_local_symbols): Likewise.
4970 (map_to_kept_section): Compute output address directly.
4971 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4972 output_sections and section_offsets.
4973 (Sized_relobj::write_sections): Likewise.
4974 (Sized_relobj::relocate_sections): Likewise.
4975 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4976 * output.h (class Output_reloc): Update declarations. Change
4977 u2_.relobj to Sized_relobj*.
4978 (class Output_data_reloc): Change add functions to use
4979 Sized_relobj*.
4980 * output.cc (Output_reloc::Output_reloc): Change relobj to
4981 Sized_relobj*.
4982 (Output_reloc::local_section_offset): Change return type to
4983 Elf_Addr. Use get_output_section_offset.
4984 (Output_reloc::get_address): Likewise.
4985 (Output_section::is_input_address_mapped): Don't call
4986 is_section_specially_mapped.
4987 (Output_section::output_offset): Likewise.
4988 (Output_section::output_address): Likewise.
4989 (Output_section::starting_output_address): Likewise.
4990 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4991 parameter to Sized_relobj*.
4992 (Copy_relocs::need_copy_reloc): Likewise.
4993 (Copy_relocs::save): Likewise.
4994 * copy-relocs.h (class Copy_relocs): Update declarations.
4995 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4996 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4997 * target-reloc.h (relocate_for_relocatable): Change
4998 offset_in_output_section type to Elf_Addr. Change code that uses
4999 it as well.
5000 * layout.cc (Layout::layout): Always set *off.
5001 * mapfile.cc (Mapfile::print_input_section): Use
5002 output_section_offset.
5003 * i386.cc (Target_i386::copy_reloc): Change object parameter to
5004 Sized_relobj*.
5005 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5006 * sparc.cc (Target_sparc::copy_reloc): Likewise.
5007 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5008
5cb66f97
ILT
50092008-07-03 Ian Lance Taylor <iant@google.com>
5010
5011 * layout.cc (Layout::include_section): Do not discard unrecognized
5012 SHT_STRTAB sections.
5013
afe47622
CS
50142008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
5015
5016 * script.cc (Lex::can_continue_name): Make '?' allowable in
5017 version-script names.
5018 * testsuite/version_script.map: Change glob pattern to use '?'
5019
5adf9721
ILT
50202008-06-30 Manish Singh <yosh@gimp.org>
5021
5022 PR 6585
5023 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5024 Correct typo.
5025
e6fde208
ILT
50262008-06-30 Ian Lance Taylor <iant@google.com>
5027
5028 PR 6660
5029 PR 6682
5030 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5031 versions]: Don't try to read the value in the contents, since we
5032 don't use it. Use the template endianness when writing.
5033
3f2e6a2d
CC
50342008-06-25 Cary Coutant <ccoutant@google.com>
5035
5036 * fileread.cc (File_read::make_view): Assert on zero-length view.
5037 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5038 symbol table when there are no symbols to read.
5039
c43d3a48
CS
50402008-06-23 Craig Silverstein <csilvers@google.com>
5041
5042 * version.cc (version_string): Bump to 1.7
5043
5f494ea0
CS
50442008-06-18 Craig Silverstein <csilvers@google.com>
5045
5046 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5047 constant 0xFFFF to type Valtype.
5048 (Powerpc_relocate_functions::rel16_ha): Likewise.
5049
c42e122e
ILT
50502008-06-17 Ian Lance Taylor <iant@google.com>
5051
f34787f8
ILT
5052 * output.h (Output_section::Input_section): Initialize p2align_ to
5053 zero for Output_section_data constructors.
5054 (Output_section::Input_section::addralign): If not an input
5055 section, return the alignment of the Output_section_data.
5056 * testsuite/copy_test.cc: New file.
5057 * testsuite/copy_test_1.cc: New file.
5058 * testsuite/copy_test_2.cc: New file.
5059 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5060 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5061 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5062 (copy_test_1_pic.o, copy_test_1.so): New targets.
5063 (copy_test_2_pic.o, copy_test_2.so): New targets.
5064 * testsuite/Makefile.in: Rebuild.
5065
c42e122e
ILT
5066 * script-sections.cc (Script_sections::place_orphan): Initialize
5067 local variable exact.
5068
ce3ac18a
DE
50692008-06-13 David Edelsohn <edelsohn@gnu.org>
5070
5071 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5072
42cacb20
DE
50732008-06-12 David Edelsohn <edelsohn@gnu.org>
5074 David S. Miller <davem@davemloft.net>
5075
5076 * powerpc.cc: New file.
5077 * Makefile.am (TARGETSOURCES): Add powerpc.cc
5078 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5079 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5080 * Makefile.in: Rebuild.
5081
7b308235
ILT
50822008-06-09 Ian Lance Taylor <iant@google.com>
5083
5084 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5085 <exception>.
5086 (throwing, orig_terminate): New static variables.
5087 (terminate_handler): New static function.
5088 (t2): Set terminate handler.
5089
f0b886e3
ILT
50902008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5091
5092 PR 6584
cd536b21 5093 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
5094 alignment.
5095
3e90f135
CC
50962008-05-30 Cary Coutant <ccoutant@google.com>
5097
5098 * archive.cc (Archive::include_all_members) Correct to step
5099 over symbol table and extended name table in thin archives.
5100
e09ad04a
ILT
51012008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5102
5103 PR 6407
5104 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5105 calculation.
5106
62b01cb5
ILT
51072008-05-28 Caleb Howe <cshowe@google.com>
5108
5109 * reduced_debug_output.cc: New file.
5110 * reduced_debug_output.h: New file.
92de84a6 5111 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
5112 * options.cc (General_options::finalize): Add strip_debug_non_line
5113 to the strip heirarchy.
5114 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5115 fields.
5116 * layout.cc: Include "reduced_debug_output.h".
5117 (Layout::Layout): Initialize new fields.
5118 (line_only_debug_sections): New static array.
5119 (is_lines_only_debug_sections): New static inline function.
5120 (Layout::include_section): Handle --strip-debug-non-line.
5121 (Layout::make_output_section): If --strip-debug-non-line, build
5122 new output sections for .debug_abbrev and .debug_info.
5123 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5124 gold. Warn about possible overflow.
5125 (read_signed_LEB_128): Likewise.
5126 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5127 (read_signed_LEB_128): Declare.
5128 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5129 (HFILES): Add reduced_debug_output.h.
5130 * Makefile.in: Rebuild.
5131
7d9e3d98
ILT
51322008-05-21 Ian Lance Taylor <iant@google.com>
5133
5134 * mapfile.cc: New file.
5135 * mapfile.h: New file.
5136 * options.h (class General_options): Add -M/--print-map and -Map.
5137 * options.cc (General_options::finalize): Make -M equivalent to
5138 -Map -.
5139 * main.cc: Include <cstdio> and "mapfile.h".
5140 (main): Open mapfile if requested.
5141 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5142 constructor. Change caller.
5143 (queue_initial_tasks): Add mapfile parameter. Change caller.
5144 (queue_middle_tasks): Likewise.
5145 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5146 declarations.
5147 * archive.cc: Include "mapfile.h".
5148 (Archive::add_symbols): Add mapfile parameter. Change all
5149 callers. Pass mapfile, symbol, and reason to include_member.
5150 (Archive::include_all_members): Add mapfile parameter. Change all
5151 callers.
5152 (Archive::include_member): Add mapfile, sym, and why parameters.
5153 Change all callers. Report inclusion to map file.
5154 * archive.h: Include "fileread.h".
5155 (class Archive): Update declarations.
5156 (Archive::file): New const method.
5157 (class Add_archive_symbols): Add mapfile_ field. Update
5158 constructor. Change all callers.
5159 * readsyms.h (class Read_symbols): Likewise.
5160 (class Finish_group): Likewise.
5161 (class Read_script): Likewise.
5162 * common.cc: Include "mapfile.h".
5163 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5164 all callers.
5165 (Symbol_table::do_allocate_commons): Likewise.
5166 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5167 symbol allocation to mapfile.
5168 * common.h (class Allocate_commons_task): Add mapfile_ field.
5169 Update constructor. Change all callers.
5170 * symtab.h (class Symbol_table): Update declarations.
5171 * layout.cc: Include "mapfile.h".
5172 (Layout_task_runner::run): Print information to mapfile.
5173 (Layout::create_gold_note): Change Output_data_fixed_space to
5174 Output_data_zero_fill.
5175 (Layout::create_build_id): Likewise.
5176 (Layout::print_to_mapfile): New function.
5177 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5178 constructor. Change caller.
5179 (class Layout): Declare print_to_mapfile.
5180 * output.cc (Output_section::Input_section::print_to_mapfile): New
5181 function.
5182 (Output_section::add_input_section): If producing a map, always
5183 add to input_sections_ list.
5184 (Output_section::do_print_to_mapfile): New function.
5185 (Output_segment::print_sections_to_mapfile): New function.
5186 (Output_segment::print_section_list_to_mapfile): New function.
5187 * output.h: Include "mapfile.h".
5188 (Output_data::print_to_mapfile): New function.
5189 (Output_data::do_print_to_mapfile): New virtual function.
5190 (Output_segment_headers::do_print_to_mapfile): New function.
5191 (Output_file_header::do_print_to_mapfile): New function.
5192 (Output_data_const::do_print_to_mapfile): New function.
5193 (class Output_data_const_buffer): Add map_name_ field. Update
5194 constructor. Change all callers. Add do_print_to_mapfile
5195 function.
5196 (class Output_data_fixed_space): Likewise.
5197 (class Output_data_space): Likewise.
5198 (class Output_data_zero_fill): New class.
5199 (Output_data_strtab::do_print_to_mapfile): New function.
5200 (Output_data_reloc_base::do_print_to_mapfile): New function.
5201 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5202 (Output_data_group::do_print_to_mapfile): New function.
5203 (Output_data_got::do_print_to_mapfile): New function.
5204 (Output_data_dynamic::do_print_to_mapfile): New function.
5205 (Output_symtab_xindex::do_print_to_mapfile): New function.
5206 (class Output_section): Declare do_print_to_mapflie. Declare
5207 print_to_mapfile in Input_section.
5208 (class Output_segment): Declare new functions.
5209 * object.h (Sized_relobj::symbol_count): New function.
5210 * script-sections.cc
5211 (Output_section_element_dot_assignment::set_section_addresses):
5212 Change Output_data_fixed_space to Output_data_zero_fill.
5213 (Output_data_expression::do_print_to_mapfile): New function.
5214 * script.cc (read_input_script): Add mapfile parameter. Change
5215 all callers.
5216 * script.h (read_input_script): Update declaration.
5217 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5218 (Eh_frame::do_print_to_mapfile): New function.
5219 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5220 (Output_merge_string::do_print_to_mapfile): New function.
5221 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5222 function.
5223 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5224 function.
5225 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5226 function.
5227 * Makefile.am (CCFILES): Add mapfile.cc.
5228 (HFILES): Add mapfile.h.
5229 * Makefile.in: Rebuild.
5230
9f1d377b
ILT
52312008-05-19 Ian Lance Taylor <iant@google.com>
5232
5233 * options.h (class General_options): Add -z relro.
5234 * layout.cc (Layout::Layout): Initialize relro_segment_.
5235 (Layout::add_output_section_data): Return the output section.
5236 (Layout::make_output_section): Rcognize relro sections and mark
5237 them appropriately.
5238 (Layout::attach_allocated_section_to_segment): Put relro sections
5239 in a PT_GNU_RELRO segment.
5240 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5241 section as relro.
5242 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5243 PT_TLS segments.
5244 (Layout::linkonce_mapping): Map d.rel.ro.local to
5245 .data.rel.ro.local.
5246 (Layout::output_section_name): Us .data.rel.ro.local for any
5247 section which begins with that.
5248 * layout.h (class Layout): Update add_output_section_data
5249 declaration. Add relro_segment_ field.
5250 * output.cc (Output_section::Output_section): Initialize is_relro_
5251 and is_relro_local_ fields.
5252 (Output_segment::add_output_section): Group relro sections.
5253 (Output_segment::is_first_section_relro): New function.
5254 (Output_segment::maximum_alignment): If there is a relro section,
5255 align the segment to the common page size.
5256 (Output_segment::set_section_addresses): Track whether we are
5257 looking at relro sections. If the last section is a relro
5258 section, align to the common page size.
5259 (Output_segment::set_section_list_addresses): Add in_relro
5260 parameter. Change all callers. Align to the page size when
5261 moving from relro to non-relro section.
5262 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5263 segment.
5264 * output.h (class Output_section): Add is_relro_ and
5265 is_relro_local_ fields.
5266 (Output_section::is_relro): New function.
5267 (Output_section::set_is_relro): New function.
5268 (Output_section::is_relro_local): New function.
5269 (Output_section::set_is_relro_local): New function.
5270 (class Output_segment): Update declarations.
5271 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5272 * sparc.cc (Target_sparc::got_section): Likewise.
5273 * x86_64.cc (Target_x86_64::got_section): Likewise.
5274 * testsuite/relro_test_main.cc: New file.
5275 * testsuite/relro_test.cc: New file.
5276 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5277 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5278 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5279 (relro_test.so, relro_test_pic.o): New targets.
5280 * testsuite/Makefile.in: Rebuild.
5281
a984ee1d
ILT
52822008-05-16 Ian Lance Taylor <iant@google.com>
5283
01676dcd
ILT
5284 * output.cc (Output_segment::add_output_section): Remove front
5285 parameter.
5286 * output.h (class Output_segment): Remove
5287 add_initial_output_section and overloaded add_output_section.
5288 Update declaration of remaining add_output_section.
5289 * layout.cc (Layout::create_interp): Call add_output_section
5290 rather than add_initial_output_section.
5291 (Layout::finish_dynamic_section): Likewise.
5292
497897f9
ILT
5293 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5294 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5295 know the dynamic type.
5296 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5297 field. Initialize it in constructor.
5298 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5299 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5300 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5301 reloc.
5302
a984ee1d
ILT
5303 * output.cc (Output_reloc::get_address): Change return type to
5304 Elf_Addr.
5305 * output.h (class Output_reloc): Update get_address declaration.
5306 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5307 for section addresses.
5308
55ba0940
ILT
53092008-05-09 Ian Lance Taylor <iant@google.com>
5310
5311 PR 6493
5312 * gold.cc (gold_nomem): Use return value of write.
5313
75517b77
ILT
53142008-05-08 Ian Lance Taylor <iant@google.com>
5315
5316 * symtab.c (Symbol::init_base_output_data): Add version
5317 parameter. Change all callers.
5318 (Symbol::init_base_output_segment): Likewise.
5319 (Symbol::init_base_constant): Likewise.
5320 (Symbol::init_base_undefined): Likewise.
5321 (Sized_symbol::init_output_data): Likewise.
5322 (Sized_symbol::init_output_segment): Likewise.
5323 (Sized_symbol::init_constant): Likewise.
5324 (Sized_symbol::init_undefined): Likewise.
5325 (Symbol_table::do_define_in_output_data): If the new symbol has a
5326 version, mark it as the default.
5327 (Symbol_table::do_define_in_output_segment): Likewise.
5328 (Symbol_table::do_define_as_constant): Likewise.
5329 * symtab.h (class Symbol): Update declarations.
5330 (class Sized_symbol): Likewise.
5331 * resolve.cc (Symbol::override_version): New function.
c42e122e 5332 (Symbol::override_base): Call override_version.
75517b77
ILT
5333 (Symbol::override_base_with_special): Likewise.
5334 * testsuite/ver_script_8.script: New file.
5335 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5336 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5337 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5338 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5339
f1f70eae
ILT
53402008-05-06 Ian Lance Taylor <iant@google.com>
5341
f3e9c5c5
ILT
5342 PR 6049
5343 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5344 functions.
5345 (class General_options): Remove existing --undefined, and add
5346 --no-undefined instead. Add new --undefined as synonym for -u.
5347 * archive.cc (Archive::add_symbols): Check whether symbol was
5348 named with -u.
5349 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5350 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5351 all uses. Add IS_UNDEFINED. Update declarations to split
5352 different versions of init_base. Declare init_base_undefined.
5353 (Symbol::is_defined): Handle IS_UNDEFINED.
5354 (Symbol::is_undefined): Likewise.
5355 (Symbol::is_weak_undefined): Call is_undefined.
5356 (Symbol::is_absolute): Handle IS_CONSTANT.
5357 (class Sized_symbol): Update declarations to split different
5358 versions of init. Declare init_undefined.
5359 (class Symbol_table): Declare new functions.
5360 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5361 Change all callers.
5362 (Symbol::init_base_output_data): Likewise.
5363 (Symbol::init_base_output_segment): Likewise.
5364 (Symbol::init_base_constant): Likewise.
5365 (Symbol::init_base_undefined): New function.
5366 (Sized_symbol::init_object): Rename from init. Change all
5367 callers.
5368 (Sized_symbol::init_output_data): Likewise.
5369 (Sized_symbol::init_output_segment): Likewise.
5370 (Sized_symbol::init_constant): Likewise.
5371 (Sized_symbol::init_undefined): New function.
5372 (Symbol_table::add_undefined_symbols_from_command_line): New
5373 function.
5374 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5375 function.
5376 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5377 (Symbol::output_section): Likewise.
5378 (Symbol::set_output_section): Likewise.
5379 (Symbol_table::sized_finalize_symbol): Likewise.
5380 (Symbol_table::sized_write_globals): Likewise.
5381 * resolve.cc (Symbol_table::should_override): Likewise.
5382 (Symbol::override_base_with_special): Likewise.
5383
8bdcdf2c
ILT
5384 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5385 symbol, change it to have default visibility.
5386 * testsuite/protected_1.cc: New file.
5387 * testsuite/protected_2.cc: New file.
5388 * testsuite/protected_3.cc: New file.
5389 * testsuite/protected_main_1.cc: New file.
5390 * testsuite/protected_main_2.cc: New file.
5391 * testsuite/protected_main_3.cc: New file.
5392 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5393 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5394 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5395 (protected_1.so): New target.
5396 (protected_1_pic.o, protected_2_pic.o): New targets.
5397 (protected_3_pic.o): New target.
5398 (check_PROGRAMS): Add protected_2.
5399 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5400 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5401 * testsuite/Makefile.in: Rebuild.
5402
2b706932
ILT
5403 * options.h (DEFINE_var): Add set_user_set_##varname__.
5404 (DEFINE_bool_alias): New macro.
5405 (class General_options): Define -Bstatic using DEFINE_bool_alias
5406 rather than DEFINE_special. Add --undefined as an alias for -z
5407 defs.
5408 * options.cc (General_options::parse_Bstatic): Remove.
5409
d82a5bcc
ILT
5410 * options.h (class General_options): Add --fatal-warnings.
5411 * main.cc (main): Implement --fatal-warnings.
5412 * errors.h (Errors::warning_count): New function.
5413
f1f70eae
ILT
5414 * options.h (class General_options): Add -Bsymbolic-functions.
5415 * symtab.h (Symbol::is_preemptible): Check for
5416 -Bsymbolic-functions.
5417
8825ac63
ILT
54182008-05-05 Ian Lance Taylor <iant@google.com>
5419
d98bc257
ILT
5420 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5421 as noVARNAME rather than no-VARNAME.
5422 (class General_options): Add option -z combreloc.
5423 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5424 get_address.
5425 (Output_reloc::sort_before) [SHT_REL]: New function.
5426 (Output_reloc::sort_before) [SHT_RELA]: New function.
5427 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5428 Sort_relocs_comparison.
5429 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5430 parameter. Change all callers.
5431 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5432 sort_relocs parameter. Change all callers.
5433 * output.cc (Output_reloc::get_address): New function, broken out
5434 of write_rel.
5435 (Output_reloc::write_rel): Call it.
5436 (Output_reloc::compare): New function.
5437 (Output_data_reloc_base::do_write): Optionally sort relocs.
5438
60b2b4e7
ILT
5439 * configure.ac: If targ_extra_obj is set, link it in.
5440 * configure.tgt: Initialize all variables.
5441 (x86_64*): Set targ_extra_obj and targ_extra_size.
5442 * configure: Rebuild.
5443
8825ac63
ILT
5444 * object.cc (Sized_relobj::include_section_group): Adjust section
5445 indexes read from group data. Build vector to pass to
5446 layout_group.
5447 * layout.cc (Layout::layout_group): Add flags and shndxes
5448 parameters. Remove contents parameter. Change caller. Update
5449 explicit instantiations.
5450 * layout.h (class Layout): Update layout_group declaration.
5451 * output.cc (Output_data_group::Output_data_group): Add flags and
5452 input_shndxes parameters. Remove contents parameter. Change
5453 caller.
5454 (Output_data_group::do_write): Change input_sections_ to
5455 input_shndxes_.
5456 * output.h (class Output_data_group): Update constructor
5457 declaration. Rename input_sections_ to input_shndxes_.
5458 * testsuite/many_sections_test.cc: Add template.
5459
e94cf127
CC
54602008-04-30 Cary Coutant <ccoutant@google.com>
5461
4418b2d5
CC
5462 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5463
e94cf127
CC
5464 * layout.cc (Layout::include_section): Refactored check for debug
5465 info section.
5466 (Layout::add_comdat): Add new parameters. Change type
5467 of signature parameter. Add object and shndx to signatures table.
5468 (Layout::find_kept_object): New function.
5469 * layout.h: Include <cstring>.
5470 (Layout::is_debug_info_section): New function.
5471 (Layout::add_comdat): Add new parameters.
5472 (Layout::find_kept_object): New function.
5473 (Layout::Kept_section): New struct.
5474 (Layout::Signatures): Change type of map range.
5475 * object.cc (Relobj::output_section_address): New function.
5476 (Sized_relobj::include_section_group): Add new parameters. Change
5477 calls to Layout::add_comdat. Change to build table of kept comdat
5478 groups and table mapping discarded sections to kept sections.
5479 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5480 (Sized_relobj::do_layout): Change calls to include_section_group and
5481 include_linkonce_section.
5482 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5483 value to zero when section is discarded.
5484 (Sized_relobj::map_to_kept_section): New function.
5485 * object.h (Relobj::output_section_address): New function.
5486 (Relobj::Comdat_group): New type.
5487 (Relobj::find_comdat_group): New function.
5488 (Relobj::Comdat_group_table): New type.
5489 (Relobj::Kept_comdat_section): New type.
5490 (Relobj::Kept_comdat_section_table): New type.
5491 (Relobj::add_comdat_group): New function.
5492 (Relobj::set_kept_comdat_section): New function.
5493 (Relobj::get_kept_comdat_section): New function.
5494 (Relobj::comdat_groups_): New field.
5495 (Relobj::kept_comdat_sections_): New field.
5496 (Symbol_value::input_value): Update comment.
5497 (Sized_relobj::map_to_kept_section) New function.
5498 (Sized_relobj::include_linkonce_section): Add new parameter.
5499 * target-reloc.h (Comdat_behavior): New type.
5500 (get_comdat_behavior): New function.
5501 (relocate_section): Add code to map a discarded section to the
5502 corresponding kept section when applying a relocation.
5503
e4e5049b
CS
55042008-04-30 Craig Silverstein <csilvers@google.com>
5505
5506 * dwarf_reader.cc (next_generation_count): New static var.
5507 (Addr2line_cache_entry): New struct.
5508 (addr2line_cache): New static var.
5509 (Dwarf_line_info::one_addr2line): Added caching.
5510 (Dwarf_line_info::clear_addr2line_cache): New function.
5511 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5512 cache-size parameter.
5513 (Dwarf_line_info::one_addr2line_cache): New function.
5514 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5515 new cache-size argument to one_addr2line(), and clear cache.
5516
d09e9154
CC
55172008-04-28 Cary Coutant <ccoutant@google.com>
5518
5519 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5520 R_386_PC8 relocations.
5521
7ef73768
ILT
55222008-04-23 Ian Lance Taylor <iant@google.com>
5523
55438702
ILT
5524 * object.cc (Sized_relobj::include_section_group): Check for
5525 invalid section group.
5526
c165fb93
ILT
5527 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5528 header size.
5529
7ef73768
ILT
5530 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5531 than read for file header.
5532 * archive.cc (Archive::include_member): Likewise.
5533
6194aaab
L
55342008-04-23 Paolo Bonzini <bonzini@gnu.org>
5535
5536 * aclocal.m4: Regenerate.
5537 * configure: Regenerate.
5538
d491d34e
ILT
55392008-04-19 Ian Lance Taylor <iant@google.com>
5540
5ea2bac6
ILT
5541 * version.cc (version_string): Bump to 1.6.
5542
7bc3e21a
ILT
5543 * testsuite/Makefile.am (many_sections_r_test): New target.
5544 (many_sections_r_test_SOURCES): Remove.
5545 (many_sections_r_test_DEPENDENCIES): Remove.
5546 (many_sections_r_test_LDFLAGS): Remove.
5547 (many_sections_r_test_LDADD): Remove.
5548
7fcd3aa9
ILT
5549 * object.cc (Sized_relobj::do_add_symbols): Always pass
5550 local_symbol_count_ to add_from_relobj.
5551
4c94d6ae
ILT
5552 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5553 every thousand variables.
5554 * testsuite/Makefile.in: Rebuild.
5555
d491d34e
ILT
5556 * object.cc (Xindex::initialize_symtab_xindex): New function.
5557 (Xindex::read_symtab_xindex): New function.
5558 (Xindex::sym_xindex_to_shndx): New function.
5559 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5560 available.
5561 (Sized_relobj::do_initialize_xindex): New function.
5562 (Sized_relobj::do_read_symbols): Adjust section links.
5563 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5564 parameter. Change all callers.
5565 (Sized_relobj::include_section_group): Adjust section links and
5566 symbol section indexes.
5567 (Sized_relobj::do_layout): Adjust section links.
5568 (Sized_relobj::do_count_local_symbols): Adjust section links and
5569 symbol section indexes.
5570 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5571 ordinary and special symbols.
5572 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5573 dynsym_xindex parameters. Change all callers. Adjust section
5574 links. Use SHN_XINDEX when needed.
5575 (Sized_relobj::get_symbol_location_info): Adjust section links.
5576 Don't get fooled by special symbols.
5577 * object.h (class Xindex): Define.
5578 (class Object): Add xindex_ parameter. Declare virtual functoin
5579 do_initialize_xindex.
5580 (Object::adjust_sym_shndx): New function.
5581 (Object::set_xindex): New protected function.
5582 (class Symbol_value): Add is_ordinary_shndx_ field.
5583 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5584 (Symbol_value::value): Assert ordinary section.
5585 (Symbol_value::initialize_input_to_output_map): Likewise.
5586 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5587 Change all callers.
5588 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5589 all callers.
5590 (class Sized_relobj): Update declarations.
5591 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5592 parameter. Change all callers.
5593 (Sized_relobj::adjust_shndx): New function.
5594 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5595 field.
5596 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5597 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5598 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5599 (Sized_dynobj::read_dynsym_section): Adjust section links.
5600 (Sized_dynobj::read_dynamic): Likewise.
5601 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5602 section links.
5603 (Sized_dynobj::do_initialize_xindex): New function.
5604 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5605 do_initialize_xindex.
5606 (Sized_dynobj::adjust_shndx): New function.
5607 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5608 dynsym_xindex_ fields.
5609 (Layout::finalize): Add a call to set_section_indexes before
5610 creating the symtab sections.
5611 (Layout::set_section_indexes): Don't do anything if the section
5612 already has a section index.
5613 (Layout::create_symtab_sections): Add shnum parameter. Change
5614 caller. Create .symtab_shndx section if needed.
5615 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5616 caller.
5617 (Layout::allocated_output_section_count): New function.
5618 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5619 needed.
5620 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5621 fields. Update declarations.
5622 (Layout::symtab_xindex): New function.
5623 (Layout::dynsym_xindex): New function.
5624 (class Write_symbols_task): Add layout_ field.
5625 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5626 Change caller.
5627 * output.cc (Output_section_headers::Output_section_headers): Add
5628 shstrtab_section parameter. Change all callers.
5629 (Output_section_headers::do_sized_write): Store overflow values
5630 for section count and section string table section index in
5631 section header zero.
5632 (Output_file_header::do_sized_write): Check for overflow of
5633 section count and section string table section index.
5634 (Output_symtab_xindex::do_write): New function.
5635 (Output_symtab_xindex::endian_do_write): New function.
5636 * output.h (class Output_section_headers): Add shstrtab_section_.
5637 Update declarations.
5638 (class Output_symtab_xindex): Define.
5639 (Output_section::has_out_shndx): New function.
5640 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5641 field.
5642 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5643 Change all callers.
5644 (Sized_symbol::init): Likewise.
5645 (Symbol::output_section): Check for ordinary symbol.
5646 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5647 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5648 callers.
5649 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5650 Change all callers. Simplify handling of symbols from sections
5651 not included in the link.
5652 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5653 distinction.
5654 (Weak_alias_sorter::operator()): Assert that symbols are
5655 ordinary.
5656 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5657 distinction.
5658 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5659 parameters. Change all callers.
5660 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5661 symbol distinction. Use SHN_XINDEX when needed.
5662 (Symbol_table::write_section_symbol): Add symtab_xindex
5663 parameter. Change all callers.
5664 (Symbol_table::sized_write_section_symbol): Likewise. Use
5665 SHN_XINDEX when needed.
5666 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5667 declarations.
5668 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5669 (Symbol::is_defined): Check is_ordinary.
5670 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5671 (Symbol::is_absolute, Symbol::is_common): Likewise.
5672 (class Sized_symbol): Update declarations.
5673 (class Symbol_table): Update declarations.
5674 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5675 parameters. Change all callers.
5676 (Sized_symbol::override): Likewise.
5677 (Symbol_table::override): Likewise.
5678 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5679 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5680 is_ordinary, and orig_st_shndx parameters. Change all callers.
5681 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5682 to be in an ordinary section.
5683 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5684 object and is_ordinary parameters. Change all callers.
5685 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5686 Change all callers. Don't add undefined or non-ordinary symbols
5687 to reloc_map_.
5688 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5689 Change all callers.
5690 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5691 declarations.
5692 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5693 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5694 (Sized_relobj::relocate_sections): Likewise.
5695 * target-reloc.h (scan_relocs): Adjust section symbol index.
5696 (scan_relocatable_relocs): Likewise.
5697 * i386.cc (Scan::local): Check for ordinary symbols.
5698 * sparc.cc (Scan::local): Likewise.
5699 * x86_64.cc (Scan::local): Likewise.
5700 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5701 to symbol_section_and_value.
5702 * testsuite/many_sections_test.cc: New file.
5703 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5704 (check_PROGRAMS): Add many_sections_test.
5705 (many_sections_test_SOURCES): Define.
5706 (many_sections_test_DEPENDENCIES): Define.
5707 (many_sections_test_LDFLAGS): Define.
5708 (BUILT_SOURCES): Add many_sections_define.h.
5709 (many_sections_define.h): New target.
5710 (BUILT_SOURCES): Add many_sections_check.h.
5711 (many_sections_check.h): New target.
5712 (check_PROGRAMS): Add many_sections_r_test.
5713 (many_sections_r_test_SOURCES): Define.
5714 (many_sections_r_test_DEPENDENCIES): Define.
5715 (many_sections_r_test_LDFLAGS): Define.
5716 (many_sections_r_test_LDADD): Define.
5717 (many_sections_r_test.o): New target.
5718 * testsuite/Makefile.in: Rebuild.
5719
c5818ff1
CC
57202008-04-17 Cary Coutant <ccoutant@google.com>
5721
5722 * errors.cc (Errors::info): New function.
5723 (gold_info): New function.
5724 * errors.h (Errors::info): New function.
5725 * gold.h (gold_info): New function.
5726 * object.cc (Input_objects::add_object): Print trace output.
5727 * options.cc (options::parse_set): New function.
5728 (General_options::parse_wrap): Deleted.
5729 (General_options::General_options): Deleted initializer.
5730 * options.h (options::String_set): New typedef.
5731 (options::parse_set): New function.
5732 (DEFINE_set): New macro.
5733 (General_options::wrap): Changed to use DEFINE_set. Changed
5734 callers of any_wrap_symbols and is_wrap_symbol.
5735 (General_options::trace, General_options::trace_symbol):
5736 New options.
5737 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5738 (General_options::wrap_symbols_): Deleted.
5739 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5740
b5be4a7c
DM
57412008-04-17 David S. Miller <davem@davemloft.net>
5742
5743 * options.cc (General_options::parse_V): New function.
5744 * options.h: Add entries for -V and -Qy.
5745
155a0dd7
ILT
57462008-04-17 Ian Lance Taylor <iant@google.com>
5747
5748 * common.cc (Symbol_table::allocate_commons): Remove options
5749 parameter. Change caller.
5750 (Symbol_table::do_allocate_commons): Remove options parameter.
5751 Change caller. Just call do_allocate_commons_list twice.
5752 (Symbol_table::do_allocate_commons_list): New function, broken out
5753 of do_allocate_commons.
5754 * common.h (class Allocate_commons_task): Remove options_ field.
5755 Update constructor.
5756 * symtab.cc (Symbol_table::Symbol_table): Initialize
5757 tls_commons_.
5758 (Symbol_table::add_from_object): Put TLS common symbols on
5759 tls_commons_ list.
5760 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5761 which are IN_OUTPUT_DATA.
5762 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5763 allocate_commons and do_allocate_commons declarations. Declare
5764 do_allocate_commons_list.
5765 * gold.cc (queue_middle_tasks): Update creation of
5766 Allocate_commons_task to not pass options.
5767 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5768 (TLS_TEST_C_FLAGS): New variable.
5769 (tls_test_c_pic.o): New target.
5770 (tls_test_shared.so): Link in tls_test_c_pic.o.
5771 (tls_test_c_pic_ie.o): New target.
5772 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5773 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5774 (tls_test_c.o): New target.
5775 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5776 (tls_pic_test_LDADD): Likewise.
5777 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5778 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5779 (tls_test_c_gnu2.o): New target.
5780 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5781 tls_test_c_gnu2.o.
5782 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5783 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5784 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5785 * testsuite/tls_test.cc: Include "config.h".
5786 (t_last): Call t11_last.
5787 * testsuite/tls_test.h (t11, t11_last): Declare.
5788 * testsuite/tls_test_c.c: New file.
5789 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5790 * configure.ac: Check for OpenMP support.
5791 * configure, config.in, Makefile.in: Rebuild.
5792 * testsuite/Makefile.in: Rebuild.
5793
edfbb029
CC
57942008-04-16 Cary Coutant <ccoutant@google.com>
5795
5796 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5797 (Target_i386::tls_base_symbol_defined_): New field.
5798 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5799 (Target_i386::Scan::global): Likewise.
5800 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5801 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5802 (Target_x86_64::tls_base_symbol_defined_): New field.
5803 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5804 (Target_x86_64::Scan::global): Likewise.
5805
f3c69fca
CC
58062008-04-16 Cary Coutant <ccoutant@google.com>
5807
5808 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5809 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5810 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5811 building shared libraries.
5812 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5813 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5814 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5815 * testsuite/Makefile.in: Rebuild.
5816 * testsuite/weak_undef.h: New file.
5817 * testsuite/weak_undef_file1.cc: Add extra test cases.
5818 * testsuite/weak_undef_file2.cc: Likewise.
5819 * testsuite/weak_undef_test.cc: Likewise.
5820
7c414435
DM
58212008-04-16 David S. Miller <davem@davemloft.net>
5822
32b769e1
DM
5823 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5824 Add issued_non_pic_error_ field. Declare check_non_pic.
5825 (Target_sparc::Scan::check_non_pic): New function.
5826 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5827 (Target_sparc::Scan::global): Likewise.
5828
11936fb1
DM
5829 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5830 * configure: Rebuild.
5831
7c414435
DM
5832 * options.h (DEFINE_enable): New macro.
5833 (new_dtags): New enable option.
5834 (initfirst, interpose, loadfltr, nodefaultlib,
5835 nodelete, nodlopen, nodump): New -z options.
5836 * layout.cc (Layout:finish_dynamic_section): If new
5837 dtags enabled, emit DT_RUNPATH. Also, emit a
5838 DT_FLAGS_1 containing any specified -z flags.
5839
85c7bf8b
ILT
58402008-04-16 Ian Lance Taylor <iant@google.com>
5841
12c0daef
ILT
5842 * copy-relocs.cc: New file.
5843 * copy-relocs.h: New file.
5844 * reloc.cc: Remove Copy_relocs code.
5845 * reloc.h: Likewise.
5846 * reloc-types.h (struct Reloc_types) [both versions]: Add
5847 get_reloc_addend_noerror.
5848 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5849 variants of add_global which take an addend which must be zero.
5850 * i386.cc: Include "copy-relocs.h".
5851 (class Target_i386): Change type of copy_relocs_ to variable,
5852 update initializer.
5853 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5854 Change all callers.
5855 (Target_i386::do_finalize_sections): Change handling of
5856 copy_relocs_.
5857 * sparc.cc: Include "copy-relocs.h".
5858 (class Target_sparc): Change type of copy_relocs_ to variable,
5859 update initializer.
5860 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5861 Change all callers.
5862 (Target_sparc::do_finalize_sections): Change handling of
5863 copy_relocs_.
5864 * x86_64.cc: Include "copy-relocs.h".
5865 (class Target_x86_64): Change type of copy_relocs_ to variable,
5866 update initializer.
5867 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5868 class. Change all callers.
5869 (Target_x86_64::do_finalize_sections): Change handling of
5870 copy_relocs_.
5871 * Makefile.am (CCFILES): Add copy-relocs.cc.
5872 (HFILES): Add copy-relocs.h.
5873
4f4995b6
ILT
5874 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5875
85c7bf8b
ILT
5876 * testsuite/script_test_4.sh: Permit leading zeroes.
5877
4f2a9edd
ILT
58782008-04-15 Ian Lance Taylor <iant@google.com>
5879
e6188289
ILT
5880 * script-sections.cc (Script_sections::create_segments): Use
5881 header_size_adjustment even when there is enough room for the
5882 headers.
5883 * testsuite/script_test_4.sh: New file.
5884 * testsuite/script_test_4.t: New file.
5885 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5886 (check_DATA): Add script_test_4.stdout.
5887 (MOSTLYCLEANFILES): Likewise.
5888 (script_test_4): New target.
5889 (script_test_4.stdout): New target.
5890 * testsuite/Makefile.in: Rebuild.
5891
4f2a9edd
ILT
5892 * sparc.cc: Add definitions for Output_data_plt_sparc class
5893 constants.
5894
f5314dd5
DM
58952008-04-14 David S. Miller <davem@davemloft.net>
5896
5897 * sparc.cc: New file.
5898 * Makefile.am (TARGETSOURCES): Add sparc.cc
5899 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5900 * configure.tgt: Document targ_extra_size and
5901 targ_extra_big_endian. Add entries for sparc-* and
5902 sparc64-*.
5903 * configure.ac: Handle targ_extra_size and
5904 targ_extra_big_endian.
5905 * Makefile.in: Rebuild.
5906 * configure: Likewise.
5907 * po/POTFILES.in: Likewise.
5908 * po/gold.pot: Likewise.
5909
154e0e9a
ILT
59102008-04-14 Ian Lance Taylor <iant@google.com>
5911
5912 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5913 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5914 in the name/type/flags to section mapping. Don't call
5915 allocate_output_section.
5916 (Layout::choose_output_section): Change parameter from adjust_name
5917 to is_input_section. Don't permit input sections after sections
5918 are attached to segments. Don't call allocate_output_section.
5919 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5920 not write_enable_output_section.
5921 (Layout::make_output_section): Don't push to
5922 unattached_section_list_ nor call attach_to_segment. Call
5923 attach_section_to_segment if sections are attached.
5924 (Layout::attach_sections_to_segments): New function.
5925 (Layout::attach_section_to_segment): New function.
5926 (Layout::attach_allocated_section_to_segment): Rename from
5927 attach_to_segment. Remove flags parameter.
5928 (Layout::allocate_output_section): Remove function.
5929 (Layout::write_enable_output_section): Remove function.
5930 * layout.h (class Layout): Update for above changes. Add new
5931 field sections_are_attached_.
5932 * output.h (Output_section::update_flags_for_input_section): New
5933 function.
5934 * output.cc (Output_section::add_input_section): Call
5935 update_flags_for_input_section.
5936 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5937
009a67a2
CC
59382008-04-11 Cary Coutant <ccoutant@google.com>
5939
5940 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5941 thought unnecessary.
5942 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5943
759b1a24
ILT
59442008-04-11 Ian Lance Taylor <iant@google.com>
5945
5946 * output.h (class Output_section_data): Remove inline definition
5947 of set_addralign.
5948 * output.cc (Output_section_data::set_addralign): New function.
5949
c2b45e22
CC
59502008-04-11 Cary Coutant <ccoutant@google.com>
5951
5952 Add support for TLS descriptors for i386 and x86_64.
5953 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5954 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5955 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5956 GOT_TYPE_TLS_DESC.
5957 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5958 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5959 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5960 relocations.
5961 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5962 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5963 Fix problem with initial-exec relocations.
5964 (Target_i386::Relocate::relocate_tls): Likewise.
5965 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5966 relaxation.
5967 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5968 support for section-plus-offset dynamic table entries.
5969 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5970 (Output_data_dynamic::Dynamic_entry): Add support for
5971 section-plus-offset dynamic table entries.
5972 (Output_data_dynamic::Classification): Likewise.
5973 (Output_data_dynamic::classification_): Renamed offset_.
5974 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5975 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5976 (Target_x86_64::make_plt_section): New function.
5977 (Target_x86_64::reserve_tlsdesc_entries): New function.
5978 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5979 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5980 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5981 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5982 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5983 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5984 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5985 add extra PLT entry for TLS descriptors.
5986 (Output_data_plt_x86_64::got_): New field.
5987 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5988 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5989 fields.
5990 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5991 descriptors.
5992 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5993 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5994 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5995 R_386_TLS_DESC_CALL relocations.
5996 (Target_x86_64::Scan::global): Likewise.
5997 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5998 for TLS descriptors.
5999 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6000 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6001 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6002 GD-to-IE relaxation.
6003 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6004 and TLS_DESCRIPTORS.
6005 * Makefile.in: Rebuild.
6006 * configure: Rebuild.
6007 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6008 (tls_test_shared2.so): New target.
6009 (tls_shared_gd_to_ie_test_SOURCES): New variable.
6010 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6011 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6012 (tls_shared_gd_to_ie_test_LDADD): New variable.
6013 (tls_shared_gnu2_gd_to_ie_test): New target.
6014 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6015 New targets.
6016 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6017 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6018 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6019 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6020 (tls_shared_gnu2_test): New target.
6021 (tls_test_gnu2_shared.so): New target.
6022 (tls_shared_gnu2_test_SOURCES): New variable.
6023 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6024 (tls_shared_gnu2_test_LDFLAGS): New variable.
6025 (tls_shared_gnu2_test_LDADD): New variable.
6026 * testsuite/Makefile.in: Rebuild.
6027 * testsuite/Makefile.
6028
83bfb6b7
ILT
60292008-04-11 Ian Lance Taylor <iant@google.com>
6030
6031 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6032 justsyms.t.
6033 * testsuite/Makefile.in: Rebuild.
6034
6035 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6036 long.
6037 * testsuite/script_test_2.cc (main): Adjust test.
6038
706e1f5e
ILT
60392008-04-11 David S. Miller <davem@davemloft.net>
6040 Ian Lance Taylor <iant@google.com>
6041
6042 * options.h (General_options): Add entries for '-Y' and
6043 '-relax'.
6044 * options.cc (General_options:finalize): If -Y was used, add those
6045 entries to the library path instead of the default "/lib" and
6046 "/usr/lib".
6047
7c98e6bb
DM
60482008-04-11 David S. Miller <davem@davemloft.net>
6049
6050 * testsuite/justsyms.t: Start at 0x100.
6051 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
6052 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6053 long.
6054 * testsuite/script_test_2.cc: Adjust string and section length
6055 checks.
7c98e6bb 6056
99a37bfd
ILT
60572008-04-09 Ian Lance Taylor <iant@google.com>
6058
2cefc357
ILT
6059 PR gold/5996
6060 * script-sections.cc (Sections_element::allocate_to_segment): Add
6061 orphan parameter.
6062 (Output_section_definition::allocate_to_segment): Likewise.
6063 (Orphan_output_section::allocate_to_segment): Likewise.
6064 (Script_sections::attach_sections_using_phdrs_clause): Don't
6065 propagate non-PT_LOAD segments to orphan sections.
6066 * testsuite/Makefile.am (script_test_3.stdout): Generate using
6067 readelf rather than objdump.
6068 * testsuite/script_test_3.sh: Adjust accordingly. Test that
6069 .interp section and PT_INTERP segment are the same size.
6070 * testsuite/Makefile.in: Rebuild.
6071
99a37bfd
ILT
6072 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6073 aliases for symbols defined in the same object.
6074 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6075 (weak_alias_test_SOURCES): New variable.
6076 (weak_alias_test_DEPENDENCIES): New variable.
6077 (weak_alias_test_LDFLAGS): New variable.
6078 (weak_alias_test_LDADD): New variable.
6079 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6080 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6081 (weak_alias_test_3.o): New target.
6082 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6083 * testsuite/weak_alias_test_main.cc: New file.
6084 * testsuite/weak_alias_test_1.cc: New file.
6085 * testsuite/weak_alias_test_2.cc: New file.
6086 * testsuite/weak_alias_test_3.cc: New file.
6087
780e49c5
ILT
60882008-04-08 Ian Lance Taylor <iant@google.com>
6089
cdb0b8f5
ILT
6090 * options.h (class General_options): Add --noinhibit-exec option.
6091 * main.cc (main): Check --noinhibit-exec.
6092
0864d551
ILT
6093 * options.h (class General_options): Define --wrap as a special
6094 option. Add wrap_symbols_ field.
6095 (General_options::any_wrap_symbols): New function.
6096 (General_options::is_wrap_symbol): New function.
6097 * options.cc (General_options::parse_wrap): New function.
6098 (General_options::General_options): Initialize wrap_symbols_.
6099 * symtab.cc (Symbol_table::wrap_symbol): New function.
6100 (Symbol_table::add_from_object): Handle --wrap.
6101 * symtab.h (class Symbol_table): Declare wrap_symbol.
6102 * target.h (Target::wrap_char): New function.
6103 (Target::Target_info): Add wrap_char field.
6104 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6105 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6106 * testsuite/testfile.cc (Target_test::test_target_info):
6107 Likewise.
6108
789aa6de
ILT
6109 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6110 there is one.
6111
2c38906f
ILT
6112 * layout.h (class Layout): Add added_eh_frame_data_ field.
6113 * layout.cc (Layout::Layout): Initialize new field.
6114 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6115 output section until we find a section we merged successfully.
6116 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6117 that the size be non-zero.
6118
780e49c5
ILT
6119 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6120 qualifier.
6121
7fcd0256
ILT
61222008-04-08 Craig Silverstein <csilvers@google.com>
6123
6124 * configure.ac: Export new conditional variable HAVE_ZLIB.
6125 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6126 on HAVE_ZLIB.
6127 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6128 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6129
6835af53
ILT
61302008-04-07 Ian Lance Taylor <iant@google.com>
6131
e24f324c
ILT
6132 * version.cc (version_string): Set to "1.5".
6133
a036edd8
ILT
6134 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6135 Add issued_non_pic_error_ field. Declare check_non_pic.
6136 (Target_x86_64::Scan::check_non_pic): New function.
6137 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6138 (Target_x86_64::Scan::global): Likewise.
6139
624f8810
ILT
6140 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6141 addend parameter. Change caller. Handle merge sections.
6142 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6143 Address to Addend. Don't add in the result of
6144 local_section_offset, pass down the addend and use the returned
6145 value.
6146 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6147 Update declarations of local_section_offset and symbol_value.
6148 * testsuite/two_file_test_1.cc (t18): New function.
6149 * testsuite/two_file_test_2.cc (f18): New function.
6150 * testsuite/two_file_test_main.cc (main): Call t18.
6151 * testsuite/two_file_test.h (t18, f18): Declare.
6152
6835af53
ILT
6153 * configure.ac: Don't test for objdump, c++filt, or readelf.
6154 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6155 conditionals.
6156 (TEST_READELF): New variable.
6157 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6158 (check_PROGRAMS): Add two_file_strip_test.
6159 (two_file_strip_test): New target.
6160 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6161 (two_file_same_shared_strip_test_SOURCES): New variable.
6162 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6163 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6164 (two_file_same_shared_strip_test_LDADD): New variable.
6165 (two_file_shared_strip.so): New target.
6166 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6167 (ver_test_5.syms, ver_test_7.syms): Likewise.
6168 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6169 (strip_test_3.stdout): Use TEST_OBJDUMP.
6170 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6171
86925eef
CC
61722008-04-04 Cary Coutant <ccoutant@google.com>
6173
6174 * symtab.h (Symbol::is_weak_undefined): New function.
6175 (Symbol::is_strong_undefined): New function.
6176 (Symbol::is_absolute): New function.
6177 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6178 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6179 absolute symbols.
6180 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6181 (weak_undef_test): New target.
6182 * testsuite/Makefile.in: Rebuild.
6183 * testsuite/weak_undef_file1.cc: New file.
6184 * testsuite/weak_undef_file2.cc: New file.
6185 * testsuite/weak_undef_test.cc: New file.
6186
126f3ece
ILT
61872008-04-03 Craig Silverstein <csilvers@google.com>
6188
6189 * compressed_output.h (class Output_compressed_section): Use
6190 unsigned buffer.
6191 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6192 add zlib header.
6193 (zlib_compressed_suffix): Removed.
6194 (Output_compressed_section::set_final_data_size): Use unsigned
6195 buffers.
6196 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6197 Fix linker invocation.
6198 (flagstest_o_specialfile_and_compress_debug_sections):
6199 Likewise.
6200 * testsuite/Makefile.in: Regenerated.
6201
deae2a14
DM
62022008-04-02 David S. Miller <davem@davemloft.net>
6203
6204 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6205 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6206
70752818
ILT
62072008-04-02 Craig Silverstein <csilvers@google.com>
6208
6209 * TODO: New file.
6210
39d0cb0e
ILT
62112008-04-02 Ian Lance Taylor <iant@google.com>
6212
6213 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6214 parameters. Update for new key type to views_. Change all
6215 callers.
6216 (File_read::read): Adjust for byteshift in returned view.
6217 (File_read::add_view): New function, broken out of
6218 find_and_make_view.
6219 (File_read::make_view): New function, broken out of
6220 find_and_make_view.
6221 (File_read::find_or_make_view): Add offset and aligned
6222 parameters. Rewrite accordingly. Change all callers.
6223 (File_read::get_view): Add offset and aligned parameters. Adjust
6224 for byteshift in return value.
6225 (File_read::get_lasting_view): Likewise.
6226 * fileread.h (class File_read): Update declarations.
6227 (class File_read::View): Add byteshift_ field. Add byteshift to
6228 constructor. Add byteshift method.
6229 * archive.h (Archive::clear_uncached_views): New function.
6230 (Archive::get_view): Add aligned parameter. Change all callers.
6231 * object.h (Object::get_view): Add aligned parameter. Change all
6232 callers.
6233 (Object::get_lasting_view): Likewise.
6234
6235 * fileread.cc (File_read::release): Don't call clear_views if
6236 there are multiple objects.
6237 * fileread.h (File_read::clear_uncached_views): New function.
6238 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6239 on the archive.
6240
a1207466
CC
62412008-03-31 Cary Coutant <ccoutant@google.com>
6242
6243 Add thin archive support.
6244 * archive.cc (Archive::armagt): New const.
6245 (Archive::setup): Remove task parameter and calls to unlock.
6246 (Archive::unlock_nested_archives): New function.
6247 (Archive::read_header): Add nested_off parameter. Change
6248 all callers.
6249 (Archive::interpret_header): Likewise.
6250 (Archive::include_all_members): Change to handle thin
6251 archives.
6252 (Archive::include_member): Likewise.
6253 * archive.h (Archive::Archive): Add new parameters and
6254 initializers.
6255 (Archive::armagt): New const.
6256 (Archive::setup): Remove task parameter.
6257 (Archive::unlock_nested_archives): New function.
6258 (Archive::read_header): Add nested_off parameter.
6259 (Archive::interpret_header): Likewise.
6260 (Archive::Nested_archive_table): New typedef.
6261 (Archive::is_thin_archive_): New field.
6262 (Archive::nested_archives_): New field.
6263 (Archive::options_): New field.
6264 (Archive::dirpath_): New field.
6265 (Archive::task_): New field.
6266 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6267 for thin archives. Pass additional parameters to
6268 Archive::Archive. Unlock the archive file after calling
6269 Archive::setup.
cd536b21 6270
479f6503
ILT
62712008-03-29 Ian Lance Taylor <iant@google.com>
6272
686c8caf
ILT
6273 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6274 version symbol to be local.
6275 * testsuite/ver_test_4.sh: New file.
6276 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6277 (check_DATA): Add ver_test_4.syms.
6278 (ver_test_4.syms): New target.
6279 * testsuite/Makefile.in: Rebuild.
6280
ab794b6b
ILT
6281 * output.cc
6282 (Output_section::Input_section_sort_entry::has_priority): New
6283 function.
6284 (Output_section::Input_section_sort_entry::match_file_name): New
6285 function.
6286 (Output_section::Input_section_sort_entry::match_section_name):
6287 Remove.
6288 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6289 Remove.
6290 (Output_section::Input_section_sort_entry::match_section_file):
6291 Remove.
6292 (Output_section::Input_section_sort_compare::operator()): Rewrite
6293 using new Input_section_sort_entry functions. Sort crtbegin and
6294 crtend first. Sort sections with no priority before sections with
6295 a priority.
6296 * testsuite/initpri1.c (d3): Check j != 4.
6297 (cd5): New constructor/destructor function.
6298 (main): Check j != 2.
6299
479f6503
ILT
6300 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6301 new symbol when resolving, don't call set_is_default.
6302 * testsuite/ver_test_7.cc: New file.
6303 * testsuite/ver_test_7.sh: New file.
6304 * testsuite/Makefile.am (ver_test_7.so): New target.
6305 (ver_test_7.o): New target.
6306 (check_SCRIPTS): Add ver_test_7.sh.
6307 (check_DATA): Add ver_test_7.syms.
6308 (ver_test_7.syms): New target.
6309
2fd32231
ILT
63102008-03-28 Ian Lance Taylor <iant@google.com>
6311
6312 * layout.cc (Layout::layout): If we see an input section with a
6313 name that needs sorting, set the must_sort flag for the output
6314 section.
6315 (Layout::make_output_section): If the name of the output section
6316 indicates that it might require sorting, set the may_sort flag.
6317 * output.h (Output_section::may_sort_attached_input_sections): New
6318 function.
6319 (Output_section::set_may_sort_attached_input_sections): New
6320 function.
6321 (Output_section::must_sort_attached_input_sections): New
6322 function.
6323 (Output_section::set_must_sort_attached_input_sections): New
6324 function.
6325 (class Output_section): Declare Input_section_sort_entry. Define
6326 Input_section_sort_compare. Declare
6327 sort_attached_input_sections. Add new fields:
6328 may_sort_attached_input_sections_,
6329 must_sort_attached_input_sections_,
6330 attached_input_sections_are_sorted_.
6331 * output.cc (Output_section::Output_section): Initialize new
6332 fields.
6333 (Output_section::add_input_section): Add an entry to
6334 input_sections_ if may_sort or must_sort are true.
6335 (Output_section::set_final_data_size): Call
6336 sort_attached_input_sections if necessary.
6337 (Output_section::Input_section_sort_entry): Define new class.
6338 (Output_section::Input_section_sort_compare::operator()): New
6339 function.
6340 (Output_section::sort_attached_input_sections): New function.
6341 * configure.ac: Check whether the compiler supports constructor
6342 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6343 * testsuite/initpri1.c: New file.
6344 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6345 CONSTRUCTOR_PRIORITY.
6346 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6347 (initpri1_LDFLAGS): New variable.
6348 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6349
18e6b24e
ILT
63502008-03-27 Ian Lance Taylor <iant@google.com>
6351
49bdd526
ILT
6352 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6353 * testsuite/common_test_1.c: New file.
6354 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6355 (common_test_1_SOURCES): New variable.
6356 (common_test_1_DEPENDENCIES): New variable.
6357 (common_test_1_LDFLAGS): New variable.
6358
18e6b24e
ILT
6359 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6360 and commons_ correctly when NAME/VERSION does not override
6361 NAME/NULL.
6362 * testsuite/ver_test_6.c: New file.
6363 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6364 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6365 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6366
04bf7072
ILT
63672008-03-26 Ian Lance Taylor <iant@google.com>
6368
5871526f
ILT
6369 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6370 of an undefined symbol from a version script.
6371 * testsuite/Makefile.am (ver_test_5.so): New target.
6372 (ver_test_5.o): New target.
6373 (check_SCRIPTS): Add ver_test_5.sh.
6374 (check_DATA): Add ver_test_5.syms.
6375 (ver_test_5.syms): New target.
6376 * testsuite/ver_test_5.cc: New file.
6377 * testsuite/ver_test_5.script: New file.
6378 * testsuite/ver_test_5.sh: New file.
6379 * Makefile.in, testsuite/Makefile.in: Rebuild.
6380
04bf7072
ILT
6381 PR gold/5986
6382 Fix problems building gold with gcc 4.3.0.
6383 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6384 (gold_error_at_location, gold_warning_at_location): Use it.
6385 * configure.ac: Check whether we can compile and use a template
6386 function with a printf attribute.
6387 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6388 when jumping over bytes.
6389 * object.cc: Instantiate Object::read_section_data.
6390 * debug.h: Include <cstring>
6391 * dwarf_reader.cc: Include <algorithm>
6392 * main.cc: Include <cstring>.
6393 * options.cc: Include <cstring>.
6394 * output.cc: Include <cstring>.
6395 * script.cc: Include <cstring>.
6396 * script.h: Include <string>.
6397 * symtab.cc: Include <cstring> and <algorithm>.
6398 * target-select.cc: Include <cstring>.
6399 * version.cc: Include <string>.
6400 * testsuite/testmain.cc: Include <cstdlib>.
6401 * configure, config.in: Rebuild.
6402
874c5b28
ILT
64032008-03-25 Ian Lance Taylor <iant@google.com>
6404
819d6c3a
ILT
6405 * options.cc: Include "../bfd/bfdver.h".
6406 (options::help): Print bug reporting address.
6407
f4b2c6f5
ILT
6408 * version.cc (print_version): Adjust output for current value of
6409 BFD_VERSION_STRING.
6410
6411 * NEWS: New file.
6412
e96caa79
ILT
6413 * options.cc (options::help): Print list of supported targets.
6414 * target-select.h: Include <vector>.
6415 (class Target_selector): Make machine_, size_, and is_big_endian_
6416 fields const. Add bfd_name_ and instantiated_target_ fields.
6417 (Target_selector::Target_selector): Add bfd_name parameter.
6418 (Target_selector::recognize): Make non-virtual, call
6419 do_recognize.
6420 (Target_selector::recognize_by_name): Make non-virtual, call
6421 do_recognize_by_name.
6422 (Target_selector::supported_names): New function.
6423 (Target_selector::bfd_name): New function.
6424 (Target_selector::do_instantiate_target): New pure virtual
6425 function.
6426 (Target_selector::do_recognize): New virtual function.
6427 (Target_selector::do_recognize_by_name): New virtual function.
6428 (Target_selector::instantiate_target): New private function.
6429 (supported_target_names): Declare.
6430 * target-select.cc (Target_selector::Target_selector): Update for
6431 new parameter and fields.
6432 (select_target_by_name): Check that the name matches before
6433 calling recognize_by_name.
6434 (supported_target_names): New function.
6435 * i386.cc (class Target_selector_i386): Update Target_selector
6436 constructor call. Remove recognize and recognize_by_name. Add
6437 do_instantiate_target.
6438 * x86_64.cc (class Target_selector_x86_64): Likewise.
6439 * testsuite/testfile.cc (class Target_selector_test): Update for
6440 changes to Target_selector.
6441
874c5b28
ILT
6442 * README: Rewrite, with some notes on unsupported features.
6443
0a65a3a7
CC
64442008-03-24 Cary Coutant <ccoutant@google.com>
6445
6446 * i386.cc (Target_i386::Got_type): New enum declaration.
6447 (Target_i386::Scan::local): Updated callers of Output_data_got
6448 member functions.
6449 (Target_i386::Scan::global): Likewise.
6450 (Target_i386::Relocate::relocate): Likewise.
6451 (Target_i386::Relocate::relocate_tls): Likewise.
6452 * object.h (Got_offset_list): New class.
6453 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6454 (Sized_relobj::local_got_offset): Likewise.
6455 (Sized_relobj::set_local_got_offset): Likewise.
6456 (Sized_relobj::local_has_tls_got_offset): Removed.
6457 (Sized_relobj::local_tls_got_offset): Removed.
6458 (Sized_relobj::set_local_tls_got_offset): Removed.
6459 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6460 * output.cc (Output_data_got::add_global): Added got_type parameter.
6461 (Output_data_got::add_global_with_rel): Likewise.
6462 (Output_data_got::add_global_with_rela): Likewise.
6463 (Output_data_got::add_global_pair_with_rel): New function.
6464 (Output_data_got::add_global_pair_with_rela): New function.
6465 (Output_data_got::add_local): Added got_type parameter.
6466 (Output_data_got::add_local_with_rel): Likewise.
6467 (Output_data_got::add_local_with_rela): Likewise.
6468 (Output_data_got::add_local_pair_with_rel): New function.
6469 (Output_data_got::add_local_pair_with_rela): New function.
6470 (Output_data_got::add_global_tls): Removed.
6471 (Output_data_got::add_global_tls_with_rel): Removed.
6472 (Output_data_got::add_global_tls_with_rela): Removed.
6473 (Output_data_got::add_local_tls): Removed.
6474 (Output_data_got::add_local_tls_with_rel): Removed.
6475 (Output_data_got::add_local_tls_with_rela): Removed.
6476 * output.h (Output_data_got::add_global): Added got_type parameter.
6477 (Output_data_got::add_global_with_rel): Likewise.
6478 (Output_data_got::add_global_with_rela): Likewise.
6479 (Output_data_got::add_global_pair_with_rel): New function.
6480 (Output_data_got::add_global_pair_with_rela): New function.
6481 (Output_data_got::add_local): Added got_type parameter.
6482 (Output_data_got::add_local_with_rel): Likewise.
6483 (Output_data_got::add_local_with_rela): Likewise.
6484 (Output_data_got::add_local_pair_with_rel): New function.
6485 (Output_data_got::add_local_pair_with_rela): New function.
6486 (Output_data_got::add_global_tls): Removed.
6487 (Output_data_got::add_global_tls_with_rel): Removed.
6488 (Output_data_got::add_global_tls_with_rela): Removed.
6489 (Output_data_got::add_local_tls): Removed.
6490 (Output_data_got::add_local_tls_with_rel): Removed.
6491 (Output_data_got::add_local_tls_with_rela): Removed.
6492 * resolve.cc (Symbol::override_base_with_special): Removed
6493 reference to has_got_offset_ field.
6494 * symtab.cc (Symbol::init_fields): Replaced initialization
6495 of got_offset_ with got_offsets_. Removed initialization
6496 of has_got_offset_
53fcba31 6497 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
6498 (Symbol::got_offset): Likewise.
6499 (Symbol::set_got_offset): Likewise.
6500 (Symbol::has_tls_got_offset): Removed.
6501 (Symbol::tls_got_offset): Removed.
6502 (Symbol::set_tls_got_offset): Removed.
6503 (Symbol::got_offset_): Removed.
6504 (Symbol::tls_mod_got_offset_): Removed.
6505 (Symbol::tls_pair_got_offset_): Removed.
6506 (Symbol::got_offsets_): New field.
6507 (Symbol::has_got_offset): Removed.
6508 (Symbol::has_tls_mod_got_offset): Removed.
6509 (Symbol::has_tls_pair_got_offset): Removed.
6510 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6511 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6512 member functions.
6513 (Target_x86_64::Scan::global): Likewise.
6514 (Target_x86_64::Relocate::relocate): Likewise.
6515 (Target_x86_64::Relocate::relocate_tls): Likewise.
6516
bd52eafb
BE
65172008-03-25 Ben Elliston <bje@au.ibm.com>
6518
6519 * yyscript.y: Fix spelling error in comment.
6520
8b105e34
ILT
65212008-03-24 Ian Lance Taylor <iant@google.com>
6522
8ed814a9
ILT
6523 * options.h (class General_options): Define build_id option.
6524 * layout.h (class Layout): Declare write_build_id, create_note,
6525 create_build_id. Add build_id_note_ member.
6526 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6527 "libiberty.h", "md5.h", "sha1.h".
6528 (Layout::Layout): Initialize eh_frame_data_,
6529 eh_frame_hdr_section_, and build_id_note_.
6530 (Layout::finalize): Call create_build_id.
6531 (Layout::create_note): New function, broken out of
6532 Layout::create_gold_note.
6533 (Layout::create_gold_note): Call create_note.
6534 (Layout::create_build_id): New function.
6535 (Layout::write_build_id): New function.
6536 (Close_task_runner::run): Call write_build_id.
6537
8b105e34
ILT
6538 * x86_64.cc: Correct license to GPLv3.
6539
086a1841
ILT
65402008-03-23 Ian Lance Taylor <iant@google.com>
6541
6542 * options.cc: Include "demangle.h".
6543 (parse_optional_string): New function.
6544 (parse_long_option): Handle takes_optional_argument.
6545 (parse_short_option): Update dash_z initializer. Handle
6546 takes_optional_argument.
6547 (General_options::General_options): Initialize do_demangle_.
6548 (General_options::finalize): Set do_demangle_. Handle demangling
6549 style.
6550 * options.h (parse_optional_string): Declare.
6551 (struct One_option): Add optional_arg field. Update constructor.
6552 Update call constructor calls. Add takes_optional_argument
6553 function.
6554 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6555 (DEFINE_optional_string): Define.
6556 (General_options::demangle): Change from DEFINE_bool to
6557 DEFINE_optional_string.
6558 (General_options::no_demangle): New function.
6559 (General_options::do_demangle): New function.
6560 (General_options::set_do_demangle): New function.
6561 (General_options::execstack_status_): Move definition to end of
6562 class definition.
6563 (General_options::static_): Likewise.
6564 (General_options::do_demangle_): New field.
6565 * object.cc (big_endian>::get_symbol_location_info): Call
6566 Options::do_demangle, not Options::demangle.
6567 * symtab.cc (demangle): Likewise.
6568
cbb93e63
ILT
65692008-03-22 Ian Lance Taylor <iant@google.com>
6570
6571 * gold.h: Include <cstddef> and <sys/types.h>
6572 * options.h: Include <cstring>.
6573
ec531623
ILT
65742008-03-21 Ian Lance Taylor <iant@google.com>
6575
6576 * Added source code to GNU binutils.
This page took 0.432384 seconds and 4 git commands to generate.