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