PR ld/11012
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
20b52f1a
RÁE
12009-12-07 Rafael Avila de Espindola <espindola@google.com>
2
3 PR gold/11055
4 * incremental-dump.cc (dump_incremental_inputs): New.
5 (main): Use dump_incremental_inputs.
6
53d7974c
L
72009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8
9 PR gold/10893
10 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11 checking elfcpp::STT_FUNC.
12 (Target_i386::Relocate::relocate): Likewise.
13 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
14
15 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
16 symbols from shared libraries into normal FUNC symbols.
17
18 * symtab.h (Symbol): Add is_func and use it.
19
05a352e6
DK
202009-12-05 Doug Kwan <dougkwan@google.com>
21
22 * arm.cc (Target_arm::arm_info): Initialize new fields
23 attributes_section and attributes_vendor.
24 * i386.cc (Target_i386::i386_info): Same.
25 * object.cc (Sized_relobj::do_layout): Skip attribute section.
26 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
27 fields attributes_section and attributes_vendor.
53d7974c 28 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
29 * target.h (Target::attributes_section, Target::attributes_vendor,
30 Target::is_attributes_section, Target::attribute_arg_type,
31 Target::attributes_order): New method definitions.
32 (Target::Target_info::attributes_section,
33 Target::Target_info::attributes_vendor): New fields.
34 (Target::do_attribute_arg_type, Target::do_attributes_order): New
35 virtual method definitions.
36 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
37 attributes_section and attributes_vendor.
38 * testsuite/testfile.cc (Target_test::test_target_info): Same.
39
f4e5969c
DK
402009-12-05 Doug Kwan <dougkwan@google.com>
41
42 * arm.cc: Update comments about interworking and stub generation.
43 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
44 considered as non-PIC.
45 (Arm_relocate_functions::base_abs): Fix formatting.
46 (Arm_relocate_functions::got_prel): Fix comment. Change interface
47 of function to use GOT entry address instead of offset.
48 (Target_arm::Scan::global): Issue an error if a symbol would need a
49 PLT does not get one because it is untyped. Remove code to create
50 dynamic symbols for relative branches.
51 (Target_arm::Relocate::relocate: Use 0 instead of false since function
52 takes unsigned integer instead of boolean.
53
1abce4a6
L
542009-12-05 H.J. Lu <hongjiu.lu@intel.com>
55
56 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
57 (two_file_test_LDADD): Likewise.
58 (common_test_1_LDADD): Likewise.
59 (exception_test_LDADD) Likewise.
60 (weak_test_LDADD): Likewise.
61 (many_sections_test_LDADD): Likewise.
62 (initpri1_LDADD): Likewise.
63 (script_test_1_LDADD): Likewise.
64 (script_test_2_LDADD): Likewise.
65 (justsyms_LDADD): Likewise.
66 (binary_test_LDADD): Likewise.
67 (large_LDADD): Likewise.
68 * testsuite/Makefile.in: Regenerated.
69
adcf2816 702009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 71
adcf2816
L
72 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
73 (Symbol_table::override_with_special): Likewise.
74 (Symbol_table::add_from_object): Likewise.
75
28e67f5d
RÁE
762009-12-04 Rafael Avila de Espindola <espindola@google.com>
77
78 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
79 Don't set the data_offset twice.
80
ae10a101
RÁE
812009-12-04 Rafael Avila de Espindola <espindola@google.com>
82
83 * testsuite/Makefile.in: Regenerate.
84
f59f41f3
DK
852009-12-03 Doug Kwan <dougkwan@google.com>
86
87 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
88 (Target_arm::do_finalize_sections): Add parameter for symbol table
89 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
90 * i386.cc (Target_i386::do_finalize_sections): Add an additional
91 parameter for symbol table pointer.
92 * layout.cc (Layout::finalize): Call Target::finalize_sections with
93 an additional parameter for a pointer to symbol table.
94 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
95 parameter for a symbol table pointer.
96 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
97 * target.h (Target::finalize_sections, Target::do_finalize_sections):
98 Ditto.
99 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
100 parameter for a symbol table pointer.
101
ca55d848
RÁE
1022009-12-03 Rafael Avila de Espindola <espindola@google.com>
103
104 * incremental.cc (Incremental_inputs_header)
105 (Incremental_inputs_header_write, Incremental_inputs_entry)
106 (Incremental_inputs_entry_write): Move ...
107 * incremental.h (Incremental_inputs_header)
108 (Incremental_inputs_header_write, Incremental_inputs_entry)
109 (Incremental_inputs_entry_write): here.
110
3aec4f9c
RÁE
1112009-12-02 Rafael Avila de Espindola <espindola@google.com>
112
113 * incremental.cc (make_sized_incremental_binary): Set the target.
114 Error if it is incompatible.
115 * output.h (Output_file): Add filename method.
116
9c0ae74d
RÁE
1172009-12-02 Rafael Avila de Espindola <espindola@google.com>
118
119 * incremental.cc (Incremental_inputs_entry): Remove unused argument
120 from the get_* methods.
121
a45500ae
RÁE
1222009-12-02 Rafael Avila de Espindola <espindola@google.com>
123
124 * incremental-dump.cc (main): Check that the offeset of a script is 0.
125 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
126 Write 0 for the data_offset of scripts.
127
325e6408
RÁE
1282009-12-02 Rafael Avila de Espindola <espindola@google.com>
129
130 * testsuite/Makefile.am: Add the incremental_test.sh test.
131 * testsuite/incremental_test.sh: New.
132 * testsuite/incremental_test_1.c: New.
133 * testsuite/incremental_test_2.c: New.
134
954c3e2e
RÁE
1352009-12-01 Rafael Avila de Espindola <espindola@google.com>
136
137 * incremental-dump.cc (main): Fix typos.
138
f8086623
RÁE
1392009-11-27 Rafael Avila de Espindola <espindola@google.com>
140
141 PR gold/11025
142 * incremental-dump.cc (main): Use llu to print 64 bit values.
143
3b0dd6ac
L
1442009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
145 H.J. Lu <hongjiu.lu@intel.com>
146
147 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
148 $(LIBDL).
149 (incremental_dump_LDADD): Likewise.
150 * Makefile.in: Regenerated.
151
a6d1ef57
DK
1522009-11-25 Doug Kwan <dougkwan@google.com>
153
154 Revert:
155
156 2009-11-25 Doug Kwan <dougkwan@google.com>
157
158 * arm.cc (Target_arm::Target_arm): Move method definition
159 outside of class definition. Add code to handle
160 --target1-rel, --target1-abs and --target2= options.
161 (Target_arm::get_reloc_reloc_type): Change method to be
162 non-static and const.
163 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
164 New data member declaration.
165 (Target_arm::Scan::local, Target_arm::Scan::global,
166 Target_arm::Relocate::relocate,
167 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
168 Adjust call to Target_arm::get_real_reloc_type.
169 (Target_arm::get_real_reloc_type): Use command line options
170 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
171 * options.h (--target1-rel, --target1-abs, --target2): New
172 ARM-only options.
173
50aeb7d4
DK
1742009-11-25 Doug Kwan <dougkwan@google.com>
175
176 * arm.cc (Target_arm::Target_arm): Move method definition outside of
177 class definition. Add code to handle --target1-rel, --target1-abs
178 and --target2= options.
179 (Target_arm::get_reloc_reloc_type): Change method to be non-static
180 and const.
181 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
182 member declaration.
183 (Target_arm::Scan::local, Target_arm::Scan::global,
184 Target_arm::Relocate::relocate,
185 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
186 call to Target_arm::get_real_reloc_type.
187 (Target_arm::get_real_reloc_type): Use command line options to
188 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
189 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
190 options.
191
51938283
DK
1922009-11-25 Doug Kwan <dougkwan@google.com>
193
194 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
195 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
196 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
197 formatting.
198 (Arm_relocate_functions::thm_call): Replace body with a call to
199 Arm_relocate_functions::thumb_branch_common.
200 (Arm_relocate_functions::thm_jump24,
201 Arm_relocate_functions::thm_xpc22): New method definitions.
202 (Arm_relocate_functions::thumb_branch_common): New method definition.
203 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
204 operator.
205 (Target_arm::Relocate::relocate): Adjust call to thm_call.
206 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
207
e2b8f3c4
RÁE
2082009-11-24 Rafael Avila de Espindola <espindola@google.com>
209
210 * Makefile.am: Build incremental-dump
211 * Makefile.in: Regenerate.
212 * incremental-dump.cc: New.
213 * incremental.cc (Incremental_inputs_header_data,
214 Incremental_inputs_entry_data): Move to incremental.h
215 * incremental.h: (Incremental_inputs_header_data,
216 Incremental_inputs_entry_data): Move from incremental.cc
217
bcba9aec
RÁE
2182009-11-24 Rafael Avila de Espindola <espindola@google.com>
219
220 * incremental.cc (Incremental_inputs_header,
221 Incremental_inputs_header_write, Incremental_inputs_entry,
222 Incremental_inputs_entry_write): Add a typedef with the data type.
223
7c3afe08
RÁE
2242009-11-24 Rafael Avila de Espindola <espindola@google.com>
225
226 * incremental.cc (Incremental_inputs_header,
227 Incremental_inputs_header_write, Incremental_inputs_entry,
228 Incremental_inputs_entry_write): Update comment about which
229 type has the filed descriptions.
230
d204b6e9
DK
2312009-11-15 Doug Kwan <dougkwan@google.com>
232
233 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
234 (Arm_relocate_functions::arm_branch_common): Change method defintion
235 in class definition to a method declaration and update list of formal
236 parameters.
237 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
238 Arm_relocation_functions::jump24): Adjust call to
239 Arm_relocate_functions::arm_branch_common. Update list of formal
240 parameters.
241 (Arm_relocate_functions::xpc25): New method definition.
242 (Arm_relocate_functions::arm_branch_common): Move method defintion
243 out from class definition. Use stubs for mode-switching and extending
244 branch ranges.
245 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
246 specially. Change code to enable use of stubs in ARM branches.
247
43d12afe
DK
2482009-11-10 Doug Kwan <dougkwan@google.com>
249
250 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
251 in method declaration.
252 (Target_arm::relocate_stub): New method declaration.
253 (Target_arm::default_target): Change to return a pointer instead of
254 a const reference.
255 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
256 Target_arm::default_target.
257 (Arm_Relobj::do_relocate_sections): Remove options paramater in
258 method definition.
259 (Target_arm::relocate_section): Adjust view.
260 (Target_arm::relocate_stub): New method definition.
261
ac33a407
DK
2622009-11-10 Doug Kwan <dougkwan@google.com>
263
264 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
265 a format warning.
266 * incremental.cc (open_incremental_binary): Initialized local
267 variables to avoid warnings.
268 * object.cc (make_elf_object): Ditto.
269 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
270 a format warning.
271
88ee28e9
L
272009-11-09 H.J. Lu <hongjiu.lu@intel.com>
273
274 PR gold/10930
275 * testsuite/plugin_test.c: Include "config.h".
276
2daedcd6
DK
2772009-11-09 Doug Kwan <dougkwan@google.com>
278
279 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
280 (arm_symbol_value): Remove.
281 (Arm_relocate_functions::arm_branch_common,
282 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
283 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
284 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
285 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
286 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
287 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
288 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
289 Arm_relocate_functions::thm_mobw_abs_nc,
290 Arm_relocate_functions::thm_mov_abs,
291 Arm_relocate_functions::movw_prel_nc,
292 Arm_relocate_functions::thm_movt_abs,
293 Arm_relocate_functions::movt_prel,
294 Arm_relocate_functions::thm_movw_prel_nc,
295 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
296 (Target_arm::Relocate::relocate): Only decompose address into two
297 parts if relocation type uses the thumb-bit and pass the actual
298 bit instead of a flag indicating that the thumb-bit is used. Adjust
299 calls to methods in Arm_relocate_functions for this change.
300
3e4afc80
ILT
3012009-11-08 Ian Lance Taylor <ian@airs.com>
302
303 PR 10925
304 * reloc.cc: Instantiate
305 Sized_relobj::initialize_input_to_output_maps and
306 Sized_relobj:free_input_to_output_maps.
307
e53ad1b5
ILT
3082009-11-06 Ian Lance Taylor <iant@google.com>
309
310 PR 10876
311 * defstd.cc (in_segment): Set only_if_ref true for "end".
312
eb44217c
DK
3132009-11-06 Doug Kwan <dougkwan@google.com>
314
315 * arm.cc (class Reloc_stub): Correct a comment.
316 (Target_arm::Target_arm): Initialize arm_input_section_map_.
317 (Target_arm::scan_section_for_stubs): New method declaration.
318 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
319 Change methods from private to protected.
320 (Target_arm::do_may_relax): New method definition.
321 (Target_arm::do_relax, Target_arm::group_sections,
322 Target_arm::scan_reloc_for_stub,
323 Target_arm::scan_reloc_section_for_stubs): New method declarations.
324 (Target_arm::arm_input_section_map_): New data member declaration.
325 (Target_arm::scan_reloc_for_stub,
326 Target_arm::scan_reloc_section_for_stubs,
327 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
328 Target_arm::do_relax): New method definitions.
329
5d329b7d
ILT
3302009-11-06 Mikolaj Zalewski <mikolaj@google.com>
331
332 * configure.ac: Check for (struct stat)::st_mtim
333 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
334 * config.in: Regenerate.
335 * configure: Regenerate.
336
96a0d71b
ILT
3372009-11-05 Ian Lance Taylor <iant@google.com>
338
339 PR 10910
340 * output.cc (Output_segment::add_output_section): Add missing
341 return statement.
342
594c8e5e
ILT
3432009-11-04 Ian Lance Taylor <iant@google.com>
344
345 PR 10880
346 * object.h (class Object): Add is_needed and set_is_needed
347 methods. Add is_needed_ field. Make bool fields into bitfields.
348 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
349 defined in a dynamic object and referenced by a regular object,
350 set is_needed for the dynamic object.
351 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
352 if the file is marked with as_needed and it is not needed.
353
22b127cc
ILT
3542009-11-04 Ian Lance Taylor <iant@google.com>
355
356 PR 10887
357 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
358 tags if data is discarded by linker script.
359 * i386.cc (Target_i386::do_finalize_sections): Likewise.
360 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
361 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
362 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
363
f5c870d2
ILT
3642009-11-04 Ian Lance Taylor <iant@google.com>
365
366 * layout.cc (Layout::get_output_section): Add is_interp and
367 is_dynamic_linker_section parameters. Change all callers.
368 (Layout::choose_output_section): Likewise.
369 (Layout::make_output_section): Likewise.
370 (Layout::add_output_section_data): Add is_dynamic_linker_section
371 parameter. Change all callers.
372 * layout.h (class Layout): Update declarations.
373 * output.h (class Output_section): Add is_interp, set_is_interp,
374 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
375 Add is_interp_, is_dynamic_linker_section_ fields. Change
376 generate_code_fills_at_write_ to a bitfield.
377 * output.cc (Output_section::Output_sections): Initialize new
378 fields.
379 (Output_segment::add_output_section): Add do_sort parameter.
380 Change all callers.
381
1ae4d23b
ILT
3822009-11-03 Ian Lance Taylor <iant@google.com>
383
384 PR 10860
385 * options.h (class General_options): Add --warn-common.
386 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
387 merging two common symbols.
388 (Symbol_table::should_override): Handle --warn-common when merging
389 a common symbol with a defined symbol. Use report_resolve_problem
390 for multiple definitions.
391 (Symbol_table::report_resolve_problem): New function.
392 * symtab.h (class Symbol_table): Declare report_resolve_problem.
393
55da9579
DK
3942009-11-03 Doug Kwan <dougkwan@google.com>
395
396 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
397 stub_factory_.
398 (Target_arm::stub_factory): New method definition.
399 (Target_arm::new_arm_input_section,
400 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
401 Target_arm::reloc_uses_thumb_bit): New method declarations.
402 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
403 New type definitions.
404 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
405 member declarations.
406 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
407 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
408 New method definitions.
409
37a9ac43
ILT
4102009-11-03 Ian Lance Taylor <iant@google.com>
411
412 * options.h (class General_options): Add --warn_constructors.
413
b3d6a3d4
ILT
4142009-11-03 Ian Lance Taylor <iant@google.com>
415
416 PR 10893
417 * defstd.cc (in_section): Add entries for __rel_iplt_start,
418 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
419
934b01dd
ILT
4202009-11-03 Ian Lance Taylor <iant@google.com>
421
422 PR 10895
423 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
424 --msgid-bugs-address.
425 (install-pdf): New target.
426 (install-data_yes): Look up one directory to find mkinstalldirs.
427
03c1939b
L
4282009-11-03 H.J. Lu <hongjiu.lu@intel.com>
429
430 * po/Make-in (.po.gmo): Don't generate .gmo files in source
431 tree.
432
ebd95253
DK
4332009-10-30 Doug Kwan <dougkwan@google.com>
434
435 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
436
e9bbb538
DK
4372009-10-30 Doug Kwan <dougkwan@google.com>
438
439 * arm.cc (Stub_addend_reader): New struct template definition
440 and partial specializations.
441 (Stub_addend_reader::operator()): New method definition for a
442 partially specialized template.
443
d5b40221
DK
4442009-10-30 Doug Kwan <dougkwan@google.com>
445
446 * arm.cc (Arm_relobj::processor_specific_flags): New method
447 definition.
448 (Arm_relobj::do_read_symbols): New method declaration.
449 (Arm_relobj::processor_specific_flags_): New data member declaration.
450 (Arm_dynobj): New class definition.
451 (Target_arm::do_finalize_sections): Add input_objects parameter.
452 (Target_arm::do_adjust_elf_header): New method declaration.
453 (Target_arm::are_eabi_versions_compatible,
454 (Target_arm::merge_processor_specific_flags): New method declaration.
455 (Target_arm::do_make_elf_object): New overloaded method definitions
456 and declaration.
457 (Arm_relobj::do_read_symbols): New method definition.
458 (Arm_dynobj::do_read_symbols): Ditto.
459 (Target_arm::do_finalize_sections): Add input_objects parameters.
460 Merge processor-specific flags from all input objects.
461 (Target_arm::are_eabi_versions_compatible,
462 Target_arm::merge_processor_specific_flags,
463 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
464 New method definitions.
465 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
466 Input_objects pointer type parameter.
467 * layout.cc (Layout::finalize): Pass input objects to target's.
468 finalize_sections function.
469 * output.cc (Output_file_header::do_sized_write): Set ELF file
470 header's processor-specific flags.
471 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
472 Input_objects pointer type parameter.
473 * sparc.cc (Target_sparc::do_finalize_sections): Same.
474 * target.h (Input_objects): New forward class declaration.
475 (Target::processor_specific_flags,
476 Target::are_processor_specific_flags_sect): New method definitions.
477 (Target::finalize_sections): Add input_objects parameter.
478 (Target::Target): Initialize processor_specific_flags_ and
479 are_processor_specific_flags_set_.
480 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
481 parameter.
482 (Target::set_processor_specific_flags): New method definition.
483 (Target::processor_specific_flags_,
484 Target::are_processor_specific_flags_set_): New data member
485 declarations.
486 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
487 Input_objects pointer type parameter.
488
ebabffbd
DK
4892009-10-30 Doug Kwan <dougkwan@google.com>
490
491 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
492
ad0f2072
ILT
4932009-10-28 Ian Lance Taylor <iant@google.com>
494
495 * object.h (class Relobj): Drop options parameter from
496 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
497 do_scan_relocs, do_relocate. Change all callers.
498 (class Sized_relobj): Drop options parameters from
499 do_gc_process_relocs, do_scan_relocs, do_relocate,
500 do_relocate_sections, relocate_sections, emit_relocs_scan,
501 emit_relocs_scan_reltype. Change all callers.
502 (struct Relocate_info): Remove options field and all references to
503 it.
504 * reloc.h (class Read_relocs): Remove options constructor
505 parameter and options_ field. Change all callers.
506 (class Gc_process_relocs, class Scan_relocs): Likewise.
507 (class Relocate_task): Likewise.
508 * target-reloc.h (scan_relocs): Remove options parameter. Change
509 all callers.
510 (scan_relocatable_relocs): Likewise.
511 * target.h (class Sized_target): Remove options parameter from
512 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
513 all callers.
514 * gc.h (gc_process_relocs): Remove options parameter. Change all
515 callers.
516 * arm.cc: Update functions to remove options parameters.
517 * i386.cc: Likewise.
518 * powerpc.cc: Likewise.
519 * sparc.cc: Likewise.
520 * x86_64.cc: Likewise.
521 * testsuite/testfile.cc: Likewise.
522
8ffa3667
DK
5232009-10-28 Doug Kwan <dougkwan@google.com>
524
525 * arm.cc (Arm_relobj): New class definition.
526 (Arm_relobj::scan_sections_for_stubs,
527 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
528 New method definitions.
529
40f36857
CC
5302009-10-28 Cary Coutant <ccoutant@google.com>
531
532 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
533 (Plugin::cleanup_done_): New member.
534 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
535 (Plugin_manager::cleanup_done_): Remove.
536 (Plugin_manager::add_input_file): Edit error message.
537 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
538 (Plugin_manager::cleanup): Remove use of cleanup_done_.
539
2c849493
ILT
5402009-10-27 Mikolaj Zalewski <mikolajz@google.com>
541
542 * fileread.cc: (File_read::View::~View): Use the new
543 data_ownership_ filed.
544 (File_read::~File_read): Dispose the new whole_file_view_.
545 (File_read::open): Mmap the whole file if needed.
546 (File_read::open): Use whole_file_view_ instead of contents_.
547 (File_read::find_view): Use whole_file_view_ if applicable.
548 (File_read::do_read): Use whole_file_view_ instead of contents_.
549 (File_read::make_view): Use whole_file_view_ instead of contents_,
550 update File_read::View::View call.
551 (File_read::find_or_make_view): Update File_read::View::View
552 call.
553 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
554 remove contents_
555 (File_read::View::Data_ownership): New enum.
556 (File_read::View::View): Replace bool mapped_ with Data_ownership
557 argument.
558 (File_read::View::mapped_): Remove (replaced by data_ownership_).
559 (File_read::View::data_ownership_): New field.
560 (File_read::contents_): Remove (replaced by whole_file_view_).
561 (File_read::whole_file_view_): New field.
562 * options.h (class General_options): Add --keep-files-mapped.
563
24998053
CC
5642009-10-27 Cary Coutant <ccoutant@google.com>
565
566 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
567 * testsuite/Makefile.am (plugin_test_5): New test case.
568 * testsuite/Makefile.in: Regenerate.
569
72adc4fa
DK
5702009-10-25 Doug Kwan <dougkwan@google.com>
571
572 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
573 from private to protected to allow access by child class.
574 (Sized_relobj::do_relocate_sections): New method declaration.
575 (Sized_relobj::relocate_sections): Virtualize.
576 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
577 Sized_relobj::relocate_sections. Instantiate template explicitly
578 for different target sizes and endianity.
579
07f508a2
DK
5802009-10-24 Doug Kwan <dougkwan@google.com>
581
582 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
583 (Arm_input_section::as_arm_input_section): New method.
584 (Arm_output_section): New class definition.
585 (Arm_output_section::create_stub_group,
586 Arm_output_section::group_sections): New method definitions.
587
10ad9fe5
DK
5882009-10-22 Doug Kwan <dougkwan@google.com>
589
590 * arm.cc (Arm_input_section): New class definition.
591 (Arm_input_section::init, Arm_input_section:do_write,
592 Arm_input_section::set_final_data_size,
593 Arm_input_section::do_reset_address_and_file_offset): New method
594 definitions.
595
56ee5e00
DK
5962009-10-21 Doug Kwan <dougkwan@google.com>
597
598 * arm.cc (Stub_table, Arm_input_section): New forward class
599 declarations.
600 (Stub_table): New class defintion.
601 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
602 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
603 New method definition.
604
b569affa
DK
6052009-10-21 Doug Kwan <dougkwan@google.com>
606
607 * arm.cc: Update copyright comments.
608 (Target_arm): New forward class template declaration.
609 (Arm_address): New type.
610 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
611 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
612 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
613 constants.
614 (Insn_template): Same.
615 (DEF_STUBS): New macro.
616 (Stub_type): New enum type.
617 (Stub_template): New class definition.
618 (Stub): Same.
619 (Reloc_stub): Same.
620 (Stub_factory): Same.
621 (Target_arm::Target_arm): Initialize may_use_blx_ and
622 should_force_pic_veneer_.
623 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
624 Target_arm::should_force_pic_veneer,
625 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
626 Target_arm::using_thumb_only, Target_arm:;default_target): New
627 method defintions.
628 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
629 New data member declarations.
630 (Insn_template::size, Insn_template::alignment): New method defintions.
631 (Stub_template::Stub_template): New method definition.
632 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
633 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
634 (Stub_factory::Stub_factory): New method definition.
635 * gold.h (string_hash): New template.
636 * output.h (Input_section_specifier::hash_value): Use
637 gold::string_hash.
638 (Input_section_specifier::string_hash): Remove.
639 * stringpool.cc (Stringpool_template::string_hash): Use
640 gold::string_hash.
641
6c172549
DK
6422009-10-20 Doug Kwan <dougkwan@google.com>
643
644 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
645 symbols of relaxed input sections.
646 * output.h (Output_section::find_relaxed_input_section): Make
647 method public.
648
c5617f2f
DK
6492009-10-16 Doug Kwan <dougkwan@google.com>
650
651 * dynobj.cc (Versions::Versions): Initialize version_script_.
652 Only insert base version symbol definition for a shared object
653 if version script defines any version versions.
654 (Versions::define_base_version): New method definition.
655 (Versions::add_def): Check that base version is not needed.
656 (Versions::add_need): Define base version lazily.
657 * dynobj.h (Versions::define_base_version): New method declaration.
658 (Versions::needs_base_version_): New data member declaration.
659 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
660 (check_DATA): Add no_version_test.stdout.
661 (libno_version_test.so, no_version_test.o no_version_test.stdout):
662 New make rules.
663 * testsuite/Makefile.in: Regenerate.
664 * testsuite/no_version_test.c: New file.
665 * testsuite/no_version_test.sh: Ditto.
666
3c12dcdb
DK
6672009-10-16 Doug Kwan <dougkwan@google.com>
668
669 * expression.cc (class Segment_start_expression): New class definition.
670 (Segment_start_expression::value): New method definition.
671 (script_exp_function_segment_start): Return a new
672 Segment_start_expression.
673 * gold/script-c.h (script_saw_segment_start_expression): New function
674 prototype.
675 * script-sections.cc (Script_sections::Script_sections): Initialize
676 SAW_SEGMENT_START_EXPRESSION_ to false.
677 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
678 and -Tbbs options to specify section addresses if given in
679 command line and no SEGMENT_START expression is seen in a script.
680 * script-sections.h (Script_sections::saw_segment_start_expression,
681 Script_sections::set_saw_segment_start_expression): New method
682 definition.
683 (Script_sections::saw_segment_start_expression_): New data member
684 declaration.
685 * script.cc (script_saw_segment_start_expression): New function.
686 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
687 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
688 script_test_7.sh and script_test_8.sh.
689 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
690 script_test_8.stdout.
691 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
692 (script_test_6, script_test_6.stdout, script_test_7,
693 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
694 * Makefile.in: Regenerate.
695 * testsuite/script_test_6.sh: New file.
696 * testsuite/script_test_6.t: Same.
697 * testsuite/script_test_7.sh: Same.
698 * testsuite/script_test_7.t: Same.
699 * testsuite/script_test_8.sh: Same.
700
64b1ae37
DK
7012009-10-16 Doug Kwan <dougkwan@google.com>
702
703 * output.cc (Output_segment::set_section_list_address): Cast
704 expressions to unsigned long long type to avoid format warnings.
705
661be1e2
ILT
7062009-10-15 Ian Lance Taylor <iant@google.com>
707
12edd763 708 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 709 dot assignment to script_sections_.
12edd763
ILT
710 * script-sections.cc (Script_sections::add_dot_assignment):
711 Initialize if necessary.
712
68b6574b
ILT
713 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
714 program headers with no load segment if there is a linker script.
715
661be1e2
ILT
716 * layout.cc (Layout::set_segment_offsets): Align the file offset
717 to the segment aligment for -N or -n with no load segment.
718 * output.cc (Output_segment::add_output_section): Don't crash if
719 the first section is a TLS section.
720 (Output_segment::set_section_list_addresses): Print an error
721 message if the address moves backward in a linker script.
722 * script-sections.cc
723 (Output_section_element_input::set_section_addresses): Don't
724 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
725 (Orphan_output_section::set_section_addresses): Likewise.
726
f15f61a7
DK
7272009-10-15 Doug Kwan <dougkwan@google.com>
728
729 * layout.cc (Layout::finish_dynamic_section): Generate tags
730 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
731 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
732 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
733
82bb573a
ILT
7342009-10-14 Ian Lance Taylor <iant@google.com>
735
736 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
737 fields.
738 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
739 data_shdr fields of relinfo.
740 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
741 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
742 R_386_TLS_LDO_32, adjust based on section flags.
743 (Target_i386::Relocate::fix_up_ldo): Remove.
744
374ad285
ILT
7452009-10-13 Ian Lance Taylor <iant@google.com>
746
747 Add support for -pie.
748 * options.h (class General_options): Add -pie and
749 --pic-executable.
750 (General_options::output_is_position_independent): Test -pie.
751 (General_options::output_is_executable): Return true if not shared
752 and not relocatable.
753 (General_options::output_is_pie): Remove.
754 * options.cc (General_options::finalize): Reject incompatible uses
755 of -pie.
756 * gold.cc (queue_middle_tasks): A -pie link is not static.
757 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
758 * symtab.cc (Symbol::final_value_is_known): Return false if
759 output_is_position_independent.
760 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
761 output_is_position_independent.
762 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
763 output_is_position_independent.
764 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
765 output_is_position_independent.
766 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
767 two_file_pie_test.
768 (basic_pie_test.o, basic_pie_test): New targets.
769 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
770 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
771 (two_file_pie_test): New target.
772 * testsuite/Makefile.in: Rebuild.
773 * README: Remove note saying that -pie is not supported.
774
c6585162
ILT
7752009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
776
777 * options.h (class General_options): Add -init and -fini.
778 * layout.cc (Layout::finish_dynamic_section): Emit
779 given init and fini functions.
780
032ce4e9
ST
7812009-10-13 Sriraman Tallam <tmsriram@google.com>
782
783 * gc.h (gc_process_relocs): Check if icf is enabled using new
784 function.
785 * gold.cc (queue_initial_tasks): Likewise.
786 (queue_middle_tasks): Likewise.
787 * object.cc (do_layout): Likewise.
788 * symtab.cc (is_section_folded): Likewise.
789 * main.cc (main): Likewise.
790 * reloc.cc (Read_relocs::run): Likewise.
791 (Sized_relobj::do_scan_relocs): Likewise.
792 * icf.cc (is_function_ctor_or_dtor): New function.
793 (Icf::find_identical_sections): Check if function is ctor or dtor when
794 safe icf is chosen.
795 * options.h (General_options::icf): Change option to be an enum.
796 (Icf_status): New enum.
797 (icf_enabled): New method.
798 (icf_safe_folding): New method.
799 (set_icf_status): New method.
800 (icf_status_): New variable.
801 * (options.cc) (General_options::finalize): Set icf_status_.
802 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
803 icf_test and icf_keep_unique_test to use the --icf enum flag.
804 * testsuite/icf_safe_test.sh: New file.
805 * testsuite/icf_safe_test.cc: New file.
806
f345227a
ST
8072009-10-12 Sriraman Tallam <tmsriram@google.com>
808
809 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
810 includes to gc.h and icf.h.
811 * arm.cc: Include gc.h.
812 * gold.cc: Likewise.
813 * i386.cc: Likewise.
814 * powerpc.cc: Likewise.
815 * sparc.cc: Likewise.
816 * x86_64.cc: Likewise.
817 * gc.h: Include icf.h.
818
1c7814ed
ILT
8192009-10-11 Ian Lance Taylor <iant@google.com>
820
821 * plugin.cc: Include "gold.h" before other header files.
822
ae3b5189
CD
8232009-10-10 Chris Demetriou <cgd@google.com>
824
825 * options.h (Input_file_argument::Input_file_type): New enum.
826 (Input_file_argument::is_lib_): Replace with...
827 (Input_file_argument::type_): New member.
828 (Input_file_argument::Input_file_argument): Take Input_file_type
829 'type' rather than boolean 'is_lib' as second argument.
830 (Input_file_argument::is_lib): Use type_.
831 (Input_file_argument::is_searched_file): New function.
832 (Input_file_argument::may_need_search): Handle is_searched_file.
833 * options.cc (General_options::parse_library): Support -l:filename.
834 (General_options::parse_just_symbols): Update for Input_file_argument
835 changes.
836 (Command_line::process): Likewise.
837 * archive.cc (Archive::get_file_and_offset): Likewise.
838 * plugin.cc (Plugin_manager::release_input_file): Likewise.
839 * script.cc (read_script_file, script_add_file): Likewise.
840 * fileread.cc (Input_file::Input_file): Likewise.
841 (Input_file::will_search_for): Handle is_searched_file.
842 (Input_file::open): Likewise.
843 * readsyms.cc (Read_symbols::get_name): Likewise.
844 * testsuite/Makefile.am (searched_file_test): New test.
845 * testsuite/Makefile.in: Regenerate.
846 * testsuite/searched_file_test.cc: New file.
847 * testsuite/searched_file_test_lib.cc: New file.
848
f3048a1d
ILT
8492009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
850 Ian Lance Taylor <iant@google.com>
851
852 * descriptor.cc: Include <cstdio> and "binary-io.h".
853 (Descriptors::open): Open the files in binary mode always.
854 * script.cc (Lex::get_token): Treat \r as whitespace.
855
d4780e57
ILT
8562009-10-09 Ian Lance Taylor <iant@google.com>
857
858 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
859
d9a893b8
ILT
8602009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
861 Ian Lance Taylor <iant@google.com>
862
863 * configure.ac: Check for readv function also.
864 * fileread.cc (readv): Define if not HAVE_READV.
865 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
866 does not exist.
867 * config.in: Regenerate.
868 * configure: Regenerate.
869
c0a62865
DK
8702009-10-09 Doug Kwan <dougkwan@google.com>
871
872 * layout.cc (Layout::make_output_section): Call target hook to make
873 ordinary output section.
874 (Layout::finalize): Adjust parameter list of call the
875 Target::may_relax().
876 * layout.h (class Layout::section_list): New method.
877 * merge.h (Output_merge_base::entsize): Change visibility to public.
878 (Output_merge_base::is_string, Output_merge_base::do_is_string):
879 New methods.
880 (Output_merge_string::do_is_string): New method.
881 * object.cc (Sized_relobj::do_setup): renamed from
882 Sized_relobj::set_up.
883 * object.h (Sized_relobj::adjust_shndx,
884 Sized_relobj::initializ_input_to_output_maps,
885 Sized_relobj::free_input_to_output_maps): Change visibilities to
886 protected.
887 (Sized_relobj::setup): Virtualize.
888 (Sized_relobj::do_setup): New method declaration.
889 (Sized_relobj::invalidate_section_offset,
890 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
891 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
892 * options.cc (parse_int): New function.
893 * options.h (parse_int): New declaration.
894 (DEFINE_int): New macro.
895 (stub_group_size): New option.
896 * output.cc (Output_section::Output_section): Initialize memebers
897 merge_section_map_, merge_section_by_properties_map_,
898 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
899 (Output_section::add_input_section): Handled deferred code-fill
900 generation and remove an old comment.
901 (Output_section::add_relaxed_input_section): New method definition.
902 (Output_section::add_merge_input_section): Use merge section by
903 properties map to speed to search. Update merge section maps
904 as appropriate.
905 (Output_section::build_relaxation_map): New method definition.
906 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
907 Same.
908 (Output_section::relax_input_section): Renamed to
909 Output_section::convert_input_sections_to_relaxed_sections and change
910 interface to take a vector of pointers to relaxed sections.
911 (Output_section::find_merge_section,
912 Output_section::find_relaxed_input_section): New method definitions.
913 (Output_section::is_input_address_mapped,
914 Output_section::output_offset, Output_section::output_address):
915 Use output section data maps to speed up searching.
916 (Output_section::find_starting_output_address): Add comments.
917 (Output_section::do_write,
918 Output_section::write_to_postprocessing_buffer): Do code-fill
919 generation as appropriate.
920 (Output_section::get_input_sections): Invalidate relaxed input section
921 map.
922 (Output_section::restore_states): Adjust type of checkpoint .
923 Invalidate relaxed input section map.
924 * output.h (Output_merge_base): New class declaration.
925 (Input_section_specifier): New class defintion.
926 (class Output_relaxed_input_section) Change base class to
927 Output_section_data_build.
928 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
929 base class initializer.
930 (Output_section::add_relaxed_input_section): New method declaration.
931 (Output_section::Input_section): Change visibility to protected.
932 (Output_section::Input_section::relobj,
933 Output_section::Input_section::shndx): Handle relaxed input sections.
934 Output_section::input_sections) Change visibility to protected. Also
935 define overload to return a non-const pointer.
936 (Output_section::Merge_section_properties): New class defintion.
937 (Output_section::Merge_section_by_properties_map,
938 Output_section::Output_section_data_by_input_section_map,
939 Output_section::Relaxation_map): New types.
940 (Output_section::relax_input_section): Rename method to
941 Output_section::convert_input_sections_to_relaxed_sections and change
942 interface to take a vector of relaxed section pointers.
943 (Output_section::find_merge_section,
944 Output_section::find_relaxed_input_section,
945 Output_section::build_relaxation_map,
946 Output_section::convert_input_sections_in_list_to_relaxed_sections):
947 New method declarations.
948 (Output_section::merge_section_map_
949 Output_section::merge_section_by_properties_map_,
950 Output_section::relaxed_input_section_map_,
951 Output_section::is_relaxed_input_section_map_valid_,
952 Output_section::generate_code_fills_at_write_): New data members.
953 * script-sections.cc
954 (Output_section_element_input::set_section_addresses): Call
955 current_data_size and addralign methods of relaxed input sections.
956 (Orphan_output_section::set_section_addresses): Call current_data_size
957 and addralign methods of relaxed input sections.
958 * symtab.cc (Symbol_table::compute_final_value): Extract template
959 from the body of Symbol_table::sized_finalize_symbol.
960 (Symbol_table::sized_finalized_symbol): Call
961 Symbol_table::compute_final_value.
962 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
963 (Symbol_table::compute_final_value): New templated method declaration.
964 * target.cc (Target::do_make_output_section): New method defintion.
965 * target.h (Target::make_output_section): New method declaration.
966 (Target::relax): Add more parameters for input objects, symbol table
967 and layout. Adjust call to do_relax.
968 (Target::do_make_output_section): New method declaration.
969 (Target::do_relax): Add parameters for input objects, symbol table
970 and layout.
971
d446d6c4
ILT
9722009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
973
974 * pread.c: Include stdio.h.
975
bc06c745
ILT
9762009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
977
978 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
979 defined.
980
75aea3d0
ILT
9812009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
982
983 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
984 Change read_shndx type to unsigned int.
985 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
986 int.
987 (Sized_dwarf_line_info::read_line_mappings): Likewise.
988 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
989 Change read_shndx type to unsigned int.
990 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
991 int.
992 (Sized_dwarf_line_info::read_line_mappings): Likewise.
993 * layout.cc (Layout::create_symtab_sections): Cast the result of
994 local_symcount * symsize to off_t in the gold_assert.
995
be8fcb75
ILT
9962009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
997
998 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
999 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1000 R_ARM_BASE_ABS.
1001 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1002 (Arm_relocate_functions::thm_abs5): New function.
1003 (Arm_relocate_functions::abs12): New function.
1004 (Arm_relocate_functions::abs16): New function.
1005 (Arm_relocate_functions::base_abs): New function.
1006 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1007 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1008 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1009 R_ARM_BASE_ABS.
1010 (Scan::global): Likewise.
1011 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1012 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1013 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1014 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1015 R_ARM_BASE_ABS.
1016
c2a122b6
ILT
10172009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1018
1019 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1020 (Arm_relocate_functions::movt_prel): New function.
1021 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1022 (Arm_relocate_functions::thm_movt_prel): New function.
1023 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1024 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1025 (Scan::global, Relocate::relocate): Likewise.
1026 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1027
c4aa1e2d
ILT
10282009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1029
1030 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1031 Incremental_checker.
1032 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1033 unsigned int.
1034 (class Incremental_inputs_header): New class.
1035 (Incremental_inputs_header_writer): Edit comment.
1036 (Incremental_inputs_entry): New class.
1037 (Incremental_inputs_entry_writer): Edit comment.
1038 (Sized_incremental_binary::do_find_incremental_inputs_section):
1039 Add *strtab_shndx parameter, fill it.
1040 (Sized_incremental_binary::do_check_inputs): New method.
1041 (Incremental_checker::can_incrementally_link_output_file): Use
1042 Sized_incremental_binary::check_inputs.
1043 (Incremental_inputs::report_command_line): Save command line in
1044 command_line_.
1045 * incremental.h:
1046 (Incremental_binary::find_incremental_inputs_section): New
1047 method.
1048 (Incremental_binary::do_find_incremental_inputs_section): Add
1049 strtab_shndx parameter.
1050 (Incremental_binary::do_check_inputs): New pure virtual method.
1051 (Sized_incremental_binary::do_check_inputs): Declare.
1052 (Incremental_checker::Incremental_checker): Add incremental_inputs
1053 parameter, use it to initialize incremental_inputs_.
1054 (Incremental_checker::incremental_inputs_): New field.
1055 (Incremental_checker::command_line): New method.
1056 (Incremental_checker::inputs): New method.
1057 (Incremental_checker::command_line_): New field.
1058
c549a694
ILT
10592009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1060
1061 * incremental.cc: Include <cstdarg> and "target-select.h".
1062 (vexplain_no_incremental): New function.
1063 (explain_no_incremental): New function.
1064 (Incremental_binary::error): New method.
1065 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1066 method.
1067 (make_sized_incremental_binary): New function.
1068 (open_incremental_binary): New function.
1069 (can_incrementally_link_file): Add checks if output is ELF and has
1070 inputs section.
1071 * incremental.h: Include "elfcpp_file.h" and "output.h".
1072 (Incremental_binary): New class.
1073 (Sized_incremental_binary): New class.
1074 (open_incremental_binary): Declare.
1075 * object.cc (is_elf_object): Use
1076 elfcpp::Elf_recognizer::is_elf_file.
1077 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1078 * output.h (Output_file::filesize): New method.
1079
fd3c5f0b
ILT
10802009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1081
1082 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1083 New function.
1084 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1085 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1086 function.
1087 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1088 function.
1089 (Arm_relocate_functions::movw_abs_nc): New function.
1090 (Arm_relocate_functions::movt_abs): New function.
1091 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1092 (Arm_relocate_functions::thm_movt_abs): New function.
1093 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1094 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1095 (Scan::global): Likewise.
1096 (Relocate::relocate): Likewise.
1097 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1098
7f5309a5
ILT
10992009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1100
1101 * arm.cc (Arm_relocate_functions::got_prel) New function.
1102 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1103 (Relocate::relocate): Likewise.
1104 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1105
364c7fa5
ILT
11062009-10-06 Ian Lance Taylor <iant@google.com>
1107
1108 * options.h (class General_options): Define
1109 split_stack_adjust_size parameter.
1110 * object.h (class Object): Add uses_split_stack_ and
1111 has_no_split_stack_ fields. Add uses_split_stack and
1112 has_no_split_stack accessor functions. Declare
1113 handle_split_stack_section.
1114 (class Reloc_symbol_changes): Define.
1115 (class Sized_relobj): Define Function_offsets. Declare
1116 split_stack_adjust, split_stack_adjust_reltype, and
1117 find_functions.
1118 * object.cc (Object::handle_split_stack_section): New function.
1119 (Sized_relobj::do_layout): Call handle_split_stack_section.
1120 * dynobj.cc (Sized_dynobj::do_layout): Call
1121 handle_split_stack_section.
1122 * reloc.cc (Sized_relobj::relocate_sections): Call
1123 split_stack_adjust for executable sections in split_stack
1124 objects. Pass reloc_map to relocate_section.
1125 (Sized_relobj::split_stack_adjust): New function.
1126 (Sized_relobj::split_stack_adjust_reltype): New function.
1127 (Sized_relobj::find_functions): New function.
1128 * target-reloc.h: Include "object.h".
1129 (relocate_section): Add reloc_symbol_changes parameter. Change
1130 all callers.
1131 * target.h (class Target): Add calls_non_split method. Declare
1132 do_calls_non_split virtual method. Declare match_view and
1133 set_view_to_nop.
1134 * target.cc: Include "elfcpp.h".
1135 (Target::do_calls_non_split): New function.
1136 (Target::match_view): New function.
1137 (Target::set_view_to_nop): New function.
1138 * gold.cc (queue_middle_tasks): Give an error if mixing
1139 split-stack and non-split-stack objects with -r.
1140 * i386.cc (Target_i386::relocate_section): Add
1141 reloc_symbol_changes parameter.
1142 (Target_i386::do_calls_non_split): New function.
1143 * x86_64.cc (Target_x86_64::relocate_section): Add
1144 reloc_symbol_changes parameter.
1145 (Target_x86_64::do_calls_non_split): New function.
1146 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1147 parameter.
1148 * powerpc.cc (Target_powerpc::relocate_section): Add
1149 reloc_symbol_changes parameter.
1150 * sparc.cc (Target_sparc::relocate_section): Add
1151 reloc_symbol_changes parameter.
1152 * configure.ac: Call AM_CONDITIONAL for the default target.
1153 * configure: Rebuild.
1154 * testsuite/Makefile.am (TEST_AS): New variable.
1155 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
1156 (check_DATA): Add split_i386 and split_x86_64 files.
1157 (SPLIT_DEFSYMS): Define.
1158 (split_i386_[1234n].o): New targets.
1159 (split_i386_[124]): New targets.
1160 (split_i386_[1234r].stdout): New targets.
1161 (split_x86_64_[1234n].o): New targets.
1162 (split_x86_64_[124]): New targets.
1163 (split_x86_64_[1234r].stdout): New targets.
1164 (MOSTLYCLEANFILES): Add new executables.
1165 * testsuite/split_i386.sh: New file.
1166 * testsuite/split_x86_64.sh: New file.
1167 * testsuite/split_i386_1.s: New file.
1168 * testsuite/split_i386_2.s: New file.
1169 * testsuite/split_i386_3.s: New file.
1170 * testsuite/split_i386_4.s: New file.
1171 * testsuite/split_i386_n.s: New file.
1172 * testsuite/split_x86_64_1.s: New file.
1173 * testsuite/split_x86_64_2.s: New file.
1174 * testsuite/split_x86_64_3.s: New file.
1175 * testsuite/split_x86_64_4.s: New file.
1176 * testsuite/split_x86_64_n.s: New file.
1177 * testsuite/testfile.cc (Target_test): Update relocation_section
1178 function.
1179 * testsuite/Makefile.in: Rebuild.
1180
e8a9fcda
ILT
11812009-10-06 Ian Lance Taylor <iant@google.com>
1182
1183 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
1184 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
1185 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
1186 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
1187 the address on ldo_addrs_.
1188 (Target_i386::Relocate::fix_up_ldo): New function.
1189
e99daf92
ILT
11902009-10-06 Rafael Espindola <espindola@google.com>
1191
1192 * plugin.cc (add_input_library): New.
1193 (Plugin::load): Add add_input_library to tv.
1194 (Plugin_manager::add_input_file): Add the is_lib argument.
1195 (add_input_file): Update call to Plugin_manager::add_input_file.
1196 (add_input_library): New.
1197 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
1198
966d4097
DK
11992009-09-30 Doug Kwan <dougkwan@google.com>
1200
1201 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
1202 symbol and call Symbol::may_need_copy_reloc to determine if
1203 a copy reloc is needed.
1204 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
1205 nocopyreloc is given in command line.
1206 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1207 given in command line.
1208 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1209 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1210 of the removed Target_i386::may_need_copy_reloc.
1211 * options.h (copyreloc): New option with default value false.
1212 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1213 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1214 instead of the removed Target_powerpc::may_need_copy_reloc.
1215 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1216 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1217 instead of the removed Target_sparc::may_need_copy_reloc.
1218 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1219 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1220 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1221 instead of the removed Target_x86_64::may_need_copy_reloc.
1222
029ba973
ILT
12232009-09-30 Ian Lance Taylor <iant@google.com>
1224
1225 * object.h (class Object): Remove target_ field, and target,
1226 sized_target, and set_target methods.
1227 (Object::sized_target): Remove.
1228 (class Sized_relobj): Update declarations. Remove sized_target.
1229 * object.cc (Sized_relobj::setup): Remove target parameter.
1230 Change all callers.
1231 (Input_objects::add_object): Don't do anything with the target.
1232 (make_elf_sized_object): Add punconfigured parameter. Change all
1233 callers. Set or test parameter target.
1234 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1235 Change all callers.
1236 * parameters.cc (Parameters::set_target): Change parameter type to
1237 be non-const.
1238 (Parameters::default_target): Remove.
1239 (set_parameters_target): Change parameter type to be non-const.
1240 (parameters_force_valid_target): New function.
1241 (parameters_clear_target): New function.
1242 * parameters.h (class Parameters): Update declarations. Remove
1243 default_target method. Add sized_target and clear_target
1244 methods. Change target_ to be non-const.
1245 (set_parameters_target): Update declaration.
1246 (parameters_force_valid_target): Declare.
1247 (parameters_clear_target): Declare.
1248 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1249 as NULL if we aren't searching.
1250 (Add_symbols::run): Don't check for compatible target.
1251 * fileread.cc (Input_file::open_binary): Call
1252 parameters_force_valid_target.
1253 * gold.cc (queue_middle_tasks): Likewise.
1254 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1255 set_target on object.
1256 * dynobj.h (class Sized_dynobj): Update declarations.
1257 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
1258 make_elf_object returns NULL.
1259 (Archive::include_member): Don't check whether object target is
1260 compatible.
1261 * output.cc (Output_section::add_input_section): Get target from
1262 parameters.
1263 (Output_section::relax_input_section): Likewise.
1264 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
1265 parameters.
1266 (Sized_relobj::do_scan_relocs): Likewise.
1267 (Sized_relobj::relocate_sections): Likewise.
1268 * resolve.cc (Symbol_table::resolve): Likewise.
1269 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
1270 parameter. Change all callers.
1271 (Symbol_table::add_from_object): Get target from parameters.
1272 (Symbol_table::add_from_relobj): Don't check object target.
1273 (Symbol_table::add_from_dynobj): Likewise.
1274 (Symbol_table::define_special_symbol): Get target from
1275 parameters.
1276 * symtab.h (class Symbol_table): Update declaration.
1277 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
1278 parameter. Change all callers. Clear parameter target.
1279 (Binary_test): Test target here.
1280 * testsuite/object_unittest.cc (gold_testsuite): Remove
1281 target_test_pointer parameter. Change all callers.
1282 (Object_test): Test target here.
1283
a6a22b83
ILT
12842009-09-26 Ian Lance Taylor <iant@google.com>
1285
1286 * testsuite/initpri1.c: Don't try to use constructor priorities if
1287 compiling with gcc before 4.3.
1288
6a8f49fe
ILT
12892009-09-22 Mikolaj Zalewski <mikolajz@google.com>
1290
1291 * testsuite/retain_symbols_file_test.sh (check_present): Change
1292 output file name to retain_symbols_file_test.stdout.
1293 (check_absent): Likewise.
1294
8c604651
CS
12952009-09-18 Craig Silverstein <csilvers@google.com>
1296
1297 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
1298 * options.cc: Include <cerrno> and <fstream>.
1299 (General_options::finalize): Parse -retain-symbols-file tag.
1300 * options.h: New flag.
1301 (General_options): New method should_retain_symbol, new
1302 variable symbols_to_retain.
1303 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
1304 should_retain_symbol map.
1305 * testsuite/Makefile.am (retain_symbols_file_test): New test.
1306 * testsuite/Makefile.in: Regenerate.
1307 * testsuite/retain_symbols_file_test.sh: New file.
1308
ca58b19f
NC
13092009-09-18 Nick Clifton <nickc@redhat.com>
1310
1311 * po/es.po: Updated Spanish translation.
1312
20e6d0d6
DK
13132009-09-17 Doug Kwan <dougkwan@google.com>
1314
1315 * debug.h (DEBUG_RELAXATION): New constant.
1316 (DEBUG_ALL): Add DEBUG_RELAXATION.
1317 (debug_string_to_enum): Add relaxation debug option.
1318 * layout.cc
1319 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
1320 Layout::Relaxation_debug_check::read_sections,
1321 Layout::Relaxation_debug_check::read_sections): New method definitions.
1322 (Layout::Layout): Initialize data members
1323 record_output_section_data_from_scrips_,
1324 script_output_section_data_list_ and relaxation_debug_check_.
1325 (Layout::save_segments, Layout::restore_segments,
1326 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1327 Layout::relaxation_loop_body): New method definitions.
1328 (Layout::finalize): Support relaxation. Move section layout code to
1329 Layout::relaxation_loop_body.
1330 (Layout::set_asection_address_from_script): Move code for orphan
1331 section placement out.
1332 (Layout::place_orphan_sections_in_script): New method definition.
1333 * layout.h (Output_segment_headers, Output_file_header):
1334 New forward class declarations.
1335 (Layout::~Layout): Define.
1336 (Layout::new_output_section_data_from_script): New method definition.
1337 (Layout::place_orphan_sections_in_script): New method declaration.
1338 (Layout::Segment_states): New type declaration.
1339 (Layout::save_segments, Layout::restore_segments,
1340 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1341 Layout::relaxation_loop_body): New method declarations.
1342 (Layout::Output_section_data_list): New type declaration.
1343 (Layout::Relaxation_debug_check): New class definition.
1344 (Layout::record_output_section_data_from_script_,
1345 Layout::script_output_section_data_list_, Layout::segment_states_,
1346 Layout::relaxation_debug_check_): New data members.
1347 * output.cc: (Output_section_headers::do_size): New method definition.
1348 (Output_section_headers::Output_section_headers): Move size
1349 computation to Output_section_headers::do_size.
1350 (Output_segment_headers::do_size): New method definition.
1351 (Output_file_header::Output_file_header): Move size computation to
1352 Output_file_header::do_size and call it.
1353 (Output_file_header::do_size): New method definition.
1354 (Output_data_group::Output_data_group): Adjust call to
1355 Output_section_data.
1356 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
1357 (Output_symtab_xindex::do_write): Add array bound check.
1358 (Output_section::Input_section::print_to_mapfile): Handle
1359 RELAXED_INPUT_SECTION_CODE.
1360 (Output_section::Output_section): Initialize data member checkpoint_.
1361 (Output_section::~Output_section): Delete checkpoint object pointed
1362 by checkpoint_.
1363 (Output_section::add_input_section): Always add an Input_section if
1364 relaxing.
1365 (Output_section::add_merge_input_section): Add assert.
1366 (Output_section::relax_input_section): New method definition.
1367 (Output_section::set_final_data_size): Set load address to zero for
1368 an unallocated section.
1369 (Output_section::do_address_and_file_offset_have_reset_values):
1370 New method definition.
1371 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
1372 Handle relaxed input section.
1373 (Output_section::sort_attached_input_sections): Checkpoint input
1374 section list lazily.
1375 (Output_section::get_input_sections): Change type of input_sections to
1376 list of Simple_input_section pointers. Checkpoint input section list
1377 lazily. Also handle relaxed input sections.
1378 (Output_section::add_input_section_for_script): Take a reference to
1379 a Simple_input_section object instead of Relobj pointer and section
1380 index as parameter. Handle relaxed input sections.
1381 (Output_section::save_states, Output_section::restore_states): New
1382 method definitions.
1383 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
1384 (Output_data::is_data_size_fixed): New method definition.
1385 (Output_data::reset_addresss_and_file_offset): Do not reset data size
1386 if it is fixed.
1387 (Output_data::address_and_file_offset_have_reset_values): New method
1388 definition.
1389 (Output_data::do_address_and_file_offset_have_reset_values): New method
1390 definition.
1391 (Output_data::set_data_size): Check that data size is not fixed.
1392 (Output_data::fix_data_size): New method definition.
1393 (Output_data::is_data_size_fixed_): New data member.
1394 (Output_section_headers::set_final_data_size): New method definition.
1395 (Output_section_headers::do_size): New method declaration.
1396 (Output_segment_headers::set_final_data_size): New method definition.
1397 (Output_segment_headers::do_size): New method declaration.
1398 (Output_file_header::set_final_data_size)::New method definition.
1399 (Output_file_header::do_size)::New method declaration.
1400 (Output_section_data::Output_section_data): Add new parameter
1401 is_data_size_fixed and use it to fix data size.
1402 (Output_data_const::Output_data_const): Adjust call to base class
1403 constructor and fix data size.
1404 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
1405 base class constructor and fix data size.
1406 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
1407 base class constructor and fix data size.
1408 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
1409 class constructor and fix data size.
1410 (Output_data_group::set_final_data_size): New method definition.
1411 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
1412 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
1413 class constructor and fix data size.
1414 (Output_relaxed_input_section): New class definition.
1415 (Output_section::Simple_input_section): New class definition.
1416 (Output_section::get_input_sections): Adjust parameter list.
1417 (Output_section::add_input_section_for_script): Same.
1418 (Output_section::save_states, Output_section::restore_states,
1419 Output_section::do_address_and_file_offset_have_reset_values,
1420 (Output_section::Input_section::Input_section): Handle
1421 RELAXED_INPUT_SECTION_CODE. Add new overload for
1422 Output_relaxed_input_section.
1423 (Output_section::Input_section::is_input_section,
1424 Output_section::Input_section::set_output_section): Handle relaxed
1425 input section.
1426 (Output_section::Input_section::is_relaxed_input_section,
1427 Output_section::Input_section::output_section_data,
1428 Output_section::Input_section::relaxed_input_section): New method
1429 definitions.
1430 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1431 value.
1432 (Output_section::Input_section::u1_): Update comments.
1433 (Output_section::Input_section::u2_): Add new union member poris.
1434 (Output_section::Checkpoint_output_section): New classs definition.
1435 (Output_section::relax_input_section): New method declaration.
1436 (Output_section::checkpoint_): New data member.
1437 (Output_segment): Update comments.
1438 (Output_segment::Output_segment): Un-privatize copy constructor.
1439 (Output_segment::operator=): Un-privatize.
1440 * script-sections.cc (Output_section_element::Input_section_list):
1441 Change element type to Output_section::Simple_input_section.
1442 (Output_section_element_dot_assignment::set_section_addresses):
1443 Register output section data for relaxation clean up.
1444 (Output_data_exression::Output_data_expression): Adjust call to base
1445 constructor to fix data size.
1446 (Output_section_element_data::set_section_addresses): Register
1447 Output_data_expression object for relaxation clean up.
1448 (struct Input_section_info): Replace Relobj pointer and section index
1449 pair with Output_section::Simple_input_section and Convert struct to a
1450 class.
1451 (Input_section_sorter::operator()): Adjust access to
1452 Input_section_info data member to use accessors.
1453 (Output_section_element_input::set_section_addresses): Use layout
1454 parameter. Adjust code to use Output_section::Simple_input_section
1455 and Input_secction_info classes. Register filler for relaxation
1456 clean up.
1457 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1458 and section index pair with Output_section::Simple_input_section
1459 class. Adjust code accordingly.
1460 (Phdrs_element::release_segment): New method definition.
1461 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1462 segment list.
1463 (Script_sections::release_segments): New method definition.
1464 * gold/script-sections.h (Script_sections::release_segments): New
1465 method declaration.
1466 * gold/target.h (Target::may_relax, Target::relax,
1467 Target::do_may_relax, Target::do_relax): New method definitions.
1468
5e445df6
ILT
14692009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1470
1471 * arm.cc (has_signed_unsigned_overflow): New function.
1472 (Arm_relocate_functions::abs8): New function.
1473 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1474 (Target_arm::Scan::global): Likewise.
1475 (Target_arm::relocate::relocate): Likewise.
1476 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1477 Likewise.
1478
8c604651 14792009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
1480
1481 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1482 * testsuite/Makefile.in: Regenerate.
1483
1e9cc1c2
NC
14842009-09-11 Nick Clifton <nickc@redhat.com>
1485
1486 * po/gold.pot: Updated by the Translation project.
1487
6a89f575
CC
14882009-09-08 Cary Coutant <ccoutant@google.com>
1489
1490 * output.cc (Output_file::open): Add execute permission to empty file.
1491 * testsuite/Makefile.am (permission_test): New test.
1492 * testsuite/Makefile.in: Regenerate.
1493
fdcac5af
ILT
14942009-09-02 Ian Lance Taylor <iant@google.com>
1495
1496 * output.cc (Output_file::resize): Call map_no_anonymous rather
1497 than map.
1498
44453f85
ILT
14992009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1500
1501 * gold.cc: Include "incremental.h".
1502 (queue_initial_tasks): Call Incremental_checker methods.
1503 * incremental.cc: Include "output.h".
1504 (Incremental_checker::can_incrementally_link_output_file): New
1505 method.
1506 * incremental.h (Incremental_checker): New class.
1507
1508 * output.cc (Output_file::open_for_modification): New method.
1509 (Output_file::map_anonymous): Changed return type to bool. Record
1510 map in base_ field.
1511 (Output_file::map_no_anonymous): New method, broken out of map.
1512 (Output_file::map): Use map_no_anonymous and map_anonymous.
1513 * output.h (class Output_file): Update declarations.
1514
293c1386
CC
15152009-08-24 Cary Coutant <ccoutant@google.com>
1516
1517 * options.h (Command_line::Pre_options): New class.
1518 (Command_line::pre_options): New member.
1519 * options.cc (gold::options::ready_to_register): New variable.
1520 (One_option::register_option): Do nothing if not registering options.
1521 Assert if same short option registered twice.
1522 (General_options::General_options): Turn off option registration when
1523 done constructing.
1524 (Command_line::Pre_options::Pre_options): New constructor.
1525
f773f3d2
CC
15262009-08-24 Cary Coutant <ccoutant@google.com>
1527
06a73cfe
CC
1528 * options.h (General_options::no_keep_memory): Remove incorrect
1529 short option.
f773f3d2 1530
a15af8e2
RW
15312009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1532
1533 * Makefile.am (am__skiplex, am__skipyacc): New.
1534 * Makefile.in: Regenerate.
1535
c462b41b
RW
15362009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1537
14ec8efd
RW
1538 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1539 (INCLUDES): ... this.
1540 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1541 (AM_CPPFLAGS): Renamed from ...
1542 (INCLUDE): ... this.
1543 * Makefile.in, testsuite/Makefile.in: Regenerate.
1544
81ecdfbb
RW
1545 * Makefile.in: Regenerate.
1546 * aclocal.m4: Likewise.
1547 * config.in: Likewise.
1548 * configure: Likewise.
1549 * testsuite/Makefile.in: Likewise.
1550
c462b41b
RW
1551 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1552 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1553 * Makefile.in: Regenerate.
1554 * testsuite/Makefile.in: Regenerate.
1555
2da73f13
CC
15562009-08-19 Cary Coutant <ccoutant@google.com>
1557
1558 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1559 symbols in shared libraries overridden by hidden or internal symbols
1560 in the main program.
1561
2db70501
CD
15622009-08-19 Chris Demetriou <cgd@google.com>
1563
1564 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1565 checking source file names in error messages.
1566
f733487b
DK
15672009-08-18 Doug Kwan <dougkwan@google.com>
1568
1569 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1570 an elcpp::Ehdr as parameter. Adjust call to set_target.
1571 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1572 an elfcpp::Ehdr as parameter.
1573 * object.cc (Object::set_target): Remove the version that looks up
1574 a target and sets it.
1575 (Sized_relobj::setup): Take a Target object instead of
1576 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1577 (make_elf_sized_object): Find target and ask target to
1578 make an ELF object.
1579 * object.h: (Object::set_target): Remove the version that looks up
1580 a target and sets it.
1581 (Sized_relobj::setup): Take a Target object instead of
1582 an elfcpp:Ehdr as parameter.
1583 * target.cc: Include dynobj.h.
1584 (Target::do_make_elf_object_implementation): New.
1585 (Target::do_make_elf_object): New.
1586 * target.h (Target::make_elf_object): New template declaration.
1587 (Target::do_make_elf_object): New method declarations.
1588 (Target::do_make_elf_object_implementation): New template declaration.
1589
cc70f101
ILT
15902009-08-14 Ian Lance Taylor <iant@google.com>
1591
1592 * gold.h (FUNCTION_NAME): Define.
1593 (gold_unreachable): Use FUNCTION_NAME.
1594
ef5e0cb1
ST
15952009-08-12 Sriraman Tallam <tmsriram@google.com>
1596
1597 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1598 symbol in the --keep-unique list is not found.
1599
48c187ce
ST
16002009-08-12 Sriraman Tallam <tmsriram@google.com>
1601
1602 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1603 been maked as --keep-unique.
1604 (Icf::unfold_section): New function.
1605 * icf.h (Icf::unfold_section): New function.
1606 * options.h (General_options::keep_unique): New option.
1607 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1608 * testsuite/Makefile.in: Regenerate.
1609 * testsuite/icf_keep_unique_test.sh: New file.
1610 * testsuite/icf_keep_unique_test.cc: New file.
1611
645afe0c
CC
16122009-08-12 Cary Coutant <ccoutant@google.com>
1613
1614 PR 10471
1615 * resolve.cc (Symbol_table::resolve): Check for references from
1616 dynamic objects to hidden and internal symbols.
1617 * testsuite/Makefile.am (hidden_test.sh): New test.
1618 * testsuite/Makefile.in: Regenerate.
1619 * testsuite/hidden_test.sh: New script.
1620 * testsuite/hidden_test_1.c: New test source.
1621 * testsuite/hidden_test_main.c: New test source.
1622
11af873f
DK
16232009-08-11 Doug Kwan <dougkwan@google.com>
1624
1625 * arm.cc: Update comments.
1626 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1627 segment to locate the .ARM.exidx section if present.
1628
b9f7d72d
DK
16292009-08-09 Doug Kwan <dougkwan@google.com>
1630
1631 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1632 patch.
1633
ddd3c53c
ST
16342009-08-07 Sriraman Tallam <tmsriram@google.com>
1635 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1636 compiler warnings.
1637
27721062
ST
16382009-08-06 Sriraman Tallam <tmsriram@google.com>
1639
1640 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1641 valid tls_segment only for non-debug-section relocations.
1642 * testsuite/Makefile.am: Add gc_tls_test.
1643 * testsuite/Makefile.in: Regenerate.
1644 * testsuite/gc_tls_test.cc: New file.
1645 * testsuite/gc_tls_test.sh: New file.
1646
ef15dade
ST
16472009-08-05 Sriraman Tallam <tmsriram@google.com>
1648
1649 * icf.cc: New file.
1650 * icf.h: New file.
1651 * Makefile.am (CCFILES): Add icf.cc.
1652 (HFILES): Add icf.h
1653 * Makefile.in: Regenerate.
1654 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1655 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1656 section, symbol and addend information for the relocs.
1657 * gold.cc (queue_middle_tasks): Call identical code folding.
1658 * gold.h: Add defines for multimap.
1659 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1660 to the call of finalize_local_symbols.
1661 * main.cc (main): Create object of class Icf.
1662 * object.cc (Sized_relobj::do_layout): Allow this function to be
1663 called twice during icf.
1664 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1665 to sections marked as identical by icf.
1666 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1667 when available.
1668 (Sized_relobj::do_section_entsize): New function.
1669 * object.h (Object::section_entsize): New function.
1670 (Object::do_section_entsize): New pure virtual function.
1671 (Relobj::finalize_local_symbols): Add new parameter.
1672 (Relobj::do_section_entsize): New function.
1673 * options.h (General_options::icf): New option.
1674 (General_options::icf_iterations): New option.
1675 (General_options::print_icf_sections): New option.
1676 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1677 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1678 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1679 icf.
1680 * symtab.cc (Symbol_table::is_section_folded): New function.
1681 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1682 to sections marked as identical by icf.
1683 * symtab.h (Symbol_table::set_icf): New function.
1684 (Symbol_table::icf): New function.
1685 (Symbol_table::is_section_folded): New function.
1686 (Symbol_table::icf_): New data member.
1687 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1688 * testsuite/Makefile.am: Add commands to build icf_test.
1689 * testsuite/Makefile.in: Regenerate.
1690 * testsuite/icf_test.sh: New file.
1691 * testsuite/icf_test.cc: New file.
1692
c3b65ac4
CD
16932009-07-24 Chris Demetriou <cgd@google.com>
1694
1695 * layout.cc (is_compressible_debug_section): Fix incorrect
1696 comment about compressed section names.
1697
1caf2c51
ILT
16982009-07-20 Ian Lance Taylor <ian@airs.com>
1699
1700 PR 10419
1701 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1702
1ef4d87f
ILT
17032009-07-16 Ian Lance Taylor <iant@google.com>
1704
1705 PR 10400
1706 * layout.h: #include <map>.
1707 (class Kept_section): Change from struct to class. Add accessors
1708 and setters. Add section size to Comdat_group mapping. Change
1709 Comdat_group to std::map. Add is_comdat_ field. Add
1710 linkonce_size field in union.
1711 (class Layout): Update declaration of find_or_add_kept_section.
1712 Don't declare find_kept_object.
1713 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1714 parameter. Add object, shndx, is_comdat, and is_group_name
1715 parameters. Change all callers. Adjust for new Kept_section.
1716 (Layout::find_kept_object): Remove.
1717 * object.cc (Sized_relobj::include_section_group): Update use of
1718 Kept_section. Rename secnum to shndx. Only record
1719 Kept_comdat_section if sections are the same size.
1720 (Sized_relobj::include_linkonce_section): Update use of
1721 Kept_section. Only record Kept_comdat_section if sections are the
1722 same size. Set size of linkonce section.
1723 (Sized_relobj::map_to_kept_section): Update call to
1724 get_kept_comdat_section.
1725 * object.h (class Sized_relobj): Rename fields in
1726 Kept_comdat_section to drop trailing underscores; change object
1727 field to Relobj*. Change Kept_comdat_section_table to store
1728 struct rather than pointer.
1729 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1730 Add kept_object and kept_shndx parameters. Change all callers.
1731 (Sized_relobj::get_kept_comdat_section): Change return type to
1732 bool. Add kept_object and kept_shndx parameters. Change all
1733 callers.
1734 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1735 Layout::find_or_add_kept_section.
1736
37c3b7b0
ILT
17372009-07-09 Ian Lance Taylor <iant@google.com>
1738
1739 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1740 Reserve space in the hash table.
1741
98fa85cb
ILT
17422009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1743
1744 * fileread.cc (File_read::get_mtime): New method.
1745 * fileread.h (Timespec): New structure.
1746 (File_read::get_mtime): New method.
1747 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1748 Renamed from timestamp_nsec.
1749 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1750 Elf_Xword.
1751 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1752 timestamp_nsec.
1753 (Incremental_inputs::report_archive): Save mtime; style fix.
1754 (Incremental_inputs::report_obejct): Save mtime; style fix.
1755 (Incremental_inputs::report_script): Save mtime; style fix.
1756 (Incremental_inputs::finalize_inputs): Style fix.
1757 (Incremental_inputs::finalize): Style fix.
1758 (Incremental_inputs::create_input_section_data): Store inputs
1759 mtime.
1760 * incremental.h (Incremental_inputs::report_script): Add mtime
1761 argument.
1762 (Incremental_inputs::Input_info::Input_info): Intialize only one
1763 union member.
1764 (Incremental_inputs::Input_info::archive): Move to nameless
1765 union.
1766 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1767 (Incremental_inputs::Input_info::script): Move to nameless union.
1768 (Incremental_inputs::mtime): New field.
1769 * script.cc (read_input_script): Pass file mtime to
1770 Incremental_input.
1771 * script.h (Script_info::inputs): Style fix.
1772
c9d70757
ILT
17732009-07-01 Ian Lance Taylor <ian@airs.com>
1774
1775 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1776 instead of 32.
1777
9c547ec3
ILT
17782009-06-24 Ian Lance Taylor <iant@google.com>
1779
1780 PR 10156
1781 * layout.cc (Layout::choose_output_section): If we find an
1782 existing section, update the flags.
1783 (Layout::create_notes): New function, broken out of
1784 Layout::finalize.
1785 (Layout::finalize): Don't create note sections.
1786 (Layout::create_note): Don't crash if linker script discards
1787 section.
1788 (Layout::create_gold_note): Likewise.
1789 (Layout::create_build_id): Likewise. Don't set
1790 after_input_sections on the section.
1791 (Layout::create_executable_stack_info): Remove target parameter.
1792 Change caller.
1793 * layout.h (class Layout): Declare create_notes. Update
1794 declaration of create_executable_stack_info.
1795 * gold.cc (queue_middle_tasks): Call create_notes.
1796 * output.cc (Output_section::update_flags_for_input_section): Move
1797 here from output.h. If SHF_ALLOC flag is newly set, mark address
1798 invalid.
1799 * output.h (Output_data::mark_address_invalid): New function.
1800 (class Output_section): Only declare, not define,
1801 update_flags_for_input_section. Remove set_flags.
1802
55458500
ILT
18032009-06-24 Ian Lance Taylor <iant@google.com>
1804
1805 * script-sections.cc (Output_section_definition::
1806 set_section_addresses): Rename shadowing local load_address to
1807 laddr.
1808
1307d6cd
ILT
18092009-06-24 Ian Lance Taylor <iant@google.com>
1810
1811 PR 10244
1812 * reloc.cc (relocate_sections): Skip empty relocation sections.
1813
ec3f783e
ILT
18142009-06-23 Ian Lance Taylor <iant@google.com>
1815
1816 PR 10156
1817 * layout.cc (Layout::create_note): Use choose_output_section
1818 rather than make_output_section.
1819
459c9f1c
ILT
18202009-06-23 Ian Lance Taylor <iant@google.com>
1821
1822 PR 10237
1823 * options.cc (General_options::parse_V): Set printed_version_.
1824 (General_options::General_options): Initialize printed_version_.
1825 * options.h (class General_options): Add printed_version_ field.
1826 * gold.cc (queue_initial_tasks): If there are no input files,
1827 don't give a fatal error if we printed the version information.
1828 (queue_middle_tasks): If using -r with a shared object, give a
1829 fatal error rather than an ordinary error.
1830
1518dc8f
ILT
18312009-06-23 Ian Lance Taylor <iant@google.com>
1832
1833 PR 10219
1834 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1835 (Layout::make_output_section): Set have_stabstr_section_ if we see
1836 a .stab*str section.
1837 (Layout::finalize): Call link_stabs_sections.
1838 (Layout::link_stabs_sections): New file.
1839 * layout.h (class Layout): Add have_stabstr_section_ field.
1840 Declare link_stabs_sections.
1841
3d857b98
DK
18422009-06-23 Doug Kwan <dougkwan@google.com>
1843
1844 * Makefile.am (libgold_a_LIBADD): New.
1845 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1846 * Makefile.in: Regenerate.
1847 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1848 * configure: Regenerate.
1849 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1850 * fileread.cc: Include sys/state.h
1851 * gold.h: Declare memmem and strndup if found missing.
1852 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1853
0639a6f6
ILT
18542009-06-23 Ian Lance Taylor <iant@google.com>
1855
1856 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1857 * configure: Rebuild.
1858
8d63875c
ILT
18592009-06-23 Ian Lance Taylor <iant@google.com>
1860
1861 PR 10147
1862 * object.cc (Object::section_contents): Don't try to get a view if
1863 the section has length zero.
1864 (Object::handle_gnu_warning_section): If the section is empty, use
1865 the name of the section as the warning.
1866
f7c8a183
ILT
18672009-06-23 Ian Lance Taylor <iant@google.com>
1868
1869 PR 10133
1870 * stringpool.h (class Stringpool_template): Add optimize_ field.
1871 (Stringpool_template::set_optimize): New function.
1872 * stringpool.cc (Stringpool_template::Stringpool_template):
1873 Initialize optimize_ field.
1874 (Stringpool_template::set_string_offsets): Test local optimize
1875 fild rather than parameter.
1876 * layout.cc (Layout::Layout): Call set_optimize on the section
1877 name stringpool.
1878
e6a307ba
ILT
18792009-06-22 Ian Lance Taylor <iant@google.com>
1880
1881 PR 10030
1882 * yyscript.y: Parse TARGET.
1883 * script.cc (script_set_target): New function.
1884 * script-c.h (script_set_target): Declare.
1885 * options.cc (General_options::string_to_object_format): Rename
1886 from string_to_object_format in anonymous namespace. Change
1887 callers.
1888 * options.h (class General_options): Declare
1889 string_to_object_format.
1890
3ee173de
ILT
18912009-06-22 Ian Lance Taylor <iant@google.com>
1892
1893 * script-sections.cc (Script_sections::create_segments): Don't put
1894 program headers in a PT_LOAD segment if -n or -N.
1895
18962009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
1897
1898 PR 10141
1899 * options.h (class General_options): Add -z lazy and -z now. Sort
1900 -z options into alphabetical order.
1901 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1902
cd6739a1 19032009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
1904
1905 * layout.cc (Layout::make_output_section): Call
1906 Target::new_output_section.
1907 (Layout::attach_allocated_section_to_segment): Put large section
1908 sections in a separate load segment with the large segment flag
1909 set.
1910 (Layout::segment_precedes): Sort large data segments after other
1911 load segments.
1912 (align_file_offset): New static function.
1913 (Layout::set_segment_offsets): Use align_file_offset.
1914 * output.h (class Output_section): Add is_small_section_ and
1915 is_large_section_ fields.
1916 (Output_section::is_small_section): New function.
1917 (Output_section::set_is_small_section): New function.
1918 (Output_section::is_large_section): New function.
1919 (Output_section::set_is_large_section): New function.
1920 (Output_section::is_large_data_section): New function.
1921 (class Output_segment): Add is_large_data_segment_ field.
1922 (Output_segment::is_large_data_segment): New function.
1923 (Output_segment::set_is_large_data_segment): New function.
1924 * output.cc (Output_section::Output_section): Initialize new
1925 fields.
1926 (Output_segment::Output_segment): Likewise.
1927 (Output_segment::add_output_section): Add assertion that large
1928 data sections always go in large data segments. Force small data
1929 sections to the end of the list of data sections. Force small BSS
1930 sections to the start of the list of BSS sections. For large BSS
1931 sections to the end of the list of BSS sections.
1932 * symtab.h (class Symbol): Declare is_common_shndx.
1933 (Symbol::is_defined): Check Symbol::is_common_shndx.
1934 (Symbol::is_common): Likewise.
1935 (class Symbol_table): Define enum Commons_section_type. Update
1936 declarations. Add small_commons_ and large_commons_ fields.
1937 * symtab.cc (Symbol::is_common_shndx): New function.
1938 (Symbol_table::Symbol_table): Initialize new fields.
1939 (Symbol_table::add_from_object): Put small and large common
1940 symbols in the right list.
1941 (Symbol_table::sized_finalized_symbol): Check
1942 Symbol::is_common_shndx.
1943 (Symbol_table::sized_write_globals): Likewise.
1944 * common.cc (Symbol_table::do_allocate_commons): Allocate new
1945 common symbol lists. Don't call do_allocate_commons_list if the
1946 list is empty.
1947 (Symbol_table::do_allocate_commons_list): Remove is_tls
1948 parameter. Add comons_section_type parameter. Change all
1949 callers. Handle small and large common symbols.
1950 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
1951 Symbol::is_common_shndx.
1952 * resolve.cc (symbol_to_bits): Likewise.
1953 * target.h (Target::small_common_shndx): New function.
1954 (Target::small_common_section_flags): New function.
1955 (Target::large_common_shndx): New function.
1956 (Target::large_common_section_flags): New function.
1957 (Target::new_output_section): New function.
1958 (Target::Target_info): Add small_common_shndx, large_common_shndx,
1959 small_common_section_flags, and large_common_section_flags
1960 fields.
1961 (Target::do_new_output_section): New virtual function.
1962 * arm.cc (Target_arm::arm_info): Initialize new fields.
1963 * i386.cc (Target_i386::i386_info): Likewise.
1964 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1965 Likewise.
1966 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
1967 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1968 (Target_x86_64::do_new_output_section): New function.
1969 * configure.ac: Define conditional MCMODEL_MEDIUM.
1970 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1971 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1972 (large_LDFLAGS): Define.
1973 * testsuite/large.c: New file.
1974 * testsuite/testfile.cc (Target_test::test_target_info):
1975 Initialize new fields.
1976 * configure, testsuite/Makefile.in: Rebuild.
1977
bb04269c
DK
19782009-06-05 Doug Kwan <dougkwan@google.com>
1979
1980 * Makefile.am (CCFILES): Add target.cc.
1981 * Makefile.in: Regenerate.
1982 * i386.cc (class Target_i386): Define new virtual method to
1983 override do_is_local_label_name in parent.
1984 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1985 local symbols if --discard-locals or -X is given.
1986 * options.h (class General_options): Declare new options
1987 '--discard-locals' and '-X' for discarding locals.
1988 * target.h (class Target): Define new methods is_local_label_name.
1989 Declare new virtual method do_is_local_label_name.
1990 * target.cc: New file.
1991 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1992 (check_SCRIPTS): Add discard_locals_test.sh.
1993 (check_DATA): Add discard_local_tests.syms.
1994 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1995 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1996 * testsuite/Makefile.in: Regenerate.
1997 * testsuite/discard_locals_test.c: New file.
1998 * testsuite/discard_locals_test.sh: Same.
1999
805bb01c
DK
20002009-06-05 Doug Kwan <dougkwan@google.com>
2001
2002 * object.cc (Sized_relobj::Sized_relobj): Initialize
2003 discarded_eh_frame_shndx_ to -1U.
2004 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2005 section.
2006 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2007 a discarded .eh_frame section.
2008 (Sized_relobj::do_finalize_local_symbols): Ditto.
2009 * object.h (class Sized_relobj): Declare new member
2010 discarded_eh_frame_shndx_.
2011 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2012 (local_labels_test.o, local_labels_test): New rules.
2013 * testsuite/Makefile.in: Regenerate.
2014
1dcd334d
DK
20152009-06-04 Doug Kwan <dougkwan@google.com>
2016
2017 * layout.cc (Layout::section_name_mapping): Add mapping for
2018 special ARM sections.
2019
96d49306
DK
20202009-06-03 Doug Kwan <dougkwan@google.com>
2021
2022 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2023 (utils::has_overflow): Same.
2024
dff16297
ILT
20252009-06-03 Ian Lance Taylor <iant@google.com>
2026
2027 * layout.cc (Layout::section_name_mapping): New array, replacing
2028 Layout::linkonce_mapping.
2029 (Layout::section_name_mapping_count): New variable, replacing
2030 Layout::linkonce_mapping_count.
2031 (Layout::linkonce_output_name): Remove.
2032 (Layout::output_section_name): Rewrite.
2033 * layout.h (class Layout): Rename Linkonce_mapping to
2034 Section_name_mapping, linkonce_mapping to section_name_mapping,
2035 linkonce_mapping_count to section_name_mapping_count. Don't
2036 declare linkonce_output_name.
2037
c121c671
DK
20382009-06-03 Doug Kwan <dougkwan@google.com>
2039
2040 * gold/arm.cc (namespace utils): New.
2041 (Target_arm::reloc_is_non_pic): Define new method.
2042 (class Arm_relocate_functions): New.
2043 (Target_arm::Relocate::relocate): Handle relocation types used by
2044 Android.
2045
07800fab
ILT
20462009-06-03 Ian Lance Taylor <iant@google.com>
2047
2048 * arm.cc (Target_arm::scan::global): Use || instead of |.
2049
c121c671
DK
20502009-06-02 Doug Kwan <dougkwan@google.com>
2051
2052 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2053 issued_non_pic_error_.
2054 (class Target_arm::Scan): Declare new method check_non_pic.
2055 Define new method symbol_needs_plt_entry.
2056 Declare new data member issued_non_pic_error_.
2057 (class Target_arm::Relocate): Declare new method
2058 should_apply_static_reloc.
2059 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2060 (Target_arm::Scan::check_non_pic): Define new method.
2061 (Target_arm::Scan::local): Handle a small subset of reloc types used
2062 by Android.
2063 (Target_arm::Scan::local): Same.
2064 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2065
b19b0c6d
ILT
20662009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2067
2068 * incremental.cc (Incremental_inputs::report_command_line): Filter
2069 out --incremental-* options.
2070
94cdfcff
DK
20712009-05-29 Doug Kwan <dougkwan@google.com>
2072
2073 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2074 template class.
2075 (class Target_arm): Update comment.
2076 (Target_arm::Target_arm): Initialize new data members GOT_,
2077 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2078 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2079 and Target_arm::rel_dyn_section.
2080 Declare new_enum Target_arm::Got_type.
2081 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2082 and DYNBSS_.
2083 Update commments for member do_dynsym_value.
2084 (Target_arm::got_size, Target_arm::plt_section,
2085 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2086 new methods inside class defintion.
2087 (Target_arm::got_section): Define new method.
2088 (Target_arm::rel_dyn_section): Same.
2089 (Output_data_plt_arm): New template class.
2090 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2091 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2092 (Output_data_plt_arm::add_entry): Same.
2093 (Output_data_plt_arm::first_plt_entry): Define new
2094 static data member for PLT instruction template.
2095 (Output_data_plt_arm::plt_entry): Same.
2096 (Output_data_plt_arm::do_write): Define new method.
2097 (Target_arm::make_plt_entry): Same.
2098 (Target_arm::do_finalize_sections): Same.
2099 (Target_arm::do_dynsym_value): Same.
2100
4a657b0d
DK
21012009-05-28 Doug Kwan <dougkwan@google.com>
2102
2103 * Makefile.am (TARGETSOURCES): Add arm.cc.
2104 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2105 * Makefile.in: Regenerate.
2106 * arm.cc: New file.
2107 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2108
e7ae8c36
DK
21092009-05-26 Doug Kwan <dougkwan@google.com>
2110
2111 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2112 (General_options::check_excluded_libs): Strip off directories in
2113 archive name before matching like GNU ld does.
2114 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2115 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2116 (exclude_libs_test_LDFLAGS): Add linker option
2117 -Wl,--exclude-libs,libexclude_libs_test_3
2118 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2119 an explicit archive without using -l.
2120 (alt/libexclude_libs_test_3.a): New make rule.
2121 * testsuite/Makefile.in: Regenerate.
2122 * testsuite/exclude_libs_test.c : Declare lib3_default().
2123 (main): Call it.
2124 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2125 * exclude_libs_test_3.c: New file.
2126
f12e7348
NC
21272009-05-26 Nick Clifton <nickc@redhat.com>
2128
2129 * po/id.po: New Indonesian translation.
2130 * po/gold.pot: Updated template file.
2131
4daadc0d
ST
21322009-05-22 Sriraman Tallam <tmsriram@google.com>
2133
2134 * testsuite/Makefile.am: Add -ffunction-sections to compile
2135 gc_comdat_test files. Add -Wl,--gc-sections to build
2136 gc_comdat_test.
2137 * testsuite/Makefile.in: Regenerate.
2138 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2139
531813ad
ST
21402009-05-21 Sriraman Tallam <tmsriram@google.com>
2141
2142 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2143 kept comdat section was garbage collected.
2144 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2145 * testsuite/Makefile.in: Regenerate.
2146 * testsuite/gc_comdat_test.sh: New file.
2147 * testsuite/gc_comdat_test_1.cc: New file.
2148 * testsuite/gc_comdat_test_2.cc: New file.
2149
65514900
CC
21502009-05-19 Doug Kwan <dougkwan@google.com>
2151
2152 * archive.cc (Archive::Archive): Move constructor from archive.h
2153 to here. Initialize no_export_.
2154 (Archive::get_elf_object_for_member): Set no_export flag of object.
2155 * archive.h (Archive::Archive): Move constructor body to
2156 archive.cc.
2157 (Archive::no_export): New method.
2158 (Archive::no_export_): New field.
2159 * object.h (Object::Object): Initialize no_export_ to false.
2160 (Object::no_export, Object::set_no_export): New methods.
2161 (Object::no_export_): New field.
2162 * options.cc (General_options::parse_exclude_libs): New method.
2163 (General_options::check_excluded_libs) Same.
2164 * options.h (exclude_libs): New option.
2165 (General_options::check_excluded_libs): New method declaration.
2166 (General_options::excluded_libs_): New field.
2167 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
2168 default or protected visibility if an object has no-export flag set.
2169 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
2170 (check_SCRIPTS): Add exclude_libs_test.sh.
2171 (check_DATA): Add exclude_libs_test.syms.
2172 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
2173 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
2174 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
2175 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
2176 (exclude_libs_test.syms, libexclude_libs_test_1.a,
2177 libexclude_libs_test_2.a): New rules.
2178 * testsuite/Makefile.in: Regenerate.
2179 * testsuite/exclude_libs_test.c: New file.
2180 * testsuite/exclude_libs_test.sh: Ditto.
2181 * testsuite/exclude_libs_test_1.c: Ditto.
2182 * testsuite/exclude_libs_test_2.c: Ditto.
2183
1b77ea50
ILT
21842009-05-15 Ian Lance Taylor <iant@google.com>
2185
2186 * configure.ac: Check for declarations for cases where libiberty.h
2187 checks HAVE_DECL_xxx.
2188 * configure, config.in: Rebuild.
2189
072fe7ce
ILT
21902009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2191
2192 * gold.h (Incremental_argument_list): Remove (invalid) forward
2193 declaration.
2194 * incremental.cc (Incremental_inputs::report_achive): New method.
2195 (Incremental_inputs::report_object): New method.
2196 (Incremental_inputs::report_script): New method.
2197 (Incremental_inputs::finalize_inputs): New method.
2198 (Incremental_inputs::finalize): Call finalize_inputs().
2199 (Incremental_inputs::sized_create_incremental_inputs_section_data):
2200 Create inputs entries.
2201 * incremental.h (Incremental_input_type): New enum.
2202 (Incremental_inputs::Incremental_input): Initialize new fields.
2203 (Incremental_inputs::report_inputs): New method.
2204 (Incremental_inputs::report_achive): New method.
2205 (Incremental_inputs::report_object): New method.
2206 (Incremental_inputs::report_script): New method.
2207 (Incremental_inputs::finalize_inputs): New method.
2208 (Incremental_inputs::Input_info): New struct.
2209 (Incremental_inputs::Input_info_map): New typedef.
2210 (Incremental_inputs::lock_): New field.
2211 (Incremental_inputs::Inputs_): New field.
2212 (Incremental_inputs::Inputs_map): New field.
2213 * main.cc (main): Call Incremental_input::report_inputs.
2214 * options.h (Input_argument_list): Typedef moved from
2215 Input_arguments.
2216 (Input_file_group::Files): Remove, use ::Input_argument_list.
2217 (Input_file_group::Input_argument_list): Remove, use
2218 ::Input_argument_list.
2219 * plugin.cc (Plugin_manager::add_input_file): Add error in
2220 incremental build.
2221 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2222 functions.
2223 * script.cc (read_input_script): Call
2224 Incremental_input::report_script.
2225 * script.h (Script_info): New class.
2226
b0481b0b
ILT
22272009-04-27 Ian Lance Taylor <iant@google.com>
2228
2229 * x86_64.cc (do_adjust_output_section): Set entsize to
2230 plt_entry_size.
2231
b22a5a41 22322009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
2233
2234 * output.cc (Output_file::close): After short writes, continue
2235 writing from the correct offset in the buffer being written.
2236
40fde488
CD
22372009-04-23 Chris Demetriou <cgd@google.com>
2238
2239 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2240 * configure: Regenerate.
2241 * config.in: Regenerate.
2242 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2243 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2244
3ce2c28e
ILT
22452009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2246
2247 * incremental.cc (Incremental_inputs_header_data): Renamed from
2248 Incremental_input_header_data.
2249 (Incremental_inputs_header_data::data_size): New field.
2250 (Incremental_inputs_header_data::put_input_file_count): Renamed
2251 from input_file_count.
2252 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2253 from command_line_offset.
2254 (Incremental_inputs_header_data::put_reserved): Renamed from
2255 put_reserved.
2256 (Incremental_inputs_entry_data): Renamed from
2257 Incremental_input_entry_data.
2258 (Incremental_inputs_entry_data::data_size): New field.
2259 (Incremental_inputs::report_command_line): New method.
2260 (Incremental_inputs::finalize): New method.
2261 (Incremental_inputs::create_incremental_inputs_data): New method.
2262 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
2263 * incremental.h: New file.
2264 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
2265 (Layout::finalize): Create incremental inputs section in
2266 incremental builds.
2267 (Layout::create_incremental_info_sections): New method.
2268 * layout.h (Layout::incremental_inputs): New method.
2269 (Layout::create_incremental_info_sections): New method.
2270 (Layout::incremental_inputs_): New field.
2271 * main.cc (main): Notify Incremental_input of the command line.
2272
e55bde5e
ILT
22732009-04-01 Ian Lance Taylor <iant@google.com>
2274 Mikolaj Zalewski <mikolajz@google.com>
2275
2276 * gold.h (reserve_unordered_map): Define, three versions, one for
2277 each version of Unordered_map.
2278 * layout.cc (Layout::Layout): Remove options parameter. Add
2279 number_of_input_files parameter. Don't initialize options_.
2280 Initialize number_of_input_files_ and resized_signatures_. Move
2281 sections_are_attached_.
2282 (Layout::layout_group): Reserve space for group_signatures_.
2283 (Layout::find_or_add_kept_section): Change name parameter to be a
2284 reference. Resize signatures_ map when it gets large enough.
2285 (Layout::layout_eh_frame): Use parameters->options() instead of
2286 this->options_.
2287 (Layout::make_output_section): Likewise.
2288 (Layout::attach_allocated_section_to_segment): Likewise.
2289 (Layout::finalize, Layout::create_executable_stack): Likewise.
2290 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
2291 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
2292 * layout.h (class Layout): Update declarations. Remove options_
2293 field. Add number_of_input_files_ and resized_signatures_
2294 fields. Move sections_are_attached_ field.
2295 * main.cc (main): Pass number of input files to Layout
2296 constructor. Don't pass options.
2297
154b857c
ILT
22982009-03-30 Ian Lance Taylor <iant@google.com>
2299
2300 * ffsll.c (ffsll): Correct implementation.
2301
2f35ab9b
ILT
23022009-03-27 Ian Lance Taylor <iant@google.com>
2303
fd03461a
ILT
2304 * ffsll.c: New file.
2305 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
2306 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
2307 * ftruncate.c (ftruncate): Declare before definition.
2308 * mremap.c (mremap): Likewise.
2309 * pread.c (pread): Likewise.
2310 * configure, Makefile.in, config.in: Rebuild.
2311
2f35ab9b
ILT
2312 * mremap.c: New file.
2313 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
2314 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
2315 (mremap): Declare if HAVE_MREMAP is not defined.
2316 * configure, Makefile.in, config.in: Rebuild.
2317
33aea2fd
CC
23182009-03-27 Cary Coutant <ccoutant@google.com>
2319
2320 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
2321 position independent.
2322 * sparc.cc (Target_sparc::check_non_pic): Likewise.
2323 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
2324
6d479619
CC
23252009-03-24 Cary Coutant <ccoutant@google.com>
2326
2327 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
2328 an executable.
2329 (needs_dynamic_reloc): Likewise.
2330
afc06bb8
ILT
23312009-03-24 Ian Lance Taylor <iant@google.com>
2332
2333 * yyscript.y (file_cmd): Recognize EXTERN.
2334 (extern_name_list, extern_name_list_body): New nonterminals.
2335 * script.cc (script_add_extern): Define.
2336 * script-c.h (script_add_extern): Declare.
2337
f6060a4d
ILT
23382009-03-24 Rafael Avila de Espindola <espindola@google.com>
2339
2340 * object.cc (is_elf_object): Define.
2341 * object.h (is_elf_object): Declare.
2342 * archive.cc (Archive::get_elf_object_for_member): Call
2343 is_elf_object.
33aea2fd 2344 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 2345
26736d8e
ILT
23462009-03-24 Elliott Hughes <enh@google.com>
2347
2348 * output.cc (Output_file::map_anonymous): Define.
2349 (Output_file::map): Use map_anonymous. If the regular mmap fails,
2350 try an anonymous one. Report the size if the mmap fails.
2351 * output.h (class Output_file): Declare map_anonymous.
2352
22fd9730
ILT
23532009-03-24 Ian Lance Taylor <iant@google.com>
2354
2355 * target-select.cc (instantiate_target): Don't acquire the lock if
2356 the instantiated_target_ field has already been set.
2357
cb010894
ILT
23582009-03-23 Ian Lance Taylor <iant@google.com>
2359
7f055c20
ILT
2360 * gold-threads.h (class Initialize_lock): Define.
2361 * gold-threads.cc (class Initialize_lock_once): Define.
2362 (initialize_lock_control): New static variable.
2363 (initialize_lock_pointer): New static variable.
2364 (initialize_lock_once): New static function.
2365 (Initialize_lock::Initialize_lock): Define.
2366 (Initialize_lock::initialize): Define.
2367 * target-select.h: Include "gold-threads.h".
2368 (class Target_selector): Add lock_ and initialize_lock_ fields.
2369 Don't define instantiate_target, just declare it.
2370 * target-select.cc (Target_selector::Target_selector): Initialize
2371 new fields.
2372 (Target_selector::instantiate_target): Define.
2373 * descriptors.h: Include "gold-threads.h".
2374 (class Descriptors): Add initialize_lock_ field.
2375 * descriptors.cc (Descriptors::Descriptors): Initialize new
2376 field.
2377 (Descriptors::open): Use initialize_lock_ field
2378 * errors.h (class Errors): Add initialize_lock_ field.
2379 * errors.cc (Errors::Errors): Initialize new field.
2380 (Errors::initialize_lock): Use initialize_lock_ field.
2381 * powerpc.cc (class Target_selector_powerpc): Remove
2382 instantiated_target_ field. In do_recognize call
2383 instantiate_target rather than do_instantiate_target. In
2384 do_instantiate_target just allocate a new target.
2385 * sparc.cc (class Target_selector_sparc): Likewise.
2386
36959681
ILT
2387 * freebsd.h: New file.
2388 * i386.cc: Include "freebsd.h".
2389 (Target_i386): Derive from Target_freebsd rather than
2390 Sized_target.
2391 (Target_selector_i386): Derive from Target_selector_freebsd rather
2392 than Target_selector.
2393 * x86_64.cc: Include "freebsd.h".
2394 (Target_x86_64): Derive from Target_freebsd rather than
2395 Sized_target.
2396 (Target_selector_x86_64): Derive from Target_selector_freebsd
2397 rather than Target_selector.
2398 * target.h (class Target): Add adjust_elf_header and
2399 do_adjust_elf_header.
2400 * output.cc (Output_file_header:: do_sized_write): Call target
2401 adjust_elf_header routine.
2402 * configure.tgt: Set targ_osabi.
2403 * configure.ac: Define GOLD_DEFAULT_OSABI.
2404 * parameters.cc (Parameters::default_target): Pass
2405 GOLD_DEFAULT_OSABI to select_target.
2406 * target-select.h (class Target_selector): Make instantiate_target
2407 protected rather than private.
2408 * Makefile.am (HFILES): Add freebsd.h.
2409 * configure, Makefile.in, config.in: Rebuild.
2410
cb010894
ILT
2411 * merge.cc (do_add_input_section): Correct pend value. Change
2412 message about last entry not being null terminated from error to
2413 warning.
2414
0e879927
ILT
24152009-03-20 Mikolaj Zalewski <mikolajz@google.com>
2416
2417 * incremental.cc: New file.
2418 * Makefile.am (CCFILES): Add incremental.cc.
2419 * Makefile.in: Rebuild.
2420
41105937
PP
24212009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
2422
2423 * layout.cc (Layout::output_section_name): Preserve names
2424 of '.note.' sections.
2425
60439920
ILT
24262009-03-19 Ian Lance Taylor <iant@google.com>
2427
2428 * descriptors.cc (Descriptors::open): Check that the options are
2429 valid before using them.
2430
0d371ad3
ILT
24312009-03-18 Ian Lance Taylor <iant@google.com>
2432
2433 * script-sections.h: Include <list>.
2434 (class Script_sections): Change Sections_elements from std::vector
2435 to std::list. Typedef public Elements_iterator. Add
2436 orphan_section_placement_, data_segment_align_start_, and
2437 saw_data_segment_align_ fields. Remove data_segment_align_index_
2438 field.
2439 * script-sections.cc (class Orphan_section_placement): New class.
2440 (class Sections_element): Add virtual functions is_relro and
2441 orphan_section_init. Remove virtual function place_orphan_here.
2442 (class Output_section_definition): Add is_relro and
2443 orphan_section_init. Remove place_orphan_here.
2444 (class Orphan_output_section): Likewise.
2445 (Script_sections::Script_sections): Update for field changes.
2446 (Script_sections::data_segment_align): Set saw_data_segment_align_
2447 and data_segment_align_start_, not data_segment_align_index.
2448 (Script_sections::data_segment_relro_end): Check
2449 saw_data_segment_align_. Use data_segment_align_start_ rather
2450 than data_segment_align_index_.
2451 (Script_sections::place_orphan): Rewrite to use
2452 Orphan_section_placement.
2453
9201d894
ILT
24542009-03-17 Ian Lance Taylor <iant@google.com>
2455
9c5b8369
ILT
2456 * archive.cc (Archive::add_symbols): Check for a version attached
2457 to the symbol name in the archive map.
2458 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2459 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2460 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2461 (ver_test_11.a): New target.
2462 * testsuite/Makefile.in: Rebuild.
2463
9201d894
ILT
2464 * configure.ac: Check for chsize and posix_fallocate. Replace
2465 ftruncate.
2466 * ftruncate.c: New file, from gnulib.
2467 * output.cc (posix_fallocate): Define dummy version if not
2468 HAVE_POSIX_FALLOCATE.
2469 (Output_file::map): Call posix_fallocate rather than lseek and
2470 write.
2471 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2472 * configure, Makefile.in, config.in: Rebuild.
2473
ef4ab7a8
PP
24742009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2475
2476 * layout.h (Layout::create_note): Add section_name parameter.
2477 * layout.cc (Layout::create_note): Likewise.
2478 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2479
8c500701
ILT
24802009-03-17 Ian Lance Taylor <iant@google.com>
2481
e85b18e1
ILT
2482 * descriptors.cc: Include "options.h".
2483 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2484 (Descriptors::open): Always use O_CLOEXEC when opening a new
2485 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2486 then set FD_CLOEXEC.
2487
9efe6174
ILT
2488 * sparc.cc (class Target_sparc): Add has_got_section.
2489 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2490 make sure we have a GOT section.
2491
2492 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2493 (Target_sparc::Scan::local): Likewise.
2494 (Target_sparc::Scan::global): Likewise.
2495 (Target_sparc::Relocate::relocate): Likewise.
2496 (Target_sparc::Relocate::relocate_tls): Likewise.
2497
8c500701
ILT
2498 * symtab.cc (Symbol_table::define_default_version): New function,
2499 broken out of add_from_object.
2500 (Symbol_table::add_from_object): Call define_default_version.
2501 (Symbol_table::define_special_symbol): Add resolve_oldsym
2502 parameter. Change all callers. If the version for a symbol comes
2503 from a version script, resolve it with the symbol with the same
2504 name with no version. Also add the symbol without a version if
2505 appropriate.
2506 (do_define_in_output_data): If resolving with oldsym, don't delete
2507 sym.
2508 (do_define_in_output_segment): Likewise.
2509 (do_define_as_constant): Likewise.
2510 * symtab.h (class Symbol_table): Update declarations.
2511
f1ed28fb
ILT
25122009-03-13 Ian Lance Taylor <iant@google.com>
2513
15f8229b
ILT
2514 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2515 (Read_symbols::requeue): New function.
2516 (Read_symbols::do_read_symbols): If make_elf_object fails because
2517 the target type is not configured, and the file was searched for,
2518 issue a warning and retry with the next directory.
2519 (Add_symbols::run): If the file has an incompatible format, and
2520 it was searched for, requeue the Read_symbols task. On error,
2521 release the object.
2522 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2523 dirindex parameter to constructor. Change all callers. Declare
2524 incompatible_warning and requeue.
2525 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2526 input_argument_ and input_group_ fields. Add them to
2527 constructor. Change all callers.
2528 (class Read_script): Add dirindex_ field. Add it to constructor.
2529 Change all callers.
2530 * archive.cc (Archive::setup): Remove input_objects parameter.
2531 Change all callers.
2532 (Archive::get_file_and_offset): Likewise.
2533 (Archive::read_all_symbols): Likewise.
2534 (Archive::read_symbols): Likewise.
2535 (Archive::get_elf_object_for_member): Remove input_objects
2536 parameter. Add punconfigured parameter. Change all callers.
2537 (Archive::add_symbols): Change return type to bool. Check return
2538 value of include_member.
2539 (Archive::include_all_members): Likewise.
2540 (Archive::include_member): Change return type to bool. Return
2541 false if first included object has incompatible target. Set
2542 included_member_ field.
2543 (Add_archive_symbols::run): If add_symbols returns false, requeue
2544 Read_symbols task.
2545 * archive.h (class Archive): Add included_member_ field.
2546 Initialize it in constructor. Add input_file and searched_for
2547 methods. Update declarations.
2548 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2549 input_argument_ fields. Add them to constructor. Change all
2550 callers.
2551 * script.cc: Include "target-select.h".
2552 (class Parser_closure): Add skip_on_incompatible_target_ and
2553 found_incompatible_target_ fields. Add
2554 skip_on_incompatible_target parameter to constructor. Change all
2555 callers. Add methods skip_on_incompatible_target,
2556 clear_skip_on_incompatible_target, found_incompatible_target, and
2557 set_found_incompatible_target.
2558 (read_input_script): Add dirindex parameter. Change all callers.
2559 If parser finds an incompatible target, requeue Read_symbols
2560 task.
2561 (script_set_symbol): Clear skip_on_incompatible_target in
2562 closure.
2563 (script_add_assertion, script_parse_option): Likewise.
2564 (script_start_sections, script_add_phdr): Likewise.
2565 (script_check_output_format): New function.
2566 * script.h (read_input_script): Update declaration.
2567 * script-c.h (script_check_output_format): Declare.
2568 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2569 (ignore_cmd): Remove OUTPUT_FORMAT.
2570 * fileread.cc (Input_file::Input_file): Add explicit this.
2571 (Input_file::will_search_for): New function.
2572 (Input_file::open): Add pindex parameter. Change all callers.
2573 * fileread.h (class Input_file): Add input_file_argument method.
2574 Declare will_search_for. Update declarations.
2575 * object.cc (make_elf_object): Add punconfigured parameter.
2576 Change all callers.
2577 * object.h (class Object): Make input_file public. Add
2578 searched_for method.
2579 (make_elf_object): Update declaration.
2580 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2581 restart search.
2582 * dirsearch.h (class Dirsearch): Update declaration.
2583 * options.h (class General_options): Add --warn-search-mismatch.
2584 * parameters.cc (Parameters::is_compatible_target): New function.
2585 * parameters.h (class Parameters): Declare is_compatible_target.
2586 * workqueue.cc (Workqueue::add_blocker): New function.
2587 * workqueue.h (class Workqueue): Declare add_blocker.
2588
f1ed28fb
ILT
2589 * fileread.cc (Input_file::open): Remove options parameter.
2590 Change all callers.
2591 (Input_file::open_binary): Likewise.
2592 * script.cc (read_input_script): Likewise.
2593 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2594 options parameter from constructor. Change all callers.
2595 (class Read_script): Likewise.
2596 * fileread.h (class Input_file): Update declarations.
2597 * script.h (read_input_script): Update declaration.
2598
34dd024a
NC
25992009-03-10 Nick Clifton <nickc@redhat.com>
2600
2601 * po/es.po: New Spanish translation.
2602
6d71b17c
CC
26032009-03-06 Cary Coutant <ccoutant@google.com>
2604
2605 * options.cc (parse_short_option): Keep dash_z from registering itself.
2606
031cdbed
ILT
26072009-03-03 Ian Lance Taylor <iant@google.com>
2608
2609 PR 9918
2610 * target-reloc.h (relocate_section): Pass output_section to
2611 relocate.
2612 * i386.cc (Target_i386::should_apply_static_reloc): Add
2613 output_section parameter. Change all callers.
2614 (Target_i386::Relocate::relocate): Add output_section parameter.
2615 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2616 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2617 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2618 * testsuite/two_file_shared.sh: New script.
2619 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2620 (check_DATA): Add two_file_shared.dbg.
2621 (two_file_shared.dbg): New target.
2622 * testsuite/Makefile.in: Rebuild.
2623
15d5fa16
ILT
26242009-03-01 Ian Lance Taylor <iant@google.com>
2625
2626 * configure.ac: Check for byteswap.h.
2627 * configure: Rebuild.
2628 * config.in: Rebuild.
2629
8a4c0b0d
ILT
26302009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2631
2632 * layout.cc (Layout::find_or_add_kept_section): New function.
2633 (Layout::add_comdat): Removed.
2634 * layout.h (struct Kept_section): Move out of class Layout.
2635 Remove trailing underscores from field names. Add group_sections
2636 field. Rename group_ field to is_group. Change all uses.
2637 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2638 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2639 comdat_groups_ field.
2640 (Sized_relobj::include_section_group): Use
2641 find_or_add_kept_section and Kept_section::group_sections.
2642 (Sized_relobj::include_linkonce_section): Likewise.
2643 * object.cc (class Sized_relobj): Don't define Comdat_group or
2644 Comdat_group_table. Remove find_comdat_group and
2645 add_comdat_group. Remove comdat_groups_ field.
2646 * plugin.cc (include_comdat_group): Use
2647 Layout::find_or_add_kept_section.
2648
b4ecf66b
ILT
26492009-02-28 Ian Lance Taylor <iant@google.com>
2650
14359ca0
ILT
2651 * README: --gc-sections and map files are now supported. Document
2652 some build requirements.
2653
b4ecf66b
ILT
2654 PR 6992
2655 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2656 relocatable link set the value of the section symbol to zero.
2657 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2658 relocatable link don't include the section address in the local
2659 symbol value.
2660
0602e05a
ILT
26612009-02-27 Ian Lance Taylor <iant@google.com>
2662
fd9d194f
ILT
2663 PR 6811
2664 * options.h (class Search_directory): Add is_system_directory.
2665 (class General_options): Declare is_in_system_directory.
2666 * options.cc (get_relative_sysroot): Make static.
2667 (get_default_sysroot): Make static.
2668 (General_optoins::is_in_system_directory): New function.
2669 * fileread.cc (Input_file::is_in_system_directory): New function.
2670 * fileread.h (class Input_file): Declare is_in_system_directory.
2671 * object.h (class Object): Add is_in_system_directory.
2672 (class Input_objects): Remove system_library_directory_ field.
2673 * object.cc (Input_objects::add_object): Don't set
2674 system_library_directory_.
2675 (input_objects::found_in_system_library_directory): Remove.
2676 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2677 parameter. Change all callers.
2678 (Symbol_table::sized_write_globals): Likewise.
2679 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2680 Call Object::is_in_system_directory.
2681 * symtab.h (class Symbol_table): Update declarations.
2682
61edd21f
ILT
2683 PR 5990
2684 * descriptors.h (Open_descriptor): Add is_on_stack field.
2685 * descriptors.cc (Descriptors::open): If the descriptor is on the
2686 top of the stack, remove it. Initialize is_on_stack field.
2687 (Descriptors::release): Only add pod to stack if it is not on the
2688 stack already.
2689 (Descriptors::close_some_descriptor): Clear stack_next and
2690 is_on_stack fields.
2691
e29e076a
ILT
2692 PR 7091
2693 * output.cc (Output_section::find_starting_output_address): Rename
2694 from starting_output_address; add PADDR parameter; change return
2695 type.
2696 * output.h (class Output_section): Declare
2697 find_starting_output_address instead of starting_output_address.
2698 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2699 section symbol for which we can't find a merge section.
2700
0602e05a
ILT
2701 PR 9836
2702 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2703 hidden or internal, force the symbol to be local.
2704 * resolve.cc (Symbol::override_visibility): Define.
2705 (Symbol::override_base): Use override_visibility.
2706 (Symbol_table::resolve): Likewise.
2707 (Symbol::override_base_with_special): Likewise.
2708 (Symbol_table::override_with_special): If the visibility is hidden
2709 or internal, force the symbol to be local.
2710 * symtab.h (class Symbol): Add set_visibility and
2711 override_visibility.
2712 * testsuite/ver_test_1.sh: New file.
2713 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2714 (check_DATA): Add ver_test_1.syms.
2715 (ver_test_1.syms): New target.
2716 * testsuite/Makefile.in: Rebuild.
2717
401a9a73
CC
27182009-02-25 Cary Coutant <ccoutant@google.com>
2719
2720 * layout.cc (Layout::choose_output_section): Don't rename sections
2721 when using a linker script that has a SECTIONS clause.
2722 * Makefile.in: Regenerate.
2723
2724 * testsuite/Makefile.am (script_test_5.sh): New test case.
2725 * testsuite/Makefile.in: Regenerate.
2726 * testsuite/script_test_5.cc: New file.
2727 * testsuite/script_test_5.sh: New file.
2728 * testsuite/script_test_5.t: New file.
2729
f488e4b0
CC
27302009-02-13 Rafael Avila de Espindola <espindola@google.com>
2731
2732 * archive.cc (Archive::include_member): Update calls to add_symbols.
2733 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2734 the Layout argument.
2735 * dynobj.h (do_add_symbols): Add the Layout argument.
2736 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2737 Layout argument.
2738 * object.h (Object::add_symbols): Add the Layout argument.
2739 (Object::do_add_symbols): Add the Layout argument.
2740 (Sized_relobj::do_add_symbols): Add the Layout argument.
2741 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2742 Unify the two versions.
2743 (Add_plugin_symbols): Remove.
2744 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2745 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2746 (Add_plugin_symbols): Remove.
2747 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2748 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2749 (Add_symbols::run): Make it work with Pulginobj.
2750
89dd1680
ILT
27512009-02-06 Ian Lance Taylor <iant@google.com>
2752
2753 * object.cc (Sized_relobj::do_layout): Make info message start
2754 with lower case letter.
2755
266d0a74
ILT
27562009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2757
602b464e
ILT
2758 * binary.cc: Fix file comment.
2759
266d0a74
ILT
2760 * options.h (enum Incremental_disposition): Define.
2761 (class General_options): Add new options: --incremental,
2762 --incremental_changed, --incremental_unchanged,
2763 --incremental_unknown. Add incremental_disposition_ and
2764 implicit_incremental_ fields.
2765 (General_options::incremental_disposition): New function.
2766 (class Position_dependent_options): Add incremental_disposition
2767 option.
2768 (Position_dependent_options::copy_from_options): Set incremental
2769 dispositions.
2770 * options.cc (General_options::parse_incremental_changed): New
2771 function.
2772 (General_options::parse_incremental_unchanged): New function.
2773 (General_options::parse_incremental_unknown): New function.
2774 (General_options::General_options): Initialize new fields
2775 incremental_disposition_ and implicit_incremental_.
2776 (General_options::finalize): Check for uasge of --incremental-*
2777 without --incremental.
2778
f073bbf7
CD
27792009-02-06 Chris Demetriou <cgd@google.com>
2780
2781 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2782 pointer and to report location as the file name associated with
2783 the symbol.
2784 (gold_undefined_symbol_at_location): New function to replace the
2785 old gold_undefined_symbol functionality.
2786 * target-reloc.h (relocate_section): Update to use
2787 gold_undefined_symbol_at_location.
2788 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2789 Call gold_undefined_symbol function rather than gold_error.
2790 * errors.h (Errors::undefined_symbol): Take location as a
2791 string, rather than calculating it from a relocation.
2792 * errors.cc (Errors::fatal): Print "fatal error:" before the
2793 formatted message.
2794 (Errors::error, Errors::error_at_location): Print "error: "
2795 before the formatted message.
2796 (Errors::undefined_symbol): Take location as a string, rather
2797 than calculating it from a relocation.
2798 (gold_undefined_symbol_at_location): New function akin to
2799 old gold_undefined_symbol, calculates location from relocation.
2800 (gold_undefined_symbol): Change to take only a Symbol pointer
2801 and to report location as the file name associated with the symbol.
2802 * testsuite/debug_msg.sh: Update for changed error messages.
2803 * testsuite/undef_symbol.sh: Likewise.
2804
8e94a90c
ILT
28052009-02-04 Duncan Sands <baldrick@free.fr>
2806
2807 PR 9812
2808 * reduced_debug_output.h
2809 (Output_reduced_debug_abbrev_section::failed): Use format for
2810 gold_warning.
2811 (Output_reduced_debug_info_section::faild): Likewise.
2812
88a0e15b
ILT
28132009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2814
2815 * script.cc (Lazy_demangler): New class.
2816 (Version_script_info::get_symbol_version_helper): Demangle a
2817 symbol only once.
2818
5efc7cd2
CC
28192009-01-29 Cary Coutant <ccoutant@google.com>
2820
2821 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2822 to __tls_get_addr.
2823 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2824
e0ebcf42
ILT
28252009-01-28 Ian Lance Taylor <iant@google.com>
2826
5efc7cd2 2827 * version.cc (version_string): Bump to 1.9.
75fe7426 2828
e0ebcf42
ILT
2829 * gold.h: Include <cstring> and <stdint.h>.
2830 * version.cc: Include <cstdio>.
2831 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2832 warning.
2833 * reduced_debug_output.cc (insert_into_vector): Rename from
2834 Insert_into_vector; change all callers. Use Swap_unaligned to
2835 avoid aliasing issue; remove union since it is unnecessary.
2836
8e2813be 28372009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
2838
2839 * Makefile.am (CCFILES): Add gc.cc.
2840 (HFILES): Add gc.h.
2841 * Makefile.in: Regenerate.
2842 * gold.cc (Gc_runner): New class.
2843 (queue_initial_tasks): Call garbage collection related tasks
2844 when corresponding options are invoked.
2845 (queue_middle_gc_tasks): New function.
2846 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2847 processed early before laying out sections during garbage collection.
2848 * gold.h (queue_middle_gc_tasks): New function.
2849 (is_prefix_of): Move from "layout.cc".
2850 * i386.cc (Target_i386::gc_process_relocs): New function.
2851 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2852 * main.cc (main): Create object of class "Garbage_collection".
2853 * object.cc (Relobj::copy_symbols_data): New function.
2854 (Relobj::is_section_name_included): New function.
2855 (Sized_relobj::do_layout): Allow this function to be called twice
2856 during garbage collection and defer layout of section during the
2857 first call.
2858 * object.h (Relobj::get_symbols_data): New function.
2859 (Relobj::is_section_name_included): New function.
2860 (Relobj::copy_symbols_data): New function.
2861 (Relobj::set_symbols_data): New function.
2862 (Relobj::get_relocs_data): New function.
2863 (Relobj::set_relocs_data): New function.
2864 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2865 (Relobj::gc_process_relocs): New function.
2866 (Relobj::do_gc_process_relocs): New pure virtual function.
2867 (Relobj::sd_): New data member.
2868 (Sized_relobj::is_output_section_offset_invalid): New function.
2869 (Sized_relobj::do_gc_process_relocs): New function.
2870 * options.h (General_options::gc_sections): Modify to not be a no-op.
2871 (General_options::print_gc_sections): New option.
2872 * plugin.cc (Plugin_finish::run): Remove function call to
2873 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2874 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2875 * reloc.cc (Read_relocs::run): Add task to process relocs and
2876 determine unreferenced sections when doing garbage collection.
2877 (Gc_process_relocs): New class.
2878 (Sized_relobj::do_gc_process_relocs): New function.
2879 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2880 sections that are garbage collected.
2881 * reloc.h (Gc_process_relocs): New class.
2882 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2883 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2884 symbols whose corresponding sections are garbage collected.
2885 (Symbol_table::Symbol_table): Add new parameter for the garbage
2886 collection object.
2887 (Symbol_table::gc_mark_undef_symbols): New function.
2888 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2889 (Symbol_table::gc_mark_dyn_syms): New function.
2890 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2891 as garbage.
2892 (Symbol_table::add_from_object): Likewise.
2893 (Symbol_table::add_from_relobj): When building shared objects, do not
2894 treat externally visible symbols as garbage.
2895 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2896 table information for static and relocatable links.
2897 * symtab.h (Symbol_table::set_gc): New function.
2898 (Symbol_table::gc): New function.
2899 (Symbol_table::gc_mark_undef_symbols): New function.
2900 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2901 (Symbol_table::gc_mark_dyn_syms): New function.
2902 (Symbol_table::gc_): New data member.
2903 * target.h (Sized_target::gc_process_relocs): New pure virtual
2904 function.
2905 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2906 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2907
3b293544
CF
29082009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2909
2910 * options.h (General_options::gc_sections): Define as a no-op for now.
2911 (General_options::no_keep_memory): Ditto.
2912 (General_options::Bshareable): Define.
2913 * options.cc (General_options::finalize): Honor -Bshareable.
2914
83d22aa8
AS
29152009-01-20 Andreas Schwab <schwab@suse.de>
2916
2917 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2918 read the value in the contents, since we don't use it. Use the
2919 template endianness when writing.
2920 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2921
cd536b21
AS
29222009-01-19 Andreas Schwab <schwab@suse.de>
2923
2924 * configure.tgt (powerpc64-*): Fix targ_obj.
2925
99e9a495
ILT
29262009-01-15 Ian Lance Taylor <iant@google.com>
2927
2928 * object.cc (Sized_relobj::write_local_symbols): Don't write out
2929 local symbols when stripping all symbols.
2930
bbbfea06
CC
29312009-01-14 Cary Coutant <ccoutant@google.com>
2932
99e9a495 2933 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 2934
0f7c0701
CC
29352009-01-14 Cary Coutant <ccoutant@google.com>
2936
2937 * archive.cc (Archive::get_elf_object_for_member): Remove call
2938 to File_read::claim_for_plugin.
2939 * descriptors.cc (Descriptors::open): Remove reference to
2940 is_claimed.
2941 (Descriptors::claim_for_plugin): Remove.
2942 * descriptors.h (Descriptors::claim_for_plugin): Remove.
2943 (Descriptors::is_claimed): Remove.
2944 (claim_descriptor_for_plugin): Remove.
2945 * fileread.cc (File_read::claim_for_plugin): Remove.
2946 * fileread.h (File_read::claim_for_plugin): Remove.
2947 (File_read::descriptor): Reopen descriptor if necessary.
2948 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
2949 (Plugin_manager::all_symbols_read): Add task parameter. Change
2950 all callers.
2951 (Plugin_manager::get_input_file): New function.
2952 (Plugin_manager::release_input_file): New function.
2953 (Pluginobj::Pluginobj): Add filesize parameter and initialize
2954 corresponding data member.
2955 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
2956 and pass to base constructor. Change all callers.
2957 (get_input_file, release_input_file): New functions.
2958 (make_sized_plugin_object): Add filesize parameter. Change all callers.
2959 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
2960 (Plugin_manager::all_symbols_read): Add task parameter.
2961 (Plugin_manager::get_input_file): New function.
2962 (Plugin_manager::release_input_file): New function.
2963 (Plugin_manager::task_): New data member.
2964 (Pluginobj::Pluginobj): Add filesize parameter.
2965 (Pluginobj::filename): New function.
2966 (Pluginobj::descriptor): New function.
2967 (Pluginobj::filesize): New function.
2968 (Pluginobj::filesize_): New data member.
2969 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
2970 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2971 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2972
2973 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2974 with archive libraries.
2975 * testsuite/Makefile.in: Regenerate.
2976 * testsuite/plugin_test.c (struct sym_info): New type.
2977 (get_input_file, release_input_file): New static variables.
2978 (onload): Capture new transfer vector entries.
2979 (claim_file_hook): Stop reading at end of file according to filesize.
2980 Factor out parsing of readelf output into separate function.
2981 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2982 APIs and get the source file name from the symbol table. Convert
2983 source file name to corresponding object file name. Print info
2984 message when adding new input files.
2985 (parse_readelf_line): New function.
2986 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2987 * testsuite/plugin_test_2.sh: Likewise.
2988 * testsuite/plugin_test_3.sh: Likewise.
2989 * testsuite/plugin_test_4.sh: New test case.
2990
62a6d109
ILT
29912009-01-07 Ian Lance Taylor <iant@google.com>
2992
2993 * version.cc (version_string): Bump to 1.8.
2994
483620e8
CC
29952008-12-23 Cary Coutant <ccoutant@google.com>
2996
2997 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2998 * plugin.cc (Plugin_manager::finish): Rename as
2999 layout_deferred_objects. Move cleanup to separate function.
3000 (Plugin_manager::cleanup): New function.
3001 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3002 separately.
3003 * plugin.h (Plugin_manager::finish): Rename as
3004 layout_deferred_objects.
3005 (Plugin_manager::cleanup): New function.
3006 (Plugin_manager::cleanup_done): New field.
3007
d66a9eb3
CC
30082008-12-23 Cary Coutant <ccoutant@google.com>
3009
3010 * plugin.cc (is_visible_from_outside): New function.
3011 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3012 so we don't return "IR only" status for exported symbols or -r links.
3013
3014 * testsuite/Makefile.am (plugin_test_3): New test case.
3015 * testsuite/Makefile.in: Regenerate.
3016 * testsuite/plugin_test_3.sh: New file.
3017
5995b570
CC
30182008-12-22 Cary Coutant <ccoutant@google.com>
3019
3020 * object.cc (Sized_relobj::layout_section): New function.
3021 (Sized_relobj::do_layout): Defer layout of input sections until after
3022 plugin has provided replacement files.
3023 (Sized_relobj::do_layout_deferred_sections): New function.
3024 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3025 (Relobj::layout_deferred_sections): New function.
3026 (Relobj::do_layout_deferred_sections): New function.
3027 (Sized_relobj::do_layout_deferred_sections): New function.
3028 (Sized_relobj::layout_section): New function.
3029 (Sized_relobj::Deferred_layout): New structure.
3030 (Sized_relobj::deferred_layout_): New field.
3031 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3032 Change all callers. Layout deferred sections.
3033 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3034 references.
3035 (Plugin_hook::run): Move code from do_plugin_hook inline.
3036 (Plugin_hook::do_plugin_hook): Remove.
3037 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3038 (Plugin_manager::finish): Renamed, was cleanup.
3039 (Plugin_manager::should_defer_layout): New function.
3040 (Plugin_manager::add_deferred_layout_object): New function.
3041 (Plugin_manager::Deferred_layout_list): New type.
3042 (Plugin_manager::deferred_layout_objects_): New field.
3043 (Plugin_hook::do_plugin_hook): Remove.
3044
ee769c88
ILT
30452008-12-17 Ian Lance Taylor <iant@google.com>
3046
3047 * options.h (class General_options): Add --no case for
3048 --export-dynamic.
3049
abc8dcba
CC
30502008-12-16 Cary Coutant <ccoutant@google.com>
3051
3052 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3053 vector.
3054 (Plugin_manager::claim_file): Create plugin object even if
3055 plugin did not call the add_symbols callback.
3056 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3057 asking for more symbols than were added.
3058 * testsuite/Makefile.am (plugin_test_1): Add test case with
3059 no global symbols.
3060 (empty.syms): New target.
3061 * testsuite/Makefile.in: Regenerate.
3062 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3063 message. Don't call add_symbols if no globals.
3064 (all_symbols_read_hook): Don't provide replacement for empty
3065 claimed file.
3066
b0074644
ILT
30672008-12-12 Ian Lance Taylor <iant@google.com>
3068
68943102
ILT
3069 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3070 r_type == 0 for a local symbol with r_sym == 0.
3071 (scan_relocatable_relocs): Pass r_sym to
3072 local_non_section_strategy.
3073 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3074 r_sym parameter.
3075
b0074644
ILT
3076 * configure.ac: Update test for TLS descriptors: they are
3077 supported as of glibc 2.9.
3078 * configure: Rebuild.
3079
c2508178
ILT
30802008-12-11 Ian Lance Taylor <iant@google.com>
3081
3082 PR 7091
3083 * target-reloc.h (Default_scan_relocatable_relocs): For each
3084 function, map r_type == 0 to RELOC_DISCARD.
3085
2756a258
CC
30862008-12-10 Cary Coutant <ccoutant@google.com>
3087
3088 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3089 object to override a kept COMDAT group from a plugin object.
3090
bb6f53d3
ILT
30912008-12-09 Ian Lance Taylor <iant@google.com>
3092
fbc558e1
ILT
3093 PR 7088
3094 * yyscript.y (file_cmd): Handle INPUT.
3095
bb6f53d3
ILT
3096 * testsuite/initpri1.c: Change all declarations to be full
3097 prototypes by adding void, to avoid compiler warnings.
3098
4674ecfc
CC
30992008-12-05 Rafael Avila de Espindola <espindola@google.com>
3100
3101 * options.cc (General_options::parse_plugin_opt): New.
3102 (General_options::add_plugin): The argument now is just the filename.
3103 (General_options::add_plugin_option): New.
3104 * options.h (plugin_opt): New.
3105 (add_plugin): Change argument name.
3106 (add_plugin_option): New.
3107 * plugin.cc (Plugin::load): Don't parse the plugin option.
3108 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3109 (Plugin::add_option): New.
3110 (Plugin::args_): Change type.
3111 (Plugin::filename_): New.
3112 (Plugin_manager::add_plugin_option): New.
3113 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3114 * testsuite/Makefile.in: Regenerate.
3115
fd06b4aa
CC
31162008-12-05 Cary Coutant <ccoutant@google.com>
3117
3118 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3119 Handle --strip-lto-sections option.
3120 * options.h (strip_lto_sections): New option.
3121
6c52134c
CC
31222008-12-01 Cary Coutant <ccoutant@google.com>
3123
3124 * plugin.cc (ld_plugin_message): Change format parameter to const.
3125 Fix mismatch between new[] and delete.
3126
a45248e0
CC
31272008-11-14 Cary Coutant <ccoutant@google.com>
3128
3129 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3130 instead of -1U.
3131
c82fbeee
CS
31322008-11-05 Craig Silverstein <csilvers@google.com>
3133
3134 * options.cc (General_options::parse_dynamic_list): New function.
3135 * options.h (General_options): New flags dynamic_list,
3136 dynamic_list_data, dynamic_list_cpp_new, and
3137 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3138 (General_options::in_dynamic_list): New function.
3139 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3140 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3141 (Lex::can_continue_name): Likewise.
3142 (yylex): Likewise.
3143 (read_script_file): New parameter script_options.
3144 (read_dynamic_list): New function.
3145 (Script_options::define_dynamic_list): New function.
3146 (dynamic_list_keyword_parsecodes): New variable.
3147 (dynamic_list_keywords): New variable.
3148 * script.h (Script_options::define_dynamic_list): New function
3149 prototype.
3150 (read_dynamic_list): New function prototype.
3151 * symtab.cc (strprefix): New macro.
3152 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3153 dynamic_list_data, dynamic_list_cpp_new, and
3154 dynamic_list_cpp_typeinfo.
3155 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
3156 (dynamic_list_expr): New rule.
3157 (dynamic_list_nodes): Likewise.
3158 (dynamic_list_node): Likewise.
3159 * testsuite/Makefile.am (dynamic_list): New test.
3160 * testsuite/Makefile.in: Regenerated.
3161 * testsuite/dynamic_list.t: New file.
3162 * testsuite/dynamic_list.sh: New file.
3163
e0bb29a5
CS
31642008-11-05 Craig Silverstein <csilvers@google.com>
3165
3166 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
3167 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
3168 (t11_last): Likewise.
3169 * testsuite/ver_test_6.c (main): Likewise.
3170
4e1e25e0
CC
31712008-10-07 Cary Coutant <ccoutant@google.com>
3172
3173 * options.c (General_options::finalize): Add check for -static and
3174 -shared.
3175 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
3176 is not empty.
3177
92f03fcb
CC
31782008-10-02 Cary Coutant <ccoutant@google.com>
3179
3180 * plugin.cc (make_sized_plugin_object): Fix conditional
3181 compilation to work when not all targets are enabled.
3182
fbd8a257
CC
31832008-09-29 Cary Coutant <ccoutant@google.com>
3184
3185 * archive.cc (Archive::get_file_and_offset): Use filename instead
3186 of name to get library path.
3187 (Archive::include_member): Unlock external member of a thin archive.
3188
3189 * testsuite/Makefile.am (TEST_AR): New variable.
3190 (thin_archive_test_1): New test.
3191 (thin_archive_test_2): New test.
81636b3f
CC
3192 * testsuite/Makefile.in: Regenerate.
3193 * testsuite/thin_archive_main.cc: New file.
3194 * testsuite/thin_archive_test_1.cc: New file.
3195 * testsuite/thin_archive_test_2.cc: New file.
3196 * testsuite/thin_archive_test_3.cc: New file.
3197 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 3198
eff45813
CC
31992008-09-29 Cary Coutant <ccoutant@google.com>
3200
3201 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
3202 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
3203 instead of -1U.
3204 (Sized_relobj::do_finalize_local_symbols): Likewise.
3205 (Sized_relobj::map_to_kept_section): Likewise.
3206 * object.h (Sized_relobj::invalid_address): New constant.
3207 (Sized_relobj::do_output_section_offset): Check for invalid_address
3208 and return -1ULL.
3209 * output.cc (Output_reloc::local_section_offset): Use constant
3210 invalid_address instead of -1U.
3211 (Output_reloc::get_address): Likewise.
3212 (Output_section::output_address): Change -1U to -1ULL.
3213 * output.h (Output_reloc::invalid_address): New constant.
3214 * reloc.cc (Sized_relobj::write_sections): Use constant
3215 invalid_address instead of -1U.
3216 (Sized_relobj::relocate_sections): Likewise.
3217 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3218 values for merge sections.
3219 * target-reloc.h (relocate_for_relocatable): Use constant
3220 invalid_address instead of -1U.
3221
89fc3421
CC
32222008-09-19 Cary Coutant <ccoutant@google.com>
3223
3224 Add plugin functionality for link-time optimization (LTO).
3225 * configure.ac (plugins): Add --enable-plugins option.
3226 * configure: Regenerate.
3227 * config.in: Regenerate.
3228 * Makefile.am (LIBDL): New variable.
3229 (CCFILES): Add plugin.cc.
3230 (HFILES): Add plugin.h.
3231 (ldadd_var): Add LIBDL.
3232 * Makefile.in: Regenerate.
3233
3234 * archive.cc: Include "plugin.h".
3235 (Archive::setup): Don't preread archive symbols when using a plugin.
3236 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3237 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3238 files.
3239 (Archive::include_member): Add symbols from plugin objects.
3240 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3241 * descriptors.cc (Descriptors::open): Check for file descriptors
3242 abandoned by plugins.
3243 (Descriptors::claim_for_plugin): New function.
3244 * descriptors.h (Descriptors::claim_for_plugin): New function.
3245 (Open_descriptor::is_claimed): New field.
3246 (claim_descriptor_for_plugin): New function.
3247 * fileread.cc (File_read::claim_for_plugin): New function.
3248 * fileread.h (File_read::claim_for_plugin): New function.
3249 (File_read::descriptor): New function.
3250 * gold.cc: Include "plugin.h".
3251 (queue_initial_tasks): Add task to call plugin hooks for generating
3252 new object files.
3253 * main.cc: Include "plugin.h".
3254 (main): Load plugin libraries.
3255 * object.h (Pluginobj): Declare.
3256 (Object::pluginobj): New function.
3257 (Object::do_pluginobj): New function.
3258 (Object::set_target): New function.
3259 * options.cc: Include "plugin.h".
3260 (General_options::parse_plugin): New function.
3261 (General_options::General_options): Initialize plugins_ field.
3262 (General_options::add_plugin): New function.
3263 * options.h (Plugin_manager): Declare.
3264 (General_options): Add --plugin option.
3265 (General_options::has_plugins): New function.
3266 (General_options::plugins): New function.
3267 (General_options::add_plugin): New function.
3268 (General_options::plugins_): New field.
3269 * plugin.cc: New file.
3270 * plugin.h: New file.
3271 * readsyms.cc: Include "plugin.h".
3272 (Read_symbols::do_read_symbols): Check for archive before checking
3273 for ELF file. Call plugin hooks to claim files.
3274 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
3275 from a real object file; force override when processing replacement
3276 files.
3277 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
3278 (Symbol::init_base_object): Likewise.
3279 (Symbol::init_base_output_data): Likewise.
3280 (Symbol::init_base_output_segment): Likewise.
3281 (Symbol::init_base_constant): Likewise.
3282 (Symbol::init_base_undefined): Likewise.
3283 (Symbol::output_section): Assert that object is not a plugin.
3284 (Symbol_table::add_from_pluginobj): New function.
3285 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
3286 undefined.
3287 (Symbol_table::sized_write_globals): Likewise.
3288 (Symbol_table::add_from_pluginobj): Instantiate template.
3289 * symtab.h (Sized_pluginobj): Declare.
3290 (Symbol::in_real_elf): New function.
3291 (Symbol::set_in_real_elf): New function.
3292 (Symbol::in_real_elf_): New field.
3293 (Symbol_table::add_from_pluginobj): New function.
3294
3295 * testsuite/Makefile.am (AM_CFLAGS): New variable.
3296 (LIBDL): New variable.
3297 (LDADD): Add LIBDL.
3298 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
3299 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
3300 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
3301 (MOSTLYCLEANFILES): Likewise.
3302 * testsuite/Makefile.in: Regenerate.
3303 * testsuite/plugin_test.c: New file.
3304 * testsuite/plugin_test_1.sh: New file.
3305 * testsuite/plugin_test_2.sh: New file.
3306
de31bda5
ILT
33072008-09-16 Ian Lance Taylor <iant@google.com>
3308
9c2d0ef9
ILT
3309 * target-reloc.h (relocate_section): Check whether a symbol is
3310 defined by the ABI before reporting an undefined symbol error.
3311 * target.h (Target::is_defined_by_abi): Make parameter const.
3312 (Target::do_is_defined_by_abi): Likewise.
3313 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
3314 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
3315 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
3316 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
3317 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
3318 * testsuite/Makefile.in: Rebuild.
3319
de31bda5
ILT
3320 * fileread.cc (make_view): Add casts to avoid warning.
3321
9fa33bee
AO
33222008-09-16 Alexandre Oliva <aoliva@redhat.com>
3323
3324 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
3325 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3326
183fd0e3
AO
33272008-09-16 Alexandre Oliva <aoliva@redhat.com>
3328
3329 * options.h (General_options::output_is_executable): New.
3330 (General_options::output_is_pie): New.
3331 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
3332 for shared libraries.
3333 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3334
7be8330a
CD
33352008-09-11 Chris Demetriou <cgd@google.com>
3336
3337 * options.h (origin): New -z option.
3338 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
3339 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
3340 in DT_FLAGS_1.
3341
a9caad02
CC
33422008-09-05 Cary Coutant <ccoutant@google.com>
3343
3344 * fileread.cc (File_read::make_view): Add check for attempt to map
3345 beyond end of file.
3346
ae6dce4d
CC
33472008-09-05 Cary Coutant <ccoutant@google.com>
3348
3349 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
3350 explicit instantiations.
3351
d7ab2a47
KVH
33522008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
3353
3354 PR gold/6858
3355 * options.cc (General_options::finalize): Allow undefined symbols
3356 in shlibs if linking -shared.
3357
3358 PR gold/6859
3359 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
3360 symbols as not needing a dynsym entry.
3361
1e52a9c1
CS
33622008-08-20 Craig Silverstein <csilvers@google.com>
3363
3364 * fileread.cc (File_read::open): Do not lock the file unless it
3365 was successfully opened.
3366
d85c80a3
CC
33672008-08-14 Cary Coutant <ccoutant@google.com>
3368
3369 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
3370 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
3371 * testsuite/tls_test.cc (struct int128): 128-bit struct
3372 for testing TLS relocs with non-zero addend.
3373 (v12): New TLS variable.
3374 (t12): New test.
3375 (t_last): Add check for v12.
3376 * testsuite/tls_test.h (t12): New function.
3377 * testsuite/tls_test_main.cc (thread_routine): Call new test.
3378
2d924fd9
ILT
33792008-08-13 Ian Lance Taylor <iant@google.com>
3380
3381 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
3382 set tls_segment_ or relro_segment_.
3383 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
3384 when appropriate.
3385 * output.h (Output_section::clear_is_relro): New function.
3386 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
3387 sections specially even when output_data_ is empty.
3388 (Output_segment::maximum_alignment): When first section is relro,
3389 only force alignment for PT_LOAD segments.
3390 * script.cc (script_data_segment_align): New function.
3391 (script_data_segment_relro_end): New function.
3392 * script-c.h (script_data_segment_align): Declare.
3393 (script_data_segment_relro_end): Declare.
3394 * script-sections.h (class Script_sections): Declare
3395 data_segment_align and data_segment_relro_end. Add fields
3396 segment_align_index_ and saw_relro_end_.
3397 * script-sections.cc (class Sections_element): Add set_is_relro
3398 virtual function. Add new bool* parameter to place_orphan_here.
3399 Add get_output_section virtual function.
3400 (class Output_section_definition): Add set_is_relro. Add new
3401 bool* parameter to place_orphan_here. Add get_output_section.
3402 Add is_relro_ field.
3403 (Output_section_definition::Output_section_definition): Initialize
3404 evaluated_address_, evaluated_load_address, evaluated_addralign_,
3405 and is_relro_ fields.
3406 (Output_section_definition::place_orphan_here): Add is_relro
3407 parameter.
3408 (Output_section_definition::set_section_addresses): Set relro for
3409 output section.
3410 (Output_section_definition::alternate_constraint): Likewise.
3411 (class Orphan_output_section): Add new bool* parameter to
3412 place_orphan_here. Add get_output_section.
3413 (Orphan_output_section::place_orphan_here): Add is_relro
3414 parameter.
3415 (Script_sections::Script_sections): Initialize
3416 data_segment_align_index_ and saw_relro_end_.
3417 (Script_sections::data_segment_align): New function.
3418 (Script_sections::data_segment_relro_end): New function.
3419 (Script_sections::place_orphan): Set or clear is_relro.
3420 (Script_sections::set_section_addresses): Force alignment of first
3421 TLS section.
3422 * yyscript.y (exp): Call script_data_segment_align and
3423 script_data_segment_relro_end.
3424 * testsuite/relro_script_test.t: New file.
3425 * testsuite/relro_test.cc (using_script): Declare.
3426 (t1, t2): Test using_script.
3427 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3428 (relro_script_test_SOURCES): Define.
3429 (relro_script_test_DEPENDENCIES): Define.
3430 (relro_script_test_LDFLAGS): Define.
3431 (relro_script_test_LDADD): Define.
3432 (relro_script_test.so): New target.
3433 * testsuite/Makefile.in: Rebuild.
3434
f827c9a9
CC
34352008-08-06 Cary Coutant <ccoutant@google.com>
3436
3437 * archive.cc (Archive::total_archives, Archive::total_members)
3438 (Archive::total_members_loaded): New variables.
3439 (Archive::setup): Add parameter. Add option to preread
3440 archive symbols.
3441 (Archive::read_armap): Add counter.
3442 (Archive::get_file_and_offset): New function.
3443 (Archive::get_elf_object_for_member): New function.
3444 (Archive::read_all_symbols): New function.
3445 (Archive::read_symbols): New function.
3446 (Archive::add_symbols): Add counters.
3447 (Archive::include_all_members): Use armap to find members if it's
3448 already built.
3449 (Archive::include_member): Skip reading symbols if already read.
3450 Factored code into Archive::get_file_and_offset and
3451 Archive::get_elf_object_for_member. Changed call to
3452 Mapfile::report_include_archive_member.
3453 (Archive::print_stats): New function.
3454 * archive.h: Declare Object and Read_symbols_data classes.
3455 (Archive::Archive): Add initializers for new members.
3456 (Archive::setup): Add parameter.
3457 (Archive::print_stats): New function.
3458 (Archive::total_archives, Archive::total_members)
3459 (Archive::total_members_loaded): New variables.
3460 (Archive::get_file_and_offset): New function.
3461 (Archive::get_elf_object_for_member): New function.
3462 (Archive::read_all_symbols): New function.
3463 (Archive::read_symbols): New function.
3464 (Archive::Archive_member): New class.
3465 (Archive::members_): New member.
3466 (Archive::num_members_): New member.
3467 * main.cc: Include archive.h.
3468 (main): Call Archive::print_stats.
3469 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3470 archive parameter; member_name is now the fully-decorated name.
3471 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3472 * options.h: (General_options): Add --preread-archive-symbols option.
3473 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3474 Archive::setup.
3475
de4c45bd
ILT
34762008-08-04 Ian Lance Taylor <iant@google.com>
3477
3478 * symtab.h (Symbol::use_plt_offset): New function.
3479 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3480 * powerpc.cc (Relocate::relocate): Likewise.
3481 * sparc.cc (Relocate::relocate): Likewise.
3482 * x86_64.cc (Relocate::relocate): Likewise.
3483 * testsuite/weak_plt.sh: New test.
3484 * testsuite/weak_plt_main.cc: New test.
3485 * testsuite/weak_plt_shared.cc: New test.
3486 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3487 (check_PROGRAMS): Add weak_plt.
3488 (check_DATA): Add weak_plt_shared.so.
3489 (weak_plt_main_pic.o, weak_plt): New targets.
3490 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3491 * testsuite/Makefile.in: Rebuild.
3492
3493 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3494 gcctestdir/ld.
3495 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3496 * testsuite/Makefile.in: Rebuild.
3497
323ee3f4
AM
34982008-08-04 Alan Modra <amodra@bigpond.net.au>
3499
3500 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3501 * Makefile.in: Regenerate.
3502 * po/POTFILES.in: Regenerate.
3503
7c07ecec
ILT
35042008-07-29 Ian Lance Taylor <iant@google.com>
3505
3506 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3507 symbols before other symbols.
3508 * testsuite/script_test_2.cc (test_addr): Declare.
3509 (test_addr_alias): Declare.
3510 (main): Check that test_addr and test_addr_alias have the right
cd536b21 3511 values.
7c07ecec
ILT
3512 * testsuite/script_test_2.t: Define test_addr_alias and
3513 test_addr.
3514
5778530e
ILT
35152008-07-24 Ian Lance Taylor <iant@google.com>
3516
2a00e4fb
ILT
3517 PR 5990
3518 * descriptors.cc: New file.
3519 * descriptors.h: New file.
3520 * gold-threads.h (class Hold_optional_lock): New class.
3521 * fileread.cc: Include "descriptors.h".
3522 (File_read::~File_read): Release descriptor rather than closing
3523 it.
3524 (File_read::open) [file]: Call open_descriptor rather than open.
3525 Set is_descriptor_opened_.
3526 (File_read::open) [memory]: Assert that descriptor is not open.
3527 (File_read::reopen_descriptor): New function.
3528 (File_read::release): Release descriptor.
3529 (File_read::do_read): Make non-const. Reopen descriptor.
3530 (File_read::read): Make non-const.
3531 (File_read::make_view): Reopen descriptor.
3532 (File_read::do_readv): Likewise.
3533 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3534 Update declarations.
3535 * layout.cc: Include "descriptors.h".
3536 (Layout::create_build_id): Use open_descriptor rather than open.
3537 * output.cc: Include "descriptors.h".
3538 (Output_file::open): Use open_descriptor rather than open.
3539 * archive.cc (Archive::const_iterator): Change Archive to be
3540 non-const.
3541 (Archive::begin, Archive::end): Make non-const.
3542 (Archive::count_members): Likewise.
3543 * archive.h (class Archive): Update declarations.
3544 * object.h (Object::read): Make non-const.
3545 * Makefile.am (CCFILES): Add descriptors.cc.
3546 (HFILES): Add descriptors.h.
3547 * Makefile.in: Rebuild.
3548
801647d1
ILT
3549 PR 6716
3550 * gold.h: Always include <clocale>. Add Solaris workarounds
3551 following code in binutils/sysdep.h.
3552
5edd166e
ILT
3553 PR 6048
3554 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3555 this->eh_frame_hdr_ is NULL before using it.
3556
c89ad728
ILT
3557 * dynobj.cc (Versions::Versions): Update comment.
3558
aa86f06b
ILT
3559 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3560 the base version name.
3561
5778530e
ILT
3562 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3563 array size plus one.
3564 (Stringpool_template::set_string_offsets): Subtract one from key
3565 before using it as an array index.
3566 (Stringpool_template::get_offset_with_length): Likewise.
3567 (Stringpool_template::write_to_buffer): Likewise.
3568 * stringpool.h (Stringpool_template::get_offset_from_key):
3569 Likewise.
3570
057ead22
ILT
35712008-07-23 Ian Lance Taylor <iant@google.com>
3572
7f649c59
ILT
3573 PR 6658
3574 * object.h (Merged_symbol_value::value): Do our best to handle a
3575 negative addend.
3576
057ead22
ILT
3577 PR 6647
3578 * script.cc (Version_script_info::get_versions): Don't add empty
3579 version tag to return value.
3580 (Version_script_info::get_symbol_version_helper): Change return
3581 type to bool. Add pversion parameter. Change all callers.
3582 (script_register_vers_node): Don't require a non-NULL tag.
3583 * script.h (class Version_script_info): Update declarations.
3584 (Version_script_info::get_symbol_version): Change return type to
3585 bool. Add version parameter. Change all callers.
3586 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3587 handling. Handle an empty version from a version script.
3588 (Symbol_table::define_special_symbol): Likewise.
3589 * testsuite/ver_test_10.script: New file.
3590 * testsuite/ver_test_10.sh: New file.
3591 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3592 (check_DATA): Add ver_test_10.syms.
3593 (ver_test_10.syms, ver_test_10.so): New target.
3594 * testsuite/Makefile.in: Rebuild.
3595
58e54ac2
CD
35962008-07-23 Simon Baldwin <simonb@google.com>
3597
3598 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3599 to zero for undefined symbols from dynamic libraries.
3600
95d14cd3
ILT
36012008-07-23 Ian Lance Taylor <iant@google.com>
3602
3603 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3604 Change all callers.
3605 * symtab.h (class Symbol_table): Update declaration.
3606 * testsuite/ver_test_9.cc: New file.
3607 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3608 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3609 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3610 (ver_test_9.so, ver_test_9.o): New targets.
3611 * testsuite/Makefile.in: Rebuild.
3612
92de84a6
ILT
36132008-07-22 Ian Lance Taylor <iant@google.com>
3614
34810851
ILT
3615 * options.h (class General_options): Define --check-sections.
3616 * layout.cc (Layout::set_segment_offsets): Handle
3617 --check-sections.
3618
af6156ef
ILT
3619 * options.h (class General_options): Define -n/--nmagic and
3620 -N/--omagic.
3621 * options.cc (General_options::finalize): For -n/--nmagic or
3622 -N/--omagic, set -static.
3623 * layout.cc (Layout::attach_allocated_section_to_segment): If
3624 -N/--omagic, don't put read-only and read-write sections in
3625 different segments.
3626 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3627 finding a read-only segment.
3628 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3629 don't set the minimum segment alignment to the common page size,
3630 and don't set the file offset to the address modulo the page size.
3631 * script-sections.cc (Script_sections::create_segments): If
3632 -n/--omagic, don't put read-only and read-write sections in
3633 different segments.
3634
92de84a6
ILT
3635 * cref.cc: New file.
3636 * cref.h: New file.
3637 * options.h (class General_options): Add --print-symbol-counts.
3638 * main.cc (main): Issue defined symbol report if requested.
3639 * archive.cc (Archive::interpret_header): Make into a const member
3640 function.
3641 (Archive::add_symbols): Call Input_objects::archive_start and
3642 archive_stop.
3643 (Archive::const_iterator): Define new class.
3644 (Archive::begin, Archive::end): New functions.
3645 (Archive::include_all_members): Rewrite to use iterator.
3646 (Archive::count_members): New function.
3647 * archive.h (class Archive): Update declarations.
3648 (Archive::filename): New function.
3649 * object.cc: Include "cref.h".
3650 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3651 (Sized_relobj::do_get_global_symbol_counts): New function.
3652 (Input_objects::add_object): Add object to cross-referencer.
3653 (Input_objects::archive_start): New function.
3654 (Input_objects::archive_stop): New function.
3655 (Input_objects::print_symbol_counts): New function.
3656 * object.h: Declare Cref and Archive.
3657 (Object::get_global_symbol_counts): New function.
3658 (Object::do_get_global_symbol_counts): New pure virtual function.
3659 (class Sized_relobj): Add defined_count_ field. Update
3660 declarations.
3661 (class Input_objects): Add cref_ field. Update constructor.
3662 Update declarations.
3663 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3664 defined_count_.
3665 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3666 symbol counts.
3667 (Sized_dynobj::do_get_global_symbol_counts): New function.
3668 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3669 defined_count_. Update declarations. Define Symbols typedef.
3670 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3671 parameter. Change all callers.
3672 (Symbol_table::add_from_dynobj): Add sympointers and defined
3673 parameters. Change all callers.
3674 * symtab.h (class Symbol_table): Update declarations.
3675 * Makefile.am (CCFILES): Add cref.cc.
3676 (HFILES): Add cref.h.
3677 * Makefile.in: Rebuild.
3678
3f7c5e1d
CD
36792008-07-22 Simon Baldwin <simonb@google.com>
3680
3681 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3682 to zero when writing undefined symbols.
3683
e0b64032
ILT
36842008-07-22 Ian Lance Taylor <iant@google.com>
3685
3686 * output.cc (Output_section::add_input_section): Don't try to
3687 merge empty merge sections.
3688
096b02cf
CS
36892008-07-21 Craig Silverstein <csilvers@google.com>
3690
3691 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3692 Include symbol version in error message.
cd536b21 3693
1d1f116d
CD
36942008-07-20 Chris Demetriou <cgd@google.com>
3695
cd536b21 3696 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
3697 (RANDOM_SEED_CFLAGS): New substituted variable.
3698 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3699 * configure: Rebuild.
3700 * Makefile.in: Likewise.
3701 * testsuite/Makefile.in: Likewise.
3702
a18f591e
ILT
37032008-07-18 Ian Lance Taylor <iant@google.com>
3704
3705 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3706 where we see NAME/NULL and NAME/VERSION as separate symbols.
3707 * testsuite/ver_test_main.cc (main): Call t4.
3708 (t4, t4_2a): Define.
3709 * testsuite/ver_test_2.cc (t4_2): Define.
3710 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3711 * testsuite/ver_test_4.cc (t4_2a): Define.
3712 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3713 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3714
c6e3f6ed
ILT
37152008-07-17 Ian Lance Taylor <iant@google.com>
3716
3717 * dynobj.cc (Versions::add_def): If we give an error about a
3718 missing version, go ahead and create the version anyhow.
3719
ef9beddf
ILT
37202008-07-10 Ian Lance Taylor <iant@google.com>
3721
3722 Handle output sections with more than 0x7fffffff bytes.
3723 * object.h (class Relobj): Change map_to_output_ to
3724 output_sections_, and just keep a section pointer. Change all
3725 uses. Move comdat group support to Sized_relobj.
3726 (Relobj::is_section_specially_mapped): Remove.
3727 (Relobj::output_section): Remove poff parameter. Change all
3728 callers.
3729 (Relobj::output_section_offset): New function.
3730 (Relobj::set_section_offset): Rewrite.
3731 (Relobj::map_to_output): Remove.
3732 (Relobj::output_sections): New function.
3733 (Relobj::do_output_section_offset): New pure virtual function.
3734 (Relobj::do_set_section_offset): Likewise.
3735 (class Sized_relobj): Add section_offsets_ field. Add comdat
3736 group support from Relobj. Update declarations.
3737 (Sized_relobj::get_output_section_offset): New function.
3738 (Sized_relobj::do_output_section_offset): New function.
3739 (Sized_relobj::do_set_section_offset): New function.
3740 * object.cc (Relobj::output_section_address): Remove.
3741 (Sized_relobj::Sized_relobj): Initialize new fields.
3742 (Sized_relobj::include_section_group): Cast find_kept_object to
3743 Sized_relobj.
3744 (Sized_relobj::include_linkonce_section): Likewise.
3745 (Sized_relobj::do_layout): Use separate arrays for output section
3746 and output offset.
3747 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3748 output_sections.
3749 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3750 output_sections and section_offsets.
3751 (Sized_relobj::write_local_symbols): Likewise.
3752 (map_to_kept_section): Compute output address directly.
3753 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3754 output_sections and section_offsets.
3755 (Sized_relobj::write_sections): Likewise.
3756 (Sized_relobj::relocate_sections): Likewise.
3757 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3758 * output.h (class Output_reloc): Update declarations. Change
3759 u2_.relobj to Sized_relobj*.
3760 (class Output_data_reloc): Change add functions to use
3761 Sized_relobj*.
3762 * output.cc (Output_reloc::Output_reloc): Change relobj to
3763 Sized_relobj*.
3764 (Output_reloc::local_section_offset): Change return type to
3765 Elf_Addr. Use get_output_section_offset.
3766 (Output_reloc::get_address): Likewise.
3767 (Output_section::is_input_address_mapped): Don't call
3768 is_section_specially_mapped.
3769 (Output_section::output_offset): Likewise.
3770 (Output_section::output_address): Likewise.
3771 (Output_section::starting_output_address): Likewise.
3772 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3773 parameter to Sized_relobj*.
3774 (Copy_relocs::need_copy_reloc): Likewise.
3775 (Copy_relocs::save): Likewise.
3776 * copy-relocs.h (class Copy_relocs): Update declarations.
3777 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3778 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3779 * target-reloc.h (relocate_for_relocatable): Change
3780 offset_in_output_section type to Elf_Addr. Change code that uses
3781 it as well.
3782 * layout.cc (Layout::layout): Always set *off.
3783 * mapfile.cc (Mapfile::print_input_section): Use
3784 output_section_offset.
3785 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3786 Sized_relobj*.
3787 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3788 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3789 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3790
5cb66f97
ILT
37912008-07-03 Ian Lance Taylor <iant@google.com>
3792
3793 * layout.cc (Layout::include_section): Do not discard unrecognized
3794 SHT_STRTAB sections.
3795
afe47622
CS
37962008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3797
3798 * script.cc (Lex::can_continue_name): Make '?' allowable in
3799 version-script names.
3800 * testsuite/version_script.map: Change glob pattern to use '?'
3801
5adf9721
ILT
38022008-06-30 Manish Singh <yosh@gimp.org>
3803
3804 PR 6585
3805 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3806 Correct typo.
3807
e6fde208
ILT
38082008-06-30 Ian Lance Taylor <iant@google.com>
3809
3810 PR 6660
3811 PR 6682
3812 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3813 versions]: Don't try to read the value in the contents, since we
3814 don't use it. Use the template endianness when writing.
3815
3f2e6a2d
CC
38162008-06-25 Cary Coutant <ccoutant@google.com>
3817
3818 * fileread.cc (File_read::make_view): Assert on zero-length view.
3819 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3820 symbol table when there are no symbols to read.
3821
c43d3a48
CS
38222008-06-23 Craig Silverstein <csilvers@google.com>
3823
3824 * version.cc (version_string): Bump to 1.7
3825
5f494ea0
CS
38262008-06-18 Craig Silverstein <csilvers@google.com>
3827
3828 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3829 constant 0xFFFF to type Valtype.
3830 (Powerpc_relocate_functions::rel16_ha): Likewise.
3831
c42e122e
ILT
38322008-06-17 Ian Lance Taylor <iant@google.com>
3833
f34787f8
ILT
3834 * output.h (Output_section::Input_section): Initialize p2align_ to
3835 zero for Output_section_data constructors.
3836 (Output_section::Input_section::addralign): If not an input
3837 section, return the alignment of the Output_section_data.
3838 * testsuite/copy_test.cc: New file.
3839 * testsuite/copy_test_1.cc: New file.
3840 * testsuite/copy_test_2.cc: New file.
3841 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3842 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3843 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3844 (copy_test_1_pic.o, copy_test_1.so): New targets.
3845 (copy_test_2_pic.o, copy_test_2.so): New targets.
3846 * testsuite/Makefile.in: Rebuild.
3847
c42e122e
ILT
3848 * script-sections.cc (Script_sections::place_orphan): Initialize
3849 local variable exact.
3850
ce3ac18a
DE
38512008-06-13 David Edelsohn <edelsohn@gnu.org>
3852
3853 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3854
42cacb20
DE
38552008-06-12 David Edelsohn <edelsohn@gnu.org>
3856 David S. Miller <davem@davemloft.net>
3857
3858 * powerpc.cc: New file.
3859 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3860 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3861 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3862 * Makefile.in: Rebuild.
3863
7b308235
ILT
38642008-06-09 Ian Lance Taylor <iant@google.com>
3865
3866 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3867 <exception>.
3868 (throwing, orig_terminate): New static variables.
3869 (terminate_handler): New static function.
3870 (t2): Set terminate handler.
3871
f0b886e3
ILT
38722008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3873
3874 PR 6584
cd536b21 3875 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
3876 alignment.
3877
3e90f135
CC
38782008-05-30 Cary Coutant <ccoutant@google.com>
3879
3880 * archive.cc (Archive::include_all_members) Correct to step
3881 over symbol table and extended name table in thin archives.
3882
e09ad04a
ILT
38832008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3884
3885 PR 6407
3886 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3887 calculation.
3888
62b01cb5
ILT
38892008-05-28 Caleb Howe <cshowe@google.com>
3890
3891 * reduced_debug_output.cc: New file.
3892 * reduced_debug_output.h: New file.
92de84a6 3893 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
3894 * options.cc (General_options::finalize): Add strip_debug_non_line
3895 to the strip heirarchy.
3896 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3897 fields.
3898 * layout.cc: Include "reduced_debug_output.h".
3899 (Layout::Layout): Initialize new fields.
3900 (line_only_debug_sections): New static array.
3901 (is_lines_only_debug_sections): New static inline function.
3902 (Layout::include_section): Handle --strip-debug-non-line.
3903 (Layout::make_output_section): If --strip-debug-non-line, build
3904 new output sections for .debug_abbrev and .debug_info.
3905 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3906 gold. Warn about possible overflow.
3907 (read_signed_LEB_128): Likewise.
3908 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3909 (read_signed_LEB_128): Declare.
3910 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3911 (HFILES): Add reduced_debug_output.h.
3912 * Makefile.in: Rebuild.
3913
7d9e3d98
ILT
39142008-05-21 Ian Lance Taylor <iant@google.com>
3915
3916 * mapfile.cc: New file.
3917 * mapfile.h: New file.
3918 * options.h (class General_options): Add -M/--print-map and -Map.
3919 * options.cc (General_options::finalize): Make -M equivalent to
3920 -Map -.
3921 * main.cc: Include <cstdio> and "mapfile.h".
3922 (main): Open mapfile if requested.
3923 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3924 constructor. Change caller.
3925 (queue_initial_tasks): Add mapfile parameter. Change caller.
3926 (queue_middle_tasks): Likewise.
3927 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
3928 declarations.
3929 * archive.cc: Include "mapfile.h".
3930 (Archive::add_symbols): Add mapfile parameter. Change all
3931 callers. Pass mapfile, symbol, and reason to include_member.
3932 (Archive::include_all_members): Add mapfile parameter. Change all
3933 callers.
3934 (Archive::include_member): Add mapfile, sym, and why parameters.
3935 Change all callers. Report inclusion to map file.
3936 * archive.h: Include "fileread.h".
3937 (class Archive): Update declarations.
3938 (Archive::file): New const method.
3939 (class Add_archive_symbols): Add mapfile_ field. Update
3940 constructor. Change all callers.
3941 * readsyms.h (class Read_symbols): Likewise.
3942 (class Finish_group): Likewise.
3943 (class Read_script): Likewise.
3944 * common.cc: Include "mapfile.h".
3945 (Symbol_table::allocate_commons): Add mapfile parameter. Change
3946 all callers.
3947 (Symbol_table::do_allocate_commons): Likewise.
3948 (Symbol_table::do_allocate_commons_list): Likewise. Report common
3949 symbol allocation to mapfile.
3950 * common.h (class Allocate_commons_task): Add mapfile_ field.
3951 Update constructor. Change all callers.
3952 * symtab.h (class Symbol_table): Update declarations.
3953 * layout.cc: Include "mapfile.h".
3954 (Layout_task_runner::run): Print information to mapfile.
3955 (Layout::create_gold_note): Change Output_data_fixed_space to
3956 Output_data_zero_fill.
3957 (Layout::create_build_id): Likewise.
3958 (Layout::print_to_mapfile): New function.
3959 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
3960 constructor. Change caller.
3961 (class Layout): Declare print_to_mapfile.
3962 * output.cc (Output_section::Input_section::print_to_mapfile): New
3963 function.
3964 (Output_section::add_input_section): If producing a map, always
3965 add to input_sections_ list.
3966 (Output_section::do_print_to_mapfile): New function.
3967 (Output_segment::print_sections_to_mapfile): New function.
3968 (Output_segment::print_section_list_to_mapfile): New function.
3969 * output.h: Include "mapfile.h".
3970 (Output_data::print_to_mapfile): New function.
3971 (Output_data::do_print_to_mapfile): New virtual function.
3972 (Output_segment_headers::do_print_to_mapfile): New function.
3973 (Output_file_header::do_print_to_mapfile): New function.
3974 (Output_data_const::do_print_to_mapfile): New function.
3975 (class Output_data_const_buffer): Add map_name_ field. Update
3976 constructor. Change all callers. Add do_print_to_mapfile
3977 function.
3978 (class Output_data_fixed_space): Likewise.
3979 (class Output_data_space): Likewise.
3980 (class Output_data_zero_fill): New class.
3981 (Output_data_strtab::do_print_to_mapfile): New function.
3982 (Output_data_reloc_base::do_print_to_mapfile): New function.
3983 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3984 (Output_data_group::do_print_to_mapfile): New function.
3985 (Output_data_got::do_print_to_mapfile): New function.
3986 (Output_data_dynamic::do_print_to_mapfile): New function.
3987 (Output_symtab_xindex::do_print_to_mapfile): New function.
3988 (class Output_section): Declare do_print_to_mapflie. Declare
3989 print_to_mapfile in Input_section.
3990 (class Output_segment): Declare new functions.
3991 * object.h (Sized_relobj::symbol_count): New function.
3992 * script-sections.cc
3993 (Output_section_element_dot_assignment::set_section_addresses):
3994 Change Output_data_fixed_space to Output_data_zero_fill.
3995 (Output_data_expression::do_print_to_mapfile): New function.
3996 * script.cc (read_input_script): Add mapfile parameter. Change
3997 all callers.
3998 * script.h (read_input_script): Update declaration.
3999 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4000 (Eh_frame::do_print_to_mapfile): New function.
4001 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4002 (Output_merge_string::do_print_to_mapfile): New function.
4003 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4004 function.
4005 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4006 function.
4007 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4008 function.
4009 * Makefile.am (CCFILES): Add mapfile.cc.
4010 (HFILES): Add mapfile.h.
4011 * Makefile.in: Rebuild.
4012
9f1d377b
ILT
40132008-05-19 Ian Lance Taylor <iant@google.com>
4014
4015 * options.h (class General_options): Add -z relro.
4016 * layout.cc (Layout::Layout): Initialize relro_segment_.
4017 (Layout::add_output_section_data): Return the output section.
4018 (Layout::make_output_section): Rcognize relro sections and mark
4019 them appropriately.
4020 (Layout::attach_allocated_section_to_segment): Put relro sections
4021 in a PT_GNU_RELRO segment.
4022 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4023 section as relro.
4024 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4025 PT_TLS segments.
4026 (Layout::linkonce_mapping): Map d.rel.ro.local to
4027 .data.rel.ro.local.
4028 (Layout::output_section_name): Us .data.rel.ro.local for any
4029 section which begins with that.
4030 * layout.h (class Layout): Update add_output_section_data
4031 declaration. Add relro_segment_ field.
4032 * output.cc (Output_section::Output_section): Initialize is_relro_
4033 and is_relro_local_ fields.
4034 (Output_segment::add_output_section): Group relro sections.
4035 (Output_segment::is_first_section_relro): New function.
4036 (Output_segment::maximum_alignment): If there is a relro section,
4037 align the segment to the common page size.
4038 (Output_segment::set_section_addresses): Track whether we are
4039 looking at relro sections. If the last section is a relro
4040 section, align to the common page size.
4041 (Output_segment::set_section_list_addresses): Add in_relro
4042 parameter. Change all callers. Align to the page size when
4043 moving from relro to non-relro section.
4044 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4045 segment.
4046 * output.h (class Output_section): Add is_relro_ and
4047 is_relro_local_ fields.
4048 (Output_section::is_relro): New function.
4049 (Output_section::set_is_relro): New function.
4050 (Output_section::is_relro_local): New function.
4051 (Output_section::set_is_relro_local): New function.
4052 (class Output_segment): Update declarations.
4053 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4054 * sparc.cc (Target_sparc::got_section): Likewise.
4055 * x86_64.cc (Target_x86_64::got_section): Likewise.
4056 * testsuite/relro_test_main.cc: New file.
4057 * testsuite/relro_test.cc: New file.
4058 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4059 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4060 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4061 (relro_test.so, relro_test_pic.o): New targets.
4062 * testsuite/Makefile.in: Rebuild.
4063
a984ee1d
ILT
40642008-05-16 Ian Lance Taylor <iant@google.com>
4065
01676dcd
ILT
4066 * output.cc (Output_segment::add_output_section): Remove front
4067 parameter.
4068 * output.h (class Output_segment): Remove
4069 add_initial_output_section and overloaded add_output_section.
4070 Update declaration of remaining add_output_section.
4071 * layout.cc (Layout::create_interp): Call add_output_section
4072 rather than add_initial_output_section.
4073 (Layout::finish_dynamic_section): Likewise.
4074
497897f9
ILT
4075 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4076 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4077 know the dynamic type.
4078 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4079 field. Initialize it in constructor.
4080 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4081 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4082 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4083 reloc.
4084
a984ee1d
ILT
4085 * output.cc (Output_reloc::get_address): Change return type to
4086 Elf_Addr.
4087 * output.h (class Output_reloc): Update get_address declaration.
4088 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4089 for section addresses.
4090
55ba0940
ILT
40912008-05-09 Ian Lance Taylor <iant@google.com>
4092
4093 PR 6493
4094 * gold.cc (gold_nomem): Use return value of write.
4095
75517b77
ILT
40962008-05-08 Ian Lance Taylor <iant@google.com>
4097
4098 * symtab.c (Symbol::init_base_output_data): Add version
4099 parameter. Change all callers.
4100 (Symbol::init_base_output_segment): Likewise.
4101 (Symbol::init_base_constant): Likewise.
4102 (Symbol::init_base_undefined): Likewise.
4103 (Sized_symbol::init_output_data): Likewise.
4104 (Sized_symbol::init_output_segment): Likewise.
4105 (Sized_symbol::init_constant): Likewise.
4106 (Sized_symbol::init_undefined): Likewise.
4107 (Symbol_table::do_define_in_output_data): If the new symbol has a
4108 version, mark it as the default.
4109 (Symbol_table::do_define_in_output_segment): Likewise.
4110 (Symbol_table::do_define_as_constant): Likewise.
4111 * symtab.h (class Symbol): Update declarations.
4112 (class Sized_symbol): Likewise.
4113 * resolve.cc (Symbol::override_version): New function.
c42e122e 4114 (Symbol::override_base): Call override_version.
75517b77
ILT
4115 (Symbol::override_base_with_special): Likewise.
4116 * testsuite/ver_script_8.script: New file.
4117 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4118 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4119 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4120 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4121
f1f70eae
ILT
41222008-05-06 Ian Lance Taylor <iant@google.com>
4123
f3e9c5c5
ILT
4124 PR 6049
4125 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4126 functions.
4127 (class General_options): Remove existing --undefined, and add
4128 --no-undefined instead. Add new --undefined as synonym for -u.
4129 * archive.cc (Archive::add_symbols): Check whether symbol was
4130 named with -u.
4131 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4132 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4133 all uses. Add IS_UNDEFINED. Update declarations to split
4134 different versions of init_base. Declare init_base_undefined.
4135 (Symbol::is_defined): Handle IS_UNDEFINED.
4136 (Symbol::is_undefined): Likewise.
4137 (Symbol::is_weak_undefined): Call is_undefined.
4138 (Symbol::is_absolute): Handle IS_CONSTANT.
4139 (class Sized_symbol): Update declarations to split different
4140 versions of init. Declare init_undefined.
4141 (class Symbol_table): Declare new functions.
4142 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4143 Change all callers.
4144 (Symbol::init_base_output_data): Likewise.
4145 (Symbol::init_base_output_segment): Likewise.
4146 (Symbol::init_base_constant): Likewise.
4147 (Symbol::init_base_undefined): New function.
4148 (Sized_symbol::init_object): Rename from init. Change all
4149 callers.
4150 (Sized_symbol::init_output_data): Likewise.
4151 (Sized_symbol::init_output_segment): Likewise.
4152 (Sized_symbol::init_constant): Likewise.
4153 (Sized_symbol::init_undefined): New function.
4154 (Symbol_table::add_undefined_symbols_from_command_line): New
4155 function.
4156 (Symbol_table::do_add_undefined_symbols_from_command_line): New
4157 function.
4158 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
4159 (Symbol::output_section): Likewise.
4160 (Symbol::set_output_section): Likewise.
4161 (Symbol_table::sized_finalize_symbol): Likewise.
4162 (Symbol_table::sized_write_globals): Likewise.
4163 * resolve.cc (Symbol_table::should_override): Likewise.
4164 (Symbol::override_base_with_special): Likewise.
4165
8bdcdf2c
ILT
4166 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
4167 symbol, change it to have default visibility.
4168 * testsuite/protected_1.cc: New file.
4169 * testsuite/protected_2.cc: New file.
4170 * testsuite/protected_3.cc: New file.
4171 * testsuite/protected_main_1.cc: New file.
4172 * testsuite/protected_main_2.cc: New file.
4173 * testsuite/protected_main_3.cc: New file.
4174 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
4175 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
4176 (protected_1_LDFLAGS, protected_1_LDADD): Define.
4177 (protected_1.so): New target.
4178 (protected_1_pic.o, protected_2_pic.o): New targets.
4179 (protected_3_pic.o): New target.
4180 (check_PROGRAMS): Add protected_2.
4181 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
4182 (protected_2_LDFLAGS, protected_2_LDADD): Define.
4183 * testsuite/Makefile.in: Rebuild.
4184
2b706932
ILT
4185 * options.h (DEFINE_var): Add set_user_set_##varname__.
4186 (DEFINE_bool_alias): New macro.
4187 (class General_options): Define -Bstatic using DEFINE_bool_alias
4188 rather than DEFINE_special. Add --undefined as an alias for -z
4189 defs.
4190 * options.cc (General_options::parse_Bstatic): Remove.
4191
d82a5bcc
ILT
4192 * options.h (class General_options): Add --fatal-warnings.
4193 * main.cc (main): Implement --fatal-warnings.
4194 * errors.h (Errors::warning_count): New function.
4195
f1f70eae
ILT
4196 * options.h (class General_options): Add -Bsymbolic-functions.
4197 * symtab.h (Symbol::is_preemptible): Check for
4198 -Bsymbolic-functions.
4199
8825ac63
ILT
42002008-05-05 Ian Lance Taylor <iant@google.com>
4201
d98bc257
ILT
4202 * options.h (DEFINE_bool): For DASH_Z, create the negative option
4203 as noVARNAME rather than no-VARNAME.
4204 (class General_options): Add option -z combreloc.
4205 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
4206 get_address.
4207 (Output_reloc::sort_before) [SHT_REL]: New function.
4208 (Output_reloc::sort_before) [SHT_RELA]: New function.
4209 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4210 Sort_relocs_comparison.
4211 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4212 parameter. Change all callers.
4213 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4214 sort_relocs parameter. Change all callers.
4215 * output.cc (Output_reloc::get_address): New function, broken out
4216 of write_rel.
4217 (Output_reloc::write_rel): Call it.
4218 (Output_reloc::compare): New function.
4219 (Output_data_reloc_base::do_write): Optionally sort relocs.
4220
60b2b4e7
ILT
4221 * configure.ac: If targ_extra_obj is set, link it in.
4222 * configure.tgt: Initialize all variables.
4223 (x86_64*): Set targ_extra_obj and targ_extra_size.
4224 * configure: Rebuild.
4225
8825ac63
ILT
4226 * object.cc (Sized_relobj::include_section_group): Adjust section
4227 indexes read from group data. Build vector to pass to
4228 layout_group.
4229 * layout.cc (Layout::layout_group): Add flags and shndxes
4230 parameters. Remove contents parameter. Change caller. Update
4231 explicit instantiations.
4232 * layout.h (class Layout): Update layout_group declaration.
4233 * output.cc (Output_data_group::Output_data_group): Add flags and
4234 input_shndxes parameters. Remove contents parameter. Change
4235 caller.
4236 (Output_data_group::do_write): Change input_sections_ to
4237 input_shndxes_.
4238 * output.h (class Output_data_group): Update constructor
4239 declaration. Rename input_sections_ to input_shndxes_.
4240 * testsuite/many_sections_test.cc: Add template.
4241
e94cf127
CC
42422008-04-30 Cary Coutant <ccoutant@google.com>
4243
4418b2d5
CC
4244 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4245
e94cf127
CC
4246 * layout.cc (Layout::include_section): Refactored check for debug
4247 info section.
4248 (Layout::add_comdat): Add new parameters. Change type
4249 of signature parameter. Add object and shndx to signatures table.
4250 (Layout::find_kept_object): New function.
4251 * layout.h: Include <cstring>.
4252 (Layout::is_debug_info_section): New function.
4253 (Layout::add_comdat): Add new parameters.
4254 (Layout::find_kept_object): New function.
4255 (Layout::Kept_section): New struct.
4256 (Layout::Signatures): Change type of map range.
4257 * object.cc (Relobj::output_section_address): New function.
4258 (Sized_relobj::include_section_group): Add new parameters. Change
4259 calls to Layout::add_comdat. Change to build table of kept comdat
4260 groups and table mapping discarded sections to kept sections.
4261 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
4262 (Sized_relobj::do_layout): Change calls to include_section_group and
4263 include_linkonce_section.
4264 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
4265 value to zero when section is discarded.
4266 (Sized_relobj::map_to_kept_section): New function.
4267 * object.h (Relobj::output_section_address): New function.
4268 (Relobj::Comdat_group): New type.
4269 (Relobj::find_comdat_group): New function.
4270 (Relobj::Comdat_group_table): New type.
4271 (Relobj::Kept_comdat_section): New type.
4272 (Relobj::Kept_comdat_section_table): New type.
4273 (Relobj::add_comdat_group): New function.
4274 (Relobj::set_kept_comdat_section): New function.
4275 (Relobj::get_kept_comdat_section): New function.
4276 (Relobj::comdat_groups_): New field.
4277 (Relobj::kept_comdat_sections_): New field.
4278 (Symbol_value::input_value): Update comment.
4279 (Sized_relobj::map_to_kept_section) New function.
4280 (Sized_relobj::include_linkonce_section): Add new parameter.
4281 * target-reloc.h (Comdat_behavior): New type.
4282 (get_comdat_behavior): New function.
4283 (relocate_section): Add code to map a discarded section to the
4284 corresponding kept section when applying a relocation.
4285
e4e5049b
CS
42862008-04-30 Craig Silverstein <csilvers@google.com>
4287
4288 * dwarf_reader.cc (next_generation_count): New static var.
4289 (Addr2line_cache_entry): New struct.
4290 (addr2line_cache): New static var.
4291 (Dwarf_line_info::one_addr2line): Added caching.
4292 (Dwarf_line_info::clear_addr2line_cache): New function.
4293 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
4294 cache-size parameter.
4295 (Dwarf_line_info::one_addr2line_cache): New function.
4296 * symtab.cc (Symbol_table::detect_odr_violations): Pass
4297 new cache-size argument to one_addr2line(), and clear cache.
4298
d09e9154
CC
42992008-04-28 Cary Coutant <ccoutant@google.com>
4300
4301 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
4302 R_386_PC8 relocations.
4303
7ef73768
ILT
43042008-04-23 Ian Lance Taylor <iant@google.com>
4305
55438702
ILT
4306 * object.cc (Sized_relobj::include_section_group): Check for
4307 invalid section group.
4308
c165fb93
ILT
4309 * object.cc (make_elf_object): Correct test for 64-bit ELF file
4310 header size.
4311
7ef73768
ILT
4312 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
4313 than read for file header.
4314 * archive.cc (Archive::include_member): Likewise.
4315
6194aaab
L
43162008-04-23 Paolo Bonzini <bonzini@gnu.org>
4317
4318 * aclocal.m4: Regenerate.
4319 * configure: Regenerate.
4320
d491d34e
ILT
43212008-04-19 Ian Lance Taylor <iant@google.com>
4322
5ea2bac6
ILT
4323 * version.cc (version_string): Bump to 1.6.
4324
7bc3e21a
ILT
4325 * testsuite/Makefile.am (many_sections_r_test): New target.
4326 (many_sections_r_test_SOURCES): Remove.
4327 (many_sections_r_test_DEPENDENCIES): Remove.
4328 (many_sections_r_test_LDFLAGS): Remove.
4329 (many_sections_r_test_LDADD): Remove.
4330
7fcd3aa9
ILT
4331 * object.cc (Sized_relobj::do_add_symbols): Always pass
4332 local_symbol_count_ to add_from_relobj.
4333
4c94d6ae
ILT
4334 * testsuite/Makefile.am (many_sections_check.h): Only check one in
4335 every thousand variables.
4336 * testsuite/Makefile.in: Rebuild.
4337
d491d34e
ILT
4338 * object.cc (Xindex::initialize_symtab_xindex): New function.
4339 (Xindex::read_symtab_xindex): New function.
4340 (Xindex::sym_xindex_to_shndx): New function.
4341 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
4342 available.
4343 (Sized_relobj::do_initialize_xindex): New function.
4344 (Sized_relobj::do_read_symbols): Adjust section links.
4345 (Sized_relobj::symbol_section_and_value): Add is_ordinary
4346 parameter. Change all callers.
4347 (Sized_relobj::include_section_group): Adjust section links and
4348 symbol section indexes.
4349 (Sized_relobj::do_layout): Adjust section links.
4350 (Sized_relobj::do_count_local_symbols): Adjust section links and
4351 symbol section indexes.
4352 (Sized_relobj::do_finalize_local_symbols): Distinguish between
4353 ordinary and special symbols.
4354 (Sized_relobj::write_local_symbols): Add symtab_xindex and
4355 dynsym_xindex parameters. Change all callers. Adjust section
4356 links. Use SHN_XINDEX when needed.
4357 (Sized_relobj::get_symbol_location_info): Adjust section links.
4358 Don't get fooled by special symbols.
4359 * object.h (class Xindex): Define.
4360 (class Object): Add xindex_ parameter. Declare virtual functoin
4361 do_initialize_xindex.
4362 (Object::adjust_sym_shndx): New function.
4363 (Object::set_xindex): New protected function.
4364 (class Symbol_value): Add is_ordinary_shndx_ field.
4365 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
4366 (Symbol_value::value): Assert ordinary section.
4367 (Symbol_value::initialize_input_to_output_map): Likewise.
4368 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
4369 Change all callers.
4370 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
4371 all callers.
4372 (class Sized_relobj): Update declarations.
4373 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
4374 parameter. Change all callers.
4375 (Sized_relobj::adjust_shndx): New function.
4376 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
4377 field.
4378 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
4379 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
4380 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
4381 (Sized_dynobj::read_dynsym_section): Adjust section links.
4382 (Sized_dynobj::read_dynamic): Likewise.
4383 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
4384 section links.
4385 (Sized_dynobj::do_initialize_xindex): New function.
4386 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
4387 do_initialize_xindex.
4388 (Sized_dynobj::adjust_shndx): New function.
4389 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
4390 dynsym_xindex_ fields.
4391 (Layout::finalize): Add a call to set_section_indexes before
4392 creating the symtab sections.
4393 (Layout::set_section_indexes): Don't do anything if the section
4394 already has a section index.
4395 (Layout::create_symtab_sections): Add shnum parameter. Change
4396 caller. Create .symtab_shndx section if needed.
4397 (Layout::create_shdrs): Add shstrtab_section parameter. Change
4398 caller.
4399 (Layout::allocated_output_section_count): New function.
4400 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
4401 needed.
4402 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
4403 fields. Update declarations.
4404 (Layout::symtab_xindex): New function.
4405 (Layout::dynsym_xindex): New function.
4406 (class Write_symbols_task): Add layout_ field.
4407 (Write_symbols_task::Write_symbols_task): Add layout parameter.
4408 Change caller.
4409 * output.cc (Output_section_headers::Output_section_headers): Add
4410 shstrtab_section parameter. Change all callers.
4411 (Output_section_headers::do_sized_write): Store overflow values
4412 for section count and section string table section index in
4413 section header zero.
4414 (Output_file_header::do_sized_write): Check for overflow of
4415 section count and section string table section index.
4416 (Output_symtab_xindex::do_write): New function.
4417 (Output_symtab_xindex::endian_do_write): New function.
4418 * output.h (class Output_section_headers): Add shstrtab_section_.
4419 Update declarations.
4420 (class Output_symtab_xindex): Define.
4421 (Output_section::has_out_shndx): New function.
4422 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
4423 field.
4424 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
4425 Change all callers.
4426 (Sized_symbol::init): Likewise.
4427 (Symbol::output_section): Check for ordinary symbol.
4428 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4429 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4430 callers.
4431 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4432 Change all callers. Simplify handling of symbols from sections
4433 not included in the link.
4434 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4435 distinction.
4436 (Weak_alias_sorter::operator()): Assert that symbols are
4437 ordinary.
4438 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4439 distinction.
4440 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4441 parameters. Change all callers.
4442 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4443 symbol distinction. Use SHN_XINDEX when needed.
4444 (Symbol_table::write_section_symbol): Add symtab_xindex
4445 parameter. Change all callers.
4446 (Symbol_table::sized_write_section_symbol): Likewise. Use
4447 SHN_XINDEX when needed.
4448 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4449 declarations.
4450 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4451 (Symbol::is_defined): Check is_ordinary.
4452 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4453 (Symbol::is_absolute, Symbol::is_common): Likewise.
4454 (class Sized_symbol): Update declarations.
4455 (class Symbol_table): Update declarations.
4456 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4457 parameters. Change all callers.
4458 (Sized_symbol::override): Likewise.
4459 (Symbol_table::override): Likewise.
4460 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4461 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4462 is_ordinary, and orig_st_shndx parameters. Change all callers.
4463 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4464 to be in an ordinary section.
4465 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4466 object and is_ordinary parameters. Change all callers.
4467 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4468 Change all callers. Don't add undefined or non-ordinary symbols
4469 to reloc_map_.
4470 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4471 Change all callers.
4472 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4473 declarations.
4474 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4475 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4476 (Sized_relobj::relocate_sections): Likewise.
4477 * target-reloc.h (scan_relocs): Adjust section symbol index.
4478 (scan_relocatable_relocs): Likewise.
4479 * i386.cc (Scan::local): Check for ordinary symbols.
4480 * sparc.cc (Scan::local): Likewise.
4481 * x86_64.cc (Scan::local): Likewise.
4482 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4483 to symbol_section_and_value.
4484 * testsuite/many_sections_test.cc: New file.
4485 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4486 (check_PROGRAMS): Add many_sections_test.
4487 (many_sections_test_SOURCES): Define.
4488 (many_sections_test_DEPENDENCIES): Define.
4489 (many_sections_test_LDFLAGS): Define.
4490 (BUILT_SOURCES): Add many_sections_define.h.
4491 (many_sections_define.h): New target.
4492 (BUILT_SOURCES): Add many_sections_check.h.
4493 (many_sections_check.h): New target.
4494 (check_PROGRAMS): Add many_sections_r_test.
4495 (many_sections_r_test_SOURCES): Define.
4496 (many_sections_r_test_DEPENDENCIES): Define.
4497 (many_sections_r_test_LDFLAGS): Define.
4498 (many_sections_r_test_LDADD): Define.
4499 (many_sections_r_test.o): New target.
4500 * testsuite/Makefile.in: Rebuild.
4501
c5818ff1
CC
45022008-04-17 Cary Coutant <ccoutant@google.com>
4503
4504 * errors.cc (Errors::info): New function.
4505 (gold_info): New function.
4506 * errors.h (Errors::info): New function.
4507 * gold.h (gold_info): New function.
4508 * object.cc (Input_objects::add_object): Print trace output.
4509 * options.cc (options::parse_set): New function.
4510 (General_options::parse_wrap): Deleted.
4511 (General_options::General_options): Deleted initializer.
4512 * options.h (options::String_set): New typedef.
4513 (options::parse_set): New function.
4514 (DEFINE_set): New macro.
4515 (General_options::wrap): Changed to use DEFINE_set. Changed
4516 callers of any_wrap_symbols and is_wrap_symbol.
4517 (General_options::trace, General_options::trace_symbol):
4518 New options.
4519 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4520 (General_options::wrap_symbols_): Deleted.
4521 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4522
b5be4a7c
DM
45232008-04-17 David S. Miller <davem@davemloft.net>
4524
4525 * options.cc (General_options::parse_V): New function.
4526 * options.h: Add entries for -V and -Qy.
4527
155a0dd7
ILT
45282008-04-17 Ian Lance Taylor <iant@google.com>
4529
4530 * common.cc (Symbol_table::allocate_commons): Remove options
4531 parameter. Change caller.
4532 (Symbol_table::do_allocate_commons): Remove options parameter.
4533 Change caller. Just call do_allocate_commons_list twice.
4534 (Symbol_table::do_allocate_commons_list): New function, broken out
4535 of do_allocate_commons.
4536 * common.h (class Allocate_commons_task): Remove options_ field.
4537 Update constructor.
4538 * symtab.cc (Symbol_table::Symbol_table): Initialize
4539 tls_commons_.
4540 (Symbol_table::add_from_object): Put TLS common symbols on
4541 tls_commons_ list.
4542 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4543 which are IN_OUTPUT_DATA.
4544 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4545 allocate_commons and do_allocate_commons declarations. Declare
4546 do_allocate_commons_list.
4547 * gold.cc (queue_middle_tasks): Update creation of
4548 Allocate_commons_task to not pass options.
4549 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4550 (TLS_TEST_C_FLAGS): New variable.
4551 (tls_test_c_pic.o): New target.
4552 (tls_test_shared.so): Link in tls_test_c_pic.o.
4553 (tls_test_c_pic_ie.o): New target.
4554 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4555 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4556 (tls_test_c.o): New target.
4557 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4558 (tls_pic_test_LDADD): Likewise.
4559 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4560 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4561 (tls_test_c_gnu2.o): New target.
4562 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4563 tls_test_c_gnu2.o.
4564 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4565 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4566 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4567 * testsuite/tls_test.cc: Include "config.h".
4568 (t_last): Call t11_last.
4569 * testsuite/tls_test.h (t11, t11_last): Declare.
4570 * testsuite/tls_test_c.c: New file.
4571 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4572 * configure.ac: Check for OpenMP support.
4573 * configure, config.in, Makefile.in: Rebuild.
4574 * testsuite/Makefile.in: Rebuild.
4575
edfbb029
CC
45762008-04-16 Cary Coutant <ccoutant@google.com>
4577
4578 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4579 (Target_i386::tls_base_symbol_defined_): New field.
4580 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4581 (Target_i386::Scan::global): Likewise.
4582 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4583 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4584 (Target_x86_64::tls_base_symbol_defined_): New field.
4585 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4586 (Target_x86_64::Scan::global): Likewise.
4587
f3c69fca
CC
45882008-04-16 Cary Coutant <ccoutant@google.com>
4589
4590 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4591 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4592 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4593 building shared libraries.
4594 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4595 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4596 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4597 * testsuite/Makefile.in: Rebuild.
4598 * testsuite/weak_undef.h: New file.
4599 * testsuite/weak_undef_file1.cc: Add extra test cases.
4600 * testsuite/weak_undef_file2.cc: Likewise.
4601 * testsuite/weak_undef_test.cc: Likewise.
4602
7c414435
DM
46032008-04-16 David S. Miller <davem@davemloft.net>
4604
32b769e1
DM
4605 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4606 Add issued_non_pic_error_ field. Declare check_non_pic.
4607 (Target_sparc::Scan::check_non_pic): New function.
4608 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4609 (Target_sparc::Scan::global): Likewise.
4610
11936fb1
DM
4611 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4612 * configure: Rebuild.
4613
7c414435
DM
4614 * options.h (DEFINE_enable): New macro.
4615 (new_dtags): New enable option.
4616 (initfirst, interpose, loadfltr, nodefaultlib,
4617 nodelete, nodlopen, nodump): New -z options.
4618 * layout.cc (Layout:finish_dynamic_section): If new
4619 dtags enabled, emit DT_RUNPATH. Also, emit a
4620 DT_FLAGS_1 containing any specified -z flags.
4621
85c7bf8b
ILT
46222008-04-16 Ian Lance Taylor <iant@google.com>
4623
12c0daef
ILT
4624 * copy-relocs.cc: New file.
4625 * copy-relocs.h: New file.
4626 * reloc.cc: Remove Copy_relocs code.
4627 * reloc.h: Likewise.
4628 * reloc-types.h (struct Reloc_types) [both versions]: Add
4629 get_reloc_addend_noerror.
4630 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4631 variants of add_global which take an addend which must be zero.
4632 * i386.cc: Include "copy-relocs.h".
4633 (class Target_i386): Change type of copy_relocs_ to variable,
4634 update initializer.
4635 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4636 Change all callers.
4637 (Target_i386::do_finalize_sections): Change handling of
4638 copy_relocs_.
4639 * sparc.cc: Include "copy-relocs.h".
4640 (class Target_sparc): Change type of copy_relocs_ to variable,
4641 update initializer.
4642 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4643 Change all callers.
4644 (Target_sparc::do_finalize_sections): Change handling of
4645 copy_relocs_.
4646 * x86_64.cc: Include "copy-relocs.h".
4647 (class Target_x86_64): Change type of copy_relocs_ to variable,
4648 update initializer.
4649 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4650 class. Change all callers.
4651 (Target_x86_64::do_finalize_sections): Change handling of
4652 copy_relocs_.
4653 * Makefile.am (CCFILES): Add copy-relocs.cc.
4654 (HFILES): Add copy-relocs.h.
4655
4f4995b6
ILT
4656 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4657
85c7bf8b
ILT
4658 * testsuite/script_test_4.sh: Permit leading zeroes.
4659
4f2a9edd
ILT
46602008-04-15 Ian Lance Taylor <iant@google.com>
4661
e6188289
ILT
4662 * script-sections.cc (Script_sections::create_segments): Use
4663 header_size_adjustment even when there is enough room for the
4664 headers.
4665 * testsuite/script_test_4.sh: New file.
4666 * testsuite/script_test_4.t: New file.
4667 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4668 (check_DATA): Add script_test_4.stdout.
4669 (MOSTLYCLEANFILES): Likewise.
4670 (script_test_4): New target.
4671 (script_test_4.stdout): New target.
4672 * testsuite/Makefile.in: Rebuild.
4673
4f2a9edd
ILT
4674 * sparc.cc: Add definitions for Output_data_plt_sparc class
4675 constants.
4676
f5314dd5
DM
46772008-04-14 David S. Miller <davem@davemloft.net>
4678
4679 * sparc.cc: New file.
4680 * Makefile.am (TARGETSOURCES): Add sparc.cc
4681 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4682 * configure.tgt: Document targ_extra_size and
4683 targ_extra_big_endian. Add entries for sparc-* and
4684 sparc64-*.
4685 * configure.ac: Handle targ_extra_size and
4686 targ_extra_big_endian.
4687 * Makefile.in: Rebuild.
4688 * configure: Likewise.
4689 * po/POTFILES.in: Likewise.
4690 * po/gold.pot: Likewise.
4691
154e0e9a
ILT
46922008-04-14 Ian Lance Taylor <iant@google.com>
4693
4694 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4695 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4696 in the name/type/flags to section mapping. Don't call
4697 allocate_output_section.
4698 (Layout::choose_output_section): Change parameter from adjust_name
4699 to is_input_section. Don't permit input sections after sections
4700 are attached to segments. Don't call allocate_output_section.
4701 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4702 not write_enable_output_section.
4703 (Layout::make_output_section): Don't push to
4704 unattached_section_list_ nor call attach_to_segment. Call
4705 attach_section_to_segment if sections are attached.
4706 (Layout::attach_sections_to_segments): New function.
4707 (Layout::attach_section_to_segment): New function.
4708 (Layout::attach_allocated_section_to_segment): Rename from
4709 attach_to_segment. Remove flags parameter.
4710 (Layout::allocate_output_section): Remove function.
4711 (Layout::write_enable_output_section): Remove function.
4712 * layout.h (class Layout): Update for above changes. Add new
4713 field sections_are_attached_.
4714 * output.h (Output_section::update_flags_for_input_section): New
4715 function.
4716 * output.cc (Output_section::add_input_section): Call
4717 update_flags_for_input_section.
4718 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4719
009a67a2
CC
47202008-04-11 Cary Coutant <ccoutant@google.com>
4721
4722 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4723 thought unnecessary.
4724 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4725
759b1a24
ILT
47262008-04-11 Ian Lance Taylor <iant@google.com>
4727
4728 * output.h (class Output_section_data): Remove inline definition
4729 of set_addralign.
4730 * output.cc (Output_section_data::set_addralign): New function.
4731
c2b45e22
CC
47322008-04-11 Cary Coutant <ccoutant@google.com>
4733
4734 Add support for TLS descriptors for i386 and x86_64.
4735 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4736 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4737 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4738 GOT_TYPE_TLS_DESC.
4739 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4740 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4741 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4742 relocations.
4743 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4744 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4745 Fix problem with initial-exec relocations.
4746 (Target_i386::Relocate::relocate_tls): Likewise.
4747 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4748 relaxation.
4749 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4750 support for section-plus-offset dynamic table entries.
4751 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4752 (Output_data_dynamic::Dynamic_entry): Add support for
4753 section-plus-offset dynamic table entries.
4754 (Output_data_dynamic::Classification): Likewise.
4755 (Output_data_dynamic::classification_): Renamed offset_.
4756 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4757 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4758 (Target_x86_64::make_plt_section): New function.
4759 (Target_x86_64::reserve_tlsdesc_entries): New function.
4760 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4761 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4762 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4763 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4764 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4765 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4766 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4767 add extra PLT entry for TLS descriptors.
4768 (Output_data_plt_x86_64::got_): New field.
4769 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4770 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4771 fields.
4772 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4773 descriptors.
4774 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4775 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4776 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4777 R_386_TLS_DESC_CALL relocations.
4778 (Target_x86_64::Scan::global): Likewise.
4779 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4780 for TLS descriptors.
4781 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4782 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4783 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4784 GD-to-IE relaxation.
4785 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4786 and TLS_DESCRIPTORS.
4787 * Makefile.in: Rebuild.
4788 * configure: Rebuild.
4789 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4790 (tls_test_shared2.so): New target.
4791 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4792 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4793 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4794 (tls_shared_gd_to_ie_test_LDADD): New variable.
4795 (tls_shared_gnu2_gd_to_ie_test): New target.
4796 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4797 New targets.
4798 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4799 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4800 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4801 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4802 (tls_shared_gnu2_test): New target.
4803 (tls_test_gnu2_shared.so): New target.
4804 (tls_shared_gnu2_test_SOURCES): New variable.
4805 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4806 (tls_shared_gnu2_test_LDFLAGS): New variable.
4807 (tls_shared_gnu2_test_LDADD): New variable.
4808 * testsuite/Makefile.in: Rebuild.
4809 * testsuite/Makefile.
4810
83bfb6b7
ILT
48112008-04-11 Ian Lance Taylor <iant@google.com>
4812
4813 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4814 justsyms.t.
4815 * testsuite/Makefile.in: Rebuild.
4816
4817 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4818 long.
4819 * testsuite/script_test_2.cc (main): Adjust test.
4820
706e1f5e
ILT
48212008-04-11 David S. Miller <davem@davemloft.net>
4822 Ian Lance Taylor <iant@google.com>
4823
4824 * options.h (General_options): Add entries for '-Y' and
4825 '-relax'.
4826 * options.cc (General_options:finalize): If -Y was used, add those
4827 entries to the library path instead of the default "/lib" and
4828 "/usr/lib".
4829
7c98e6bb
DM
48302008-04-11 David S. Miller <davem@davemloft.net>
4831
4832 * testsuite/justsyms.t: Start at 0x100.
4833 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
4834 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4835 long.
4836 * testsuite/script_test_2.cc: Adjust string and section length
4837 checks.
7c98e6bb 4838
99a37bfd
ILT
48392008-04-09 Ian Lance Taylor <iant@google.com>
4840
2cefc357
ILT
4841 PR gold/5996
4842 * script-sections.cc (Sections_element::allocate_to_segment): Add
4843 orphan parameter.
4844 (Output_section_definition::allocate_to_segment): Likewise.
4845 (Orphan_output_section::allocate_to_segment): Likewise.
4846 (Script_sections::attach_sections_using_phdrs_clause): Don't
4847 propagate non-PT_LOAD segments to orphan sections.
4848 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4849 readelf rather than objdump.
4850 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4851 .interp section and PT_INTERP segment are the same size.
4852 * testsuite/Makefile.in: Rebuild.
4853
99a37bfd
ILT
4854 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4855 aliases for symbols defined in the same object.
4856 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4857 (weak_alias_test_SOURCES): New variable.
4858 (weak_alias_test_DEPENDENCIES): New variable.
4859 (weak_alias_test_LDFLAGS): New variable.
4860 (weak_alias_test_LDADD): New variable.
4861 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4862 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4863 (weak_alias_test_3.o): New target.
4864 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4865 * testsuite/weak_alias_test_main.cc: New file.
4866 * testsuite/weak_alias_test_1.cc: New file.
4867 * testsuite/weak_alias_test_2.cc: New file.
4868 * testsuite/weak_alias_test_3.cc: New file.
4869
780e49c5
ILT
48702008-04-08 Ian Lance Taylor <iant@google.com>
4871
cdb0b8f5
ILT
4872 * options.h (class General_options): Add --noinhibit-exec option.
4873 * main.cc (main): Check --noinhibit-exec.
4874
0864d551
ILT
4875 * options.h (class General_options): Define --wrap as a special
4876 option. Add wrap_symbols_ field.
4877 (General_options::any_wrap_symbols): New function.
4878 (General_options::is_wrap_symbol): New function.
4879 * options.cc (General_options::parse_wrap): New function.
4880 (General_options::General_options): Initialize wrap_symbols_.
4881 * symtab.cc (Symbol_table::wrap_symbol): New function.
4882 (Symbol_table::add_from_object): Handle --wrap.
4883 * symtab.h (class Symbol_table): Declare wrap_symbol.
4884 * target.h (Target::wrap_char): New function.
4885 (Target::Target_info): Add wrap_char field.
4886 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4887 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4888 * testsuite/testfile.cc (Target_test::test_target_info):
4889 Likewise.
4890
789aa6de
ILT
4891 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4892 there is one.
4893
2c38906f
ILT
4894 * layout.h (class Layout): Add added_eh_frame_data_ field.
4895 * layout.cc (Layout::Layout): Initialize new field.
4896 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4897 output section until we find a section we merged successfully.
4898 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4899 that the size be non-zero.
4900
780e49c5
ILT
4901 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4902 qualifier.
4903
7fcd0256
ILT
49042008-04-08 Craig Silverstein <csilvers@google.com>
4905
4906 * configure.ac: Export new conditional variable HAVE_ZLIB.
4907 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4908 on HAVE_ZLIB.
4909 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4910 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4911
6835af53
ILT
49122008-04-07 Ian Lance Taylor <iant@google.com>
4913
e24f324c
ILT
4914 * version.cc (version_string): Set to "1.5".
4915
a036edd8
ILT
4916 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4917 Add issued_non_pic_error_ field. Declare check_non_pic.
4918 (Target_x86_64::Scan::check_non_pic): New function.
4919 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4920 (Target_x86_64::Scan::global): Likewise.
4921
624f8810
ILT
4922 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4923 addend parameter. Change caller. Handle merge sections.
4924 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
4925 Address to Addend. Don't add in the result of
4926 local_section_offset, pass down the addend and use the returned
4927 value.
4928 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
4929 Update declarations of local_section_offset and symbol_value.
4930 * testsuite/two_file_test_1.cc (t18): New function.
4931 * testsuite/two_file_test_2.cc (f18): New function.
4932 * testsuite/two_file_test_main.cc (main): Call t18.
4933 * testsuite/two_file_test.h (t18, f18): Declare.
4934
6835af53
ILT
4935 * configure.ac: Don't test for objdump, c++filt, or readelf.
4936 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
4937 conditionals.
4938 (TEST_READELF): New variable.
4939 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
4940 (check_PROGRAMS): Add two_file_strip_test.
4941 (two_file_strip_test): New target.
4942 (check_PROGRAMS): Add two_file_same_shared_strip_test.
4943 (two_file_same_shared_strip_test_SOURCES): New variable.
4944 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
4945 (two_file_same_shared_strip_test_LDFLAGS): New variable.
4946 (two_file_same_shared_strip_test_LDADD): New variable.
4947 (two_file_shared_strip.so): New target.
4948 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
4949 (ver_test_5.syms, ver_test_7.syms): Likewise.
4950 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
4951 (strip_test_3.stdout): Use TEST_OBJDUMP.
4952 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4953
86925eef
CC
49542008-04-04 Cary Coutant <ccoutant@google.com>
4955
4956 * symtab.h (Symbol::is_weak_undefined): New function.
4957 (Symbol::is_strong_undefined): New function.
4958 (Symbol::is_absolute): New function.
4959 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
4960 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
4961 absolute symbols.
4962 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
4963 (weak_undef_test): New target.
4964 * testsuite/Makefile.in: Rebuild.
4965 * testsuite/weak_undef_file1.cc: New file.
4966 * testsuite/weak_undef_file2.cc: New file.
4967 * testsuite/weak_undef_test.cc: New file.
4968
126f3ece
ILT
49692008-04-03 Craig Silverstein <csilvers@google.com>
4970
4971 * compressed_output.h (class Output_compressed_section): Use
4972 unsigned buffer.
4973 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4974 add zlib header.
4975 (zlib_compressed_suffix): Removed.
4976 (Output_compressed_section::set_final_data_size): Use unsigned
4977 buffers.
4978 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4979 Fix linker invocation.
4980 (flagstest_o_specialfile_and_compress_debug_sections):
4981 Likewise.
4982 * testsuite/Makefile.in: Regenerated.
4983
deae2a14
DM
49842008-04-02 David S. Miller <davem@davemloft.net>
4985
4986 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4987 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4988
70752818
ILT
49892008-04-02 Craig Silverstein <csilvers@google.com>
4990
4991 * TODO: New file.
4992
39d0cb0e
ILT
49932008-04-02 Ian Lance Taylor <iant@google.com>
4994
4995 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4996 parameters. Update for new key type to views_. Change all
4997 callers.
4998 (File_read::read): Adjust for byteshift in returned view.
4999 (File_read::add_view): New function, broken out of
5000 find_and_make_view.
5001 (File_read::make_view): New function, broken out of
5002 find_and_make_view.
5003 (File_read::find_or_make_view): Add offset and aligned
5004 parameters. Rewrite accordingly. Change all callers.
5005 (File_read::get_view): Add offset and aligned parameters. Adjust
5006 for byteshift in return value.
5007 (File_read::get_lasting_view): Likewise.
5008 * fileread.h (class File_read): Update declarations.
5009 (class File_read::View): Add byteshift_ field. Add byteshift to
5010 constructor. Add byteshift method.
5011 * archive.h (Archive::clear_uncached_views): New function.
5012 (Archive::get_view): Add aligned parameter. Change all callers.
5013 * object.h (Object::get_view): Add aligned parameter. Change all
5014 callers.
5015 (Object::get_lasting_view): Likewise.
5016
5017 * fileread.cc (File_read::release): Don't call clear_views if
5018 there are multiple objects.
5019 * fileread.h (File_read::clear_uncached_views): New function.
5020 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5021 on the archive.
5022
a1207466
CC
50232008-03-31 Cary Coutant <ccoutant@google.com>
5024
5025 Add thin archive support.
5026 * archive.cc (Archive::armagt): New const.
5027 (Archive::setup): Remove task parameter and calls to unlock.
5028 (Archive::unlock_nested_archives): New function.
5029 (Archive::read_header): Add nested_off parameter. Change
5030 all callers.
5031 (Archive::interpret_header): Likewise.
5032 (Archive::include_all_members): Change to handle thin
5033 archives.
5034 (Archive::include_member): Likewise.
5035 * archive.h (Archive::Archive): Add new parameters and
5036 initializers.
5037 (Archive::armagt): New const.
5038 (Archive::setup): Remove task parameter.
5039 (Archive::unlock_nested_archives): New function.
5040 (Archive::read_header): Add nested_off parameter.
5041 (Archive::interpret_header): Likewise.
5042 (Archive::Nested_archive_table): New typedef.
5043 (Archive::is_thin_archive_): New field.
5044 (Archive::nested_archives_): New field.
5045 (Archive::options_): New field.
5046 (Archive::dirpath_): New field.
5047 (Archive::task_): New field.
5048 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5049 for thin archives. Pass additional parameters to
5050 Archive::Archive. Unlock the archive file after calling
5051 Archive::setup.
cd536b21 5052
479f6503
ILT
50532008-03-29 Ian Lance Taylor <iant@google.com>
5054
686c8caf
ILT
5055 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5056 version symbol to be local.
5057 * testsuite/ver_test_4.sh: New file.
5058 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5059 (check_DATA): Add ver_test_4.syms.
5060 (ver_test_4.syms): New target.
5061 * testsuite/Makefile.in: Rebuild.
5062
ab794b6b
ILT
5063 * output.cc
5064 (Output_section::Input_section_sort_entry::has_priority): New
5065 function.
5066 (Output_section::Input_section_sort_entry::match_file_name): New
5067 function.
5068 (Output_section::Input_section_sort_entry::match_section_name):
5069 Remove.
5070 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5071 Remove.
5072 (Output_section::Input_section_sort_entry::match_section_file):
5073 Remove.
5074 (Output_section::Input_section_sort_compare::operator()): Rewrite
5075 using new Input_section_sort_entry functions. Sort crtbegin and
5076 crtend first. Sort sections with no priority before sections with
5077 a priority.
5078 * testsuite/initpri1.c (d3): Check j != 4.
5079 (cd5): New constructor/destructor function.
5080 (main): Check j != 2.
5081
479f6503
ILT
5082 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5083 new symbol when resolving, don't call set_is_default.
5084 * testsuite/ver_test_7.cc: New file.
5085 * testsuite/ver_test_7.sh: New file.
5086 * testsuite/Makefile.am (ver_test_7.so): New target.
5087 (ver_test_7.o): New target.
5088 (check_SCRIPTS): Add ver_test_7.sh.
5089 (check_DATA): Add ver_test_7.syms.
5090 (ver_test_7.syms): New target.
5091
2fd32231
ILT
50922008-03-28 Ian Lance Taylor <iant@google.com>
5093
5094 * layout.cc (Layout::layout): If we see an input section with a
5095 name that needs sorting, set the must_sort flag for the output
5096 section.
5097 (Layout::make_output_section): If the name of the output section
5098 indicates that it might require sorting, set the may_sort flag.
5099 * output.h (Output_section::may_sort_attached_input_sections): New
5100 function.
5101 (Output_section::set_may_sort_attached_input_sections): New
5102 function.
5103 (Output_section::must_sort_attached_input_sections): New
5104 function.
5105 (Output_section::set_must_sort_attached_input_sections): New
5106 function.
5107 (class Output_section): Declare Input_section_sort_entry. Define
5108 Input_section_sort_compare. Declare
5109 sort_attached_input_sections. Add new fields:
5110 may_sort_attached_input_sections_,
5111 must_sort_attached_input_sections_,
5112 attached_input_sections_are_sorted_.
5113 * output.cc (Output_section::Output_section): Initialize new
5114 fields.
5115 (Output_section::add_input_section): Add an entry to
5116 input_sections_ if may_sort or must_sort are true.
5117 (Output_section::set_final_data_size): Call
5118 sort_attached_input_sections if necessary.
5119 (Output_section::Input_section_sort_entry): Define new class.
5120 (Output_section::Input_section_sort_compare::operator()): New
5121 function.
5122 (Output_section::sort_attached_input_sections): New function.
5123 * configure.ac: Check whether the compiler supports constructor
5124 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5125 * testsuite/initpri1.c: New file.
5126 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5127 CONSTRUCTOR_PRIORITY.
5128 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5129 (initpri1_LDFLAGS): New variable.
5130 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5131
18e6b24e
ILT
51322008-03-27 Ian Lance Taylor <iant@google.com>
5133
49bdd526
ILT
5134 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5135 * testsuite/common_test_1.c: New file.
5136 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5137 (common_test_1_SOURCES): New variable.
5138 (common_test_1_DEPENDENCIES): New variable.
5139 (common_test_1_LDFLAGS): New variable.
5140
18e6b24e
ILT
5141 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5142 and commons_ correctly when NAME/VERSION does not override
5143 NAME/NULL.
5144 * testsuite/ver_test_6.c: New file.
5145 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5146 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5147 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5148
04bf7072
ILT
51492008-03-26 Ian Lance Taylor <iant@google.com>
5150
5871526f
ILT
5151 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5152 of an undefined symbol from a version script.
5153 * testsuite/Makefile.am (ver_test_5.so): New target.
5154 (ver_test_5.o): New target.
5155 (check_SCRIPTS): Add ver_test_5.sh.
5156 (check_DATA): Add ver_test_5.syms.
5157 (ver_test_5.syms): New target.
5158 * testsuite/ver_test_5.cc: New file.
5159 * testsuite/ver_test_5.script: New file.
5160 * testsuite/ver_test_5.sh: New file.
5161 * Makefile.in, testsuite/Makefile.in: Rebuild.
5162
04bf7072
ILT
5163 PR gold/5986
5164 Fix problems building gold with gcc 4.3.0.
5165 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
5166 (gold_error_at_location, gold_warning_at_location): Use it.
5167 * configure.ac: Check whether we can compile and use a template
5168 function with a printf attribute.
5169 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
5170 when jumping over bytes.
5171 * object.cc: Instantiate Object::read_section_data.
5172 * debug.h: Include <cstring>
5173 * dwarf_reader.cc: Include <algorithm>
5174 * main.cc: Include <cstring>.
5175 * options.cc: Include <cstring>.
5176 * output.cc: Include <cstring>.
5177 * script.cc: Include <cstring>.
5178 * script.h: Include <string>.
5179 * symtab.cc: Include <cstring> and <algorithm>.
5180 * target-select.cc: Include <cstring>.
5181 * version.cc: Include <string>.
5182 * testsuite/testmain.cc: Include <cstdlib>.
5183 * configure, config.in: Rebuild.
5184
874c5b28
ILT
51852008-03-25 Ian Lance Taylor <iant@google.com>
5186
819d6c3a
ILT
5187 * options.cc: Include "../bfd/bfdver.h".
5188 (options::help): Print bug reporting address.
5189
f4b2c6f5
ILT
5190 * version.cc (print_version): Adjust output for current value of
5191 BFD_VERSION_STRING.
5192
5193 * NEWS: New file.
5194
e96caa79
ILT
5195 * options.cc (options::help): Print list of supported targets.
5196 * target-select.h: Include <vector>.
5197 (class Target_selector): Make machine_, size_, and is_big_endian_
5198 fields const. Add bfd_name_ and instantiated_target_ fields.
5199 (Target_selector::Target_selector): Add bfd_name parameter.
5200 (Target_selector::recognize): Make non-virtual, call
5201 do_recognize.
5202 (Target_selector::recognize_by_name): Make non-virtual, call
5203 do_recognize_by_name.
5204 (Target_selector::supported_names): New function.
5205 (Target_selector::bfd_name): New function.
5206 (Target_selector::do_instantiate_target): New pure virtual
5207 function.
5208 (Target_selector::do_recognize): New virtual function.
5209 (Target_selector::do_recognize_by_name): New virtual function.
5210 (Target_selector::instantiate_target): New private function.
5211 (supported_target_names): Declare.
5212 * target-select.cc (Target_selector::Target_selector): Update for
5213 new parameter and fields.
5214 (select_target_by_name): Check that the name matches before
5215 calling recognize_by_name.
5216 (supported_target_names): New function.
5217 * i386.cc (class Target_selector_i386): Update Target_selector
5218 constructor call. Remove recognize and recognize_by_name. Add
5219 do_instantiate_target.
5220 * x86_64.cc (class Target_selector_x86_64): Likewise.
5221 * testsuite/testfile.cc (class Target_selector_test): Update for
5222 changes to Target_selector.
5223
874c5b28
ILT
5224 * README: Rewrite, with some notes on unsupported features.
5225
0a65a3a7
CC
52262008-03-24 Cary Coutant <ccoutant@google.com>
5227
5228 * i386.cc (Target_i386::Got_type): New enum declaration.
5229 (Target_i386::Scan::local): Updated callers of Output_data_got
5230 member functions.
5231 (Target_i386::Scan::global): Likewise.
5232 (Target_i386::Relocate::relocate): Likewise.
5233 (Target_i386::Relocate::relocate_tls): Likewise.
5234 * object.h (Got_offset_list): New class.
5235 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5236 (Sized_relobj::local_got_offset): Likewise.
5237 (Sized_relobj::set_local_got_offset): Likewise.
5238 (Sized_relobj::local_has_tls_got_offset): Removed.
5239 (Sized_relobj::local_tls_got_offset): Removed.
5240 (Sized_relobj::set_local_tls_got_offset): Removed.
5241 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5242 * output.cc (Output_data_got::add_global): Added got_type parameter.
5243 (Output_data_got::add_global_with_rel): Likewise.
5244 (Output_data_got::add_global_with_rela): Likewise.
5245 (Output_data_got::add_global_pair_with_rel): New function.
5246 (Output_data_got::add_global_pair_with_rela): New function.
5247 (Output_data_got::add_local): Added got_type parameter.
5248 (Output_data_got::add_local_with_rel): Likewise.
5249 (Output_data_got::add_local_with_rela): Likewise.
5250 (Output_data_got::add_local_pair_with_rel): New function.
5251 (Output_data_got::add_local_pair_with_rela): New function.
5252 (Output_data_got::add_global_tls): Removed.
5253 (Output_data_got::add_global_tls_with_rel): Removed.
5254 (Output_data_got::add_global_tls_with_rela): Removed.
5255 (Output_data_got::add_local_tls): Removed.
5256 (Output_data_got::add_local_tls_with_rel): Removed.
5257 (Output_data_got::add_local_tls_with_rela): Removed.
5258 * output.h (Output_data_got::add_global): Added got_type parameter.
5259 (Output_data_got::add_global_with_rel): Likewise.
5260 (Output_data_got::add_global_with_rela): Likewise.
5261 (Output_data_got::add_global_pair_with_rel): New function.
5262 (Output_data_got::add_global_pair_with_rela): New function.
5263 (Output_data_got::add_local): Added got_type parameter.
5264 (Output_data_got::add_local_with_rel): Likewise.
5265 (Output_data_got::add_local_with_rela): Likewise.
5266 (Output_data_got::add_local_pair_with_rel): New function.
5267 (Output_data_got::add_local_pair_with_rela): New function.
5268 (Output_data_got::add_global_tls): Removed.
5269 (Output_data_got::add_global_tls_with_rel): Removed.
5270 (Output_data_got::add_global_tls_with_rela): Removed.
5271 (Output_data_got::add_local_tls): Removed.
5272 (Output_data_got::add_local_tls_with_rel): Removed.
5273 (Output_data_got::add_local_tls_with_rela): Removed.
5274 * resolve.cc (Symbol::override_base_with_special): Removed
5275 reference to has_got_offset_ field.
5276 * symtab.cc (Symbol::init_fields): Replaced initialization
5277 of got_offset_ with got_offsets_. Removed initialization
5278 of has_got_offset_
53fcba31 5279 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
5280 (Symbol::got_offset): Likewise.
5281 (Symbol::set_got_offset): Likewise.
5282 (Symbol::has_tls_got_offset): Removed.
5283 (Symbol::tls_got_offset): Removed.
5284 (Symbol::set_tls_got_offset): Removed.
5285 (Symbol::got_offset_): Removed.
5286 (Symbol::tls_mod_got_offset_): Removed.
5287 (Symbol::tls_pair_got_offset_): Removed.
5288 (Symbol::got_offsets_): New field.
5289 (Symbol::has_got_offset): Removed.
5290 (Symbol::has_tls_mod_got_offset): Removed.
5291 (Symbol::has_tls_pair_got_offset): Removed.
5292 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
5293 (Target_x86_64::Scan::local): Updated callers of Output_data_got
5294 member functions.
5295 (Target_x86_64::Scan::global): Likewise.
5296 (Target_x86_64::Relocate::relocate): Likewise.
5297 (Target_x86_64::Relocate::relocate_tls): Likewise.
5298
bd52eafb
BE
52992008-03-25 Ben Elliston <bje@au.ibm.com>
5300
5301 * yyscript.y: Fix spelling error in comment.
5302
8b105e34
ILT
53032008-03-24 Ian Lance Taylor <iant@google.com>
5304
8ed814a9
ILT
5305 * options.h (class General_options): Define build_id option.
5306 * layout.h (class Layout): Declare write_build_id, create_note,
5307 create_build_id. Add build_id_note_ member.
5308 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
5309 "libiberty.h", "md5.h", "sha1.h".
5310 (Layout::Layout): Initialize eh_frame_data_,
5311 eh_frame_hdr_section_, and build_id_note_.
5312 (Layout::finalize): Call create_build_id.
5313 (Layout::create_note): New function, broken out of
5314 Layout::create_gold_note.
5315 (Layout::create_gold_note): Call create_note.
5316 (Layout::create_build_id): New function.
5317 (Layout::write_build_id): New function.
5318 (Close_task_runner::run): Call write_build_id.
5319
8b105e34
ILT
5320 * x86_64.cc: Correct license to GPLv3.
5321
086a1841
ILT
53222008-03-23 Ian Lance Taylor <iant@google.com>
5323
5324 * options.cc: Include "demangle.h".
5325 (parse_optional_string): New function.
5326 (parse_long_option): Handle takes_optional_argument.
5327 (parse_short_option): Update dash_z initializer. Handle
5328 takes_optional_argument.
5329 (General_options::General_options): Initialize do_demangle_.
5330 (General_options::finalize): Set do_demangle_. Handle demangling
5331 style.
5332 * options.h (parse_optional_string): Declare.
5333 (struct One_option): Add optional_arg field. Update constructor.
5334 Update call constructor calls. Add takes_optional_argument
5335 function.
5336 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
5337 (DEFINE_optional_string): Define.
5338 (General_options::demangle): Change from DEFINE_bool to
5339 DEFINE_optional_string.
5340 (General_options::no_demangle): New function.
5341 (General_options::do_demangle): New function.
5342 (General_options::set_do_demangle): New function.
5343 (General_options::execstack_status_): Move definition to end of
5344 class definition.
5345 (General_options::static_): Likewise.
5346 (General_options::do_demangle_): New field.
5347 * object.cc (big_endian>::get_symbol_location_info): Call
5348 Options::do_demangle, not Options::demangle.
5349 * symtab.cc (demangle): Likewise.
5350
cbb93e63
ILT
53512008-03-22 Ian Lance Taylor <iant@google.com>
5352
5353 * gold.h: Include <cstddef> and <sys/types.h>
5354 * options.h: Include <cstring>.
5355
ec531623
ILT
53562008-03-21 Ian Lance Taylor <iant@google.com>
5357
5358 * Added source code to GNU binutils.
This page took 0.353389 seconds and 4 git commands to generate.