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