]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/ChangeLog
* dwarf2.h (DW_AT_GNU_macros): New.
[thirdparty/binutils-gdb.git] / gold / ChangeLog
CommitLineData
f1ddb600
ILT
12011-07-15 Ian Lance Taylor <iant@google.com>
2
3 * options.h (class General_options): Add --print-output-format.
4 Move -EL next to -EB, for better --help output.
5 * target-select.cc: Include <cstdio>, "options.h", and
6 "parameters.h".
7 (Target_selector::do_target_bfd_name): New function.
8 (print_output_format): New function.
9 * target-select.h (class Target_selector): Update declarations.
10 (Target_selector::target_bfd_name): New function.
11 (print_output_format): Declare.
12 * main.cc: Include "target-select.h".
13 (main): Handle --print-output-format.
14 * gold.cc: Include "target-select.h".
15 (queue_initial_tasks): Handle --print-output-format when there are
16 no input files.
17 * parameters.cc (parameters_force_valid_target): Give a better
18 error message if -EB/-EL does not match target.
19 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
20 function.
21
7d172687
ILT
222011-07-15 Ian Lance Taylor <iant@google.com>
23
24 * i386.cc (class Output_data_plt_i386): Add layout_ field.
25 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
26 (Output_data_plt_i386::do_write): Write address of .dynamic
27 section to first entry in .got.plt section.
28 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
29 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
30 Initialize layout_.
31 (Output_data_plt_x86_64::do_write): Write address of .dynamic
32 section to first entry in .got.plt section.
33 * layout.h (Layout::dynamic_section): New function.
34
e9552f7e
ST
352011-07-13 Sriraman Tallam <tmsriram@google.com>
36
37 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
38 to claim_file call.
39 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
40 input_section_position_, and input_section_glob_.
41 (read_layout_from_file): Call function section_ordering_specified.
42 * layout.h (is_section_ordering_specified): New function.
43 (section_ordering_specified): New function.
44 (section_ordering_specified_): New boolean member.
45 * main.cc(main): Call load_plugins after layout object is defined.
46 * output.cc (Output_section::add_input_section): Use
47 function section_ordering_specified to check if section ordering is
48 needed.
49 * output.cc (Output_section::add_relaxed_input_section): Use
50 function section_ordering_specified to check if section ordering is
51 needed.
52 (Output_section::update_section_layout): New function.
53 (Output_section::sort_attached_input_sections): Check if input section
54 must be reordered.
55 * output.h (Output_section::update_section_layout): New function.
56 * plugin.cc (get_section_count): New function.
57 (get_section_type): New function.
58 (get_section_name): New function.
59 (get_section_contents): New function.
60 (update_section_order): New function.
61 (allow_section_ordering): New function.
62 (Plugin::load): Add the new interfaces to the transfer vector.
63 (Plugin_manager::load_plugins): New parameter.
64 (Plugin_manager::all_symbols_read): New parameter.
65 (Plugin_manager::claim_file): New parameter. Save the elf object for
66 unclaimed objects.
67 (Plugin_manager::get_elf_object): New function.
68 (Plugin_manager::get_view): Change to directly use the bool to check
69 if get_view is called from claim_file_hook.
70 * plugin.h (input_objects): New function
71 (Plugin__manager::load_plugins): New parameter.
72 (Plugin_manager::claim_file): New parameter.
73 (Plugin_manager::get_elf_object): New function.
74 (Plugin_manager::in_claim_file_handler): New function.
75 (Plugin_manager::in_claim_file_handler_): New member.
76 (layout): New function.
77 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
78 handler with an extra parameter. Make the elf object before calling
79 claim_file handler.
80 * testsuite/plugin_test.c (get_section_count): New function pointer.
81 (get_section_type): New function pointer.
82 (get_section_name): New function pointer.
83 (get_section_contents): New function pointer.
84 (update_section_order): New function pointer.
85 (allow_section_ordering): New function pointer.
86 (onload): Check if the new interfaces exist.
87
9446efde
ILT
882011-07-13 Ian Lance Taylor <iant@google.com>
89
90 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
91 relro section.
92 * x86_64.cc (Target_x86_64::got_section): Likewise.
93 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
94 (relro_now_test_SOURCES): New variable.
95 (relro_now_test_DEPENDENCIES): New variable.
96 (relro_now_test_LDFLAGS): New variable.
97 (relro_now_test_LDADD): New variable.
98 (relro_now_test.so): New target.
99 * testsuite/Makefile.in: Rebuild.
100
07aa62f2
ILT
1012011-07-12 Ian Lance Taylor <iant@google.com>
102
103 PR gold/12980
104 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
105 GLOB_DAT relocation rather than a RELATIVE relocation for a
106 protected symbol when creating a shared library.
107 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
108 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
109 * testsuite/protected_main_1.cc (main): Test that protected
110 function has same address.
111
e2153196
ILT
1122011-07-11 Ian Lance Taylor <iant@google.com>
113
114 PR gold/12979
115 * options.h (class General_options): Add -Bgroup.
116 * options.cc (General_options::finalize): If -Bgroup is set,
117 default to --unresolved-symbols=report-all.
118 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
119 * target-reloc.h (issue_undefined_symbol_error): Handle
120 --unresolved-symbols=report-all.
121
6daf5215
ILT
1222011-07-08 Ian Lance Taylor <iant@google.com>
123
124 PR gold/11985
125 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
126 if linker script discards key sections.
127 (Layout::create_dynamic_symtab): Likewise.
128 (Layout::assign_local_dynsym_offsets): Likewise.
129 (Layout::sized_create_version_sections): Likewise.
130 (Layout::create_interp): Likewise.
131 (Layout::finish_dynamic_section): Likewise.
132 (Layout::set_dynamic_symbol_size): Likewise.
133
beabb2c6
ILT
1342011-07-08 Ian Lance Taylor <iant@google.com>
135
136 PR gold/12386
137 * options.h (class General_options): Add --unresolved-symbols.
138 * target-reloc.h (issue_undefined_symbol_error): Check
139 --unresolved-symbols. Add comments.
140
9c16daf1
ILT
1412011-07-08 Ian Lance Taylor <iant@google.com>
142
143 * testsuite/odr_violation2.cc (Ordering::operator()): Make
144 expression more complex.
145
191f1a2d
ILT
1462011-07-08 Ian Lance Taylor <iant@google.com>
147
148 PR gold/11317
149 * target-reloc.h (issue_undefined_symbol_error): New inline
150 function, broken out of relocate_section.
151 (relocate_section): Call issue_undefined_symbol_error.
152 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
153 there is no TLS segment if we are about to issue an undefined
154 symbol error.
155 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
156
62855347
ILT
1572011-07-08 Ian Lance Taylor <iant@google.com>
158
159 PR gold/12279
160 * resolve.cc (Symbol_table::should_override): Add fromtype
161 parameter. Change all callers. Give error when linking together
162 TLS and non-TLS symbol.
163 (Symbol_table::should_override_with_special): Add fromtype
164 parameter. Change all callers.
165 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
166 there is no TLS segment if we have reported some errors.
167 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
168
67181c72
ILT
1692011-07-08 Ian Lance Taylor <iant@google.com>
170
171 PR gold/12372
172 * target.h (Target::plt_address_for_global): New function.
173 (Target::plt_address_for_local): New function.
174 (Target::plt_section_for_global): Remove.
175 (Target::plt_section_for_local): Remove.
176 (Target::do_plt_address_for_global): New virtual function.
177 (Target::do_plt_address_for_local): New virtual function.
178 (Target::do_plt_section_for_global): Remove.
179 (Target::do_plt_section_for_local): Remove.
180 (Target::register_global_plt_entry): Add Symbol_table and Layout
181 parameters.
182 * output.cc (Output_data_got::Got_entry::write): Use
183 plt_address_for_global and plt_address_for_local.
184 * layout.cc (Layout::add_target_dynamic_tags): Use size and
185 address of output section.
186 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
187 got_irelative_, and irelative_count_ fields. Update
188 declarations.
189 (Output_data_plt_i386::has_irelative_section): New function.
190 (Output_data_plt_i386::entry_count): Add irelative_count_.
191 (Output_data_plt_i386::set_final_data_size): Likewise.
192 (class Target_i386): Add got_irelative_ and rel_irelative_
193 fields. Update declarations.
194 (Target_i386::Target_i386): Initialize new fields.
195 (Target_i386::do_plt_address_for_global): New function replacing
196 do_plt_section_for_global.
197 (Target_i386::do_plt_address_for_local): New function replacing
198 do_plt_section_for_local.
199 (Target_i386::got_section): Create got_irelative_.
200 (Target_i386::rel_irelative_section): New function.
201 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
202 fields. Don't define __rel_iplt_{start,end}.
203 (Output_data_plt_i386::add_entry): Add symtab and layout
204 parameters. Change all callers. Use different PLT and GOT for
205 IFUNC symbols.
206 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
207 layout parameters. Change all callers. Use different PLT and
208 GOT.
209 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
210 (Output_data_plt_i386::rel_irelative): New function.
211 (Output_data_plt_i386::address_for_global): New function.
212 (Output_data_plt_i386::address_for_local): New function.
213 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
214 IRELATIVE GOT when changing IFUNC GOT entries.
215 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
216 reloc.
217 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
218 if we didn't create an IRELATIVE GOT.
219 (Target_i386::Relocate::relocate): Use plt_address_for_global and
220 plt_address_for_local.
221 (Target_i386::do_dynsym_value): Use plt_address_for_global.
222 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
223 got_irelative_, and irelative_count_ fields. Update
224 declarations.
225 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
226 Initialize new fields. Remove symtab parameter. Change all
227 callers.
228 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
229 irelative_count_.
230 (Output_data_plt_x86_64::has_irelative_section): New function.
231 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
232 (class Target_x86_64): Add got_irelative_ and rel_irelative_
233 fields. Update declarations.
234 (Target_x86_64::Target_x86_64): Initialize new fields.
235 (Target_x86_64::do_plt_address_for_global): New function replacing
236 do_plt_section_for_global.
237 (Target_x86_64::do_plt_address_for_local): New function replacing
238 do_plt_section_for_local.
239 (Target_x86_64::got_section): Create got_irelative_.
240 (Target_x86_64::rela_irelative_section): New function.
241 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
242 all callers. Don't create __rel_iplt_{start,end}.
243 (Output_data_plt_x86_64::add_entry): Add symtab and layout
244 parameters. Change all callers. Use different PLT and GOT for
245 IFUNC symbols.
246 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
247 layout parameters. Change all callers. Use different PLT and
248 GOT.
249 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
250 parameters. Change all callers. Use different PLT and GOT for
251 IFUNC symbols.
252 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
253 (Output_data_plt_x86_64::rela_irelative): New function.
254 (Output_data_plt_x86_64::address_for_global): New function.
255 (Output_data_plt_x86_64::address_for_local): New function.
256 (Output_data_plt_x86_64::set_final_data_size): Likewise.
257 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
258 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
259 (Target_x86_64::register_global_plt_entry): Add symtab and layout
260 parameters.
261 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
262 reloc.
263 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
264 symbols if we didn't create an IRELATIVE GOT.
265 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
266 plt_address_for_local.
267 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
268 * testsuite/ifuncvar1.c: New test file.
269 * testsuite/ifuncvar2.c: New test file.
270 * testsuite/ifuncvar3.c: New test file.
271 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
272 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
273 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
274 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
275 * testsuite/Makefile.in: Rebuild.
276
33c15b45
CC
2772011-07-07 Cary Coutant <ccoutant@google.com>
278
279 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
280 (two_file_test_1_ndebug.o): Likewise.
281 (two_file_test_1b_ndebug.o): Likewise.
282 (two_file_test_2_ndebug.o): Likewise.
283 (two_file_test_main_ndebug.o): Likewise.
284 (incremental_test_2): Link with no-debug versions.
285
f48b5fb7
CC
2862011-07-06 Cary Coutant <ccoutant@google.com>
287
288 * gold/incremental.cc
289 (Output_section_incremental_inputs::write_info_blocks): Check for
290 hidden and internal symbols.
291
221597a5
CC
2922011-07-06 Cary Coutant <ccoutant@google.com>
293
294 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
295 Check disposition for startup file.
296 (Incremental_inputs::report_command_line): Ignore
297 --incremental-startup-unchanged option.
298 * options.cc (General_options::parse_incremental_startup_unchanged):
299 New function.
300 (General_options::General_options): Initialize new data member.
301 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
302 (General_options): Add --incremental-startup-unchanged option.
303 (General_options::incremental_startup_disposition): New function.
304 (General_options::incremental_startup_disposition_): New data member.
305
e24719f6
CC
3062011-07-06 Cary Coutant <ccoutant@google.com>
307
308 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
309 input file index to Script_info ctor.
310 (Sized_incremental_binary::do_file_has_changed): Find the
311 command-line argument for files named in scripts.
312 * incremental.h (Script_info::Script_info): New ctor
313 with input file index.
314 (Script_info::input_file_index): New function.
315 (Script_info::input_file_index_): New data member.
316 (Incremental_binary::get_library): Add const.
317 (Incremental_binary::get_script_info): Add const.
318 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
319 * testsuite/Makefile.am (incremental_test_5): New test case.
320 (incremental_test_6): New test case.
321 * testsuite/Makefile.in: Regenerate.
322
8f7c81e8
CC
3232011-07-06 Cary Coutant <ccoutant@google.com>
324
325 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
326 debug output when command lines differ.
327
9fbd3822
CC
3282011-07-06 Cary Coutant <ccoutant@google.com>
329
330 * incremental.cc (Incremental_inputs::report_command_line): Ignore
331 --incremental-patch option.
332 * layout.cc (Free_list::allocate): Extend allocation beyond original
333 end if enabled.
334 (Layout::make_output_section): Mark sections that should get
335 patch space.
336 * options.cc (parse_percent): New function.
337 * options.h (parse_percent): New function.
338 (DEFINE_percent): New macro.
339 (General_options): Add --incremental-patch option.
340 * output.cc (Output_section::Output_section): Initialize new data
341 members.
342 (Output_section::add_input_section): Print section name when out
343 of patch space.
344 (Output_section::add_output_section_data): Likewise.
345 (Output_section::set_final_data_size): Add patch space when
346 doing --incremental-full.
347 (Output_section::do_reset_address_and_file_offset): Remove patch
348 space.
349 (Output_segment::set_section_list_addresses): Print debug output
350 only if --incremental-update.
351 * output.h (Output_section::set_is_patch_space_allowed): New function.
352 (Output_section::is_patch_space_allowed_): New data member.
353 (Output_section::patch_space_): New data member.
354 * parameters.cc (Parameters::incremental_full): New function.
355 * parameters.h (Parameters::incremental_full): New function
356 * testsuite/Makefile.am (incremental_test_2): Add test for
357 --incremental-patch option.
358 * testsuite/Makefile.in: Regenerate.
359 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
360 (t18): Remove function body.
361
f6cccc2c
DK
3622011-07-05 Doug Kwan <dougkwan@google.com>
363
364 PR gold/12771
365 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
366 Arm_Address type for relocation result.
367 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
368 overflow check.
369 (Arm_relocate_functions::abs32): Use unaligned access.
370 (Arm_relocate_functions::rel32): Ditto.
371 (Arm_relocate_functions::prel31): Ditto.
372 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
373 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
374 static data relocations.
375 * testsuite/Makefile.in: Regnerate.
376 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
377
28a13fec
ILT
3782011-07-05 Ian Lance Taylor <iant@google.com>
379
380 PR gold/12392
381 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
382 symbols if necessary.
383 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
384
24d47b34
ILT
3852011-07-05 Ian Lance Taylor <iant@google.com>
386
387 PR gold/12952
388 * resolve.cc (Symbol::override_base_with_special): Simply override
389 version with special symbol version, ignoring previous version.
390
41f9cbbe
ILT
3912011-07-05 Ian Lance Taylor <iant@google.com>
392
393 * object.cc (Sized_relobj_file::include_section_group): Add
394 information to comment about signature location.
395
886288f1
ILT
3962011-07-02 Ian Lance Taylor <iant@google.com>
397
398 PR gold/12957
399 * options.h (class General_options): Add -f and -F.
400 * options.cc (General_options::finalize): Fatal error if -f/-F
401 are used without -shared.
402 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
403
ae3a6d4f
ILT
4042011-07-02 Ian Lance Taylor <iant@google.com>
405
406 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
407
21131061
ILT
4082011-07-01 Ian Lance Taylor <iant@google.com>
409
410 PR gold/12525
411 PR gold/12952
412 * resolve.cc (Symbol::override_base_with_special): Don't override
413 the version if the overriding symbol has a different name.
414 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
415 all callers. If we give an error about an undefined version,
416 define the base version if necessary.
417 * dynobj.h (class Versions): Update declaration.
418 * testsuite/weak_alias_test_5.cc: New file.
419 * testsuite/weak_alias_test.script: New file.
420 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
421 and versioned_alias have the right value, and call t2.
422 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
423 weak_alias_test_5.so.
424 (weak_alias_test_LDADD): Likewise.
425 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
426 * testsuite/Makefile.in: Rebuild.
427
611062c0
ILT
4282011-07-01 Ian Lance Taylor <iant@google.com>
429
430 PR gold/12525
431 * options.h (class General_options): Support -z notext.
432 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
433 -Wl,-z,notext.
434 (two_file_shared_nonpic.so): Likewise.
435 (two_file_shared_mixed.so): Likewise.
436 (two_file_shared_mixed_1.so): Likewise.
437 (weak_undef_lib_nonpic.so): Likewise.
438 (alt/weak_undef_lib_nonpic.so): Likewise.
439 (tls_test_shared_nonpic.so): Likewise.
440 * testsuite/Makefile.in: Rebuild.
441
328c7c2f
ILT
4422011-07-01 Ian Lance Taylor <iant@google.com>
443
444 PR gold/12525
445 * configure.ac: Test whether static linking works, setting
446 the automake conditional HAVE_STATIC.
447 * testsuite/Makefile.am: Disable tests using -static if
448 HAVE_STATIC is not true.
449 * configure, testsuite/Makefile.in: Rebuild.
450
02d7cd44
ILT
4512011-07-01 Ian Lance Taylor <iant@google.com>
452
453 PR gold/12525
454 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
455 Assert if we see DW_EH_PE_indirect.
456 * target.h (Target::ehframe_datarel_base): New function.
457 (Target::do_ehframe_datarel_base): New target function.
458 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
459 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
460 function.
461
07a60597
ILT
4622011-07-01 Ian Lance Taylor <iant@google.com>
463
464 PR gold/12571
465 * options.h (class General_options): Add
466 --ld-generated-unwind-info.
467 * ehframe.cc (Fde::write): Add address parameter. Change all
468 callers. If associated with PLT, fill in address and size.
469 (Cie::set_output_offset): Only add merge mapping if there is an
470 object.
471 (Cie::write): Add address parameter. Change all callers.
472 (Eh_frame::add_ehframe_for_plt): New function.
473 * ehframe.h (class Fde): Update declarations. Move shndx_ and
474 input_offset_ fields into union u_, with new plt field.
475 (Fde::Fde): Adjust for new union field.
476 (Fde::Fde) [Output_data version]: New constructor.
477 (Fde::add_mapping): Only add merge mapping if there is an object.
478 (class Cie): Update declarations.
479 (class Eh_frame): Declare add_ehframe_for_plt.
480 * layout.cc (Layout::layout_eh_frame): Break out code into
481 make_eh_frame_section, and call it.
482 (Layout::make_eh_frame_section): New function.
483 (Layout::add_eh_frame_for_plt): New function.
484 * layout.h (class Layout): Update declarations.
485 * merge.cc (Merge_map::add_mapping): Add assertion.
486 * i386.cc: Include "dwarf.h".
487 (class Output_data_plt_i386): Make first_plt_entry,
488 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
489 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
490 and plt_eh_frame_fde.
491 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
492 boundary. Call add_eh_frame_for_plt if appropriate.
493 * x86_64.cc: Include "dwarf.h".
494 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
495 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
496 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
497 and plt_eh_frame_fde.
498 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
499 appropriate.
500
14788a3f
ILT
5012011-06-29 Ian Lance Taylor <iant@google.com>
502
503 PR gold/12629
504 * object.cc (Sized_relobj_file::layout_section): Change shdr
505 parameter to be const.
506 (Sized_relobj_file::layout_eh_frame_section): New function, broken
507 out of do_layout.
508 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
509 appropriate. Call layout_eh_frame_section.
510 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
511 sections.
512 * object.h (class Sized_relobj_file): Update declarations.
513
6c21fce1
ILT
5142011-06-29 Ian Lance Taylor <iant@google.com>
515
37e41b03 516 PR gold/12652
6c21fce1
ILT
517 * script.cc (Token::integer_value): Accept trailing M/m/K/k
518 modifier.
519 (Lex::gather_token): Accept trailing M/m/K/k for integers.
520
4d5e4e62
ILT
5212011-06-29 Ian Lance Taylor <iant@google.com>
522
523 PR gold/12675
524 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
525 SHT_X86_64_UNWIND.
526 * layout.cc (Layout::layout_eh_frame): Likewise.
527
886f533a
ILT
5282011-06-29 Ian Lance Taylor <iant@google.com>
529
530 PR gold/12695
531 * layout.cc (Layout::symtab_section_shndx): New function.
532 * layout.h (class Layout): Declare symtab_section_shndx.
533 * output.cc (Output_section::write_header): Call it.
534
f3ae1b28
ILT
5352011-06-29 Ian Lance Taylor <iant@google.com>
536
537 PR gold/12818
538 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
539 symbols which are not used in a relocation.
540
aecf301f
ILT
5412011-06-28 Ian Lance Taylor <iant@google.com>
542
543 PR gold/12898
544 * layout.cc (Layout::segment_precedes): Don't crash if a linker
545 script create indistinguishable segments.
546 (Layout::set_segment_offsets): Use stable_sort when sorting
547 segments. Pass this to Compare_segments constructor.
548 * layout.h (class Layout): Make segment_precedes non-static.
549 (class Compare_segments): Change from struct to class. Add
550 layout_ field. Add constructor.
551 * script-sections.cc
552 (Script_sections::attach_sections_using_phdrs_clause): Rename
553 local orphan to is_orphan. Don't report failure to put empty
554 section in segment. On attachment failure, report name of
555 section, and attach to first PT_LOAD segment.
556
03ef7571
ILT
5572011-06-28 Ian Lance Taylor <iant@google.com>
558
559 PR gold/12934
560 * target-select.cc (Target_selector::Target_selector): Add
561 emulation parameter. Change all callers.
562 (select_target_by_bfd_name): Rename from select_target_by_name.
563 Change all callers.
564 (select_target_by_emulation): New function.
565 (supported_emulation_names): New function.
566 * target-select.h (class Target_selector): Add emulation_ field.
567 Update declarations.
568 (Target_selector::recognize_by_bfd_name): Rename from
569 recognize_by_name. Change all callers.
570 (Target_selector::supported_bfd_names): Rename from
571 supported_names. Change all callers.
572 (Target_selector::recognize_by_emulation): New function.
573 (Target_selector::supported_emulations): New function.
574 (Target_selector::emulation): New function.
575 (Target_selector::do_recognize_by_bfd_name): Rename from
576 do_recognize_by_name. Change all callers.
577 (Target_selector::do_supported_bfd_names): Rename from
578 do_supported_names. Change all callers.
579 (Target_selector::do_recognize_by_emulation): New function.
580 (Target_selector::do_supported_emulations): New function.
581 (select_target_by_bfd_name): Change name in declaration.
582 (select_target_by_emulation): Declare.
583 (supported_emulation_names): Declare.
584 * parameters.cc (parameters_force_valid_target): Try to find
585 target based on emulation from -m option.
586 * options.h (class General_options): Change doc string for -m.
587 * options.cc (help): Print emulations.
588 (General_options::parse_V): Likewise.
589 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
590 Add emulation parameter. Change all callers.
591
200b2bb9
ILT
5922011-06-28 Ian Lance Taylor <iant@google.com>
593
594 * target.h (class Target): Add osabi_ field.
595 (Target::osabi): New function.
596 (Target::set_osabi): New function.
597 (Target::Target): Initialize osabi_.
598 (Target::do_adjust_elf_header): Make pure virtual.
599 (Sized_target::do_adjust_elf_header): Declare.
600 * target.cc (Sized_target::do_adjust_elf_header): New function.
601 (class Sized_target): Instantiate all versions.
602 * freebsd.h (class Target_freebsd): Remove.
603 (Target_selector_freebsd::do_recognize): Call set_osabi on
604 Target.
605 (Target_selector_freebsd::do_recognize_by_name): Likewise.
606 (Target_selector_freebsd::set_osabi): Remove.
607 * i386.cc (class Target_i386): Inherit from Sized_target rather
608 than Target_freebsd.
609 * x86_64.cc (class Target_x86_64): Likewise.
610
b3ce541e
ILT
6112011-06-28 Ian Lance Taylor <iant@google.com>
612
613 * target.h (Target::can_check_for_function_pointers): Rewrite.
614 Make non-virtual.
615 (Target::can_icf_inline_merge_sections): Likewise.
616 (Target::section_may_have_icf_unsafe_poineters): Likewise.
617 (Target::Target_info): Add can_icf_inline_merge_sections field.
618 (Target::do_can_check_for_function_pointers): New virtual
619 function.
620 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
621 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
622 from can_check_for_function_pointers, move in file.
623 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
624 section_may_have_icf_unsafe_poineters, move in file.
625 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
626 * i386.cc (Target_i386::do_can_check_for_function_pointers):
627 Rename from can_check_for_function_pointers, move in file.
628 (Target_i386::can_icf_inline_merge_sections): Remove.
629 (Target_i386::i386_info): Initialize
630 can_icf_inline_merge_sections.
631 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
632 Initialize can_icf_inline_merge_sections.
633 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
634 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
635 Rename from can_check_for_function_pointers, move in file.
636 (Target_x86_64::can_icf_inline_merge_sections): Remove.
637 (Target_x86_64::x86_64_info): Initialize
638 can_icf_inline_merge_sections.
639 * testsuite/testfile.cc (Target_test::test_target_info):
640 Likewise.
641 * icf.cc (get_section_contents): Correct formatting.
642
6d1c4efb
ILT
6432011-06-27 Ian Lance Taylor <iant@google.com>
644
645 * symtab.cc (Symbol::versioned_name): New function.
646 (Symbol_table::add_to_final_symtab): Use versioned_name when
647 appropriate.
648 (Symbol_table::sized_write_symbol): Likewise.
649 * symtab.h (class Symbol): Declare versioned_name.
650 * stringpool.h (class Stringpool_template): Add variant of add
651 which takes a std::basic_string.
652 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
653 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
654 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
655 (ver_test_12.o): New target.
656 * testsuite/Makefile.in: Rebuild.
657
57eb9b50
DK
6582011-06-27 Doug Kwan <dougkwan@google.com>
659
660 * arm.cc (Arm_relocate_functions::thm_jump8,
661 Arm_relocate_functions::thm_jump11): Use a wider signed
662 type to compute offset.
663 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
664 arm_thm_jump8.
665 * testsuite/Makefile.in: Regenerate.
666 * testsuite/arm_branch_in_range.sh: Check test results of
667 arm_thm_jump11 and arm_thm_jump8.
668 * testsuite/arm_thm_jump11.s: New test source file.
669 * testsuite/arm_thm_jump11.t: New linker script.
670 * testsuite/arm_thm_jump8.s: New test source file.
671 * testsuite/arm_thm_jump8.t: New linker script.
672
487b39df
ILT
6732011-06-24 Ian Lance Taylor <iant@google.com>
674
675 * layout.cc: Include "object.h".
676 (ctors_sections_in_init_array): New static variable.
677 (Layout::is_ctors_in_init_array): New function.
678 (Layout::layout): Add entry to ctors_sections_in_init_array if
679 appropriate.
680 * layout.h (class Layout): Declare is_ctors_in_init_array.
681 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
682 is_ctors_reverse_view is set.
683 (Sized_relobj_file::write_sections): Add layout parameter. Change
684 all callers. Set is_ctors_reverse_view field of View_size.
685 (Sized_relobj_file::reverse_words): New function.
686 * object.h (Sized_relobj_file::View_size): Add
687 is_ctors_reverse_view field.
688 (class Sized_relobj_file): Update declarations.
689 * testsuite/initpri3.c: New test.
690 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
691 initpri3b.
692 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
693 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
694 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
695 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
696 * testsuite/Makefile.in: Rebuild.
697
472076e4
CC
6982011-06-24 Cary Coutant <ccoutant@google.com>
699
700 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
701 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
702 (debug_msg_cdebug.err): New targets.
703 * testsuite/Makefile.in: Regenerate.
704 * testsuite/debug_msg.sh: Check output of link with compressed debug.
705 Fix checks for link with shared library.
706
a60af0db
DK
7072011-06-24 Doug Kwan <dougkwan@google.com>
708
709 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
710 skip empty text sections.
711 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
712
5393d741
ILT
7132011-06-22 Ian Lance Taylor <iant@google.com>
714
715 PR gold/12910
716 * options.h (class General_options): Add --ctors-in-init-array.
717 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
718 friends as SHT_PROGBITS for merging sections.
719 (Layout::layout): Remove special handling of .init_array and
720 friends. Don't sort if doing relocatable link. Sort for .ctors
721 and .dtors if ctors_in_init_array.
722 (Layout::make_output_section): Force correct section types for
723 .init_array and friends. Don't sort if doing relocatable link,
724 Don't sort .ctors and .dtors if ctors_in_init_array.
725 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
726 (Layout::output_section_name): Add relobj parameter. Change all
727 callers. Handle .ctors. and .dtors. in code rather than table.
728 Handle .ctors and .dtors if ctors_in_init_array.
729 (Layout::match_file_name): New function, moved from output.cc.
730 * layout.h (class Layout): Update declarations.
731 * output.cc: Include "layout.h".
732 (Input_section_sort_entry::get_priority): New function.
733 (Input_section_sort_entry::match_file_name): Just call
734 Layout::match_file_name.
735 (Output_section::Input_section_sort_init_fini_compare::operator()):
736 Handle .ctors and .dtors. Sort by explicit priority rather than
737 by name.
738 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
739 * testsuite/initpri2.c: New test.
740 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
741 (check_PROGRAMS): Add initpri2.
742 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
743 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
744 * configure, testsuite/Makefile.in: Rebuild.
745
e1f74f98
ILT
7462011-06-19 Ian Lance Taylor <iant@google.com>
747
748 PR gold/12880
749 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
750 .interp section to a PT_INTERP segment even if we have seen a
751 --dynamic-linker option. Don't do it if we have seen a PHDRS
752 clause in a linker script.
753 (Layout::finalize): Don't create a .interp section if we've
754 already create a PT_INTERP segment.
755 (Layout::create_interp): Always call choose_output_section (revert
756 patch of 2011-06-17). Don't create PT_INTERP segment.
757 * script-sections.cc
758 (Script_sections::create_note_and_tls_segments): Add a .interp
759 section to a PT_INTERP segment even if we have seen a
760 --dynamic-linker option.
761
766f91bb
ILT
7622011-06-18 Ian Lance Taylor <iant@google.com>
763
764 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
765 merely because a non-PT_LOAD segment has a dynamic reloc.
766
0d212c3a
ILT
7672011-06-18 Ian Lance Taylor <iant@google.com>
768
769 * layout.cc (Layout::finish_dynamic_section): Don't create
770 DT_FLAGS entry if not needed.
771
911a5072
ILT
7722011-06-18 Ian Lance Taylor <iant@google.com>
773
774 PR gold/12745
775 * layout.cc (Layout::layout_eh_frame): Correct handling of
776 writable .eh_frame section.
777
534b4e5f
ILT
7782011-06-17 Ian Lance Taylor <iant@google.com>
779
780 PR gold/12893
781 * resolve.cc (Symbol_table::resolve): Don't give an error if a
782 symbol is redefined with the exact same object and value.
783
10b4f102
ILT
7842011-06-17 Ian Lance Taylor <iant@google.com>
785
786 PR gold/12880
787 * layout.h (class Layout): Add interp_segment_ field.
788 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
789 (Layout::attach_allocated_section_to_segment): If making shared
790 library, put .interp section in PT_INTERP segment.
791 (Layout::finalize): Also call create_interp if -dynamic-linker
792 option was used.
793 (Layout::create_interp): Assert that there is no PT_INTERP
794 segment. If not using a SECTIONS clause, use make_output_section.
795 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
796 * script-sections.cc
797 (Script_sections::create_note_and_tls_segments): If making shared
798 library, put .interp section in PT_INTERP segment.
799
a29b0dad
ILT
8002011-06-17 Ian Lance Taylor <iant@google.com>
801
e588ea8d
ILT
802 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
803 when making a shared library.
804
8052011-06-17 Ian Lance Taylor <iant@google.com>
806
807 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
808 parameter. Change all callers. Don't issue warning about PC32
809 against locally defined symbol.
a29b0dad 810
9d3b0698
ILT
8112011-06-16 Ian Lance Taylor <iant@google.com>
812
813 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
814 occurs in same object.
815
85b0f90c
AM
8162011-06-14 Alan Modra <amodra@gmail.com>
817
818 * po/POTFILES.in: Regenerate.
819
a94907d9
ILT
8202011-06-09 Ian Lance Taylor <iant@google.com>
821
822 * script-sections.cc
823 (Orphan_output_section::set_section_addresses): For a relocatable
824 link set address to 0.
825
4fb3a1c3
CC
8262011-06-09 Cary Coutant <ccoutant@google.com>
827
828 PR gold/12804
829 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
830 used with --compress-debug-sections.
831 * gold/object.cc (Sized_relobj_file::do_layout): Report
832 uncompressed size of compressed input sections.
833
61220854
CC
8342011-06-08 Cary Coutant <ccoutant@google.com>
835
836 PR gold/12804
837 * testsuite/two_file_test_2_v1.cc: Change initialization of
838 v2 to keep it in .data.
839
e6455dfb
CC
8402011-06-07 Cary Coutant <ccoutant@google.com>
841
842 * common.cc (Symbol_table::do_allocate_commons_list): Call
843 gold_fallback.
844 * errors.cc (Errors::fatal): Adjust call to gold_exit.
845 (Errors::fallback): New function.
846 (gold_fallback): New function.
847 * errors.h (Errors::fallback): New function.
848 * gold.cc (gold_exit): Change status parameter to enum; adjust
849 all callers.
850 (queue_initial_tasks): Call gold_fallback.
851 * gold.h: Include cstdlib.
852 (Exit_status): New enum type.
853 (gold_exit): Change status parameter to enum.
854 (gold_fallback): New function.
855 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
856 (Layout::create_symtab_sections): Likewise.
857 (Layout::create_shdrs): Likewise.
858 * main.cc (main): Adjust call to gold_exit.
859 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
860 (Output_data_got::add_got_entry_pair): Likewise.
861 (Output_section::add_input_section): Likewise.
862 (Output_section::add_output_section_data): Likewise.
863 (Output_segment::set_section_list_addresses): Likewise.
864 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
865
fb0e076f
CC
8662011-06-07 Cary Coutant <ccoutant@google.com>
867
868 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
869 for incremental links.
870 * output.cc (Output_segment::set_section_list_addresses): Remove
871 FIXME and test for TLS or BSS.
872
a5ee4d5d
CC
8732011-06-07 Cary Coutant <ccoutant@google.com>
874
875 * testsuite/Makefile.am: Add incremental_copy_test,
876 incremental_common_test_1.
877 * testsuite/Makefile.in: Regenerate.
878 * testsuite/common_test_1_v1.c: New source file.
879 * testsuite/common_test_1_v2.c: New source file.
880 * testsuite/copy_test_v1.cc: New source file.
881
5146f448
CC
8822011-06-07 Cary Coutant <ccoutant@google.com>
883
884 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
885 update, allocate common from bss section's free list.
886 * incremental-dump.cc (dump_incremental_inputs): Print flag for
887 linker-defined symbols.
888 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
889 Skip GOT and PLT entries that are no longer referenced.
890 (Output_section_incremental_inputs::write_info_blocks): Mark
891 linker-defined symbols.
892 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
893 * output.cc (Output_section::allocate): New function.
894 * output.h (Output_section::allocate): New function.
895 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
896 linker-defined symbols.
897 (Symbol::override_base_with_special): Copy is_predefined_ flag.
898 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
899 (Symbol::init_base_output_data): Likewise.
900 (Symbol::init_base_output_segment): Likewise.
901 (Symbol::init_base_constant): Likewise.
902 (Sized_symbol::init_output_data): Likewise.
903 (Sized_symbol::init_output_segment): Likewise.
904 (Sized_symbol::init_constant): Likewise.
905 (Symbol_table::do_define_in_output_data): Likewise.
906 (Symbol_table::do_define_in_output_segment): Likewise.
907 (Symbol_table::do_define_as_constant): Likewise.
908 * symtab.h (Symbol::is_predefined): New function.
909 (Symbol::init_base_output_data): Add is_predefined parameter.
910 (Symbol::init_base_output_segment): Likewise.
911 (Symbol::init_base_constant): Likewise.
912 (Symbol::is_predefined_): New data member.
913 (Sized_symbol::init_output_data): Add is_predefined parameter.
914 (Sized_symbol::init_output_segment): Likewise.
915 (Sized_symbol::init_constant): Likewise.
916 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
917
26d3c67d
CC
9182011-06-07 Cary Coutant <ccoutant@google.com>
919
920 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
921 instead of emit_copy_reloc.
922 (Copy_relocs::emit_copy_reloc): Refactor.
923 (Copy_relocs::make_copy_reloc): New function.
924 (Copy_relocs::add_copy_reloc): Remove.
925 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
926 section.
927 (Copy_relocs::make_copy_reloc): New function.
928 (Copy_relocs::add_copy_reloc): Remove.
929 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
930 unchanged input files.
931 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
932 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
933 Reserve BSS space for COPY relocations.
934 (Sized_incremental_binary::do_emit_copy_relocs): New function.
935 (Output_section_incremental_inputs::write_info_blocks): Record
936 whether a symbol is copied from a shared object.
937 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
938 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
939 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
940 (Incremental_input_entry_reader::get_output_symbol_index): Add
941 is_copy parameter.
942 (Incremental_binary::emit_copy_relocs): New function.
943 (Incremental_binary::do_emit_copy_relocs): New function.
944 (Sized_incremental_binary::Sized_incremental_binary): Initialize
945 new data member.
946 (Sized_incremental_binary::add_copy_reloc): New function.
947 (Sized_incremental_binary::do_emit_copy_relocs): New function.
948 (Sized_incremental_binary::Copy_reloc): New struct.
949 (Sized_incremental_binary::Copy_relocs): New typedef.
950 (Sized_incremental_binary::copy_relocs_): New data member.
951 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
952 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
953 * target.h (Sized_target::emit_copy_reloc): New function.
954 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
955
7cdb37d9
CC
9562011-06-02 Cary Coutant <ccoutant@google.com>
957
958 PR gold/12163
959 * gold/archive.cc (Archive::Archive): Initialize new data member.
960 (Archive::include_all_members): Return if archive has already been
961 included.
962 * gold/archive.h (Archive::include_all_members_): New data member.
963
cc643b88
NC
9642011-06-02 Nick Clifton <nickc@redhat.com>
965
966 * dynobj.h: Fix spelling mistake in comment.
967 * output.cc: Likewise.
968
f62a3ca7
DK
9692011-05-31 Doug Kwan <dougkwan@google.com>
970 Asier Llano
971
972 PR gold/12826
cc643b88 973 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
974 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
975 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
976 redundant arm_exidx_test.so.
977 * testsuite/Makefile.in: Regenerate.
978 (check_SCRIPTS): Add pr12826.sh
979 (check_DATA): Add pr12826.stdout
980 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
981 * testsuite/pr12826.sh: New file.
982 * testsuite/pr12826_1.s: Ditto.
983 * testsuite/pr12826_1.s: Ditto.
984
8dbe1edc
ILT
9852011-05-30 Ian Lance Taylor <iant@google.com>
986
987 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
988 sections.
989
c49875be
ILT
9902011-05-29 Ian Lance Taylor <iant@google.com>
991
992 PR gold/12804
993 * testsuite/Makefile.am: Use different file name for two_file_test
994 temporary file for each incremental test.
995 * testsuite/Makefile.in: Rebuild.
996
69d53f7a
ILT
9972011-05-29 Ian Lance Taylor <iant@google.com>
998
999 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1000 binary input file is empty.
1001
41d0ab5f
ILT
10022011-05-27 Ian Lance Taylor <iant@google.com>
1003
1004 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1005 (ver_test_9.so): Likewise.
1006 * testsuite/Makefile.in: Rebuild.
1007
89d8a36b
CC
10082011-05-26 Cary Coutant <ccoutant@google.com>
1009
1010 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1011 * incremental.cc (Incremental_inputs::report_input_section): Fix
1012 comment, indentation.
1013 (Incremental_inputs::report_comdat_group): New function.
1014 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1015 of data for incremental input file entry.
1016 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1017 group count, COMDAT group signatures.
1018 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1019 an unchanged input file.
1020 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1021 Initialize new data member.
1022 (Incremental_object_entry::add_comdat_group): New function.
1023 (Incremental_object_entry::get_comdat_group_count): New function.
1024 (Incremental_object_entry::get_comdat_signature_key): New function.
1025 (Incremental_object_entry::groups_): New data member.
1026 (Incremental_inputs::report_comdat_group): New function.
1027 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1028 data for incremental input file entry.
1029 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1030 (Incremental_input_entry_reader::get_input_section): Adjust size of
1031 data for incremental input file entry.
1032 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1033 (Incremental_input_entry_reader::get_comdat_group_signature): New
1034 function.
1035 * object.cc (Sized_relobj::include_section_group): Report kept
1036 COMDAT groups for incremental links.
1037
1706a06f
ILT
10382011-05-24 David Meyer <pdox@google.com>
1039
1040 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1041 with name parameter. Add found_name parameter.
1042 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1043 * dirsearch.h (class Dirsearch): Update declaration.
1044
a10ae760
ILT
10452011-05-24 Ian Lance Taylor <iant@google.com>
1046
1047 * archive.cc (Library_base::should_include_member): Pull in object
1048 from archive if it defines the entry symbol.
1049 * parameters.cc (Parameters::entry): New function.
1050 * parameters.h (class Parameters): Declare entry.
1051 * output.h (class Output_file_header): Remove entry_ field.
1052 * output.cc (Output_file_header::Output_file_header): Remove entry
1053 parameter. Change all callers.
1054 (Output_file_header::entry): Use parameters->entry.
1055 * gold.cc (queue_middle_tasks): Likewise.
1056 * plugin.cc (Plugin_hook::run): Likewise.
1057
aa92d6ed
CC
10582011-05-24 Cary Coutant <ccoutant@google.com>
1059
1060 * gold.cc (queue_initial_tasks): Pass incremental base filename
1061 to Output_file::open_base_file; don't print error message.
1062 * incremental-dump.cc (main): Adjust call to
1063 Output_file::open_for_modification.
1064 * incremental-dump.cc (main): Likewise.
1065 * incremental.cc (Incremental_inputs::report_command_line):
1066 Ignore --incremental-base option when comparing command lines.
1067 Ignore parameter when given as separate argument.
1068 * options.h (class General_options): Add --incremental-base.
1069 * output.cc (Output_file::Output_file):
1070 (Output_file::open_base_file): Add base_name and writable parameters;
1071 read base file into new file; print error message here.
1072 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1073 callers.
1074 * output.h (Output_file::open_for_modification): Rename to...
1075 (Output_file::open_base_file): ...this; add base_name and
1076 writable parameters; adjust all callers.
1077 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1078 callers.
1079 * testsuite/Makefile.am (incremental_test_4): Test
1080 --incremental-base.
1081 * testsuite/Makefile.in: Regenerate.
1082
2eedd706
CC
10832011-05-24 Cary Coutant <ccoutant@google.com>
1084
1085 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1086 incremental_test_4.
1087 * testsuite/Makefile.in: Regenerate.
1088 * testsuite/two_file_test_1_v1.cc: New test source file.
1089 * testsuite/two_file_test_1b_v1.cc: New test source file.
1090 * testsuite/two_file_test_2_v1.cc: New test source file.
1091
0f1c85a6
CC
10922011-05-24 Cary Coutant <ccoutant@google.com>
1093
1094 * dynobj.h (Dynobj::do_dynobj): New function.
1095 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1096 flag and soname for shared objects.
1097 * incremental.cc (Incremental_inputs::report_object): Make
1098 either Incremental_object_entry or Incremental_dynobj_entry; add
1099 soname to string table.
1100 (Incremental_inputs::report_input_section): Add assertion.
1101 (Output_section_incremental_inputs::set_final_data_size): Adjust
1102 type of input file entry for shared libraries; adjust size of
1103 shared library info entry.
1104 (Output_section_incremental_inputs::write_input_files): Write
1105 as_needed flag for shared libraries.
1106 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1107 of input file entry for shared libraries; write soname.
1108 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1109 soname from incremental info.
1110 * incremental.h (enum Incremental_input_flags): Add
1111 INCREMENTAL_INPUT_AS_NEEDED.
1112 (Incremental_input_entry::Incremental_input_entry): Initialize new
1113 data member.
1114 (Incremental_input_entry::set_as_needed): New function.
1115 (Incremental_input_entry::as_needed): New function.
1116 (Incremental_input_entry::do_dynobj_entry): New function.
1117 (Incremental_input_entry::as_needed_): New data member.
1118 (Incremental_object_entry::Incremental_object_entry): Don't check
1119 for shared library.
1120 (Incremental_object_entry::do_type): Likewise.
1121 (class Incremental_dynobj_entry): New class.
1122 (Incremental_input_entry_reader::as_needed): New function.
1123 (Incremental_input_entry_reader::get_soname): New function.
1124 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1125 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1126 size of shared library info entry.
1127 * layout.cc (Layout::finish_dynamic_section): Don't test for
1128 incremental link when adding DT_NEEDED entries.
1129 * object.h (Object::Object): Initialize new data member.
1130 (Object::dynobj): New function.
1131 (Object::set_as_needed): New function.
1132 (Object::as_needed): New function.
1133 (Object::do_dynobj): New function.
1134 (Object::as_needed_): New data member.
1135
6fa2a40b
CC
11362011-05-24 Cary Coutant <ccoutant@google.com>
1137
1138 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1139 info; adjust display of GOT entries.
1140 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1141 vector of input objects; remove file_status_.
1142 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1143 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1144 got_plt reader; call target hooks to reserve GOT entries.
1145 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1146 of input file info header and GOT info entry.
1147 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1148 relocation info.
1149 (Got_plt_view_info::got_descriptor): Remove.
1150 (Got_plt_view_info::sym_index): New data member.
1151 (Got_plt_view_info::input_index): New data member.
1152 (Local_got_offset_visitor::visit): Write input file index.
1153 (Global_got_offset_visitor::visit): Write 0 for input file index.
1154 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1155 with sym_index and input_index.
1156 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1157 incremental info GOT entry; replace got_descriptor with input_index.
1158 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1159 map from input file index to object.
1160 (Sized_relobj_incr::do_layout): Replace direct data member reference
1161 with accessor function.
1162 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1163 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1164 Adjust size of input file info header.
1165 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1166 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1167 (Incremental_input_entry_reader::get_input_section): Adjust size of
1168 input file info header.
1169 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1170 of incremental info GOT entry.
1171 (Incremental_got_plt_reader::get_got_desc): Remove.
1172 (Incremental_got_plt_reader::get_got_symndx): New function.
1173 (Incremental_got_plt_reader::get_got_input_index): New function.
1174 (Sized_incremental_binary::Sized_incremental_binary): Remove
1175 file_status_; add input_objects_.
1176 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1177 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1178 (Sized_incremental_binary::file_is_unchanged): Remove.
1179 (Sized_incremental_binary::set_input_object): New function.
1180 (Sized_incremental_binary::input_object): New function.
1181 (Sized_incremental_binary::file_status_): Remove.
1182 (Sized_incremental_binary::input_objects_): New data member.
1183 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1184 references.
1185 (Sized_relobj_incr::invalid_address): Move to base class.
1186 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1187 class.
1188 (Sized_relobj_incr::do_output_section_offset): Likewise.
1189 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1190 (Sized_relobj_incr::section_offsets_): Likewise.
1191 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1192 function.
1193 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1194 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1195 with accessor function.
1196 (Sized_relobj_file::do_layout): Likewise.
1197 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1198 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1199 (Sized_relobj_file::compute_final_local_value): Replace refs to
1200 section_offsets_ with accessor function.
1201 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1202 * object.h (Relobj::Relobj): Initialize new data members.
1203 (Relobj::add_dyn_reloc): New function.
1204 (Relobj::first_dyn_reloc): New function.
1205 (Relobj::dyn_reloc_count): New function.
1206 (Relobj::first_dyn_reloc_): New data member.
1207 (Relobj::dyn_reloc_count_): New data member.
1208 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1209 references.
1210 (Sized_relobj::Address): New typedef.
1211 (Sized_relobj::invalid_address): Move here from child class.
1212 (Sized_relobj::Sized_relobj): Initialize new data members.
1213 (Sized_relobj::sized_relobj): New function.
1214 (Sized_relobj::is_output_section_offset_invalid): Move here from
1215 child class.
1216 (Sized_relobj::get_output_section_offset): Likewise.
1217 (Sized_relobj::local_has_got_offset): Likewise.
1218 (Sized_relobj::local_got_offset): Likewise.
1219 (Sized_relobj::set_local_got_offset): Likewise.
1220 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1221 (Sized_relobj::clear_got_offsets): New function.
1222 (Sized_relobj::section_offsets): Move here from child class.
1223 (Sized_relobj::do_output_section_offset): Likewise.
1224 (Sized_relobj::do_set_section_offset): Likewise.
1225 (Sized_relobj::Local_got_offsets): Likewise.
1226 (Sized_relobj::local_got_offsets_): Likewise.
1227 (Sized_relobj::section_offsets_): Likewise.
1228 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1229 references.
1230 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1231 class.
1232 (Sized_relobj_file::sized_relobj): New function
1233 (Sized_relobj_file::local_has_got_offset): Move to base class.
1234 (Sized_relobj_file::local_got_offset): Likewise.
1235 (Sized_relobj_file::set_local_got_offset): Likewise.
1236 (Sized_relobj_file::get_output_section_offset): Likewise.
1237 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1238 (Sized_relobj_file::do_output_section_offset): Likewise.
1239 (Sized_relobj_file::do_set_section_offset): Likewise.
1240 (Sized_relobj_file::Local_got_offsets): Likewise.
1241 (Sized_relobj_file::local_got_offsets_): Likewise.
1242 (Sized_relobj_file::section_offsets_): Likewise.
1243 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1244 (all constructors).
1245 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1246 (Output_reloc::get_symbol_index): Likewise.
1247 (Output_reloc::local_section_offset): Likewise.
1248 (Output_reloc::get_address): Likewise.
1249 (Output_reloc::symbol_value): Likewise.
1250 (Output_data_got::reserve_slot): Move to class definition.
1251 (Output_data_got::reserve_local): New function.
1252 (Output_data_got::reserve_slot_for_global): Remove.
1253 (Output_data_got::reserve_global): New function.
1254 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1255 (all constructors, two instantiations).
1256 (Output_reloc::get_relobj): New function (two instantiations).
1257 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1258 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1259 (Output_data_reloc::add_global): Adjust type of relobj.
1260 (Output_data_reloc::add_global_relative): Likewise.
1261 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1262 (Output_data_reloc::add_local): Likewise.
1263 (Output_data_reloc::add_local_relative): Likewise.
1264 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1265 (Output_data_reloc::add_local_section): Likewise.
1266 (Output_data_reloc::add_output_section): Likewise.
1267 (Output_data_reloc::add_absolute): Likewise.
1268 (Output_data_reloc::add_target_specific): Likewise.
1269 (Output_data_got::reserve_slot): Move definition here.
1270 (Output_data_got::reserve_local): New function.
1271 (Output_data_got::reserve_global): New function.
1272 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1273 section_offsets_ with accessor function.
1274 (Sized_relobj_file::write_sections): Likewise.
1275 (Sized_relobj_file::do_relocate_sections): Likewise.
1276 * target.h (Sized_target::reserve_local_got_entry): New function.
1277 (Sized_target::reserve_global_got_entry): New function.
1278 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1279 (Target_x86_64::reserve_global_got_entry): New function.
1280 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1281
4829d394
CC
12822011-05-23 Cary Coutant <ccoutant@google.com>
1283
1284 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1285 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1286 bit when checking got_type.
1287 * incremental.cc (Sized_incremental_binary::setup_readers):
1288 Store symbol table and string table locations; initialize bit vector
1289 of file status flags.
1290 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1291 unchanged files.
1292 (Sized_incremental_binary::do_process_got_plt): New function.
1293 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1294 (Output_section_incremental_inputs::set_final_data_size): Record
1295 file index for each input file.
1296 (Output_section_incremental_inputs::write_got_plt): Store file index
1297 instead of input entry offset for each GOT entry.
1298 * incremental.h
1299 (Incremental_input_entry::Incremental_input_entry): Initialize new
1300 data member.
1301 (Incremental_input_entry::set_offset): Store file index.
1302 (Incremental_input_entry::get_file_index): New function.
1303 (Incremental_input_entry::file_index_): New data member.
1304 (Incremental_binary::process_got_plt): New function.
1305 (Incremental_binary::do_process_got_plt): New function.
1306 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1307 data members.
1308 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1309 (Sized_incremental_binary::set_file_is_unchanged): New function.
1310 (Sized_incremental_binary::file_is_unchanged): New function.
1311 (Sized_incremental_binary::do_process_got_plt): New function.
1312 (Sized_incremental_binary::file_status_): New data member.
1313 (Sized_incremental_binary::main_symtab_loc_): New data member.
1314 (Sized_incremental_binary::main_strtab_loc_): New data member.
1315 * output.cc (Output_data_got::Got_entry::write): Add case
1316 RESERVED_CODE.
1317 (Output_data_got::add_global): Call add_got_entry.
1318 (Output_data_got::add_global_plt): Likewise.
1319 (Output_data_got::add_global_with_rel): Likewise.
1320 (Output_data_got::add_global_with_rela): Likewise.
1321 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1322 (Output_data_got::add_global_pair_with_rela): Likewise.
1323 (Output_data_got::add_local): Call add_got_entry.
1324 (Output_data_got::add_local_plt): Likewise.
1325 (Output_data_got::add_local_with_rel): Likewise.
1326 (Output_data_got::add_local_with_rela): Likewise.
1327 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1328 (Output_data_got::add_local_pair_with_rela): Likewise.
1329 (Output_data_got::reserve_slot): New function.
1330 (Output_data_got::reserve_slot_for_global): New function.
1331 (Output_data_got::add_got_entry): New function.
1332 (Output_data_got::add_got_entry_pair): New function.
1333 (Output_section::add_output_section_data): Edit FIXME.
1334 * output.h
1335 (Output_section_data_build::Output_section_data_build): New
1336 constructor with size parameter.
1337 (Output_data_space::Output_data_space): Likewise.
1338 (Output_data_got::Output_data_got): Initialize new data member; new
1339 constructor with size parameter.
1340 (Output_data_got::add_constant): Call add_got_entry.
1341 (Output_data_got::reserve_slot): New function.
1342 (Output_data_got::reserve_slot_for_global): New function.
1343 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1344 (Output_data_got::add_got_entry): New function.
1345 (Output_data_got::add_got_entry_pair): New function.
1346 (Output_data_got::free_list_): New data member.
1347 * target.h (Sized_target::init_got_plt_for_update): New function.
1348 (Sized_target::register_global_plt_entry): New function.
1349 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1350 Initialize new data member; call init; add constructor with PLT count.
1351 (Output_data_plt_x86_64::init): New function.
1352 (Output_data_plt_x86_64::add_relocation): New function.
1353 (Output_data_plt_x86_64::reserve_slot): New function.
1354 (Output_data_plt_x86_64::free_list_): New data member.
1355 (Target_x86_64::init_got_plt_for_update): New function.
1356 (Target_x86_64::register_global_plt_entry): New function.
1357 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1358 incremental updates.
1359 (Output_data_plt_x86_64::add_relocation): New function.
1360 * testsuite/object_unittest.cc (Object_test): Set default options.
1361
ec69d6da
ILT
13622011-05-16 Ian Lance Taylor <iant@google.com>
1363
1364 * options.h (class General_options): Make -i a synonym for -r.
1365
732e31de
ILT
13662011-05-16 Ian Lance Taylor <iant@google.com>
1367
1368 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1369
403676b5
CC
13702011-05-10 Cary Coutant <ccoutant@google.com>
1371
1372 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1373 strip_all (-s).
1374
5b7b7d6e
ILT
13752011-05-06 Ian Lance Taylor <iant@google.com>
1376
1377 * layout.cc (Layout::layout): If the output section flags change,
1378 update the ordering.
1379
f0f9babf
CC
13802011-04-25 Cary Coutant <ccoutant@google.com>
1381
1382 * incremental-dump.cc (dump_incremental_inputs): Print local
1383 symbol info for each input file.
1384 * incremental.cc
1385 (Output_section_incremental_inputs::set_final_data_size): Add local
1386 symbol info to input file entries in incremental info.
1387 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1388 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1389 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1390 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1391 implementation.
1392 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1393 (Sized_incr_relobj::do_relocate): Write the local symbols.
1394 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1395 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1396 Adjust size of input file header.
1397 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1398 (Incremental_inputs_reader::get_local_symbol_count): New function.
1399 (Incremental_inputs_reader::get_input_section): Adjust size of input
1400 file header.
1401 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1402 (Sized_incr_relobj::This): New typedef.
1403 (Sized_incr_relobj::sym_size): New const data member.
1404 (Sized_incr_relobj::Local_symbol): New struct.
1405 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1406 (Sized_incr_relobj::do_local_symbol_offset): New function.
1407 (Sized_incr_relobj::local_symbol_count_): New data member.
1408 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1409 (Sized_incr_relobj::local_symbol_index_): New data member.
1410 (Sized_incr_relobj::local_symbol_offset_): New data member.
1411 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1412 (Sized_incr_relobj::local_symbols_): New data member.
1413 * object.h (Relobj::output_local_symbol_count): New function.
1414 (Relobj::local_symbol_offset): New function.
1415 (Relobj::do_output_local_symbol_count): New function.
1416 (Relobj::do_local_symbol_offset): New function.
1417 (Sized_relobj::do_output_local_symbol_count): New function.
1418 (Sized_relobj::do_local_symbol_offset): New function.
1419
d0a9ace3
ILT
14202011-04-22 Vladimir Simonov <sv@sw.ru>
1421
1422 * descriptors.cc (set_close_on_exec): New function.
1423 (Descriptors::open): Use set_close_on_exec.
1424 * output.cc (S_ISLNK): Define if not defined.
1425
94a3fc8b
CC
14262011-04-22 Cary Coutant <ccoutant@google.com>
1427
1428 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1429 global symbol map.
1430 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1431 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1432 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1433 relocations.
1434 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1435 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1436 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1437 * incremental.h
1438 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1439 function.
1440 (Incremental_binary::apply_incremental_relocs): New function.
1441 (Incremental_binary::do_apply_incremental_relocs): New function.
1442 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1443 data member.
1444 (Sized_incremental_binary::add_global_symbol): New function.
1445 (Sized_incremental_binary::global_symbol): New function.
1446 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1447 (Sized_incremental_binary::symbol_map_): New data member.
1448 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1449 * target.h (Sized_target::apply_relocation): New function.
1450 * target-reloc.h (apply_relocation): New function.
1451 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1452
c87e4302
DK
14532011-04-22 Doug Kwan <dougkwan@google.com>
1454
1455 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1456 flag of a SHT_ARM_EXIDX section.
1457 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1458 * testsuite/Makefile.in: Regenerate.
1459 * testsuite/arm_exidx_test.s: New file.
1460 * testsuite/arm_exidx_test.sh: Same.
1461
e7782cf6
CC
14622011-04-20 Cary Coutant <ccoutant@google.com>
1463
1464 PR gold/12689
1465 * archive.h (Incremental_archive_entry::Archive_member):
1466 Initialize arg_serial_ (second constructor).
1467
308ecdc7
ILT
14682011-04-17 Ian Lance Taylor <iant@google.com>
1469
1470 * object.cc (Relocate_info::location): Simplify location string.
1471 * errors.cc (Errors::error_at_location): Don't print program
1472 name.
1473 (Errors::warning_at_location): Likewise.
1474 (Errors::undefined_symbol): Likewise.
1475 * testsuite/debug_msg.sh: Update accordingly.
1476
bec5b579
CC
14772011-04-14 Cary Coutant <ccoutant@google.com>
1478
1479 * gold/layout.cc (Layout::symtab_section_offset): New function.
1480 * gold/layout.h (Layout::symtab_section_offset): New function.
1481 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1482
88597d34
ILT
14832011-04-12 Ian Lance Taylor <iant@google.com>
1484
1485 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1486 with MREMAP_MAYMOVE.
1487 * output.h (class Output_file): Add map_is_allocated_ field.
1488 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1489 not available, provide stubs. If mremap is not available, #define
1490 it to gold_mremap.
1491 (MREMAP_MAYMOVE): Define if not defined.
1492 (Output_file::Output_file): Initialize map_is_allocated_.
1493 (Output_file::resize): Check map_is_allocated_.
1494 (Output_file::map_anonymous): If mmap fails, use malloc.
1495 (Output_file::unmap): Don't do anything for an anonymous map.
1496 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1497 is not available, provide stubs.
1498 (File_read::View::~View): Use free rather than delete[].
1499 (File_read::make_view): Use malloc rather than new[]. If mmap
1500 fails, use malloc.
1501 (File_read::find_or_make_view): Use malloc rather than new[].
1502 * gold.h: Remove HAVE_REMAP code.
1503 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1504 exists. Rename mremap to gold_mremap. If mmap is not available
1505 don't do anything.
1506 * configure, config.in: Rebuild.
1507
11e361bc
ILT
15082011-04-11 Ian Lance Taylor <iant@google.com>
1509
1510 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1511 initialize local variable v.
1512
cdc29364
CC
15132011-04-11 Cary Coutant <ccoutant@google.com>
1514
1515 * archive.cc (Archive::include_member): Adjust call to
1516 report_object.
1517 (Add_archive_symbols::run): Track argument serial numbers.
1518 (Lib_group::include_member): Likewise.
1519 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1520 * archive.h (Incremental_archive_entry::Archive_member):
1521 Initialize arg_serial_.
1522 (Archive_member::arg_serial_): New data member.
1523 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1524 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1525 incremental link.
1526 (Sized_dynobj::do_for_all_local_got_entries): New function.
1527 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1528 function.
1529 * fileread.cc (get_mtime): New function.
1530 * fileread.h (get_mtime): New function.
1531 * gold.cc (queue_initial_tasks): Check for incremental update.
1532 (process_incremental_input): New function.
1533 (queue_middle_tasks): Don't force valid target for incremental
1534 update.
1535 * incremental-dump.cc (find_input_containing_global): Adjust
1536 size of symbol info entry.
1537 (dump_incremental_inputs): Dump argument serial number and
1538 in_system_directory flag; bias shndx by 1; print symbol names
1539 when dumping per-file symbol lists; use new symbol info readers.
1540 * incremental.cc
1541 (Output_section_incremental_inputs:update_data_size): New function.
1542 (Sized_incremental_binary::setup_readers): Setup input readers
1543 for each input file; build maps for files added from libraries
1544 and scripts.
1545 (Sized_incremental_binary::check_input_args): New function.
1546 (Sized_incremental_binary::do_check_inputs): Build map of argument
1547 serial numbers to input arguments.
1548 (Sized_incremental_binary::do_file_has_changed): Rename
1549 do_file_is_unchanged to this; compare file modification times.
1550 (Sized_incremental_binary::do_init_layout): New function.
1551 (Sized_incremental_binary::do_reserve_layout): New function.
1552 (Sized_incremental_binary::do_get_input_reader): Remove.
1553 (Sized_incremental_binary::get_symtab_view): New function.
1554 (Incremental_checker::can_incrementally_link_output_file): Remove.
1555 (Incremental_inputs::report_command_line): Exclude --debug options.
1556 (Incremental_inputs::report_archive_begin): Add parameter; track
1557 argument serial numbers; don't put input file entry for archive
1558 before archive members.
1559 (Incremental_inputs::report_archive_end): Put input file entry
1560 for archive after archive members.
1561 (Incremental_inputs::report_object): Add parameter; track argument
1562 serial numbers and in_system_directory flag.
1563 (Incremental_inputs::report_script): Add parameter; track argument
1564 serial numbers.
1565 (Output_section_incremental_inputs::set_final_data_size): Adjust
1566 size of symbol info entry; check for forwarding symbols.
1567 (Output_section_incremental_inputs::write_input_files): Write
1568 in_system_directory flag and argument serial number.
1569 (Output_section_incremental_inputs::write_info_blocks): Map section
1570 indices between incremental info and original input file; store
1571 input section index for each symbol.
1572 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1573 change operator() to visit().
1574 (class Global_got_offset_visitor): Likewise.
1575 (class Global_symbol_visitor_got_plt):
1576 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1577 classes.
1578 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1579 (Sized_incr_relobj::do_read_symbols): New function.
1580 (Sized_incr_relobj::do_layout): New function.
1581 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1582 (Sized_incr_relobj::do_add_symbols): New function.
1583 (Sized_incr_relobj::do_should_include_member): New function.
1584 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1585 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1586 (Sized_incr_relobj::do_section_size): New function.
1587 (Sized_incr_relobj::do_section_name): New function.
1588 (Sized_incr_relobj::do_section_contents): New function.
1589 (Sized_incr_relobj::do_section_flags): New function.
1590 (Sized_incr_relobj::do_section_entsize): New function.
1591 (Sized_incr_relobj::do_section_address): New function.
1592 (Sized_incr_relobj::do_section_type): New function.
1593 (Sized_incr_relobj::do_section_link): New function.
1594 (Sized_incr_relobj::do_section_info): New function.
1595 (Sized_incr_relobj::do_section_addralign): New function.
1596 (Sized_incr_relobj::do_initialize_xindex): New function.
1597 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1598 (Sized_incr_relobj::do_read_relocs): New function.
1599 (Sized_incr_relobj::do_gc_process_relocs): New function.
1600 (Sized_incr_relobj::do_scan_relocs): New function.
1601 (Sized_incr_relobj::do_count_local_symbols): New function.
1602 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1603 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1604 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1605 (Sized_incr_relobj::do_relocate): New function.
1606 (Sized_incr_relobj::do_set_section_offset): New function.
1607 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1608 (Sized_incr_dynobj::do_read_symbols): New function.
1609 (Sized_incr_dynobj::do_layout): New function.
1610 (Sized_incr_dynobj::do_add_symbols): New function.
1611 (Sized_incr_dynobj::do_should_include_member): New function.
1612 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1613 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1614 (Sized_incr_dynobj::do_section_size): New function.
1615 (Sized_incr_dynobj::do_section_name): New function.
1616 (Sized_incr_dynobj::do_section_contents): New function.
1617 (Sized_incr_dynobj::do_section_flags): New function.
1618 (Sized_incr_dynobj::do_section_entsize): New function.
1619 (Sized_incr_dynobj::do_section_address): New function.
1620 (Sized_incr_dynobj::do_section_type): New function.
1621 (Sized_incr_dynobj::do_section_link): New function.
1622 (Sized_incr_dynobj::do_section_info): New function.
1623 (Sized_incr_dynobj::do_section_addralign): New function.
1624 (Sized_incr_dynobj::do_initialize_xindex): New function.
1625 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1626 (make_sized_incremental_object): New function.
1627 (Incremental_library::copy_unused_symbols): New function.
1628 (Incremental_library::do_for_all_unused_symbols): New function.
1629 * incremental.h (enum Incremental_input_flags): New type.
1630 (class Incremental_checker): Remove.
1631 (Incremental_input_entry::Incremental_input_entry): Add argument
1632 serial number.
1633 (Incremental_input_entry::arg_serial): New function.
1634 (Incremental_input_entry::set_is_in_system_directory): New function.
1635 (Incremental_input_entry::is_in_system_directory): New function.
1636 (Incremental_input_entry::arg_serial_): New data member.
1637 (Incremental_input_entry::is_in_system_directory_): New data member.
1638 (class Script_info): Move here from script.h.
1639 (Script_info::Script_info): Add filename parameter.
1640 (Script_info::filename): New function.
1641 (Script_info::filename_): New data member.
1642 (Incremental_script_entry::Incremental_script_entry): Add argument
1643 serial number.
1644 (Incremental_object_entry::Incremental_object_entry): Likewise.
1645 (Incremental_object_entry::add_input_section): Build list of input
1646 sections with map to original shndx.
1647 (Incremental_object_entry::get_input_section_index): New function.
1648 (Incremental_object_entry::shndx_): New data member.
1649 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1650 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1651 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1652 serial number.
1653 (Incremental_inputs::report_archive_begin): Likewise.
1654 (Incremental_inputs::report_object): Likewise.
1655 (Incremental_inputs::report_script): Likewise.
1656 (class Incremental_global_symbol_reader): New class.
1657 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1658 and store flags and input file type.
1659 (Incremental_input_entry_reader::arg_serial): New function.
1660 (Incremental_input_entry_reader::type): Extract type from flags.
1661 (Incremental_input_entry_reader::is_in_system_directory): New function.
1662 (Incremental_input_entry_reader::get_input_section_count): Call
1663 accessor function for type.
1664 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1665 function for type; adjust size of global symbol entry.
1666 (Incremental_input_entry_reader::get_global_symbol_count): Call
1667 accessor function for type.
1668 (Incremental_input_entry_reader::get_object_count): Likewise.
1669 (Incremental_input_entry_reader::get_object_offset): Likewise.
1670 (Incremental_input_entry_reader::get_member_count): Likewise.
1671 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1672 (Incremental_input_entry_reader::get_member_offset): Likewise.
1673 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1674 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1675 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1676 (Incremental_input_entry_reader::get_global_symbol_reader): New
1677 function.
1678 (Incremental_input_entry_reader::get_output_symbol_index): New
1679 function.
1680 (Incremental_input_entry_reader::type_): Remove.
1681 (Incremental_input_entry_reader::flags_): New data member.
1682 (Incremental_inputs_reader::input_file_offset): New function.
1683 (Incremental_inputs_reader::input_file_index): New function.
1684 (Incremental_inputs_reader::input_file): Call input_file_offset.
1685 (Incremental_inputs_reader::input_file_at_offset): New function.
1686 (Incremental_relocs_reader::get_r_type): Reformat.
1687 (Incremental_relocs_reader::get_r_shndx): Reformat.
1688 (Incremental_relocs_reader::get_r_offset): Reformat.
1689 (Incremental_relocs_reader::data): New function.
1690 (Incremental_binary::Incremental_binary): Initialize new data members.
1691 (Incremental_binary::check_inputs): Add cmdline parameter.
1692 (Incremental_binary::file_is_unchanged): Remove.
1693 (Input_reader::arg_serial): New function.
1694 (Input_reader::get_unused_symbol_count): New function.
1695 (Input_reader::get_unused_symbol): New function.
1696 (Input_reader::do_arg_serial): New function.
1697 (Input_reader::do_get_unused_symbol_count): New function.
1698 (Input_reader::do_get_unused_symbol): New function.
1699 (Incremental_binary::input_file_count): New function.
1700 (Incremental_binary::get_input_reader): Change signature to use
1701 index instead of filename.
1702 (Incremental_binary::file_has_changed): New function.
1703 (Incremental_binary::get_input_argument): New function.
1704 (Incremental_binary::get_library): New function.
1705 (Incremental_binary::get_script_info): New function.
1706 (Incremental_binary::init_layout): New function.
1707 (Incremental_binary::reserve_layout): New function.
1708 (Incremental_binary::output_file): New function.
1709 (Incremental_binary::do_check_inputs): New function.
1710 (Incremental_binary::do_file_is_unchanged): Remove.
1711 (Incremental_binary::do_file_has_changed): New function.
1712 (Incremental_binary::do_init_layout): New function.
1713 (Incremental_binary::do_reserve_layout): New function.
1714 (Incremental_binary::do_input_file_count): New function.
1715 (Incremental_binary::do_get_input_reader): Change signature.
1716 (Incremental_binary::input_args_map_): New data member.
1717 (Incremental_binary::library_map_): New data member.
1718 (Incremental_binary::script_map_): New data member.
1719 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1720 new data members.
1721 (Sized_incremental_binary::output_section): New function.
1722 (Sized_incremental_binary::inputs_reader): Add const.
1723 (Sized_incremental_binary::symtab_reader): Add const.
1724 (Sized_incremental_binary::relocs_reader): Add const.
1725 (Sized_incremental_binary::got_plt_reader): Add const.
1726 (Sized_incremental_binary::get_symtab_view): New function.
1727 (Sized_incremental_binary::Inputs_reader): New typedef.
1728 (Sized_incremental_binary::Input_entry_reader): New typedef.
1729 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1730 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1731 (Sized_incremental_binary::do_file_has_changed): New function.
1732 (Sized_incremental_binary::do_init_layout): New function.
1733 (Sized_incremental_binary::do_reserve_layout): New function.
1734 (Sized_input_reader::Inputs_reader): Remove.
1735 (Sized_input_reader::Input_entry_reader): Remove.
1736 (Sized_input_reader::do_arg_serial): New function.
1737 (Sized_input_reader::do_get_unused_symbol_count): New function.
1738 (Sized_input_reader::do_get_unused_symbol): New function.
1739 (Sized_incremental_binary::do_input_file_count): New function.
1740 (Sized_incremental_binary::do_get_input_reader): Change signature;
1741 use index instead of filename.
1742 (Sized_incremental_binary::section_map_): New data member.
1743 (Sized_incremental_binary::input_entry_readers_): New data member.
1744 (class Sized_incr_relobj): New class.
1745 (class Sized_incr_dynobj): New class.
1746 (make_sized_incremental_object): New function.
1747 (class Incremental_library): New class.
1748 * layout.cc (Free_list::num_lists): New static data member.
1749 (Free_list::num_nodes): New static data member.
1750 (Free_list::num_removes): New static data member.
1751 (Free_list::num_remove_visits): New static data member.
1752 (Free_list::num_allocates): New static data member.
1753 (Free_list::num_allocate_visits): New static data member.
1754 (Free_list::init): New function.
1755 (Free_list::remove): New function.
1756 (Free_list::allocate): New function.
1757 (Free_list::dump): New function.
1758 (Free_list::print_stats): New function.
1759 (Layout_task_runner::run): Resize output file for incremental updates.
1760 (Layout::Layout): Initialize new data members.
1761 (Layout::set_incremental_base): New function.
1762 (Layout::init_fixed_output_section): New function.
1763 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1764 incremental updates.
1765 (Layout::create_gold_note): Do not create gold note section for
1766 incremental updates.
1767 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1768 for incremental updates.
1769 (Layout::set_section_offsets): For incremental updates, allocate space
1770 from free list.
1771 (Layout::create_symtab_sections): Layout with offsets relative to
1772 start of section; for incremental updates, allocate space from free
1773 list.
1774 (Layout::create_shdrs): For incremental updates, allocate space from
1775 free list.
1776 (Layout::finish_dynamic_section): For incremental updates, do not
1777 check --as-needed (fixed in subsequent patch).
1778 * layout.h (class Free_list): New class.
1779 (Layout::set_incremental_base): New function.
1780 (Layout::incremental_base): New function.
1781 (Layout::init_fixed_output_section): New function.
1782 (Layout::allocate): New function.
1783 (Layout::incremental_base_): New data member.
1784 (Layout::free_list_): New data member.
1785 * main.cc (main): Print Free_list statistics.
1786 * object.cc (Relobj::finalize_incremental_relocs): Add
1787 clear_counts parameter; clear counts only when clear_counts is set.
1788 (Sized_relobj::Sized_relobj): Initialize new base class.
1789 (Sized_relobj::do_layout): Don't report special sections.
1790 (Sized_relobj::do_for_all_local_got_entries): New function.
1791 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1792 symtab_off to all symbol table offsets.
1793 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1794 * object.h (class Got_offset_list): Move to top of file.
1795 (Object::Object): Allow case where input_file == NULL.
1796 (Object::~Object): Likewise.
1797 (Object::input_file): Assert that input_file != NULL.
1798 (Object::lock): Allow case where input_file == NULL.
1799 (Object::unlock): Likewise.
1800 (Object::is_locked): Likewise.
1801 (Object::token): Likewise.
1802 (Object::release): Likewise.
1803 (Object::is_incremental): New function.
1804 (Object::get_mtime): New function.
1805 (Object::for_all_local_got_entries): New function.
1806 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1807 (Object::set_is_in_system_directory): New function.
1808 (Object::is_in_system_directory): New function.
1809 (Object::do_is_incremental): New function.
1810 (Object::do_get_mtime): New function.
1811 (Object::do_for_all_local_got_entries): New function.
1812 (Object::is_in_system_directory_): New data member.
1813 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1814 (class Sized_relobj_base): New class.
1815 (class Sized_relobj): Derive from Sized_relobj_base.
1816 (class Sized_relobj::Symbols): Redeclare from base class.
1817 (class Sized_relobj::local_got_offset_list): Remove.
1818 (class Sized_relobj::Output_sections): Redeclare from base class.
1819 (class Sized_relobj::do_for_all_local_got_entries): New function.
1820 (class Sized_relobj::write_local_symbols): Add offset parameter.
1821 (class Sized_relobj::local_symbol_offset_): Update comment.
1822 (class Sized_relobj::local_dynsym_offset_): Update comment.
1823 * options.cc (Input_arguments::add_file): Remove const.
1824 * options.h (Input_file_argument::Input_file_argument):
1825 Initialize arg_serial_ (all constructors).
1826 (Input_file_argument::set_arg_serial): New function.
1827 (Input_file_argument::arg_serial): New function.
1828 (Input_file_argument::arg_serial_): New data member.
1829 (Input_arguments::Input_arguments): Initialize file_count_.
1830 (Input_arguments::add_file): Remove const.
1831 (Input_arguments::number_of_input_files): New function.
1832 (Input_arguments::file_count_): New data member.
1833 (Command_line::number_of_input_files): Call
1834 Input_arguments::number_of_input_files.
1835 * output.cc (Output_segment_headers::Output_segment_headers):
1836 Set current size.
1837 (Output_section::Input_section::current_data_size): New function.
1838 (Output_section::Output_section): Initialize new data members.
1839 (Output_section::add_input_section): Don't do merge sections for
1840 an incremental link; allocate space from free list for an
1841 incremental update.
1842 (Output_section::add_output_section_data): Allocate space from
1843 free list for an incremental update.
1844 (Output_section::update_data_size): New function.
1845 (Output_section::set_fixed_layout): New function.
1846 (Output_section::reserve): New function.
1847 (Output_segment::set_section_addresses): Remove const.
1848 (Output_segment::set_section_list_addresses): Remove const; allocate
1849 space from free list for an incremental update.
1850 (Output_segment::set_offset): Adjust size of RELRO segment for an
1851 incremental update.
1852 * output.h (Output_data::current_data_size): Move here from
1853 child classes.
1854 (Output_data::pre_finalize_data_size): New function.
1855 (Output_data::update_data_size): New function.
1856 (Output_section_headers::update_data_size): new function.
1857 (Output_section_data_build::current_data_size): Move to Output_data.
1858 (Output_data_strtab::update_data_size): New function.
1859 (Output_section::current_data_size): Move to Output_data.
1860 (Output_section::set_fixed_layout): New function.
1861 (Output_section::has_fixed_layout): New function.
1862 (Output_section::reserve): New function.
1863 (Output_section::update_data_size): New function.
1864 (Output_section::has_fixed_layout_): New data member.
1865 (Output_section::free_list_): New data member.
1866 (Output_segment::set_section_addresses): Remove const.
1867 (Output_segment::set_section_list_addresses): Remove const.
1868 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1869 New function.
1870 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1871 New function.
1872 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1873 parameter when calling Add_symbols constructor; store argument
1874 serial number for members of a lib group.
1875 (Add_symbols::locks): Allow case where token == NULL.
1876 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1877 (Read_member::~Read_member): New function.
1878 (Read_member::is_runnable): New function.
1879 (Read_member::locks): New function.
1880 (Read_member::run): New function.
1881 (Check_script::~Check_script): New function.
1882 (Check_script::is_runnable): New function.
1883 (Check_script::locks): New function.
1884 (Check_script::run): New function.
1885 (Check_library::~Check_library): New function.
1886 (Check_library::is_runnable): New function.
1887 (Check_library::locks): New function.
1888 (Check_library::run): New function.
1889 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1890 (Add_symbols::library_): New data member.
1891 (class Read_member): New class.
1892 (class Check_script): New class.
1893 (class Check_library): New class.
1894 * reloc.cc (Read_relocs::is_runnable): Allow case where
1895 token == NULL.
1896 (Read_relocs::locks): Likewise.
1897 (Scan_relocs::locks): Likewise.
1898 (Relocate_task::locks): Likewise.
1899 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1900 to clear counters.
1901 (Sized_relobj::incremental_relocs_scan): Fix comment.
1902 (Sized_relobj::do_relocate): Pass output file offset to
1903 write_local_symbols.
1904 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1905 from class declaration.
1906 * script.cc (read_input_script): Allocate Script_info; pass
1907 argument serial number to report_script.
1908 * script.h (class Script_info): Move to incremental.h.
1909 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1910 * symtab.h (Symbol_table::add_from_incrobj): New function.
1911 (Symbol_table::set_file_offset): New function.
1912
b961d0d7
CC
19132011-04-05 Cary Coutant <ccoutant@google.com>
1914
1915 * incremental-dump.cc (dump_incremental_inputs): Change signature
1916 to take a Sized_incremental_binary; change caller. Use readers
1917 in Sized_incremental_binary.
1918 * incremental.cc
1919 (Sized_incremental_binary::find_incremental_inputs_sections):
1920 Rename do_find_incremental_inputs_sections to this.
1921 (Sized_incremental_binary::setup_readers): New function.
1922 (Sized_incremental_binary::do_check_inputs): Check
1923 has_incremental_info_ flag; move setup code to setup_readers;
1924 use input readers.
1925 (Sized_incremental_binary::do_file_is_unchanged): New function.
1926 (Sized_incremental_binary::do_get_input_reader): New function.
1927 * incremental.h (class Incremental_binary): Move to end of file.
1928 (Incremental_binary::file_is_unchanged): New function.
1929 (Incremental_binary::do_file_is_unchanged): New function.
1930 (Incremental_binary::Input_reader): New class.
1931 (Incremental_binary::get_input_reader): New function.
1932 (class Sized_incremental_binary): Move to end of file.
1933 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1934 input section reader classes.
1935 (Sized_incremental_binary::has_incremental_info): New function.
1936 (Sized_incremental_binary::inputs_reader): New function.
1937 (Sized_incremental_binary::symtab_reader): New function.
1938 (Sized_incremental_binary::relocs_reader): New function.
1939 (Sized_incremental_binary::got_plt_reader): New function.
1940 (Sized_incremental_binary::do_file_is_unchanged): New function.
1941 (Sized_incremental_binary::Sized_input_reader): New class.
1942 (Sized_incremental_binary::get_input_reader): New function.
1943 (Sized_incremental_binary::find_incremental_inputs_sections):
1944 Rename do_find_incremental_inputs_sections to this.
1945 (Sized_incremental_binary::setup_readers): New function.
1946 (Sized_incremental_binary::has_incremental_info_): New data member.
1947 (Sized_incremental_binary::inputs_reader_): New data member.
1948 (Sized_incremental_binary::symtab_reader_): New data member.
1949 (Sized_incremental_binary::relocs_reader_): New data member.
1950 (Sized_incremental_binary::got_plt_reader_): New data member.
1951 (Sized_incremental_binary::current_input_file_): New data member.
1952
a869183f
PP
19532011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1954
1955 PR gold/12640
1956 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1957 violation.
1958
19592011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
1960
1961 * archive.cc (Archive::include_member): Adjust call to report_object.
1962 (Add_archive_symbols::run): Add script_info to call to
1963 report_archive_begin.
1964 (Lib_group::include_member): Adjust call to report_object.
1965 (Add_lib_group_symbols::run): Adjust call to report_object.
1966 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1967 blocks. Add object count for script input files.
1968 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1969 script_info parameter; change all callers.
1970 (Incremental_inputs::report_object): Add script_info parameter;
1971 change all callers.
1972 (Incremental_inputs::report_script): Store backpointer to
1973 incremental info entry.
1974 (Output_section_incremental_inputs::set_final_data_size): Record
1975 additional information for scripts.
1976 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1977 * incremental.h (Incremental_script_entry::add_object): New function.
1978 (Incremental_script_entry::get_object_count): New function.
1979 (Incremental_script_entry::get_object): New function.
1980 (Incremental_script_entry::objects_): New data member; adjust
1981 constructor.
1982 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1983 (Incremental_inputs::report_object): Add script_info parameter.
1984 (Incremental_inputs_reader::get_object_count): New function.
1985 (Incremental_inputs_reader::get_object_offset): New function.
1986 * options.cc (Input_arguments::add_file): Return reference to
1987 new input argument.
1988 * options.h (Input_argument::set_script_info): New function.
1989 (Input_argument::script_info): New function.
1990 (Input_argument::script_info_): New data member; adjust all
1991 constructors.
1992 (Input_file_group::add_file): Return reference to new input argument.
1993 (Input_file_lib::add_file): Likewise.
1994 (Input_arguments::add_file): Likewise.
1995 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1996 * script.cc (Parser_closure::Parser_closure): Add script_info
1997 parameter; adjust all callers.
1998 (Parser_closure::script_info): New function.
1999 (Parser_closure::script_info_): New data member.
2000 (read_input_script): Report scripts earlier to incremental info.
2001 (script_add_file): Set script_info in Input_argument.
2002 (script_add_library): Likewise.
2003 * script.h (Script_options::Script_info): Rewrite class.
2004
a869183f 20052011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2006
2007 * archive.cc (Library_base::should_include_member): Move
2008 method here from class Archive.
2009 (Archive::Archive): Initialize base class.
2010 (Archive::should_include_member): Move to base class.
2011 (Archive::do_for_all_unused_symbols): New function.
2012 (Add_archive_symbols::run): Remove redundant access to
2013 incremental_inputs.
2014 (Lib_group::Lib_group): Initialize base class.
2015 (Lib_group::do_filename): New function.
2016 (Lib_group::include_member): Pass pointer to Lib_group to
2017 report_object.
2018 (Lib_group::do_for_all_unused_symbols): New function.
2019 (Add_lib_group_symbols::run): Report archive information for
2020 incremental links.
2021 * archive.h (class Library_base): New base class.
2022 (class Archive): Derive from Library_base.
2023 (Archive::filename): Move to base class.
2024 (Archive::set_incremental_info): Likewise.
2025 (Archive::incremental_info): Likewise.
2026 (Archive::Should_include): Likewise.
2027 (Archive::should_include_member): Likewise.
2028 (Archive::Armap_entry): Remove.
2029 (Archive::Unused_symbol_iterator): Remove.
2030 (Archive::unused_symbols_begin): Remove.
2031 (Archive::unused_symbols_end): Remove.
2032 (Archive::do_filename): New function.
2033 (Archive::do_get_mtime): New function.
2034 (Archive::do_for_all_unused_symbols): New function.
2035 (Archive::task_): Move to base class.
2036 (Archive::incremental_info_): Likewise.
2037 (class Lib_group): Derive from Library_base.
2038 (Lib_group::do_filename): New function.
2039 (Lib_group::do_get_mtime): New function.
2040 (Lib_group::do_for_all_unused_symbols): New function.
2041 (Lib_group::task_): Move to base class.
2042 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2043 function.
2044 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2045 function.
2046 * incremental.cc (Incremental_inputs::report_archive_begin):
2047 Use Library_base; call library's get_mtime; add incremental inputs
2048 entry before members.
2049 (class Unused_symbol_visitor): New class.
2050 (Incremental_inputs::report_archive_end): Use Library_base; use
2051 visitor class to record unused symbols; don't add incremental inputs
2052 entry after members.
2053 (Incremental_inputs::report_object): Use Library_base.
2054 * incremental.h
2055 (Incremental_archive_entry::Incremental_archive_entry): Remove
2056 unused Archive parameter.
2057 (Incremental_inputs::report_archive_begin): Use Library_base.
2058 (Incremental_inputs::report_archive_end): Likewise.
2059 (Incremental_inputs::report_object): Likewise.
2060 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2061 function.
2062 * object.h (Object::for_all_global_symbols): New function.
2063 (Object::do_for_all_global_symbols): New function.
2064 (Sized_relobj::do_for_all_global_symbols): New function.
2065 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2066 function.
2067 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2068 function.
2069
61ab3e40
ILT
20702011-03-27 Ian Lance Taylor <iant@google.com>
2071
2072 * archive.cc (Archive::interpret_header): Return -1 if something
2073 goes wrong. Change callers accordingly.
2074
30e1f9e6
CC
20752011-03-25 Cary Coutant <ccoutant@google.com>
2076
2077 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2078 * testsuite/Makefile.in: Regenerate.
2079
9c793f14
RÁE
20802010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2081
2082 * plugin.cc (get_view): New.
2083 (Plugin::load): Pass get_view to the plugin.
2084 (Plugin_manager::get_view): New.
2085
9312bb0a
ILT
20862011-03-21 Ian Lance Taylor <iant@google.com>
2087
2088 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 2089 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 2090
7e12ba9e
ST
20912011-03-21 Sriraman Tallam <tmsriram@google.com>
2092
2093 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2094 Change == to -eq.
2095 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2096 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2097 Change == to -eq.
2098 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2099 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2100
fd7a005d
ILT
21012011-03-14 Ian Lance Taylor <iant@google.com>
2102
2103 * script-sections.cc (Sort_output_sections::script_compare):
2104 Rename from is_before, change return type.
2105 (Sort_output_sections::operator()): Adjust accordingly.
2106
ed16fd1b
ILT
21072011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2108
2109 PR gold/12572
2110 * testsuite/odr_violation2.cc: Add comment to make all error line
2111 numbers double digits.
2112 * testsuite/debug_msg.sh: Adjust expected errors.
2113
71ff8986
ILT
21142011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2115
2116 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2117 but mark earlier ones as non-canonical
2118 (offset_to_iterator): Update search target and example
2119 (do_addr2line): Return extra lines in a vector*
2120 (format_file_lineno): Extract from do_addr2line
2121 (one_addr2line): Add vector* out-param
2122 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2123 when a lineno entry appeared last for its instruction
2124 (Dwarf_line_info): Add vector* out-param
2125 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2126 * symtab.cc (Odr_violation_compare): Include the lineno in the
2127 comparison again.
2128 (linenos_from_loc): New. Combine the canonical line for an
2129 address with its other lines.
2130 (True_if_intersect): New. Helper functor to make
2131 std::set_intersection a query.
2132 (detect_odr_violations): Compare sets of lines instead of just
2133 one line for each function. This became less deterministic, but
2134 has fewer false positives.
2135 * symtab.h: Declarations.
2136 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2137 mix an optimized and non-optimized object in the same binary
2138 (odr_violation2.so): Same.
2139 * testsuite/Makefile.in: Regenerate from Makefile.am.
2140 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2141 * testsuite/debug_msg.sh: Update line numbers and add
2142 assertions.
2143 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2144 non-optimized context.
2145 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2146 isn't inlined, and use OdrDerived in an optimized context.
2147 * testsuite/odr_header1.h: Defines OdrDerived, where
2148 optimization will change the
2149 first-instruction-in-the-destructor's file and line number.
2150 * testsuite/odr_header2.h: Defines OdrBase.
2151
a19fefdc
ILT
21522011-03-09 Ian Lance Taylor <iant@google.com>
2153
2154 * fileread.cc (File_read::clear_views): Don't delete the whole
2155 file view.
2156
ecb351e9
ILT
21572011-03-08 Ian Lance Taylor <iant@google.com>
2158
2159 PR gold/12525
2160 * fileread.cc: #include <climits>.
2161 (GOLD_IOV_MAX): Define.
2162 (File_read::read_multiple): Limit number of entries by iov_max.
2163 * fileread.h (class File_read): Always set max_readv_entries to
2164 128.
2165
b821d13c
ILT
21662011-03-07 Ian Lance Taylor <iant@google.com>
2167
2168 PR gold/12525
2169 * options.h (class General_options): Add -dy and -dn.
2170
89243142
CC
21712011-03-02 Cary Coutant <ccoutant@google.com>
2172
2173 * testsuite/script_test_9.t: Add TLS segment.
2174
d0773f31
ILT
21752011-03-02 Simon Baldwin <simonb@google.com>
2176
2177 * configure.ac: Add check for gnu_indirect_function support in
2178 the toolchain building binutils.
2179 * configure: Rebuild.
2180
badc8139
RÁE
21812010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2182
2183 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2184 plugin only symbols.
2185 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2186 in plugin files as not needed in the symbol table.
2187
4cf7a849
ST
21882011-02-11 Sriraman Tallam <tmsriram@google.com>
2189
2190 * output.cc (Output_section::add_input_section): Delay fill
2191 generation for section ordering.
2192
b578bd7d
ILT
21932011-02-09 Ian Lance Taylor <iant@google.com>
2194
2195 PR gold/12316
2196 * object.h (class Sized_relobj): Remove clear_local_symbols.
2197 * reloc.cc (Sized_relobj::do_relocate): Don't call
2198 clear_local_symbols.
2199
84ced98a
RÁE
22002010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2201
2202 * plugin.cc (is_visible_from_outside): Return true for symbols
2203 in the -u option.
2204
55382fb7
ILT
22052011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2206
2207 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2208 filename.
2209
4e271fff
ST
22102011-02-02 Sriraman Tallam <tmsriram@google.com>
2211
2212 * icf.h (is_section_foldable_candidate): Change type of parameter
2213 to std::string.
2214 * icf.cc (Icf::find_identical_sections): Change type of local variable
2215 section_name to be std::string.
2216 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2217
d433c3ac
ILT
22182011-01-25 Ian Lance Taylor <iant@google.com>
2219
2220 * script.cc (script_add_extern): Rewrite to use
2221 add_symbol_reference.
2222
880473a6
DK
22232011-01-25 Doug Kwan <dougkwan@google.com>
2224
d433c3ac 2225 * icf.cc (get_section_contents): Always lock section's object.
880473a6 2226
f30f86fa
ILT
22272011-01-24 Ian Lance Taylor <iant@google.com>
2228
2229 * options.h (class General_options): Accept
2230 --no-detect-odr-violations.
2231
8e51a0b9
ILT
22322011-01-24 Ian Lance Taylor <iant@google.com>
2233
2234 * version.cc (version_string): Bump to 1.11.
2235
0f3b89d8
ILT
22362011-01-24 Ian Lance Taylor <iant@google.com>
2237
2238 * plugin.cc (class Plugin_rescan): Define new class.
2239 (Plugin_manager::claim_file): Set any_claimed_.
2240 (Plugin_manager::save_archive): New function.
2241 (Plugin_manager::save_input_group): New function.
2242 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2243 necessary.
2244 (Plugin_manager::new_undefined_symbol): New function.
2245 (Plugin_manager::rescan): New function.
2246 (Plugin_manager::rescannable_defines): New function.
2247 (Plugin_manager::add_input_file): Set any_added_.
2248 * plugin.h (class Plugin_manager): define new fields rescannable_,
2249 undefined_symbols_, any_claimed_, and any_added_. Declare
2250 Plugin_rescan as friend. Declare new functions.
2251 (Plugin_manager::Rescannable): Define type.
2252 (Plugin_manager::Rescannable_list): Define type.
2253 (Plugin_manager::Undefined_symbol_list): Define type.
2254 (Plugin_manager::Plugin_manager): Initialize new fields.
2255 * archive.cc (Archive::defines_symbol): New function.
2256 (Add_archive_symbols::run): Pass archive to plugins if any.
2257 * archive.h (class Archive): Declare defines_symbol.
2258 * readsyms.cc (Input_group::~Input_group): New function.
2259 (Finish_group::run): Pass input_group to plugins if any.
2260 * readsyms.h (class Input_group): Declare destructor.
2261 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2262 any.
2263
3bb951e5
ILT
22642011-01-10 Ian Lance Taylor <iant@google.com>
2265
2266 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2267 section as relro.
2268 (Layout::set_segment_offsets): Reset increase_relro before calling
2269 set_section_addresses a second time.
2270
0aa45fac
CC
22712011-01-04 Cary Coutant <ccoutant@google.com>
2272
2273 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2274 sections before NOBITS sections.
2275
0db46eb4
L
22762011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2277
2278 * version.cc (print_version): Update copyright to 2011.
2279
829c9745
CC
22802010-12-23 Cary Coutant <ccoutant@google.com>
2281
2282 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2283 of OS to this->add. Add OD parameter to second form of the function.
2284
7500420b
ILT
22852010-12-20 Ian Lance Taylor <iant@google.com>
2286
2287 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2288 second of two consecutive entries with same offset.
2289
f8e9a930
RW
22902010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2291
2292 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2293 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2294 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2295 to avoid unneeded links against $(LDADD).
2296 * testsuite/Makefile.in: Regenerate.
2297
2fbb4320
ILT
22982010-12-15 Ian Lance Taylor <iant@google.com>
2299
2300 PR gold/12324
2301 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2302 for R_X86_64_32 and R_X86_64_PC32.
2303 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2304 ver_matching_def_pic.o.
2305 (ver_matching_def_pic.o): New target.
2306
fedb228d
RW
23072010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2308
2309 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2310 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2311 Move definition before File_read::View member definitions.
2312 (File_read::View::~View): Initialize and hold lock before
2313 updating current_mapped_bytes.
2314
9b547ce6
RW
23152010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2316
2317 * dwarf_reader.cc: Remove outdated comment.
2318 * gold-threads.cc: Fix typo in error message.
2319 * archive.cc: Fix typos in comments.
2320 * archive.h: Likewise.
2321 * arm-reloc-property.cc: Likewise.
2322 * arm-reloc-property.h: Likewise.
2323 * arm-reloc.def: Likewise.
2324 * arm.cc: Likewise.
2325 * attributes.h: Likewise.
2326 * cref.cc: Likewise.
2327 * ehframe.cc: Likewise.
2328 * fileread.h: Likewise.
2329 * gold.h: Likewise.
2330 * i386.cc: Likewise.
2331 * icf.cc: Likewise.
2332 * incremental.h: Likewise.
2333 * int_encoding.cc: Likewise.
2334 * layout.h: Likewise.
2335 * main.cc: Likewise.
2336 * merge.h: Likewise.
2337 * object.cc: Likewise.
2338 * object.h: Likewise.
2339 * options.cc: Likewise.
2340 * readsyms.cc: Likewise.
2341 * reduced_debug_output.cc: Likewise.
2342 * reloc.cc: Likewise.
2343 * script-sections.cc: Likewise.
2344 * sparc.cc: Likewise.
2345 * symtab.h: Likewise.
2346 * target-reloc.h: Likewise.
2347 * target.cc: Likewise.
2348 * target.h: Likewise.
2349 * timer.cc: Likewise.
2350 * timer.h: Likewise.
2351 * x86_64.cc: Likewise.
2352
83e17bd5
CC
23532010-12-09 Cary Coutant <ccoutant@google.com>
2354
2355 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2356 stack.
2357 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2358 parameter; change all callers.
2359 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2360 * options.h (warn_execstack): New option.
2361
017257f8
DK
23622010-12-07 Doug Kwan <dougkwan@google.com>
2363
2364 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2365 like function call relocations.
2366
c20cbc06
ILT
23672010-12-07 Ian Lance Taylor <iant@google.com>
2368
2369 * archive.cc (Archive::get_elf_object_for_member): Permit
2370 punconfigured to be NULL.
2371 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2372 (Archive::include_member): Pass NULL to get_elf_object_for_member
2373 if we searched for the archive and this is the first included
2374 object.
2375
4dbfafcc
ILT
23762010-12-01 Ian Lance Taylor <iant@google.com>
2377
2378 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2379 track_relocs_type_ field.
2380 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2381 Set track_relocs_type_.
2382 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2383 contents when using RELA relocs.
2384 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2385 reloc_map_.
2386 * reloc.cc (Track_relocs::next_addend): New function.
2387 * reloc.h (class Track_relocs): Declare next_addend.
2388
e5e19edd
ILT
23892010-12-01 Ian Lance Taylor <iant@google.com>
2390
2391 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2392 virtual destructor.
2393
9a5ce24c
ILT
23942010-12-01 Ian Lance Taylor <iant@google.com>
2395
2396 * README: Update compilers known to work and fail.
2397
c7791212
NC
23982010-11-23 Matthias Klose <doko@ubuntu.com>
2399
2400 * configure.in: For --enable-gold, handle value `default' instead of
2401 `both*'. Always install ld as ld.bfd, install as ld if gold is
2402 not the default.
2403 * configure: Regenerate.
2404
0ad220c9
DK
24052010-11-18 Doug Kwan <dougkwan@google.com>
2406
2407 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2408 and right_alignment to be zero. Store result alignment only if it is
2409 greater than existing alignment.
2410
ab8056e0
CC
24112010-11-16 Cary Coutant <ccoutant@google.com>
2412
2413 PR gold/12220
2414 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2415 Check for ".zdebug_line".
2416
fd064a5b
CC
24172010-11-16 Doug Kwan <dougkwan@google.com>
2418 Cary Coutant <ccoutant@google.com>
2419
2420 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2421 by reference; adjust all callers.
2422 * output.cc (Output_segment::set_section_addresses): Adjust references
2423 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2424 list is empty.
2425 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2426 end at page boundary.
2427
6fc6ea19
CC
24282010-11-16 Cary Coutant <ccoutant@google.com>
2429
2430 PR gold/12220
2431 * layout.cc (Layout::choose_output_section): Transform names of
2432 compressed sections even when using a script with a SECTIONS clause.
2433 (Layout::output_section_name): Remove code to transform
2434 compressed debug section names.
2435 * output.cc (Output_section::add_input_section): Use uncompressed
2436 section size when tracking input sections.
2437
95a2c8d6
RS
24382010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2439
2440 * symtab.h (Symbol::NON_PIC_REF): Remove.
2441 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2442 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2443 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2444 (Symbol::use_plt_offset): Take a flags argument and pass it
2445 directly to needs_dynamic_reloc. Restrict check for undefined
2446 weak symbols to function calls.
2447 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2448 (Target_arm::Scan::global): Use it.
2449 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2450 (Target_arm::Relocate::relocate): Likewise.
2451 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2452 parameter with an r_type parameter. Use get_reference_flags
2453 to get the flags.
2454 (Target_arm::Relocate::relocate): Update accordingly.
2455 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2456 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2457 (Target_i386::Scan::global): Likewise.
2458 (Target_i386::Relocate::relocate): Likewise.
2459 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2460 parameter with an r_type parameter. Use get_reference_flags
2461 to get the flags.
2462 (Target_i386::Relocate::relocate): Update accordingly.
2463 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2464 (Target_powerpc::Scan::global): Use it.
2465 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2466 (Target_powerpc::Relocate::relocate): Likewise.
2467 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2468 (Target_sparc::Scan::global): Use it.
2469 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2470 (Target_sparc::Relocate::relocate): Likewise.
2471 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2472 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2473 (Target_x86_64::Scan::global): Likewise.
2474 (Target_x86_64::Relocate::relocate): Likewise.
2475
f625ae50
DK
24762010-11-08 Doug Kwan <dougkwan@google.com>
2477 Cary Coutant <ccoutant@google.com>
2478
2479 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2480 (Arm_exidx_merge_section::section_contents_): New data member.
2481 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2482 (Arm_input_section::~Arm_input_section): De-allocate memory.
2483 (Arm_input_section::original_contents_): New data member.
2484 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2485 in parameters instead of calling Object::section_contents without
2486 locking.
2487 (Arm_output_section::group_section): New parameter TASK. Pass it
2488 to callees that need locking objects.
2489 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2490 to lock EXIDX input sections. Fix a formatting issue. Call
2491 Arm_exidx_merged_section::build_contents to create merged section
2492 contents.
2493 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2494 to lock object of stub table owner.
2495 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2496 TEXT_SIZE to initialize data member TEXT_SIZE_.
2497 (Arm_exidx_input_section::addralign): Fix typo in comment.
2498 (Arm_exidx_input_section::text_size): New method.
2499 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2500 that require locking objects. Lock objects before scanning for stubs
2501 and updating local symbols.
2502 (Arm_input_section<big_endian>::init): Copy contents of original
2503 input section.
2504 (Arm_input_section<big_endian>::do_write): Use saved contents of
2505 original input section instead of calling Object::section_contents
2506 without locking.
2507 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2508 size without calling Object::section_size().
2509 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2510 for size. Allocate a buffer for merged EXIDX entries.
2511 (Arm_exidx_merged_section::build_contents): New method.
2512 (Arm_exidx_merged_section::do_write): Move merge section contents
2513 building code to Arm_exidx_merged_section::build_contetns. Write
2514 out contetns in buffer instead of building it on the fly.
2515 (Arm_relobj::make_exidx_input_section): Also pass text section size
2516 to Arm_exidx_input_section constructor.
2517 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2518 (Arm_dynobj::do_read_symbols): Fix memory leak.
2519 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2520 * target.h: (class Task): Add forward declaration.
2521 (Target::relax): Add new parameter TASK and pass it to
2522 Target::do_relax().
2523 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2524
5f9bcf58
CC
25252010-11-05 Cary Coutant <ccoutant@google.com>
2526
2527 PR gold/10708
2528 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2529 object when reading from the file.
2530 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2531 second layout pass.
2532 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2533 when reading section contents.
2534 (get_section_contents): Likewise.
2535 (icf::find_identical_sections): Likewise.
2536 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2537 object when reading from the file.
2538 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2539 the object when doing deferred section layout.
2540
e597fa08
NC
25412010-11-03 Nick Clifton <nickc@redhat.com>
2542
2543 PR gold/12001
2544 * script.h (class Symbol_assignment: name): New member. Returns
2545 the name of the symbol.
2546 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2547 Returns true if the given symbol name is on the list of
2548 assignments wating to be processed.
2549 * archive.cc (should_incldue_member): If the symbol is undefined,
2550 check to see if it is on the list of symbols pending assignment.
2551
3f9a3278
ILT
25522010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2553
2554 * script-sections.cc (Script_sections::find_memory_region): Check
2555 for a NULL output section pointer.
2556
d06fb4d1
DK
25572010-10-29 Doug Kwan <dougkwan@google.com>
2558
2559 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2560 Output_section::add_relaxed_input_section.
2561 * output.cc (Output_section::add_relaxed_input_section): Add new
2562 arguments LAYOUT and NAME. Set section order index.
2563 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2564 Copy section order index.
2565 * output.h (Output_section::add_relaxed_input_section): Add new
2566 arguments LAYOUT and NAME.
2567
90e24de5
ILT
25682010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2569
2570 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2571 NATIVE_OR_CROSS_LINKER.
2572 * testsuite/Makefile.in: Regenerate.
2573
c9484ea5
DK
25742010-10-20 Doug Kwan <dougkwan@google.com>
2575
2576 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2577 without SHF_LINK_ORDER flags.
2578 * layout.cc (Layout::choose_output_section): Do not filter
2579 SHF_LINK_ORDER flag in a relocatable link.
2580
5bc2f5be
CC
25812010-10-17 Cary Coutant <ccoutant@google.com>
2582
2583 * output.h (Output_segment::set_section_addresses): Change function
2584 signature. Update all callers.
2585 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2586 sections.
2587 (Output_segment::set_section_addresses): Align after last TLS
2588 section. Add padding before last relro section instead of after.
2589
0c91cf04
DK
25902010-10-17 Doug Kwan <dougkwan@google.com>
2591
2592 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2593 GOT output section to be writable.
2594
8c21d9d3
CC
25952010-10-14 Cary Coutant <ccoutant@google.com>
2596
2597 * debug.h (DEBUG_INCREMENTAL): New flag.
2598 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2599 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2600 mode.
2601 * incremental.cc (report_command_line): Ignore all forms of
2602 --incremental.
2603 * layout.cc (Layout::Layout): Check parameters for incremental link
2604 mode.
2605 * options.cc (General_options::parse_incremental): New function.
2606 (General_options::parse_no_incremental): New function.
2607 (General_options::parse_incremental_full): New function.
2608 (General_options::parse_incremental_update): New function.
2609 (General_options::incremental_mode_): New data member.
2610 (General_options::finalize): Check incremental_mode_.
2611 * options.h (General_options): Update help text for --incremental.
2612 Add --no-incremental, --incremental-full, --incremental-update.
2613 (General_options::Incremental_mode): New enum type.
2614 (General_options::incremental_mode): New function.
2615 (General_options::incremental_mode_): New data member.
2616 * parameters.cc (Parameters::incremental_mode_): New data member.
2617 (Parameters::set_options): Set incremental_mode_.
2618 (Parameters::set_incremental_full): New function.
2619 (Parameters::incremental): New function.
2620 (Parameters::incremental_update): New function.
2621 (set_parameters_incremental_full): New function.
2622 * parameters.h (Parameters::set_incremental_full): New function.
2623 (Parameters::incremental): New function.
2624 (Parameters::incremental_update): New function.
2625 (Parameters::incremental_mode_): New data member.
2626 (set_parameters_incremental_full): New function.
2627 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2628 incremental link mode.
2629 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2630 (Sized_relobj::do_relocate_sections): Likewise.
2631 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2632 option.
2633 * testsuite/Makefile.in: Regenerate.
2634 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2635
bb32aa18 26362010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
2637
2638 * script-sections.h (class Script_sections): Make
2639 Sections_elements typedef public.
2640 * script-sections.cc (class Sort_output_sections): Add elements_
2641 field. Add constructor which sets it; change all callers.
2642 (Sort_output_sections::is_before): New function.
2643 (Sort_output_sections::operator()): Call is_before.
2644 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2645 conditional.
2646 * testsuite/script_test_10.sh: New test. Test script section
2647 order.
2648 * testsuite/script_test_10.t: Likewise.
2649 * testsuite/script_test_10.s: Likewise.
2650 * testsuite/Makefile.am: Wrap the cross linker tests and the
2651 common tests into NATIVE_OR_CROSS_LINKER.
2652 (check_SCRIPTS): Add script_test_10.sh.
2653 (check_DATA): Add script_test_10.stdout.
2654 (script_test_10.o, script_test_10): New targets.
2655 (script_test_10.stdout): New target.
2656 * configure, testsuite/Makefile.in: Regenerate.
2657
3cef7179
ILT
26582010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2659
2660 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2661 error for the deprecated relocations.
2662 (Target_arm::Scan::global): Likewise.
2663 (Target_arm::Relocate::relocate): Likewise.
2664
7411e9a8
RS
26652010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2666
2667 * fileread.cc (Input_file::find_file): Initialize *found_name
2668 and *namep when using the fallback search for case 4.
2669
6a9da32a
CC
26702010-10-11 Cary Coutant <ccoutant@google.com>
2671
2672 * options.h (class General_options): Redefine -z lazy as an alias for
2673 the negation of -z now.
2674
ac897c20
ILT
26752010-10-11 Ian Lance Taylor <iant@google.com>
2676
2677 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2678 binding.
2679
ea5cae92
NC
26802010-10-06 Nick Clifton <nickc@redhat.com>
2681
2682 * script-sections.cc(class Memory_region): Remove
2683 current_lma_offset_ field. Rename current_vma_offset_ to
2684 current_offset_. Add last_section_ field.
2685 (Memory_region::get_current_vma_address): Rename to
2686 get_current_address.
2687 (Memory_region::get_current_lma_address): Delete.
2688 (Memory_region::increment_vma_offset): Rename to
2689 increment_offset.
2690 (Memory_region::increment_lma_offset): Delete.
2691 (Memory_region::attributes_compatible): New method. Returns
2692 true if the provided section is compatible with the region.
2693 (Memory_region::get_last_section): New method. Returns the last
2694 section to use the region.
2695 (Memory_region::set_last_section): New method. Stores the last
2696 section to use the region.
2697 (Script_sections::block_in_region): New method. Returns true if
2698 a block of memory is contained within a region.
2699 (Script_sections::find_memory_region): New method. Locates a
2700 memory region to be used to set a VMA or LMA address.
2701 (Output_section_definition::set_section_addresses): Add code to
2702 check for addresses set by memory regions.
2703 (Output_segment::set_section_addresses): Remove memory region
2704 walking code.
2705 (Script_sections::create_segment): Add a warning if a header
2706 segment is created outside of any region.
2707 * script-sections.h (class Script_sections): Add prototypes for
2708 find_memory_region and block_in_region methods.
2709 * testsuite/memory_test.s: Use .long instead of .word.
2710 * testsuite/memory_test.t: Add some more output sections.
2711 * testsuite/memory_test.sh: Update expected output.
2712
a9bfd952
DK
27132010-10-02 Doug Kwan <dougkwan@google.com>
2714
2715 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2716 defintion to symtab.h
2717 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2718 declaration to defintion.
2719
bacff3ab
NC
27202010-10-01 Nick Clifton <nickc@redhat.com>
2721
2722 * expression.cc (eval): Replace dummy argument with NULL.
2723 (eval_maybe_dot): Check for a NULL result section pointer.
2724 (Symbol_expression::value): Likewise.
2725 (Dot_expression::value): Likewise.
2726 (BINARY_EXPRESSION): Likewise.
2727 (Max_expression::value): Likewise.
2728 (Min_expression::value): Likewise.
2729 (Absolute_expression::value): Likewise.
2730 (Addr_expression::value_from_output_section): Likewise.
2731 (Loaddddr_expression::value_from_output_section): Likewise.
2732 (Segment_start_expression::value): Likewise.
2733 * script-sections.cc
2734 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2735 argument with NULL.
2736 (Sections_elememt_dot_assignment::set_section_addresses):
2737 Likewise.
2738 (Output_data_expression::do_write_to_buffer): Likewise.
2739 (Output_section_definition::finalize_symbols): Likewise.
2740 (Output_section_definition::set_section_addresses): Likewise.
2741
f81bc8b5
DK
27422010-09-30 Doug Kwan <dougkwan@google.com>
2743
2744 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2745
c95e9f27
ST
27462010-09-28 Sriraman Tallam <tmsriram@google.com>
2747
2748 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 2749 function.
c95e9f27
ST
2750 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2751 virtual function.
2752 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2753 virtual function.
2754 * icf.cc (get_section_contents): Inline merge sections only when
2755 target allows it.
2756
3cac54d2
RW
27572010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2758
2759 * configure: Regenerate.
2760
2904037a
ILT
27612010-09-17 Ian Lance Taylor <iant@google.com>
2762
2763 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
2764 * testsuite/Makefile.am (memory_test.o): New target.
2765 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2766 memory_test.t.
2767 * testsuite/Makefile.in: Rebuild.
2904037a 2768
bca7fb63
DK
27692010-09-17 Doug Kwan <dougkwan@google.com>
2770
2771 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2772 defintion if relocation uses GOT entries of the symbol.
2773 * testsuite/icf_safe_test.sh: Fix test.
2774 * testsuite/icf_safe_so_test.sh: Fix test.
2775
4ef28648
CC
27762010-09-16 Cary Coutant <ccoutant@google.com>
2777
2778 * script_sections.cc (class Memory_region): Remove "NULL" from
2779 vector initializations.
2780
793990de
CC
27812010-09-15 Cary Coutant <ccoutant@google.com>
2782
2783 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2784 Resolve forwarding symbols.
2785
81e015e2
DK
27862010-09-15 Doug Kwan <dougkwan@google.com>
2787
2788 * gold/testsuite/script_test_3.t: Add ARM special sections.
2789 * gold/testsuite/script_test_4.t: Same.
2790 * gold/testsuite/script_test_5.t: Same.
2791 * gold/testsuite/script_test_6.t: Same.
2792 * gold/testsuite/script_test_7.t: Same.
2793 * gold/testsuite/script_test_7.t: Same.
2794 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2795
36171d64
CC
27962010-09-14 Cary Coutant <ccoutant@google.com>
2797
2798 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2799 (Target_x86_64::Relocate::relocate_tls): Replace check for
2800 saw_tls_block_reloc_ with test for executable section.
2801
d89051bd
CC
28022010-09-12 Cary Coutant <ccoutant@google.com>
2803
2804 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2805 position-independent executables to shared libraries need dynamic
2806 relocations.
2807 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2808 position-independent executables.
2809 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2810 * testsuite/Makefile.in: Regenerate.
2811
fca41f0f
NC
28122010-09-10 Nick Clifton <nickc@redhat.com>
2813
2814 PR gold/11997
2815 * testsuite/memory_test.t: Discard any sections that are not
2816 needed.
2817
6695e4b3
L
28182010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2819
2820 PR gold/11996
2821 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2822 "This::" to work around a bug in gcc 4.2.
2823
2824 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2825
0f72bf6f
RÁE
28262010-09-09 Rafael Espindola <espindola@google.com>
2827
2828 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2829 sections with different PF_X flags in the same segment.
2830 (Layout::find_first_load_seg): Search all segments to find the first
2831 one.
2832 * options.h (rosegment): New.
2833
28342010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2835
05a79166 2836 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2837
aa98ff75
DK
28382010-09-08 Doug Kwan <dougkwan@google.com>
2839
2840 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2841 (Arm_relobj::do_relocate_sections): Add new parameter for output
2842 file to match the parent.
2843 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2844 of local symbols instead of input values. Update code to track
2845 changes in gold::relocate_section.
2846 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2847 (Sized_relobj::compute_final_local_value_internal): New methods.
2848 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2849 body into private version of Sized_relobj::compute_final_local_value.
2850 Call the inline method.
2851 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2852 merged symbol value if there is one.
2853 (Symbol_value::has_output_value): New method defintiion.
2854 (Sized_relobj::Compute_final_local_value_status): New enum type.
2855 (Sized_relobj::compute_final_local_value): New methods.
2856 (Sized_relobj::compute_final_local_value_internal): New methods.
2857 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2858 and arm_cortex_a8.sh.
2859 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2860 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2861 New tests.
2862 * Makefile.in: Regenerate.
2863 * testsuite/arm_bl_out_of_range.s: Update test.
2864 * testsuite/thumb_bl_out_of_range.s: Ditto.
2865 * testsuite/thumb_blx_out_of_range.s: Ditto.
2866 * testsuite/arm_branch_out_of_range.sh: New file.
2867 * testsuite/arm_cortex_a8.sh: Ditto.
2868 * testsuite/arm_cortex_a8_b.s: Ditto.
2869 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2870 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2871 * testsuite/arm_cortex_a8_bl.s: Ditto.
2872 * testsuite/arm_cortex_a8_blx.s: Ditto.
2873 * testsuite/arm_cortex_a8_local.s: Ditto.
2874 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2875 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2876
05a79166
L
28772010-09-08 Rafael Espindola <espindola@google.com>
2878
2879 * Makefile.am (memory_test.stdout): Run readelf with -W.
2880 * Makefile.in: Regenerate.
2881 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2882 64 bit output.
2883
33dbc701
RÁE
28842010-09-08 Rafael Espindola <espindola@google.com>
2885
2886 * script-sections.cc (Script_sections::add_memory_region): Convert
2887 field precision to int.
2888 * script.cc (script_set_section_region, script_set_section_region):
2889 Convert field precision to int.
2890
731ca54a
RÁE
28912010-09-08 Rafael Espindola <espindola@google.com>
2892
2893 * arm.cc (do_finalize_sections): Create the __exidx_start and
2894 __exdix_end symbols even when the section is missing.
2895
7f8cd844
NC
28962010-09-08 Nick Clifton <nickc@redhat.com>
2897
2898 * README: Remove claim that MEMORY is not supported.
2899 * expression.cc (script_exp_function_origin)
2900 (script_exp_function_length): Move from here to ...
2901 * script.cc: ... here.
2902 (script_set_section_region, script_add_memory)
2903 (script_parse_memory_attr, script_include_directive): New
2904 functions.
2905 * script-sections.cc
2906 (class Memory_region): New class.
2907 (class Output_section_definition): Add set_memory_region,
2908 set_section_vma, set_section_lma and get_section_name methods.
2909 (class Script_Sections): Add add_memory_region,
2910 find_memory_region, find_memory_region_origin,
2911 find_memory_region_length and set_memory_region methods.
2912 Have set_section_addresses method walk the list of set memory
2913 regions.
2914 Extend the print methos to display memory regions.
2915 * script-sections.h: Add prototypes for new methods.
2916 Add enum for MEMORY region attributes.
2917 * yyscript.y: Add support for parsing MEMORY regions.
2918 * script-c.h: Add prototypes for new functions.
2919 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2920 * testsuite/Makefile.in: Regenerate.
2921 * testsuite/memory_test.sh: New script.
2922 * testsuite/memory_test.s: New assembler source file.
2923 * testsuite/memory_test.t: New linker script.
2924
a4649286
DK
29252010-08-27 Doug Kwan <dougkwan@google.com>
2926
2927 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2928 reference override an existing dynamic weak reference.
2929 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2930 * testsuite/Makefile.in: Regenerate.
2931 * testsuite/dyn_weak_ref.sh: New file.
2932 * testsuite/dyn_weak_ref_1.c: Ditto.
2933 * testsuite/dyn_weak_ref_2.c: Ditto.
2934
b56648ad
ILT
29352010-08-27 Ian Lance Taylor <iant@google.com>
2936
2937 * incremental.h (class Incremental_input_entry): Add virtual
2938 destructor.
2939
809313cb
ILT
29402010-08-27 Ian Lance Taylor <iant@google.com>
2941
2942 * testsuite/start_lib_test_3.c: Mark t3 as used.
2943
11e32464
NC
29442010-08-27 Nick Clifton <nickc@redhat.com>
2945
2946 * options.cc (version_script): Fix small typo in previous
2947 whitespace tidyup.
2948
ca09d69a
NC
29492010-08-25 Nick Clifton <nickc@redhat.com>
2950
2951 * archive.cc: Formatting fixes: Remove whitespace between
2952 typename and following asterisk. Remove whitespace between
2953 function name and opening parenthesis.
2954 * archive.h: Likewise.
2955 * arm.cc: Likewise.
2956 * attributes.cc: Likewise.
2957 * attributes.h: Likewise.
2958 * common.cc: Likewise.
2959 * copy-relocs.cc: Likewise.
2960 * dirsearch.h: Likewise.
2961 * dynobj.cc: Likewise.
2962 * ehframe.cc: Likewise.
2963 * ehframe.h: Likewise.
2964 * expression.cc: Likewise.
2965 * fileread.cc: Likewise.
2966 * fileread.h: Likewise.
2967 * gc.h: Likewise.
2968 * gold-threads.cc: Likewise.
2969 * gold.cc: Likewise.
2970 * i386.cc: Likewise.
2971 * icf.h: Likewise.
2972 * incremental-dump.cc: Likewise.
2973 * incremental.cc: Likewise.
2974 * layout.cc: Likewise.
2975 * layout.h: Likewise.
2976 * main.cc: Likewise.
2977 * merge.cc: Likewise.
2978 * merge.h: Likewise.
2979 * object.cc: Likewise.
2980 * object.h: Likewise.
2981 * options.cc: Likewise.
2982 * options.h: Likewise.
2983 * output.cc: Likewise.
2984 * output.h: Likewise.
2985 * plugin.cc: Likewise.
2986 * plugin.h: Likewise.
2987 * powerpc.cc: Likewise.
2988 * reloc.cc: Likewise.
2989 * script-c.h: Likewise.
2990 * script-sections.cc: Likewise.
2991 * script.cc: Likewise.
2992 * stringpool.cc: Likewise.
2993 * symtab.cc: Likewise.
2994 * symtab.h: Likewise.
2995 * target.cc: Likewise.
2996 * timer.cc: Likewise.
2997 * timer.h: Likewise.
2998 * version.cc: Likewise.
2999 * x86_64.cc: Likewise.
3000
b8fa8750
NC
30012010-08-24 Nick Clifton <nickc@redhat.com>
3002
3003 PR 11899
3004 * layout.cc (segment_precedes): Sort segments by their physical
3005 addresses, if they have been set.
3006
9919d93b
CC
30072010-08-23 Cary Coutant <ccoutant@google.com>
3008
3009 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3010 symbols data.
3011 (Lib_group::include_member): Unlock object after deleting its
3012 symbols data.
3013 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3014 the bug fixed here.
3015
97b4be1c
CC
30162010-08-19 Neil Vachharajani <nvachhar@google.com>
3017 Cary Coutant <ccoutant@google.com>
3018
3019 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3020 constructor, and set_blocker.
3021 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3022 readsyms_blocker_.
3023 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3024 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3025 * testsuite/Makefile.am (start_lib_test): New test case.
3026 * testsuite/Makefile.in: Regenerate.
3027 * testsuite/start_lib_test_main.c: New file.
3028 * testsuite/start_lib_test_1.c: New file.
3029 * testsuite/start_lib_test_2.c: New file.
3030 * testsuite/start_lib_test_3.c: New file.
3031
dd0b1884
ILT
30322010-08-19 Ian Lance Taylor <iant@google.com>
3033
3034 * Makefile.in: Rebuild with automake 1.11.1.
3035 * aclocal.m4: Likewise.
3036 * testsuite/Makefile.in: Likewise.
3037
7223e9ca
ILT
30382010-08-19 Ian Lance Taylor <iant@google.com>
3039
3040 PR 10893
3041 * i386.cc (class Output_data_plt_i386): Update declarations.
3042 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3043 local_ifuncs_ fields.
3044 (Target_i386::do_plt_section_for_global): New function.
3045 (Target_i386::do_plt_section_for_local): New function.
3046 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3047 parameter; change all callers. Initialize global_ifuncs_ and
3048 local_ifuncs_. If doing a static link define __rel_iplt_start and
3049 __rel_iplt_end.
3050 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3051 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3052 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3053 symbols.
3054 (Target_i386::make_plt_section): New function, broken out of
3055 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3056 (Target_i386::make_plt_entry): Call make_plt_section.
3057 (Target_i386::make_local_ifunc_plt_entry): New function.
3058 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3059 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3060 R_386_IRELATIVE to switch.
3061 (Target_i386::Scan::global): Likewise.
3062 (Target_i386::Relocate::relocate): Likewise.
3063 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3064 switch.
3065 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3066 (Target_x86_64::do_plt_section_for_global): New function.
3067 (Target_x86_64::do_plt_section_for_local): New function.
3068 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3069 parameter; change all callers. If doing a static link define
3070 __rela_iplt_start and __rela_iplt_end.
3071 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3072 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3073 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3074 to point to .plt.
3075 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3076 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3077 switch.
3078 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3079 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3080 R_X86_64_IRELATIVE to switch.
3081 (Target_x86_64::Scan::global): Likewise.
3082 (Target_x86_64::Relocate::relocate): Likewise.
3083 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3084 switch.
3085 * target.h (class Target): Add plt_section_for_global and
3086 plt_section_for_local functions. Add do_plt_section_for_global
3087 and do_plt_section_for_local virtual functions.
3088 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3089 clarifying comments.
3090 (Symbol::use_plt_offset): Handle IFUNC symbol.
3091 * object.cc (Sized_relobj::Sized_relobj): Initialize
3092 local_plt_offsets_.
3093 (Sized_relobj::local_has_plt_offset): New function.
3094 (Sized_relobj::local_plt_offset): New function.
3095 (Sized_relobj::set_local_plt_offset): New function.
3096 (Sized_relobj::do_count): Handle IFUNC symbol.
3097 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3098 a bit away from input_shndx_ field. Add set_is_func_symbol and
3099 is_ifunc_symbol functions.
3100 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3101 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3102 local_plt_offsets_ field.
3103 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3104 * output.h (class Output_section_data): Add non-const
3105 output_section function.
3106 (class Output_data_got): Update declarations.
3107 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3108 Add use_plt_offset parameter to global and local constructors.
3109 Change all callers. Change local_sym_index_ field to 31 bits.
3110 Change GSYM_CODE and CONSTANT_CODE accordingly.
3111 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3112 doing a static link don't set sh_link field.
3113 (Output_data_got::Got_entry::write): Use PLT offset if
3114 appropriate.
3115 (Output_data_got::add_global_plt): New function.
3116 (Output_data_got::add_local_plt): New function.
3117 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3118 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3119 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3120 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3121 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3122 IFUNC conditional.
3123 * testsuite/ifunc-sel.h: New file.
3124 * testsuite/ifuncmain1.c: New file.
3125 * testsuite/ifuncmain1vis.c: New file.
3126 * testsuite/ifuncmod1.c: New file.
3127 * testsuite/ifuncdep2.c: New file.
3128 * testsuite/ifuncmain2.c: New file.
3129 * testsuite/ifuncmain3.c: New file.
3130 * testsuite/ifuncmod3.c: New file.
3131 * testsuite/ifuncmain4.c: New file.
3132 * testsuite/ifuncmain5.c: New file.
3133 * testsuite/ifuncmod5.c: New file.
3134 * testsuite/ifuncmain6pie.c: New file.
3135 * testsuite/ifuncmod6.c: New file.
3136 * testsuite/ifuncmain7.c: New file.
3137 * configure, testsuite/Makefile.in: Rebuild.
3138
56f75c03
ILT
31392010-08-18 Ian Lance Taylor <iant@google.com>
3140
3141 * incremental.cc
3142 (Output_section_incremental_inputs::write_input_files): Add cast
3143 to avoid signed/unsigned comparison warning.
3144 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3145
55455f89
CC
31462010-08-12 Cary Coutant <ccoutant@google.com>
3147
3148 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3149
e2054bcb
ILT
31502010-08-13 Ian Lance Taylor <iant@google.com>
3151
3152 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3153
74f67560
DK
31542010-08-12 Cary Coutant <ccoutant@google.com>
3155 Doug Kwan <dougkwan@google.com>
3156
3157 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3158 defintion overrides non-weak undef, remember that the original undef
3159 is not weak.
3160 * symtab.cc (Symbol_table::sized_write_global): For undef without
3161 an original weak binding, set binding to global in output.
3162 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3163 * testsuite/Makefile.in: Regenerate.
3164 * testsuite/strong_ref_weak_def.sh: New file.
3165 * testsuite/strong_ref_weak_def_1.c: Ditto.
3166 * testsuite/strong_ref_weak_def_2.c: Ditto.
3167
d1238d12
CC
31682010-08-12 Cary Coutant <ccoutant@google.com>
3169
3170 * testsuite/incremental_test.sh: Rewrite.
3171 * testsuite/incremental_test_1.c: Rewrite.
3172 * testsuite/incremental_test_2.c: Rewrite.
3173
0e70b911
CC
31742010-08-12 Cary Coutant <ccoutant@google.com>
3175
3176 * arm.cc (Target_arm::got_size): Add const.
3177 (Target_arm::got_entry_count): New function.
3178 (Target_arm::plt_entry_count): New function.
3179 (Target_arm::first_plt_entry_offset): New function.
3180 (Target_arm::plt_entry_size): New function.
3181 (Output_data_plt_arm::entry_count): New function.
3182 (Output_data_plt_arm::first_plt_entry_offset): New function.
3183 (Output_data_plt_arm::get_plt_entry_size): New function.
3184 * i386.cc (Target_i386::got_size): Add const.
3185 (Target_i386::got_entry_count): New function.
3186 (Target_i386::plt_entry_count): New function.
3187 (Target_i386::first_plt_entry_offset): New function.
3188 (Target_i386::plt_entry_size): New function.
3189 (Output_data_plt_i386::entry_count): New function.
3190 (Output_data_plt_i386::first_plt_entry_offset): New function.
3191 (Output_data_plt_i386::get_plt_entry_size): New function.
3192 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3193 find_incremental_inputs_sections. Dump incremental_got_plt section.
3194 * incremental.cc: Include target.h.
3195 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3196 parameter. Adjust all callers. Find incremental_got_plt section.
3197 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3198 section.
3199 (Output_section_incremental_inputs::set_final_data_size): Calculate
3200 size of incremental_got_plt section.
3201 (Output_section_incremental_inputs::do_write): Write the
3202 incremental_got_plt section.
3203 (Got_plt_view_info): New struct.
3204 (Local_got_offset_visitor): New class.
3205 (Global_got_offset_visitor): New class.
3206 (Global_symbol_visitor_got_plt): New class.
3207 (Output_section_incremental_inputs::write_got_plt): New function.
3208 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3209 Add parameter. Adjust all callers.
3210 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3211 (Incremental_inputs::got_plt_section): New function.
3212 (Incremental_inputs::got_plt_section_): New data member.
3213 (Incremental_got_plt_reader): New class.
3214 * layout.cc (Layout::create_incremental_info_sections): Add the
3215 incremental_got_plt section.
3216 * object.h (Got_offset_list::get_list): New function.
3217 (Got offset_list::for_all_got_offsets): New function.
3218 (Sized_relobj::local_got_offset_list): New function.
3219 * powerpc.cc (Target_powerpc::got_size): Add const.
3220 (Target_powerpc::got_entry_count): New function.
3221 (Target_powerpc::plt_entry_count): New function.
3222 (Target_powerpc::first_plt_entry_offset): New function.
3223 (Target_powerpc::plt_entry_size): New function.
3224 (Output_data_plt_powerpc::entry_count): New function.
3225 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3226 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3227 * sparc.cc (Target_sparc::got_size): Add const.
3228 (Target_sparc::got_entry_count): New function.
3229 (Target_sparc::plt_entry_count): New function.
3230 (Target_sparc::first_plt_entry_offset): New function.
3231 (Target_sparc::plt_entry_size): New function.
3232 (Output_data_plt_sparc::entry_count): New function.
3233 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3234 (Output_data_plt_sparc::get_plt_entry_size): New function.
3235 * symtab.h (Symbol::got_offset_list): New function.
3236 (Symbol_table::for_all_symbols): New function.
3237 * target.h (Sized_target::got_entry_count): New function.
3238 (Sized_target::plt_entry_count): New function.
3239 (Sized_target::plt_entry_size): New function.
3240 * x86_64.cc (Target_x86_64::got_size): Add const.
3241 (Target_x86_64::got_entry_count): New function.
3242 (Target_x86_64::plt_entry_count): New function.
3243 (Target_x86_64::first_plt_entry_offset): New function.
3244 (Target_x86_64::plt_entry_size): New function.
3245 (Output_data_plt_x86_64::entry_count): New function.
3246 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3247 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3248
09ec0418
CC
32492010-08-12 Cary Coutant <ccoutant@google.com>
3250
3251 * archive.cc: Include incremental.h.
3252 (Archive::Archive): Initialize incremental_info_.
3253 (Archive::include_member): Record archive members in incremental info.
3254 (Add_archive_symbols::run): Record begin and end of an archive in
3255 incremental info.
3256 (Lib_group::include_member): Record objects in incremental info.
3257 * archive.h (Incremental_archive_entry): Forward declaration.
3258 (Archive::set_incremental_info): New member function.
3259 (Archive::incremental_info): New member function.
3260 (Archive::Unused_symbol_iterator): New class.
3261 (Archive::unused_symbols_begin): New member function.
3262 (Archive::unused_symbols_end): New member function.
3263 (Archive::incremental_info_): New data member.
3264 * incremental-dump.cc (find_input_containing_global): New function.
3265 (dump_incremental_inputs): Dump new incremental info sections.
3266 * incremental.cc: Include symtab.h.
3267 (Output_section_incremental_inputs): New class.
3268 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3269 new incremental info sections.
3270 (Sized_incremental_binary::do_check_inputs): Likewise.
3271 (Incremental_inputs::report_archive): Remove.
3272 (Incremental_inputs::report_archive_begin): New function.
3273 (Incremental_inputs::report_archive_end): New function.
3274 (Incremental_inputs::report_object): New function.
3275 (Incremental_inputs::finalize_inputs): Remove.
3276 (Incremental_inputs::report_input_section): New function.
3277 (Incremental_inputs::report_script): Rewrite.
3278 (Incremental_inputs::finalize): Do nothing but finalize string table.
3279 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3280 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3281 (Incremental_inputs::create_data_sections): New function.
3282 (Incremental_inputs::relocs_entsize): New function.
3283 (Output_section_incremental_inputs::set_final_data_size): New function.
3284 (Output_section_incremental_inputs::do_write): New function.
3285 (Output_section_incremental_inputs::write_header): New function.
3286 (Output_section_incremental_inputs::write_input_files): New function.
3287 (Output_section_incremental_inputs::write_info_blocks): New function.
3288 (Output_section_incremental_inputs::write_symtab): New function.
3289 * incremental.h (Incremental_script_entry): Forward declaration.
3290 (Incremental_object_entry): Forward declaration.
3291 (Incremental_archive_entry): Forward declaration.
3292 (Incremental_inputs): Forward declaration.
3293 (Incremental_inputs_header_data): Remove.
3294 (Incremental_inputs_header): Remove.
3295 (Incremental_inputs_header_write): Remove.
3296 (Incremental_inputs_entry_data): Remove.
3297 (Incremental_inputs_entry): Remove.
3298 (Incremental_inputs_entry_write): Remove.
3299 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3300 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3301 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3302 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3303 Likewise.
3304 (Incremental_input_entry): New class.
3305 (Incremental_script_entry): New class.
3306 (Incremental_object_entry): New class.
3307 (Incremental_archive_entry): New class.
3308 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3309 (Incremental_inputs::report_inputs): Remove.
3310 (Incremental_inputs::report_archive): Remove.
3311 (Incremental_inputs::report_archive_begin): New function.
3312 (Incremental_inputs::report_archive_end): New function.
3313 (Incremental_inputs::report_object): Change prototype.
3314 (Incremental_inputs::report_input_section): New function.
3315 (Incremental_inputs::report_script): Change prototype.
3316 (Incremental_inputs::get_reloc_count): New function.
3317 (Incremental_inputs::set_reloc_count): New function.
3318 (Incremental_inputs::create_data_sections): New function.
3319 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3320 (Incremental_inputs::inputs_section): New function.
3321 (Incremental_inputs::symtab_section): New function.
3322 (Incremental_inputs::relocs_section): New function.
3323 (Incremental_inputs::get_stringpool): Add const.
3324 (Incremental_inputs::command_line): Add const.
3325 (Incremental_inputs::inputs): Remove.
3326 (Incremental_inputs::command_line_key): New function.
3327 (Incremental_inputs::input_file_count): New function.
3328 (Incremental_inputs::input_files): New function.
3329 (Incremental_inputs::relocs_entsize): New function.
3330 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3331 (Incremental_inputs::finalize_inputs): Remove.
3332 (Incremental_inputs::Input_info): Remove.
3333 (Incremental_inputs::lock_): Remove.
3334 (Incremental_inputs::inputs_): Change type.
3335 (Incremental_inputs::inputs_map_): Remove.
3336 (Incremental_inputs::current_object_entry_): New data member.
3337 (Incremental_inputs::inputs_section_): New data member.
3338 (Incremental_inputs::symtab_section_): New data member.
3339 (Incremental_inputs::relocs_section_): New data member.
3340 (Incremental_inputs::reloc_count_): New data member.
3341 (Incremental_inputs_reader): New class.
3342 (Incremental_symtab_reader): New class.
3343 (Incremental_relocs_reader): New class.
3344 * layout.cc (Layout::finalize): Move finalization of incremental info
3345 and creation of incremental info sections to follow finalization of
3346 symbol table. Set offsets for postprocessing sections.
3347 (Layout::create_incremental_info_sections): Call
3348 Incremental_inputs::create_data_sections. Add incremental symtab
3349 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3350 sections to layout after input sections.
3351 * layout.h (struct Timespec): Forward declaration.
3352 (Layout::incremental_inputs): Add const.
3353 (Layout::create_incremental_info_sections): Add parameter.
3354 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3355 * object.cc: Include incremental.h.
3356 (Relobj::finalize_incremental_relocs): New function.
3357 (Sized_relobj::do_layout): Record input sections in incremental info.
3358 * object.h (Object::output_section): New function.
3359 (Object::output_section_offset): Moved from Relobj.
3360 (Object::get_incremental_reloc_base): New function.
3361 (Object::get_incremental_reloc_count): New function.
3362 (Object::do_output_section): New function.
3363 (Object::do_output_section_offset): Moved from Relobj.
3364 (Object::do_get_incremental_reloc_base): New function.
3365 (Object::do_get_incremental_reloc_count): New function.
3366 (Object::Object): Initialize new data members.
3367 (Relobj::output_section): Renamed do_output_section and moved to
3368 protected.
3369 (Relobj::output_section_offset): Moved to Object.
3370 (Relobj::do_get_incremental_reloc_base): New function.
3371 (Relobj::do_get_incremental_reloc_count): New function.
3372 (Relobj::allocate_incremental_reloc_counts): New function.
3373 (Relobj::count_incremental_reloc): New function.
3374 (Relobj::finalize_incremental_relocs): New function.
3375 (Relobj::next_incremental_reloc_index): New function.
3376 (Relobj::reloc_counts_): New data member.
3377 (Relobj::reloc_bases_): New data member.
3378 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3379 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3380 (Sized_relobj::incremental_relocs_scan): New function.
3381 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3382 (Sized_relobj::incremental_relocs_write): New function.
3383 (Sized_relobj::incremental_relocs_write_reltype): New function.
3384 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3385 incremental link.
3386 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3387 archives and object files elsewhere.
3388 (Add_symbols::run): Report object files here.
3389 (Finish_group::run): Report end of archive at end of group.
3390 * reloc.cc: Include layout.h, incremental.h.
3391 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3392 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3393 (Sized_relobj::incremental_relocs_scan): New function.
3394 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3395 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3396 (Sized_relobj::incremental_relocs_write): New function.
3397 (Sized_relobj::incremental_relocs_write_reltype): New function.
3398 * script.cc (read_input_script): Rewrite test for incremental link.
3399 Change call to Incremental_inputs::report_script.
3400 * symtab.h (Symbol_table::first_global_index): New function.
3401 (Symbol_table::output_count): New function.
3402
ce0d1972
DK
34032010-08-12 Doug Kwan <dougkwan@google.com>
3404
3405 * arm.cc (Target_arm::merge_object_attributes): Check command line
3406 options --no-wchar-size-warning and --no-enum-size-warning.
3407 * options.h (General_options): Add ld-compatible options
3408 --no-enum-size-warning and --no-wchar-size-warning.
3409
6e5710ce
ILT
34102010-08-04 Ian Lance Taylor <iant@google.com>
3411
3412 * x86_64.cc (Target_x86_64::Scan::local): Use
3413 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3414 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3415 (Target_x86_64::Scan::global): Likewise.
3416 (Target_x86_64::Relocate::relocate): Likewise.
3417 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3418 Likewise.
3419
fef830db
CC
34202010-08-03 Cary Coutant <ccoutant@google.com>
3421
3422 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3423 to reserve space in merged_strings vector. Keep total input size
3424 for stats.
3425 (Output_merge_string::do_print_merge_stats): Print total input size.
3426 * merge.h (Output_merge_string): Add input_size_ field.
3427 * stringpool.cc (Stringpool_template::string_length): Move
3428 implementations out of Stringpool_template class and place in
3429 stringpool.h.
3430 * stringpool.h (string_length): Move out of Stringpool_template.
3431
1e3811b0
ILT
34322010-08-03 Ian Lance Taylor <iant@google.com>
3433
3434 PR 11712
3435 * layout.cc (relaxation_loop_body): If address of load segment is
3436 set, adjust address to include headers if possible.
3437
7af0c620
ILT
34382010-08-03 Ian Lance Taylor <iant@google.com>
3439
3440 * version.cc (version_string): Bump to 1.10.
3441
22f0da72
ILT
34422010-08-03 Ian Lance Taylor <iant@google.com>
3443
3444 PR 11805
3445 * layout.h (enum Output_section_order): Define.
3446 (class Layout): Update declarations.
3447 * layout.cc (Layout::get_output_section): Add order parameter.
3448 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3449 is_first_non_relro parameters. Change all callers.
3450 (Layout::choose_output_section): Likewise.
3451 (Layout::add_output_section_data): Likewise.
3452 (Layout::make_output_section): Likewise. Set order.
3453 (Layout::default_section_order): New function.
3454 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3455 * output.cc (Output_section::Output_section): Initialize order_.
3456 Don't initialize deleted fields.
3457 (Output_segment::Output_segment): Don't initialize deleted
3458 fields.
3459 (Output_segment::add_output_section_to_load): New function
3460 replacing add_output_section. Change all callers to call this or
3461 add_output_section_to_nonload.
3462 (Output_segment::add_output_section_to_nonload): New function.
3463 (Output_segment::remove_output_section): Rewrite.
3464 (Output_segment::add_initial_output_data): Likewise.
3465 (Output_segment::has_any_data_sections): Likewise.
3466 (Output_segment::is_first_section_relro): Likewise.
3467 (Output_segment::maximum_alignment): Likewise.
3468 (Output_segment::has_dynamic_reloc): New function replacing
3469 dynamic_reloc_count. Change all callers.
3470 (Output_segment::has_dynamic_reloc_list): New function replacing
3471 dynamic_reloc_count_list. Change all callers.
3472 (Output_segment::set_section_addresses): Rewrite.
3473 (Output_segment::set_offset): Rewrite.
3474 (Output_segment::find_first_and_last_list): Remove.
3475 (Output_segment::set_tls_offsets): Rewrite.
3476 (Output_segment::first_section_load_address): Likewise.
3477 (Output_segment::output_section_count): Likewise.
3478 (Output_segment::section_with_lowest_load_address): Likewise.
3479 (Output_segment::write_section_headers): Likewise.
3480 (Output_segment::print_sections_to_map): Likewise.
3481 * output.h (class Output_data): Remove dynamic_reloc_count_
3482 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3483 (Output_data::add_dynamic_reloc): Rewrite.
3484 (Output_data::has_dynamic_reloc): New function.
3485 (Output_data::dynamic_reloc_count): Remove.
3486 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3487 is_last_relro_, is_first_non_relro_, is_interp_,
3488 is_dynamic_linker_section_ fields. Add order and set_order
3489 functions. Remove is_relro_local, set_is_relro_local,
3490 is_last_relro, set_is_last_relro, is_first_non_relro,
3491 set_is_first_non_relro functions, is_interp, set_is_interp,
3492 is_dynamic_linker_section, and set_is_dynamic_linker_section
3493 functions.
3494 (class Output_segment): Change Output_data_list from std::list to
3495 std:;vector. Add output_lists_ field. Remove output_data_ and
3496 output_bss_ fields. Update declarations.
3497
3ff2ccb0
ILT
34982010-08-02 Ian Lance Taylor <iant@google.com>
3499
3500 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3501 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3502 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3503
88a4108b
ILT
35042010-08-02 Ian Lance Taylor <iant@google.com>
3505
3506 PR 11855
3507 * script.cc (Script_options::Script_options): Initialize
3508 symbol_definitions_ and symbol_references_.
3509 (Script_options::add_symbol_assignment): Update
3510 symbol_definitions_ and symbol_references_.
3511 (Script_options::add_symbol_reference): New function.
3512 (script_symbol): New function.
3513 * script.h (class Script_options): Add symbol_definitions_ and
3514 symbol_references_ fields.
3515 (Script_options::referenced_const_iterator): New type.
3516 (Script_options::referenced_begin): New function.
3517 (Script_options::referenced_end): New function.
3518 (Script_options::is_referenced): New function.
3519 (Script_options::any_unreferenced): New function.
3520 * script-c.h (script_symbol): Declare.
3521 * yyscript.y (exp): Call script_symbol.
3522 * symtab.cc: Include "script.h".
3523 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3524 Change all callers. Check symbols referenced by scripts.
3525 (Symbol_table::add_undefined_symbols_from_command_line): Add
3526 layout parameter. Change all callers.
3527 (Symbol_table::do_add_undefined_symbols_from_command_line):
3528 Likewise. Break out loop body. Check symbols referenced by
3529 scripts.
3530 (Symbol_table::add_undefined_symbol_from_command_line): New
3531 function broken out of
3532 do_add_undefined_symbols_from_command_line.
3533 * symtab.h (class Symbol_table): Update declarations.
3534 * archive.cc: Include "layout.h".
3535 (Archive::should_include_member): Add layout parameter. Change
3536 all callers. Check for symbol mentioned in expression.
3537 * archive.h (class Archive): Update declaration.
3538 * object.cc (Sized_relobj::do_should_include_member): Add layout
3539 parameter.
3540 * object.h (Object::should_include_member): Add layout parameter.
3541 Change all callers.
3542 (Object::do_should_include_member): Add layout parameter.
3543 (class Sized_relobj): Update declaration.
3544 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3545 parameter.
3546 * dynobj.h (class Sized_dynobj): Update declaration.
3547 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3548 layout parameter.
3549 * plugin.h (class Sized_pluginobj): Update declaration.
3550
5f1ab67a
ILT
35512010-08-02 Ian Lance Taylor <iant@google.com>
3552
3553 PR 11866
3554 * output.cc (Output_segment::set_offset): Search for the first and
3555 last sections rather than assuming that the list is in order.
3556 (Output_segment::find_first_and_last_list): New function.
3557 * output.h (class Output_segment): Update declarations.
3558 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3559 (relro_strip_test_SOURCES): New variable.
3560 (relro_strip_test_DEPENDENCIES): New variable.
3561 (relro_strip_test_LDFLAGS): New variable.
3562 (relro_strip_test_LDADD): New variable.
3563 (relro_strip_test.so): New target.
3564
a8df5856
ILT
35652010-08-02 Ian Lance Taylor <iant@google.com>
3566
3567 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3568 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3569 (Target_i386::got_tlsdesc_section): New function.
3570 (Target_i386::got_section): Create space for GOT entries for
3571 TLSDESC relocations.
3572 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3573 R_386_TLS_GOTDESC.
3574 (Target_i386::Scan::global): Likewise.
3575 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3576 using TLSDESC GOT.
3577 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3578 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3579 (Target_x86_64::got_tlsdesc_section): New function.
3580 (Target_x86_64::got_section): Create space for GOT entries for
3581 TLSDESC relocations.
3582 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3583 R_386_TLS_GOTDESC.
3584 (Target_x86_64::Scan::global): Likewise.
3585 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3586 using TLSDESC GOT.
3587
0c10a0a6
ILT
35882010-08-02 Ian Lance Taylor <iant@google.com>
3589
3590 * testsuite/final_layout.sh: Use dc to convert from hex to
3591 decimal.
3592
41cbeecc
ST
35932010-07-29 Sriraman Tallam <tmsriram@google.com>
3594
3595 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3596 paramter to the call to gold::gc_process_relocs.
3597 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3598 paramter to the call to gold::gc_process_relocs.
3599 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3600 parameter to the call to gold::gc_process_relocs.
3601 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3602 template parameter to the call to gold::gc_process_relocs.
3603 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3604 paramter to the call to gold::gc_process_relocs.
3605 * gc.h (get_embedded_addend_size): New function.
3606 (gc_process_relocs): Save the size of the reloc for use by ICF.
3607 * icf.cc (get_section_contents): Get the addend from the text section
3608 for SHT_REL relocation sections.
3609 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3610 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3611 * int_encoding.h (read_from_pointer): New overloaded function.
3612 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3613 * testsuite/icf_sht_rel_addend_test.sh: New file.
3614 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3615 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3616
6ea55b82
RW
36172010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3618
3619 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3620 * Makefile.in: Regenerate.
3621 * testsuite/Makefile.in: Regenerate.
3622
9691462b
ILT
36232010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3624
3625 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3626 * gold/testsuite/debug_msg.cc: Likewise.
3627 * gold/testsuite/odr_violation1.cc
3628 * gold/testsuite/odr_violation2.cc
3629
76897331
CC
36302010-07-21 Cary Coutant <ccoutant@google.com>
3631
3632 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3633 string, and length fields.
3634 (Output_merge_string::Merged_strings_list): New type.
3635 (Output_merge_string::Merged_strings_lists): New typedef.
3636 (Output_merge_string): Replace merged_strings_ with
3637 merged_strings_lists_.
3638 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3639 Merged_strings_list per input object and section. Don't store pointer
3640 to the string. Don't store length with each merged string entry.
3641 (Output_merge_string::finalize_merged_data): Loop over list of merged
3642 strings lists. Recompute length of each merged string.
3643
78384e8f
CC
36442010-07-15 Cary Coutant <ccoutant@google.com>
3645
3646 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3647 here.
3648
783659f9
ILT
36492010-07-14 Ian Lance Taylor <iant@google.com>
3650
3651 * descriptors.cc (Descriptors::open): Report correct name in error
3652 message.
3653
131687b4
DK
36542010-07-13 Doug Kwan <dougkwan@google.com>
3655
3656 * arm.cc (Arm_input_section::Arm_input_section): For a
3657 SHT_ARM_EXIDX section, always keeps the input sections.
3658 (Arm_input_section::set_exidx_section_link): New method.
3659 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3660 has_errors_ to false.
3661 (Arm_exidx_input_section::has_errors,
3662 Arm_exidx_input_section::set_has_errors): New methods.
3663 (Arm_exidx_input_section::has_errors_): New data member.
3664 (Arm_relobj::get_exidx_shndx_list): New method.
3665 (Arm_output_section::append_text_sections_to_list): Do not skip
3666 section without SHF_EXECINSTR.
3667 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3668 errors.
3669 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3670 section header. Make error messages more verbose. Check for
3671 a non-executable section linked to an EXIDX section.
3672 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3673 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3674 check that there is no deferred EXIDX section if we exit early.
3675 Instead of not making an EXIDX section in case of an error, make one
3676 and set the has_errors flag of it.
3677 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3678 in a relocatable link.
3679 (Target_arm::do_relax): Look for the EXIDX output section instead of
3680 assuming that it is called .ARM.exidx.
3681 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3682 section list. Do not check for SHF_EXECINSTR section flags but
3683 skip any input section with errors.
3684 * output.cc (Output_section::Output_section): Initialize
3685 always_keeps_input_sections_ to false.
3686 (Output_section::add_input_section): Check for
3687 always_keeps_input_sections_.
3688 * output.h (Output_section::always_keeps_input_sections,
3689 Output_section::set_always_keeps_input_sections): New methods.
3690 (Output_section::always_keeps_input_sections): New data member.
3691
69517287
RÁE
36922010-07-13 Rafael Espindola <espindola@google.com>
3693
3694 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3695 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3696
82742395
ILT
36972010-07-13 Philip Herron <herron.philip@googlemail.com>
3698 Ian Lance Taylor <iant@google.com>
3699
3700 * output.h (Output_section_lookup_maps::add_merge_section):
3701 Correct check of whether value was inserted.
3702 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3703 (Output_section_lookup_maps::add_relaxed_input_section):
3704 Likewise.
3705 * arm.cc (Target_arm::got_section): Remove used local os.
3706 * i386.cc (Target_i386::got_section): Likewise.
3707 * x86_64.cc (Target_x86_64::got_section): Likewise.
3708 * sparc.cc (Target_sparc::got_section): Likewise.
3709 (Target_sparc::relocate): Remove unused local have_got_offset.
3710 * powerpc.cc (Target_powerpc::relocate): Likewise.
3711
f2d707b5
ILT
37122010-07-13 Ian Lance Taylor <iant@google.com>
3713
241531d6
ILT
3714 * compressed_output.cc (zlib_decompress): Fix signature in
3715 !HAVE_ZLIB_H case.
3716
f2d707b5
ILT
3717 * archive.cc (Archive::include_member): Unlock an external member
3718 of a thin archive. Don't bother to delete an object we know is
3719 NULL.
3720
a2e47362
CC
37212010-07-12 Cary Coutant <ccoutant@google.com>
3722
3723 * compressed_output.cc (zlib_decompress): New function.
3724 (get_uncompressed_size): New function.
3725 (decompress_input_section): New function.
3726 * compressed_output.h (get_uncompressed_size): New function.
3727 (decompress_input_section): New function.
3728 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3729 Handle compressed debug sections.
3730 * layout.cc (is_compressed_debug_section): New function.
3731 (Layout::output_section_name): Map compressed section names to
3732 canonical names.
3733 * layout.h (is_compressed_debug_section): New function.
3734 (is_debug_info_section): Recognize compressed debug sections.
3735 * merge.cc: Include compressed_output.h.
3736 (Output_merge_data::do_add_input_section): Handle compressed
3737 debug sections.
3738 (Output_merge_string::do_add_input_section): Handle compressed
3739 debug sections.
3740 * object.cc: Include compressed_output.h.
3741 (Sized_relobj::Sized_relobj): Initialize new data members.
3742 (build_compressed_section_map): New function.
3743 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3744 * object.h (Object::section_is_compressed): New method.
3745 (Object::do_section_is_compressed): New method.
3746 (Sized_relobj::Compressed_section_map): New type.
3747 (Sized_relobj::do_section_is_compressed): New method.
3748 (Sized_relobj::compressed_sections_): New data member.
3749 * output.cc (Output_section::add_input_section): Handle compressed
3750 debug sections.
3751 * reloc.cc: Include compressed_output.h.
3752 (Sized_relobj::write_sections): Handle compressed debug sections.
3753
ce279a62
CC
37542010-07-08 Cary Coutant <ccoutant@google.com>
3755
3756 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3757 weak when resolving to a dynamic def.
3758 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3759 for weak undef/dynamic def cases. Adjust callers.
3760 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3761 undef_binding_weak_.
3762 (Symbol_table::sized_write_globals): Adjust symbol binding.
3763 (Symbol_table::sized_write_symbol): Add binding parameter.
3764 * symtab.h (Symbol::set_undef_binding): New method.
3765 (Symbol::is_undef_binding_weak): New method.
3766 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3767 (Symbol_table::should_override): Add new parameter.
3768 (Symbol_table::sized_write_symbol): Add new parameter.
3769
3770 * testsuite/weak_undef_file1.cc: Add new test case.
3771 * testsuite/weak_undef_file2.cc: Fix header comment.
3772 * testsuite/weak_undef_test.cc: Add new test case.
3773
b2286c10
DK
37742010-06-29 Doug Kwan <dougkwan@google.com>
3775
3776 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3777 Initialize USE_SYMBOL_.
3778 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3779 definition.
3780 (Arm_reloc_property::uses_symbol_): New data member declaration.
3781 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3782 uses symbol value and symbol is undefined but not weakly undefined.
3783
4802450a
RÁE
37842010-06-28 Rafael Espindola <espindola@google.com>
3785
3786 * plugin.cc (Plugin::load): Use dlerror.
3787
e5ca47ba
ILT
37882010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3789
3790 * symtab.cc (detect_odr_violations): When reporting an ODR
3791 violation, report an object where the symbol is defined.
3792
8a75a161
DK
37932010-06-25 Doug Kwan <dougkwan@google.com>
3794
3795 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3796 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3797 definition.
3798 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3799 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3800 target hook to detect function points.
3801 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3802 * icf.h (Icf::check_section_for_function_pointers): Change type of
3803 parameter SECTION_NAME to const reference to std::string. Use
3804 target hook to determine if section may have unsafe pointers.
3805 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3806 method definition.
3807
42218b9f
RÁE
38082010-06-21 Rafael Espindola <espindola@google.com>
3809
3810 * fileread.cc (Input_file::find_fie): New
3811 (Input_file::open): Use Input_file::find_fie.
3812 * fileread.h (Input_file::find_fie): New
3813 * plugin.cc (set_extra_library_path): New.
3814 (Plugin::load): Add set_extra_library_path to the transfer vector.
3815 (Plugin_manager::set_extra_library_path): New.
3816 (Plugin_manager::add_input_file): Use the extra search path if set.
3817 (set_extra_library_path(): New.
3818 * plugin.h (Plugin_manager): Add set_extra_library_path and
3819 extra_search_path_.
3820
a0506cca
CC
38212010-06-19 Cary Coutant <ccoutant@google.com>
3822
3823 * layout.cc (gdb_sections): Add .debug_types.
3824 (lines_only_debug_sections): Likewise.
3825
6508b958
RÁE
38262010-06-18 Rafael Espindola <espindola@google.com>
3827
3828 * plugin.cc (add_input_file,add_input_library)
3829 (Plugin_manager::add_input_file): Make filename arguments const.
3830 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3831 const.
3832
3e235302
DK
38332010-06-16 Doug Kwan <dougkwan@google.com>
3834
3835 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3836 .ARM.attributes section if we have not merged any input
3837 attributes sections.
3838
106e8a6c
DK
38392010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3840
3841 * arm.cc: Allow combining objects with no EABI version
3842 information.
3843
91ff43fe
RÁE
38442010-06-15 Rafael Espindola <espindola@google.com>
3845
3846 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3847
68ed838c
ILT
38482010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3849
3850 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3851 (struct iovec): Correct !HAVE_READV definition.
3852
f3a2388f
CC
38532010-06-10 Cary Coutant <ccoutant@google.com>
3854
3855 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3856 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3857 reloc sections.
3858 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3859
3860 PR 11683
3861 * symtab.h (Symbol::is_placeholder): New member function.
3862 * target-reloc.h (relocate_section): Check for placeholder symbols.
3863
3864 * testsuite/Makefile.am (plugin_test_8): New test.
3865 (plugin_test_9): New test.
3866 * testsuite/Makefile.in: Regenerate.
3867
e1df38aa
NC
38682010-06-09 Nick Clifton <nickc@redhat.com>
3869
3870 * yyscript.y (input_list_element): Allow strings prefixed with
3871 the '-' character. Treat these as libraries.
3872 * script.cc (script_add_library): New function. Adds a library
3873 specified by "-l<name>" found in an input script.
3874 * script-c.h: Add prototype for script_add_library.
3875
25bbe950
DK
38762010-06-07 Doug Kwan <dougkwan@google.com>
3877
3878 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3879 Restrict stub-group size to be within long conditional branch
3880 range when working around cortex-A8 erratum.
3881
0f32ea4c
ILT
38822010-06-07 Damien Diederen <dd@crosstwine.com>
3883
3884 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3885 #ifdef typo.
3886
8fe2a369
ST
38872010-06-03 Sriraman Tallam <tmsriram@google.com>
3888
3889 PR gold/11658
3890 * output.cc
3891 (Output_section::Input_section_sort_entry::compare_section_ordering):
3892 Change to return non-zero correctly.
3893 (Output_section::Input_section_sort_section_order_index_compare
3894 ::operator()): Change to fix ambiguity in comparisons.
3895
6e9ba2ca
ST
38962010-06-01 Sriraman Tallam <tmsriram@google.com>
3897
3898 * gold.h (is_wildcard_string): New function.
3899 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3900 (Layout::layout_eh_frame): Ditto.
3901 (Layout::find_section_order_index): New method.
3902 (Layout::read_layout_from_file): New method.
3903 * layout.h (Layout::find_section_order_index): New method.
3904 (Layout::read_layout_from_file): New method.
3905 (Layout::input_section_position_): New private member.
3906 (Layout::input_section_glob_): New private member.
3907 * main.cc (main): Call read_layout_from_file here.
3908 * options.h (--section-ordering-file): New option.
3909 * output.cc (Output_section::input_section_order_specified_): New
3910 member.
3911 (Output_section::Output_section): Initialize new member.
3912 (Output_section::add_input_section): Add new parameter.
3913 Keep input sections when --section-ordering-file is used.
3914 (Output_section::set_final_data_size): Sort input sections when
3915 section ordering file is specified.
3916 (Output_section::Input_section_sort_entry): Add new parameter.
3917 Check sorting type.
3918 (Output_section::Input_section_sort_entry::compare_section_ordering):
3919 New method.
3920 (Output_section::Input_section_sort_compare::operator()): Change to
3921 consider section_order_index.
3922 (Output_section::Input_section_sort_init_fini_compare::operator()):
3923 Change to consider section_order_index.
3924 (Output_section::Input_section_sort_section_order_index_compare
3925 ::operator()): New method.
3926 (Output_section::sort_attached_input_sections): Change to sort
3927 according to section order when specified.
e1df38aa
NC
3928 (Output_section::add_input_section<32, true>): Add new parameter.
3929 (Output_section::add_input_section<64, true>): Add new parameter.
3930 (Output_section::add_input_section<32, false>): Add new parameter.
3931 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
3932 * output.h (Output_section::add_input_section): Add new parameter.
3933 (Output_section::input_section_order_specified): New
3934 method.
3935 (Output_section::set_input_section_order_specified): New method.
3936 (Input_section::Input_section): Initialize section_order_index_.
3937 (Input_section::section_order_index): New method.
3938 (Input_section::set_section_order_index): New method.
3939 (Input_section::section_order_index_): New member.
3940 (Input_section::Input_section_sort_section_order_index_compare): New
3941 struct.
3942 (Output_section::input_section_order_specified_): New member.
3943 * script-sections.cc (is_wildcard_string): Delete and move modified
3944 method to gold.h.
3945 (Output_section_element_input::Output_section_element_input): Modify
3946 call to is_wildcard_string.
3947 (Output_section_element_input::Input_section_pattern
3948 ::Input_section_pattern): Ditto.
3949 (Output_section_element_input::Output_section_element_input): Ditto.
3950 * testsuite/Makefile.am (final_layout): New test case.
3951 * testsuite/Makefile.in: Regenerate.
3952 * testsuite/final_layout.cc: New file.
3953 * testsuite/final_layout.sh: New file.
3954
3537c84b
RÁE
39552010-06-01 Rafael Espindola <espindola@google.com>
3956
3957 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3958
105b6afd
RÁE
39592010-06-01 Rafael Espindola <espindola@google.com>
3960
3961 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3962 visibility of symbols.
3963
29e11421
DK
39642010-05-27 Doug Kwan <dougkwan@google.com>
3965
3966 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3967 from start of output section instead of address for a local symbol
3968 in a merged or relaxed section when doing a relocatable link.
3969
5e0f337e
RÁE
39702010-05-26 Rafael Espindola <espindola@google.com>
3971
3972 PR 11604
3973 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3974 adding sections the garbage collector removed.
3975 * gold/testsuite/Makefile.am: Add test.
3976 * gold/testsuite/Makefile.in: Regenerate.
3977 * gold/testsuite/plugin_test_7.sh: New.
3978 * gold/testsuite/plugin_test_7_1.c: New.
3979 * gold/testsuite/plugin_test_7_2.c: New.
3980
f4187277
RÁE
39812010-05-26 Rafael Espindola <espindola@google.com>
3982
3983 * script-sections.cc (Output_section_definition::set_section_addresses):
3984 Check for --section-start.
3985
5c388529
DK
39862010-05-26 Doug Kwan <dougkwan@google.com>
3987
3988 * arm.cc (Arm_scan_relocatable_relocs): New class.
3989 (Target_arm::relocate_special_relocatable): New method.
3990 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3991 (Arm_relocate_functions::thumb_branch_common): Same.
3992 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3993 instead of Default_scan_relocatable_relocs.
3994 * target-reloc.h (relocate_for_relocatable): Let target handle
3995 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3996 * target.h (Sized_target::relocate_special_relocatable): New method.
3997
bca1c3ae
ILT
39982010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3999
4000 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4001
0439c796
DK
40022010-05-23 Doug Kwan <dougkwan@google.com>
4003
4004 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4005 instead of a cast.
4006 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4007 with a direct branch, not a conditional branch, to a stub.
4008 * merge.cc (Output_merge_base::record_input_section): New method
4009 defintion.
4010 (Output_merge_data::do_add_input_section): Record input section if
4011 keeps-input-sections flag is set.
4012 (Output_merge_string::do_add_input_section): Ditto.
4013 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4014 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4015 INPUT_SECTIONS_.
4016 (Output_merge_base::keeps_input_sections,
4017 Output_merge_base::set_keeps_input_sections,
4018 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4019 method definitions.
4020 (Output_merge_base::Input_sections): New type declaration.
4021 (Output_merge_base::input_sections_begin,
4022 Output_merge_base::input_sections_end,
4023 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4024 (Output_merge_base::bool keeps_input_sections_,
4025 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4026 Output_merge_base::input_sections_): New data members.
4027 (Output_merge_data::do_set_keeps_input_sections): New method
4028 defintion.
4029 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4030 * output.cc (Output_section::Input_section::relobj): Move method
4031 defintion from class declaration to here and handle merge sections.
4032 (Output_section::Input_section::shndx): Ditto.
4033 (Output_section::Output_section): Remove initializations of removed
4034 data members and initialize new data member LOOKUP_MAPS_.
4035 (Output_section::add_input_section): Set keeps-input-sections flag
4036 for a newly created merge output section as appropriate. Adjust code
4037 to use Output_section_lookup_maps class.
4038 (Output_section::add_relaxed_input_section): Adjst code for lookup
4039 maps code refactoring.
4040 (Output_section::add_merge_input_section): Add a new parameter
4041 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4042 class. If adding input section to a newly created merge output
4043 section fails, remove the new merge section.
4044 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 4045 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
4046 (Output_section::find_merge_section): Ditto.
4047 (Output_section::build_lookup_maps): New method defintion.
4048 (Output_section::find_relaxed_input_section): Adjust code to use
4049 Output_section_lookup_maps class.
4050 (Output_section::get_input_sections): Export merge sections. Adjust
4051 code to use Output_section_lookup_maps class.
4052 (Output_section:::add_script_input_section): Adjust code to use
4053 Output_section_lookup_maps class. Update lookup maps for merge
4054 sections also.
4055 (Output_section::discard_states): Use Output_section_lookup_maps.
4056 (Output_section::restore_states): Same.
4057 * output.h (Merge_section_properties): Move class defintion out of
4058 Output_section.
4059 (Output_section_lookup_maps): New class.
4060 (Output_section::Input_section::is_merge_section): New method
4061 defintion.
4062 (Output_section::Input_section::relobj): Move defintion out of class
4063 defintion. Declare method only.
4064 (Output_section::Input_section::shndx): Ditto.
4065 (Output_section::Input_section::output_merge_base): New method defintion.
4066 (Output_section::Input_section::u2_.pomb): New union field.
4067 (Output_section::Merge_section_by_properties_map,
4068 Output_section::Output_section_data_by_input_section_map,
4069 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4070 Remove types.
4071 (Output_section::add_merge_input_section): Add new parameter
4072 KEEPS_INPUT_SECTIONS.
4073 (Output_section::build_lookup_maps): New method declaration.
4074 (Output_section::merge_section_map_,
4075 Output_section::merge_section_by_properties_map_,
4076 Output_section::relaxed_input_section_map_,
4077 Output_section::is_relaxed_input_section_map_valid_): Remove data
4078 members.
4079 (Output_section::lookup_maps_): New data member.
4080
76295588
L
40812010-05-21 Doug Kwan <dougkwan@google.com>
4082
4083 PR gold/11619
4084 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4085 avoid a compilation error.
4086
d103a984
RÁE
40872010-05-19 Rafael Espindola <espindola@google.com>
4088
4089 * script-sections.cc (Output_section_definition::allocate_to_segment):
4090 Update the phdrs_list even when the output section is NULL.
4091 * testsuite/Makefile.am: Add test.
4092 * testsuite/Makefile.in: Regenerate.
4093 * testsuite/script_test_9.cc: New.
4094 * testsuite/script_test_9.sh: New.
4095 * testsuite/script_test_9.t: New.
4096
6625d24e
DK
40972010-05-19 Doug Kwan <dougkwan@google.com>
4098
4099 * arm.cc (Arm_input_section::original_size): New method.
4100 (Arm_input_section::do_addralign): Add a cast.
4101 (Arm_input_section::do_output_offset): Remove static cast.
4102 (Arm_input_section::original_addralign,
4103 Arm_input_section::original_size_): Change type to uint32_t.
4104 (Arm_input_section::init): Add safe casts for section alignment
4105 and size.
4106 (Arm_input_section::set_final_data_size): Do not set address and
4107 offset of stub table.
4108 (Arm_output_section::fix_exidx_coverage): Change use of of
4109 Output_section::Simple_input_section to that of
4110 Output_section::Input_section.
4111 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4112 except for the first pass.
4113 * output.cc (Output_section::get_input_sections): Change type of
4114 input_sections to std::list<Input_section>.
4115 (Output_section::add_script_input_section): Rename from
4116 Output_section::add_simple_input_section. Change type of SIS
4117 parameter from Simple_input_section to Input_section.
4118 * output.h (Output_section::Simple_input_section): Remove class.
4119 (Output_section::Input_section): Change class visibility to public.
4120 (Output_section::Input_section::addralign): Use stored alignments
4121 for special input sections if set.
4122 (Output_section::Input_section::set_addralign): New method.
4123 (Output_section::get_input_sections): Change parameter type from
4124 list of Simple_input_section to list of Input_section.
4125 (Output_section::add_script_input_section): Rename from
4126 Output_section::add_simple_input_section. Change first parameter's
4127 type from Simple_input_section to Input_section and remove the
4128 second and third parameters.
4129 * script-sections.cc (Input_section::Input_section_list): Change
4130 type to list of Output_section::Input_section/
4131 (Input_section_info::Input_section_info): Change parameter type of
4132 INPUT_SECTION to Output_section::Input_section.
4133 (Input_section_info::input_section): Change return type.
4134 (Input_section_info::input_section_): Change type to
4135 Output_section::Input_section.
4136 (Output_section_element_input::set_section_addresses): Adjust code
4137 to use Output_section::Input_section instead of
4138 Output_section::Simple_input_section. Adjust code for renaming
4139 of Output_section::add_simple_input_section.
4140 (Orphan_output_section::set_section_addresses): Ditto.
4141
e1e82ea4
RW
41422010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4143
4144 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4145 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4146
91e75c8a
RÁE
41472010-05-18 Rafael Espindola <espindola@google.com>
4148
4149 * options.cc (General_options::finalize): Handle -nostdlib.
4150 * options.h (nostdlib): New option.
4151 * script.cc (script_add_search_dir): Handle -nostdlib.
4152
da59ad79
DK
41532010-05-12 Doug Kwan <dougkwan@google.com>
4154
4155 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4156 attributes section only if there no attributes section after merging.
4157 (Target_arm::merge_object_attributes): Move value of
e1df38aa 4158 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
4159 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4160 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4161 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4162 and arm_attr_merge_7.stdout.
4163 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4164 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4165 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4166 arm_attr_merge_7b.o): New rules.
4167 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4168 arm_attr_merge_7
4169 * testsuite/Makefile.in: Regenerate.
4170 * testsuite/arm_attr_merge.sh: New file.
4171 * testsuite/arm_attr_merge_[67][ab].s: Same.
4172
3e01a7fd
NC
41732010-05-05 Nick Clifton <nickc@redhat.com>
4174
4175 * po/es.po: Updated Spanish translation.
4176
7ad2014a
L
41772010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4178
4179 * Makefile.am (install-exec-local): Properly install gold as
4180 default cross linker.
4181 * Makefile.in: Regenerated.
4182
4fda8867
NC
41832010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4184 Nick Clifton <nickc@redhat.com>
4185
4186 * configure.ac (install_as_default): Define and set to false
4187 unless --enable-gold or --enable-gold=both/gold has been
4188 specified.
4189 * configure: Regenerate.
4190
4191 * Makefile.am (install-exec-local): Install the executable as
4192 'ld.gold'. If install_as_default is true then also install it as
4193 'ld'.
4194 * Makefile.in: Regenerated.
4195
bd288ea2
ILT
41962010-04-24 Ian Lance Taylor <iant@google.com>
4197
4198 * layout.cc (Layout::layout_reloc): In relocatable link don't
4199 combine reloc sections for grouped sections.
4200
ef38fd8a
ST
42012010-04-23 Sriraman Tallam <tmsriram@google.com>
4202
4203 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4204 sections that are not ordinary to icf.
4205 * icf.cc (get_section_contents): Handle relocation pointing to section
4206 with no object or shndx information.
4207 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4208 * testsuite/Makefile.in: Regenerate.
4209 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4210 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4211
f6973bdc
ILT
42122010-04-22 Ian Lance Taylor <iant@google.com>
4213
4214 * expression.cc (Expression::Expression_eval_info): Add
4215 result_alignment_pointer field.
4216 (Expression::eval_with_dot): Add result_alignment_pointer
4217 parameter. Change all callers.
4218 (Expression::eval_maybe_dot): Likewise.
4219 (class Binary_expression): Add alignment_pointer parameter to
4220 left_value and right_value. Change all callers.
4221 (BINARY_EXPRESSION): Set result alignment.
4222 (class Trinary_expression): Add alignment_pointer parameter to
4223 arg2_value and arg3_value. Change all callers.
4224 (Trinary_cond::value): Set result alignment.
4225 (Max_expression::value, Min_expression::value): Likewise.
4226 (Align_expression::value): Likewise.
4227 * script-sections.cc (class Sections_element): Add dot_alignment
4228 parameter to set_section_addresses virtual function. Update
4229 instantiations.
4230 (class Output_section_element): Likewise.
4231 (Script_sections::create_segments): Add dot_alignment parameter.
4232 Change all callers.
4233 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4234 (Script_sections::set_phdrs_clause_addresses): Likewise.
4235 * script-sections.h: Update declarations.
4236 * script.h: Update declarations.
4237 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4238 min_p_align.
4239 * testsuite/script_test_3.t: Set large alignment.
4240 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4241 segment has expected alignment.
4242
9c9c98a5
NC
42432010-04-22 Nick Clifton <nickc@redhat.com>
4244
4245 * po/gold.pot: Updated by the Translation project.
4246 * po/vi.po: Updated Vietnamese translation.
4247
2253bfba
L
42482010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4249
4250 * testsuite/Makefile.am (check_PROGRAMS): Add
4251 icf_virtual_function_folding_test.
4252 * testsuite/Makefile.in: Regenerated.
4253
85fdf906
AH
42542010-04-15 Andrew Haley <aph@redhat.com>
4255
4256 * options.h (merge_exidx_entries): New option.
4257 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4258 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4259 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4260 (Target_arm::merge_exidx_entries): New function.
4261 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4262 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4263 to Arm_exidx_fixup constructor.
4264 Add new arg, merge_exidx_entries.
4265 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4266 Arm_output_section::fix_exidx_coverage.
4267
ce97fa81
ST
42682010-04-18 Sriraman Tallam <tmsriram@google.com>
4269
4270 * icf.cc (get_section_contents): Check for preemptible functions.
4271 Ignore addend when appropriate.
4272 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4273 section folded.
4274 (add_from_relobj): Check for section folded.
4275 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4276 * symtab.h (should_add_dynsym_entry): Add new parameter.
4277 * target-reloc.h (scan_relocs): Check for section folded.
4278 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4279 Check reloc types for function pointers in shared objects.
4280 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4281 case.
4282 (icf_preemptible_functions_test): New test case.
4283 (icf_string_merge_test): New test case.
4284 * testsuite.Makefile.in: Regenerate.
4285 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4286 bar_glob. Refactor code.
4287 * testsuite/icf_preemptible_functions_test.cc: New file.
4288 * testsuite/icf_preemptible_functions_test.sh: New file.
4289 * testsuite/icf_string_merge_test.cc: New file.
4290 * testsuite/icf_string_merge_test.sh: New file.
4291 * testsuite/icf_virtual_function_folding_test.cc: New file.
4292 * testsuite/icf_virtual_function_folding_test.sh: New file.
4293
04ceb17c
DK
42942010-04-14 Doug Kwan <dougkwan@google.com>
4295
4296 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4297 for local symbol recounting if we remove a section due to ICF.
4298 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4299 there are no regular objects in input.
4300
153e7da4
DK
43012010-04-13 Doug Kwan <dougkwan@google.com>
4302
4303 * arm.cc (Arm_input_section::set_final_data_size): Compute
4304 accurate final data size instead of using current data size.
4305
4dbd9faf
DK
43062010-04-09 Doug Kwan <dougkwan@google.com>
4307
4308 * layout.cc (Layout::choose_output_section): Handle script section
4309 types.
4310 (Layout::make_output_section_for_script): Add section type parameter.
4311 Handle script section types.
4312 * layout.h (Layout::make_output_section_for_script): Add section
4313 type parameter.
4314 * output.cc (Output_section::Output_section): Initialize data member
4315 is_noload_.
4316 (Output_section::do_reset_address_and_file_offset): Do not set address
4317 to 0 if section is a NOLOAD section.
4318 * output.h (Output_section::is_noload): New method.
4319 (Output_section::set_is_noload): Ditto.
4320 (Output_section::is_noload_): New data member.
4321 * script-c.h (Script_section_type): New enum type.
4322 (struct Parser_output_section_header): Add new file section_type.
4323 * script-sections.cc (Sections_element::output_section_name): Add
4324 parameter for returning script section type.
4325 (Output_section_definition::output_section_name): Ditto.
4326 (Output_section_definition::section_type)P; New method.
4327 (Output_section_definiton::script_section_type_name): Ditto.
4328 (Output_section_definition::script_section_type_): New data member.
4329 (Output_section_definition::Output_section_definition): Initialize
4330 data member Output_section_definition::script_section_type_.
4331 (Output_section_definition::create_sections): Pass script section type
4332 to Layout::make_output_section_for_script.
4333 (Output_section_definition::output_section_name): Return script
4334 section type to caller.
4335 (Output_section_definition::set_section_address): Do not advance
4336 dot value and load address if section type is NOLOAD. Set address
4337 of NOLOAD sections regardless of section flags.
4338 (Output_section_definition::print): Print section type if it is
4339 not SCRIPT_SECTION_TYPE_NONE.
4340 (Output_section_definition::section_type): New method.
4341 (Output_section_definition::script_section_type_name): Ditto.
4342 (Script_sections::output_section_name): Add new parameter
4343 PSECTION_TYPE for returning script section type. Pass it to
4344 section elements. Handle discard sections.
4345 (Sort_output_sections::operator()): Handle NOLOAD sections.
4346 * script-sections.h (Script_sections::Section_type): New enum type.
4347 (Script_sections::output_section_name): Add a new parameter for
4348 returning script section type.
4349 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4350 INFO and NOLOAD.
4351 * yyscript.y (union): Add new field SECTION_TYPE.
4352 (COPY, DSECT, INFO, NOLOAD): New tokens.
4353 (opt_address_and_section_type): Change type to output_section_header.
4354 (section_type): New non-terminal
4355 (section_header): Handle section type.
2253bfba 4356 (opt_address_and_section_type): Return section type value.
4dbd9faf 4357
721ea635
L
43582010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4359
4360 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4361 * testsuite/plugin_common_test_2.c (foo): Likewise.
4362
6bf924b0
DK
43632010-04-08 Doug Kwan <dougkwan@google.com>
4364
4365 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4366 Output_merge_data.
4367 * output.cc (Output_section::add_merge_input_section): Simplify
4368 code and return status of Output_merge_base::add_input_section.
e1df38aa 4369 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
4370 returns true.
4371
24af6f92
DK
43722010-04-07 Doug Kwan <dougkwan@google.com>
4373
4374 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4375 if section is marked as containing instructions but has no mapping
4376 symbols.
4377 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4378 correct section index.
4379 (Arm_relobj::find_linked_text_section): Ditto.
4380
00698fc5
CC
43812010-04-07 Cary Coutant <ccoutant@google.com>
4382
4383 * archive.cc (include_member): Destroy Read_symbols_data object before
4384 releasing file.
4385 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4386 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4387 (Read_symbols_data::~Read_symbols_data) New destructor.
4388 (Section_relocs::Section_relocs) New constructor.
4389 (Section_relocs::~Section_relocs) New destructor.
4390 (Read_relocs_data::Read_relocs_data) New constructor.
4391 (Read_relocs_data::~Read_relocs_data) New destructor.
4392 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4393 pointers to NULL after deleting.
4394
7296d933
DK
43952010-04-07 Doug Kwan <dougkwan@google.com>
4396
4397 * arm.cc: Replace "endianity" with "endianness" in comments.
4398 (Arm_exidx_cantunwind): Ditto.
4399 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4400 (Arm_relobj::merge_flags_and_attributes): New method.
4401 (Arm_relobj::merge_flags_and_attributes_): New data member.
4402 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4403 (Arm_relobj::scan_sections_for_stubs): Ditto.
4404 (Arm_relobj::do_read_symbols): Check to see if we really want to
4405 merge processor-specific flags and attributes. Exit early if
4406 an object is empty except for section names and the undefined symbol.
4407 (Target_arm::do_finalize_sections): Move check for ELF format to
4408 Arm_relobj::do_read_symbols. Merge processor specific flags and
4409 attributes from a regular object only when we have determined that
4410 it is aapropriate. Do not create an .ARM.attributes section in
4411 output if there is no regular input object.
4412 (Target_arm::merge_processor_specific_flags): Check
4413 --warn-mismatch before printing any error.
4414 (Target_arm::merge_object_attributes): Ditto.
4415 * gold.cc (queue_middle_tasks): Handle the case in which there is
4416 no regular object in input.
4417 * options.cc (General_options::parse_EB): New method.
4418 (General_options::parse_EL): Same.
4419 (General_options::General_options): Initialize endianness_.
4420 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4421 New options.
4422 (General_options::Endianness): New enum.
4423 (General_options::endianness): New method.
4424 (General_options::endianness_): New data member.
4425 * parameters.cc (Parameters::set_options): Check target endianness.
4426 (Parameters::set_target_once): Ditto.
4427 (Parameters::check_target_endianness): New method.
4428 (parameters_force_valid_target): If either -EL or -EB is specified,
4429 use it to define endianness of default target.
4430 * parameters.h (Parameters::check_target_endianness): New method
4431 declaration.
4432 * target.h (class Target): Change "endianity" to "endianness"
4433 in comments.
4434
efc8d4f2
RW
44352010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4436
4437 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4438 * configure: Regenerate.
4439 * Makefile.in: Regenerate.
4440 * testsuite/Makefile.in: Regenerate.
4441
be234d88
CC
44422010-04-06 Cary Coutant <ccoutant@google.com>
4443
4444 gcc PR lto/42757
4445 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4446 prevailing definitions of common symbols.
4447 * testsuite/plugin_test_6.sh: New test case.
4448 * testsuite/plugin_common_test_1.c: New test case.
4449 * testsuite/plugin_common_test_2.c: New test case.
4450 * testsuite/Makefile.am (plugin_test_6): New test case.
4451 * testsuite/Makefile.in: Regenerate.
4452
bd32c6bd
NC
44532010-04-06 Nick Clifton <nickc@redhat.com>
4454
4455 * po/vi.po: New Vietnamese translation.
4456
323c532f
DK
44572010-03-30 Doug Kwan <dougkwan@google.com>
4458
4459 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4460
4fcd97eb
DK
44612010-03-25 Doug Kwan <dougkwan@google.com>
4462
4463 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4464 to avoid a conversion warning on a 32-bit host.
4465
4ebf39db
ILT
44662010-03-24 Ian Lance Taylor <iant@google.com>
4467
4468 * testsuite/script_test_3.t: Add a TLS segment.
4469 * testsuite/Makefile.am (check_PROGRAMS): Add
4470 tls_phdrs_script_test.
4471 (tls_phdrs_script_test_SOURCES): Define.
4472 (tls_phdrs_script_test_DEPENDENCIES): Define.
4473 (tls_phdrs_script_test_LDFLAGS): Define.
4474 (tls_phdrs_script_test_LDADD): Define.
4475 * testsuite/Makefile.in: Rebuild.
4476
4a599bdd
CC
44772010-03-23 Cary Coutant <ccoutant@google.com>
4478
4479 * fileread.cc (find_or_make_view): Fix comment.
4480
6c93b22c
ILT
44812010-03-23 Ian Lance Taylor <iant@google.com>
4482
4483 * script-sections.cc (class Orphan_section_placement): Define
4484 PLACE_TLS and PLACE_TLS_BSS.
4485 (Orphan_section_placement::Orphan_section_placement): Initialize
4486 new places.
4487 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4488 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4489 (tls_script_test_SOURCES): Define.
4490 (tls_script_test_DEPENDENCIES): Define.
4491 (tls_script_test_LDFLAGS): Define.
4492 (tls_script_test_LDADD): Define.
4493 * testsuite/Makefile.in: Rebuild.
4494
a2c7281b
DK
44952010-03-22 Doug Kwan <dougkwan@google.com>
4496
4497 * arm.cc (Arm_relocate_functions::abs8,
4498 Arm_relocate_functions::abs16): Use correct check for overflow
4499 specified in the ARM ELF specs.
4500 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4501 target of a BLX instruction specially.
4502 (Reloc_stub::stub_type_for_reloc): Ditto.
4503 (Relocate::relocate): Use symbolic names instead of numeric relocation
4504 codes to report error.
4505 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4506 workaround.
4507 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4508 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4509 thumb2_blx_out_of_range.stdout
4510 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4511 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4512 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4513 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4514 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4515 thumb2_blx_in_range, thumb2_blx_in_range.o,
4516 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4517 thumb2_blx_out_of_range.o): New rules.
4518 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4519 thumb2_blx_in_range and thumb2_blx_out_of_range.
4520 * testsuite/Makefile.in: Regenerate.
4521 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4522 * testsuite/thumb_blx_in_range.s: New file.
4523 * testsuite/thumb_blx_out_of_range.s: New file.
4524
b0193076
RÁE
45252010-03-22 Rafael Espindola <espindola@google.com>
4526
4527 * archive.cc (Should_include): Move to archive.h.
4528 (should_include_member): Make it a member of Archive.
4529 (Lib_group): New.
4530 (Add_lib_group_symbols): New.
4531 * archive.h: Include options.h.
4532 (Archive_member): Moved from Archive.
4533 (Should_include): Moved from archive.cc.
4534 (Lib_group): New.
4535 (Add_lib_group_symbols): New.
4536 * dynobj.cc (do_should_include_member): New.
4537 * dynobj.h (do_should_include_member): New.
4538 * gold.cc (queue_initial_tasks): Update call to queue.
4539 * main.cc (main): Print lib group stats.
4540 * object.cc (do_should_include_member): New.
4541 * object.h: Include archive.h.
4542 (Object::should_include_member): New.
4543 (Object::do_should_include_member): New.
4544 (Sized_relobj::do_should_include_member): New.
4545 * options.cc (General_options::parse_start_lib): New.
4546 (General_options::parse_end_lib): New.
4547 (Input_arguments::add_file): Handle lib groups.
4548 (Input_arguments::start_group): Check we are not in a lib.
4549 (Input_arguments::start_lib): New.
4550 (Input_arguments::end_lib): New.
4551 * options.h (General_options): Add start_lib and end_lib.
4552 (Input_argument::lib_): New.
4553 (Input_argument::lib): New.
4554 (Input_argument::is_lib): New.
4555 (Input_file_lib): New.
4556 (Input_arguments::in_lib_): New.
4557 (Input_arguments::in_lib): New.
4558 (Input_arguments::start_lib): New.
4559 (Input_arguments::end_lib_): New.
4560 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4561 in unused members as preempted.
4562 (Sized_pluginobj::do_should_include_member): New.
4563 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4564 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4565 return the blocker.
4566 (Read_symbols::do_whole_lib_group): New.
4567 (Read_symbols::do_lib_group): New.
4568 (Read_symbols::do_read_symbols): Handle lib groups.
4569 (Read_symbols::get_name): Handle lib groups.
4570 * readsyms.h (Read_symbols): Add an archive member pointer.
4571 (Read_symbols::do_whole_lib_group): New.
4572 (Read_symbols::do_lib_group): New.
4573 (Read_symbols::member_): New.
4574 * script.cc (read_input_script): Update call to queue_soon.
4575
d099120c
DK
45762010-03-19 Doug Kwan <dougkwan@google.com>
4577
4578 * arm.cc (Stub_table::Stub_table): Initialize new data members
4579 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4580 (Stub_table::add_reloc_stub): Assign stub offset and update
4581 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4582 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4583 New data members.
4584 (Stub_table::update_data_size_and_addralign): Use
4585 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4586 instead of going over all reloc stubs.
4587 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4588 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4589 Stringpool_template::offset_ to size of Stringpool_char.
4590 (Stringpool_template::new_key_offset): Remove code to initialize
4591 Stringpool_template::offset_.
4592 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4593 Stringpool_template::offset_ to zero.
4594
1aa37384
DK
45952010-03-15 Doug Kwan <dougkwan@google.com>
4596
4597 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4598 offset_.
4599 (Stringpool_template::new_key_offset): New method.
4600 (Stringpool_template::add_string): Assign offsets when adding new
4601 strings.
4602 (Stringpool_template::set_string_offsets): Do not set string offsets
4603 when not optimizing.
4604 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4605 member size_.
4606 (Chunked_vector::clear): Clear size_.
4607 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4608 (Chunked_vector::size): Return size_.
4609 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 4610 (Chunked_vector::size_): New data member.
1aa37384
DK
4611 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4612 (Stringpool_template::new_key_offset): New method declaration.
4613 (Stringpool_template::offset_): New data member.
4614
b672b057
RÁE
46152010-03-15 Rafael Espindola <espindola@google.com>
4616
4617 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4618 Add_symbols' constructor.
4619 * readsyms.h (Add_symbols): Remove the input_group member.
4620
b6848d3c
ILT
46212010-03-10 Ian Lance Taylor <iant@google.com>
4622
4623 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4624 target to ask whether a reference to a symbol requires a stack
4625 split.
4626 * target.h (Target::is_call_to_non_split): New function.
4627 (Target::do_is_call_to_non_split): Declare virtual function.
4628 * target.cc: Include "symtab.h".
4629 (Target::do_is_call_to_non_split): New function.
4630 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4631
a2a5469e
CC
46322010-03-10 Cary Coutant <ccoutant@google.com>
4633
4634 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4635 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4636 (File_read::open[2]): Add whole_file_view_ to list of views.
4637 (File_read::make_view): Remove test of whole_file_view_.
4638 (File_read::find_or_make_view): Create whole_file_view_ if
4639 necessary.
4640 (File_read::clear_views): Replace bool parameter with enum;
4641 adjust all callers. Don't delete views with permanent data;
4642 do delete cached views and views from archives if
4643 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4644 if clearing the corresponding view.
4645 * fileread.h (File_read::Clear_views_mode): New enum.
4646 (File_read::View::is_permanent_view): New method.
4647 (File_read::clear_views): Replace bool parameter
4648 with enum; adjust all callers.
4649 * options.h (General_options): Change keep_files_mapped option;
4650 add map_whole_files.
4651 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4652 releasing the file.
4653 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4654 the file.
4655
8861f32b
DM
46562010-03-10 David S. Miller <davem@davemloft.net>
4657
4658 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4659
d62d0f5f
ST
46602010-03-09 Sriraman Tallam <tmsriram@google.com>
4661
4662 * icf.cc (get_section_contents): Add '@' marker after processing the
4663 merge reloc.
4664
9177756d
DK
46652010-03-08 Doug Kwan <dougkwan@google.com>
4666
4667 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4668 due to a conversion warning.
4669 (Arm_relobj::update_output_local_symbol_count): Check for local
4670 symbol with unset output index.
4671
9e9e071b
ILT
46722010-03-05 Ian Lance Taylor <iant@google.com>
4673
4674 * options.h (class General_options): Add --spare-dynamic-tags.
4675 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4676 --spare-dynamic-tags.
4677
a81ee015
ILT
46782010-03-05 Ian Lance Taylor <iant@google.com>
4679
4680 * incremental.cc: Include "libiberty.h".
4681
44ec90b9
RO
46822010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4683
4684 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4685 function, is_info_ member.
4686 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4687 (Versions::Versions): Update caller.
4688 (Versions::define_base_version): Likewise.
4689 (Versions::add_def): Likewise.
4690
0897ed3b
ST
46912010-03-03 Sriraman Tallam <tmsriram@google.com>
4692
4693 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4694 (Scan::possible_function_pointer_reloc): New function.
4695 (Scan::local_reloc_may_be_function_pointer): Change to call
4696 possible_function_pointer_reloc.
4697 (Scan::global_reloc_may_be_function_pointer): Ditto.
4698 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4699 relocations in ".data.rel.ro._ZTV" section.
4700 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4701 * testsuite/icf_safe_so_test.cc: Ditto.
4702 * testsuite/icf_safe_test.cc: Ditto.
4703 * testsuite/icf_safe_test.sh: Ditto.
4704
d3bbad62
ILT
47052010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4706 Ian Lance Taylor <iant@google.com>
4707
4708 * target-reloc.h (relocate_section): Check the symbol table index
4709 for -1U before setting the local symbol index.
4710 (scan_relocatable_relocs): If copying the relocation, record that
4711 the local symbol is required.
4712 * object.h (Symbol_value::is_output_symtab_index_set): New
4713 function.
4714 (Symbol_value::may_be_discarded_from_output_symtab): New
4715 function.
4716 (Symbol_value::has_output_symtab_entry): New function.
4717 (Symbol_value::needs_output_symtab_entry): Remove.
4718 (Symbol_value::output_symtab_index): Make sure the symbol index is
4719 set.
4720 (Symbol_value::set_output_symtab_index): Make sure the symbol
4721 index is not set. Make sure the new index is valid.
4722 (Symbol_value::set_must_have_output_symtab_entry): New function.
4723 (Symbol_value::has_output_dynsym_entry): New function.
4724 (Symbol_value::set_output_dynsym_index): Make sure the new index
4725 is valid.
4726 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4727 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4728 local symbol if permitted.
4729 (Sized_relobj::do_finalize_local_symbols): Call
4730 is_output_symtab_index_set rather than needs_output_symtab_entry.
4731 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4732 rather than needs_output_symtab_entry. Call
4733 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4734 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4735 is_output_symtab_index_set rather than needs_output_symtab_entry.
4736 * testsuite/discard_locals_relocatable_test.c: New file.
4737 * testsuite/discard_locals_test.sh: Test -r.
4738 * testsuite/Makefile.am (check_DATA): Add
4739 discard_locals_relocatable_test1.syms,
4740 discard_local_relocatable_test2.syms.
4741 (MOSTLYCLEANFILES): Likewise. Also add
4742 discard_locals_relocatable_test1.lout and
4743 discard_locals_relocatable_test2.out.
4744 (discard_locals_relocatable_test1.syms): New target.
4745 (discard_locals_relocatable_test.o): New target.
4746 (discard_locals_relocatable_test1.out): New target.
4747 (discard_locals_relocatable_test2.syms): New target.
4748 (discard_locals_relocatable_test2.out): New target.
4749 (various): Add missing ../ld-new dependencies.
4750 * testsuite/Makefile.in: Rebuild.
4751
7e8ccf26
NC
47522010-03-03 Nick Clifton <nickc@redhat.com>
4753
4754 * po/fi.po: New Finnish translation.
4755
2a0ff005
DK
47562010-03-01 Doug Kwan <dougkwan@google.com>
4757
4758 * layout.cc (Layout::Layout): Force section types of .init_array*,
4759 .preinit_array* and .fini_array* sections.
4760 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4761 Fix check of return value of std::string::find.().
4762 (Output_section::Input_section_sort_compare::operator()): Remove
4763 comment about .init_array.
4764 (Output_section::Input_section_sort_init_fini_compare::operator()):
4765 New method.
4766 (Output_section::sort_attached_input_sections): Handle .init_array
4767 and .fini_array specially.
4768 * output.h (Output_section::Inut_section_sort_compare): Update
4769 comment.
4770 (Output_section::Input_section_sort_init_fini_compare): New struct.
4771
c3e4ae29
DK
47722010-02-26 Doug Kwan <dougkwan@google.com>
4773
4774 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4775 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4776 * testsuite/debug_msg.sh: Avoid matching source line number for
4777 use of global variable undef_int.
4778
2fd9ae7a
DK
47792010-02-26 Doug Kwan <dougkwan@google.com>
4780
4781 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4782 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4783 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4784 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4785 * options.cc (General_options::General_options): Initialize member
4786 fix_v4bx_.
4787 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4788 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4789 and rm_no_fix_v4bx.stdout
4790 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4791 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4792 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4793 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4794 and arm_no_fix_v4bx.
4795 * Makefile.in: Regenerate.
4796 * testsuite/arm_fix_v4bx.s: New file.
4797 * testsuite/arm_fix_v4bx.sh: Ditto.
4798
67ec7d0b
DK
47992010-02-24 Doug Kwan <dougkwan@google.com>
4800
4801 * arm.cc (Target_arm::got_section): Make the .got section the first
4802 non RELRO section in the data segment.
4803 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4804 suffixes of section names.
4805
10165461
DK
48062010-02-24 Doug Kwan <dougkwan@google.com>
4807
4808 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4809 flags and attributes merging if an input file is a binary file.
4810 * fileread.cc (Input_file::open): Record format of original file.
4811 * fileread.h (Input_file::Format): New enum type.
4812 (Input_file::Input_file): Initialize data member format_.
4813 (Input_file::format): New method definition.
4814 (Input_file::format_):: New data member.
4815
4a54abbb
DK
48162010-02-24 Doug Kwan <dougkwan@google.com>
4817
4818 * arm.cc (Arm_output_data_got): New class.
4819 (ARM_TCB_SIZE): New constant
4820 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4821 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4822 If user uses a script with a SECTIONS clause, issue only a warning
4823 for a misplaced EXIDX input section. Otherwise, issue an error.
4824 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4825 garbage collection.
4826 (Target_arm::got_mode_index_entry): Handle static linking.
4827 (Target_arm::Scan::local): Ditto.
4828 (Target_arm::Scan::global): Ditto.
4829 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4830 all incorrectly implemented relocations.
e1df38aa 4831 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4832 Arm_output_section::fix_exidx_coverage.
4833 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4834 from ".ARM.exidx." and ".ARM.extab.".
4835
ca419a6f
ILT
48362010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4837
4838 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4839 section if it does not already exist.
4840 * attributes.cc (Attributes_section_data::Attributes_section_data):
4841 Don't crash if size is zero.
4842
135b9c78
ILT
48432010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4844 Ian Lance Taylor <iant@google.com>
4845
4846 * gold.cc (queue_middle_tasks): If no input files were opened,
4847 exit.
4848 * workqueue.h (Task_function::Task_function): Assert that there is
4849 a blocker.
4850
bb0bfe4f
DK
48512010-02-22 Doug Kwan <dougkwan@google.com>
4852
4853 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4854 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4855 types to avoid warnings due to different uint64_t implementations
4856 on different hosts.
4857
2a2b6d42
DK
48582010-02-21 Doug Kwan <dougkwan@google.com>
4859
4860 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4861 handling of the maximum backward branch offset.
4862 (Arm_relocate_functions::thumb_branch_common): Ditto.
4863 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4864 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 4865 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
4866 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4867 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4868 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4869 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4870 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4871 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4872 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4873 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4874 thumb2_bl_out_of_range.o): New rules.
4875 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4876 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4877 thumb2_bl_out_of_range
4878 * testsuite/Makefile.in: Regenerate.
4879 * testsuite/arm_bl_in_range.s: New file.
4880 * testsuite/arm_bl_out_of_range.s: Ditto.
4881 * testsuite/arm_branch_in_range.sh: Ditto.
4882 * testsuite/arm_branch_range.t: Ditto.
4883 * testsuite/thumb2_branch_range.t: Ditto.
4884 * testsuite/thumb_bl_in_range.s: Ditto.
4885 * testsuite/thumb_bl_out_of_range.s: Ditto.
4886 * testsuite/thumb_branch_range.t: Ditto.
4887
b487ad64
ST
48882010-02-20 Sriraman Tallam <tmsriram@google.com>
4889
4890 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4891 Add reloc offset information.
4892 * icf.cc (get_section_contents): Change iterators to point to the new
4893 vectors. Add reloc offset information to the contents.
4894 * icf.h (Icf::Sections_reachable_info): New typedef.
4895 (Icf::Sections_reachable_list): New typedef.
4896 (Icf::Offset_info): New typedef.
4897 (Icf::Reloc_info): New struct typedef.
4898 (Icf::Reloc_info_list): New typedef.
4899 (Icf::symbol_reloc_list): Delete method.
4900 (Icf::addend_reloc_list): Delete method.
4901 (Icf::section_reloc_list): Delete method.
4902 (Icf::reloc_info_list): New method.
4903 (Icf::reloc_info_list_): New member.
4904
f96accdf
DK
49052010-02-19 Doug Kwan <dougkwan@google.com>
4906
4907 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4908 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4909 * arm.cc (Arm_relocation_functions): New forward declaration.
4910 (Target_arm::Target_arm): Initialize new data members
4911 got_mod_index_offset_ and tls_base_symbol_defined_.
4912 (Target_arm::Relocate::relocate_tls): New method.
4913 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4914 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4915 New methods.
4916 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4917 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4918 (Target_arm::got_mod_index_offset_,
4919 Target_arm::tls_base_symbol_defined_): New data members.
4920 (Target_arm::Scan::local, Target::Scan::global,
4921 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4922 relocations.
4923
c8761b9a
DK
49242010-02-18 Doug Kwan <dougkwan@google.com>
4925
4926 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4927 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4928 text section as a parameter becuase some broken tools may not set
4929 the link in section header.
4930 (Target_arm::has_got_section): New method.
4931 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4932 without any mapping symbol as data only. Remove warning.
4933 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4934 link in its section header, try to discover the link by inspecting the
4935 REL31 relocation at the beginning of the section.
4936 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4937 in error message.
4938 (Target_arm::Scan::global): Treat any reference to the symbol
4939 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4940
21bb3914
ST
49412010-02-12 Sriraman Tallam <tmsriram@google.com>
4942
4943 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4944 (Scan::global_reloc_may_be_function_pointer): New function.
4945 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4946 (Scan::global_reloc_may_be_function_pointer): New function.
4947 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4948 (Scan::global_reloc_may_be_function_pointer): New function.
4949 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4950 (Scan::global_reloc_may_be_function_pointer): New function.
4951 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4952 (Scan::global_reloc_may_be_function_pointer): New function.
4953 (Scan::possible_function_pointer_reloc): New function.
4954 (Target_x86_64::can_check_for_function_pointers): New function.
4955 * gc.h (gc_process_relocs): Scan relocation types to determine if
4956 function pointers were taken for targets that support it.
4957 * icf.cc (Icf::find_identical_sections): Include functions for
4958 folding in safe ICF whose pointer is not taken.
4959 * icf.h (Secn_fptr_taken_set): New typedef.
4960 (fptr_section_id_): New member.
4961 (section_has_function_pointers): New function.
4962 (set_section_has_function_pointers): New function.
4963 (check_section_for_function_pointers): New function.
4964 * options.h: Fix comment for safe ICF option.
4965 * target.h (can_check_for_function_pointers): New function.
4966 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4967 Modify icf_safe_test for X86-64.
4968 * testsuite/Makefile.in: Regenerate.
4969 * testsuite/icf_safe_so_test.cc: New file.
4970 * testsuite/icf_safe_so_test.sh: New file.
4971 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4972 (main): Change to take pointer to function kept_func_3.
4973 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4974 folding is done correctly for X86-64.
4975
0da6fa6c
DM
49762010-02-12 David S. Miller <davem@davemloft.net>
4977
4978 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4979 is_symbolless parameter.
4980 (Output_reloc<SHT_REL>::is_symbolless): New.
4981 (Output_reloc<SHT_REL>::is_symbolless_): New.
4982 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4983 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4984 (Output_reloc<SHT_RELA>::is_symbolless): New.
4985 (Output_data_reloc::add_global): Handle is_symbolless.
4986 (Output_data_reloc::add_global_relative): Likewise.
4987 (Output_data_reloc::add_local): Likewise.
4988 (Output_data_reloc::add_local_relative): Likewise.
4989 (Output_data_reloc::add_symbolless_global_addend): New.
4990 (Output_data_reloc::add_symbolless_local_addend): New.
4991 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4992 is_symbolless.
4993 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4994 instead of ->is_relative_
4995 (Output_reloc::write): Likewise.
4996 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4997 (Output_reloc::write_rel): Simplify.
4998
4999 * sparc.cc (Target_sparc::Scan::local): Use
5000 ->add_symbolless_local_addend as needed.
5001 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5002 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5003 based upon relocation offset.
5004
e4782e83
DK
50052010-02-11 Doug Kwan <dougkwan@google.com>
5006
5007 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5008 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5009 beginning of function.
5010 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5011 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5012 parameter is_32bit in calls to should_apply_static_reloc.
5013 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5014 (check_DATA): Add arm_abs_global.stdout.
5015 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5016 arm_abs_global.stdout): New rules.
5017 (MOSTLLYCLEANFILES): Add arm_abs_global
5018 * Makefile.in: Regenerate.
5019 * testsuite/arm_abs_global.s: New file.
5020 * testsuite/arm_abs_global.sh: Ditto.
5021 * testsuite/arm_abs_lib.s: Ditto.
5022
93ceb764
ILT
50232010-02-11 Ian Lance Taylor <iant@google.com>
5024
5025 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5026 Read_relocs task.
5027 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5028 Allocate_commons_task first.
5029 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5030 task, rather than symtab_lock_.
5031 (Gc_process_relocs::~Gc_process_relocs): New function.
5032 (Gc_process_relocs::is_runnable): Check this_blocker_.
5033 (Gc_process_relocs::locks): Use next_blocker_ rather than
5034 blocker_.
5035 (Scan_relocs::~Scan_relocs): New function.
5036 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5037 symtab_lock_.
5038 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5039 next_blocker_.
5040 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5041 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5042 constructor accordingly.
5043 (class Gc_process_relocs): Likewise.
5044 (class Scan_relocs): Likewise.
5045 * common.h (class Allocate_commons_task): Remove symtab_lock_
5046 field, and corresponding constructor parameter.
5047 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5048 symtab_lock_.
5049 (Allocate_commons_task::locks): Likewise.
5050
114dfbe1
ILT
50512010-02-11 Ian Lance Taylor <iant@google.com>
5052
5053 * gold-threads.h (class Once): Define.
5054 (class Initialize_lock): Rewrite as child of Once.
5055 * gold-threads.cc (class Once_initialize): Define.
5056 (once_pointer_control): New static variable.
5057 (once_pointer, once_arg): New static variables.
5058 (c_run_once): New static function.
5059 (Once::Once, Once::run_once, Once::internal_run): New functions.
5060 (class Initialize_lock_once): Remove.
5061 (initialize_lock_control): Remove.
5062 (initialize_lock_pointer): Remove.
5063 (initialize_lock_once): Remove.
5064 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5065 (Initialize_lock::initialize): Rewrite.
5066 (Initialize_lock::do_run_once): New function.
5067 * archive.cc (Archive::interpret_header): Only clear name if it is
5068 not already empty.
5069 * fileread.cc: Include "gold-threads.h"
5070 (file_counts_lock): New static variable.
5071 (file_counts_initialize_lock): Likewise.
5072 (File_read::release): Only increment counts when using --stats.
5073 Use a lock around the increment.
5074 * parameters.cc (class Set_parameters_target_once): Define.
5075 (set_parameters_target_once): New static variable.
5076 (Parameters::Parameters): Move here from parameters.h.
5077 (Parameters::set_target): Rewrite.
5078 (Parameters::set_target_once): New function.
5079 (Parameters::clear_target): Move here and rewrite.
5080 * parameters.h (class Parameters): Update declarations. Add
5081 set_parameters_target_once_ field.
5082 (Parameters::Parameters): Move to parameters.cc.
5083 (Parameters::clear_target): Likewise.
5084 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5085 task.
5086 (Start_group::~Start_group): New function.
5087 (Start_group::is_runnable): New function.
5088 (Start_group::locks, Start_group::run): New functions.
5089 (Finish_group::run): Change saw_undefined to size_t.
5090 * readsyms.h (class Start_group): Define.
5091 (class Finish_group): Change saw_undefined_ field to size_t.
5092 (Finish_group::Finish_group): Remove saw_undefined and
5093 this_blocker parameters. Change all callers.
5094 (Finish_group::set_saw_undefined): New function.
5095 (Finish_group::set_blocker): New function.
5096 * symtab.h (class Symbol_table): Change saw_undefined to return
5097 size_t. Change saw_undefined_ field to size_t.
5098 * target-select.cc (Set_target_once::do_run_once): New function.
5099 (Target_selector::Target_selector): Initialize set_target_once_
5100 field. Don't initialize lock_ and initialize_lock_ fields.
5101 (Target_selector::instantiate_target): Rewrite.
5102 (Target_selector::set_target): New function.
5103 * target-select.h (class Set_target_once): Define.
5104 (class Target_selector): Update declarations. Make
5105 Set_target_once a friend. Remove lock_ and initialize_lock_
5106 fields. Add set_target_once_ field.
5107
fa17a3f4
ILT
51082010-02-10 Ian Lance Taylor <iant@google.com>
5109
5110 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5111 queueing any tasks.
5112 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5113 (queue_middle_tasks): Add all blockers before queueing any tasks.
5114 (queue_final_tasks): Likewise.
5115 * token.h (Task_token::add_blockers): New function.
5116 * object.h (Input_objects::number_of_relobjs): New function.
5117
c7177d31
ILT
51182010-02-10 Ian Lance Taylor <iant@google.com>
5119
5de0e392
ILT
5120 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5121 shared, not if not position independent.
5122 * x86_64.cc (Relocate::relocate_tls): Likewise.
5123 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5124 (tls_pie_pic_test): New target.
5125 * testsuite/Makefile.in: Rebuild.
5126
c7177d31
ILT
5127 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5128 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5129 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5130 * testsuite/Makefile.in: Rebuild.
5131
684b268a
DM
51322010-02-09 David S. Miller <davem@davemloft.net>
5133
5134 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5135 R_SPARC_RELATIVE using ->add_local_relative().
5136 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5137
612a8d3d
DM
5138 * output.h (Output_data_dynamic::add_section_size): New method
5139 that takes two Output_data objects.
5140 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5141 entry param. Handle it in initializers.
5142 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5143 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5144 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5145 arg.
5146 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5147 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5148 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5149 for dynrel_includes_plt.
5150 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5151 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5152 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5153 before .rela.plt
5154 (Target_sparc::do_finalize_sections): Update to pass true for
5155 dynrel_includes_plt.
5156 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5157 output before .rela.plt
5158 (Target_powerpc::do_finalize_sections): Update to pass true for
5159 dynrel_includes_plt when 32-bit.
5160
cb1be87e
DK
51612010-02-08 Doug Kwan <dougkwan@google.com>
5162
5163 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5164 method.
5165 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5166 Arm_relobj::scan_section_for_cortex_a8_stubs,
5167 Arm_relobj::do_relocation_section): Instead of calling
5168 Output_section::output_address, use faster
5169 Arm_relobj::simple_input_section_output_address.
5170
705b5121
DM
51712010-02-08 David S. Miller <davem@davemloft.net>
5172
5173 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5174 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5175 relocation helper function.
5176
024c4466
DM
5177 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5178 just like R_SPARC_GOT{10,13,22}.
5179 (Target_sparc::Scan::local): Likewise.
5180 (Target_sparc::Relocate:relocate): Likewise.
5181
9109c078
ILT
51822010-02-06 Ian Lance Taylor <iant@google.com>
5183
5184 * configure.ac: Rewrite targetobjs duplicate removal code to use
5185 only shell constructs.
5186 * configure: Rebuild.
5187
cf846138
DK
51882010-02-05 Doug Kwan <dougkwan@google.com>
5189
5190 PR 11247
5191 * arm.cc (Arm_relobj::section_is_scannable): New method.
5192 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5193 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5194
6cfaf60b
DK
51952010-02-04 Doug Kwan <dougkwan@google.com>
5196
5197 PR 11247
5198 * arm-reloc-property.cc (cstdio): Include.
5199 * configure.ac (targetobjs): Remove duplicates.
5200 * configure: Regenerate.
5201 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5202 big and little endian version for a given address size.
5203
5c57f1be
DK
52042010-02-03 Doug Kwan <dougkwan@google.com>
5205
5206 * arm-reloc-property.cc
5207 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5208 definition.
5209 * arm-reloc-property.h
5210 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5211 New method definition.
5212 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5213 declaration.
5214 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5215 overflow to N.
5216 (GOT_PREL): Change implemented to Y.
5217 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5218 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5219 (Arm_relocate_functions::movw_abs_nc): Remove method.
5220 (Arm_relocate_functions::movt_abs): Ditto.
5221 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5222 (Arm_relocate_functions::thm_movt_abs): Ditto.
5223 (Arm_relocate_functions::movw_rel_nc): Ditto.
5224 (Arm_relocate_functions::movw_rel): Ditto.
5225 (Arm_relocate_functions::movt_rel): Ditto.
5226 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5227 (Arm_relocate_functions:thm_movw_rel): Ditto.
5228 (Arm_relocate_functions:thm_movt_rel): Ditto.
5229 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5230 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5231 New method definitions.
5232 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5233 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5234 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5235 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5236 (Target_arm::Relocate::relocate): Check for non-static or
5237 unimplemented relocation code and exit early. Change calls to
5238 Target_arm::reloc_uses_thumb_bit and
5239 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5240 instead. Refactor code to handle similar relocations to increase
5241 code sharing. Remove check for unsupported relocation code in switch
5242 statement.
5243 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5244 relocation property table to find out size. Change error message to
5245 print out the name of a relocation code instead of the numeric value.
5246 (Target_arm::scan_reloc_for_stub): Use relocation property table
5247 instead of calling Target_arm::reloc_uses_thumb_bit().
5248
218c5831
DK
52492010-02-02 Doug Kwan <dougkwan@google.com>
5250
5251 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5252 types of relaxed input section.
5253
0d31c79d
DK
52542010-02-02 Doug Kwan <dougkwan@google.com>
5255
5256 * Makefile.am (HFILES): Add arm-reloc-property.h.
5257 (DEFFILES): New.
5258 (TARGETSOURCES): Add arm-reloc-property.cc
5259 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5260 (libgold_a_SOURCES): $(DEFFILES)
5261 * Makefile.in: Regenerate.
5262 * arm-reloc-property.cc: New file.
5263 * arm-reloc-property.h: New file.
5264 * arm-reloc.def: New file.
5265 * arm.cc: Update comments.
5266 (arm-reloc-property.h): New included header.
5267 (arm_reloc_property_table): New global variable.
5268 (Target_arm::do_select_as_default_target): New method definition.
5269 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5270 arm-reloc-property to targ_extra_obj.
5271 * parameters.cc (set_parameters_target): Call
5272 Target::select_as_default_target().
5273 * target.h (Target::select_as_default_target): New method definition.
5274 (Target::do_select_as_default_target): Same.
5275
546c7457
DK
52762010-02-01 Doug Kwan <dougkwan@google.com>
5277
5278 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5279 first_output_text_section_.
5280 (Arm_exidx_fixup::first_output_text_section): New method definition.
5281 (Arm_exidx_fixup::first_output_text_section_): New data member.
5282 (Arm_exidx_fixup::process_exidx_section): Record the first text
5283 output section seen.
5284 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5285 and entsize in output section header.
5286
11b861d5
DK
52872010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5288
5289 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5290 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5291 (Arm_relocate_functions::thm_alu11): New Method.
5292 (Arm_relocate_functions::thm_pc8): New Method.
5293 (Arm_relocate_functions::thm_pc12): New Method.
5294 (Target_arm::Scan::local): Handle the relocations.
5295 (Target_arm::Scan::global): Likewise.
5296 (Target_arm::Relocate::relocate): Likewise.
5297 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5298
c9a2c125
DK
52992010-01-29 Doug Kwan <dougkwan@google.com>
5300
5301 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5302 of relocation types as ld.
5303
1521477a
DK
53042010-01-29 Doug Kwan <dougkwan@google.com>
5305
5306 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5307 to public.
5308 (Arm_relocate_functions::thumb_branch_common): Ditto.
5309 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5310 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5311 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5312 Arm_relocate_functions::jump24): Remove.
5313 (Target_arm::Relocate::relocate): Adjust code to call
5314 Arm_relocation_functions::arm_branch_common and
5315 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 5316 wrappers. Merge switch-cases together to reduce source code size.
1521477a 5317
e7eca48c
DK
53182010-01-29 Doug Kwan <dougkwan@google.com>
5319
5320 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5321 output_local_symbol_count_needs_update_.
5322 (Arm_relobj::output_local_symbol_count_needs_update,
5323 Arm_relobj::set_output_local_symbol_count_needs_update,
5324 Arm_relobj::update_output_local_symbol_count): New methods.
5325 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5326 member.
5327 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5328 of pointed function as in a R_ARM_PREL31 relocation.
5329 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5330 for output local symbol count updating.
5331 (Target_arm::do_relax): Update output local symbol counts in objects
5332 if necessary.
5333 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5334
02961d7e
ILT
53352010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5336
5337 * arm.cc: Added support for the ARM relocations:
5338 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5339 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5340 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5341 movw_prel_nc).
5342 (Arm_relocate_functions::movw_rel): New method.
5343 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5344 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5345 thm_movw_prel_nc).
5346 (Arm_relocate_functions::thm_movw_rel): New method.
5347 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5348 thm_movt_prel).
5349 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5350 relocations.
5351 (Target_arm::Scan::global): Likewise.
5352 (Target_arm::Relocate::relocate): Likewise.
5353 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5354 Likewise.
5355
b10d2873
ILT
53562010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5357
5358 * arm.cc: Added support for ARM group relocations.
5359 (Target_arm::reloc_needs_sym_origin): New method.
5360 (Arm_relocate_functions::calc_grp_kn): New method.
5361 (Arm_relocate_functions::calc_grp_residual): New method.
5362 (Arm_relocate_functions::calc_grp_gn): New method.
5363 (Arm_relocate_functions::arm_grp_alu): New Method.
5364 (Arm_relocate_functions::arm_grp_ldr): New Method.
5365 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5366 (Arm_relocate_functions::arm_grp_ldc): New Method.
5367 (Target_arm::Scan::local): Handle the ARM group relocations.
5368 (Target_arm::Scan::global): Likewise.
5369 (Target_arm::Relocate::relocate): Likewise.
5370 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5371 Likewise.
5372
2b328d4e
DK
53732010-01-26 Doug Kwan <dougkwan@google.com>
5374
5375 * arm.cc (set): Include.
5376 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5377 pointer type.
5378 (Arm_output_section::Text_section_list): New type.
5379 (Arm_output_section::append_text_sections_to_list): New method.
5380 (Arm_output_section::fix_exidx_coverage): Ditto.
5381 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5382 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5383 Relobj::set_section_offset() instead of
5384 Sized_relobj::invalidate_section_offset().
5385 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5386 parameter for section headers. Ignore relocation sections for
5387 unallocated sections and EXIDX sections.
5388 (Target_arm::fix_exidx_coverage): New method.
5389 (Target_arm::output_section_address_less_than): New type.
5390 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5391 linked text section instead of the EXIDX section.
5392 (Arm_output_section::create_stub_group): Add an assertion to check
5393 that this is not an EXIDX output section.
5394 (Arm_output_section::append_text_sections_to_list): New method.
5395 (Arm_output_section::fix_exidx_coverage): Ditto.
5396 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5397 Arm_relobj::section_needs_reloc_stub_scanning.
5398 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5399 first pass.
5400 (Target_arm::fix_exidx_coverage): New method.
5401 * object.h (Relobj::set_output_section): New method.
5402 (Sized_relobj::invalidate_section_offset): Remove method.
5403 (Sized_relobj::do_invalidate_section_offset): Remove method.
5404 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5405
c7f3c371
DK
54062010-01-25 Doug Kwan <dougkwan@google.com>
5407
5408 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5409 Fix warning due to signed and unsigned comparison on a 32-bit host.
5410
8923b24c
DK
54112010-01-22 Doug Kwan <dougkwan@google.com>
5412
5413 * arm.cc (Target_arm::do_relax): Record an output section for section
5414 offset adjustment it contains any stub table that has changed.
5415 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5416 offsets in an output section if necessary.
5417 * output.cc (Output_section::Output_section): Initialize
5418 section_offsets_need_adjustments_.
5419 (Output_section::add_input_section_for_script): Renamed to
5420 Output_section::add_simple_input_section.
5421 (Output_section::save_states): Add a comment.
5422 (Output_section::discard_states): New method defintion.
5423 (Output_section::adjust_section_offsets): Same.
5424 * output.h (Output_section::add_input_section_for_script): Renamed to
5425 Output_section::add_simple_input_section.
5426 (Output_section::discard_states): New method declaration.
5427 (Output_section::adjust_section_offsets): Same.
5428 (Output_section::section_offsets_need_adjustment,
5429 Output_section::set_section_offsets_need_adjustment): New method
5430 definitions.
5431 (Output_section::section_offsets_need_adjustment_): New data member.
5432 * script-sections.cc
5433 (Output_section_element_input::set_section_address): Adjust code for
5434 renaming of Output_section::add_input_section_for_script.
5435 (Orphan_output_section::set_section_address): Same.
5436
9b2fd367
DK
54372010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5438
5439 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5440 Fix_v4bx enum values .
5441 * gold/options.h (General_options): New option definitions.
5442 (General_options::fix_v4bx): New method.
5443 (General_options::Fix_v4bx): New enum.
5444 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5445 (General_options::parse_fix_v4bx_interworking): New method.
5446
80d0d023
DK
54472010-01-22 Doug Kwan <dougkwan@google.com>
5448
5449 * arm.cc (Arm_exidx_fixup): New class.
5450
af2cdeae
DK
54512010-01-21 Doug Kwan <dougkwan@google.com>
5452
5453 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5454 classes.
5455 (Arm_exidx_section_offset_map): New type.
5456
993d07c1
DK
54572010-01-21 Doug Kwan <dougkwan@google.com>
5458
5459 * arm.cc (Arm_exidx_input_section): New class.
5460 (Arm_relobj::exidx_input_section_by_link,
5461 Arm_relobj::exidx_input_section_by_shndx,
5462 Arm_relobj::make_exidx_input_section): New methods.
5463 (read_arm_attributes_section): Remove.
5464 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5465 information about them.
5466 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5467 to here.
5468
5ac169d4
DK
54692010-01-20 Doug Kwan <dougkwan@google.com>
5470
5471 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5472 Input_section_specifier to Section_id.
5473 (Target_arm::new_arm_input_section: Adjust code for change of key
5474 type.
5475 (Target_arm::find_arm_input_section): Ditto.
5476 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5477 (Section_id): Remove.
5478 (Garbage_collection::Section_id_hash): Remove.
5479 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5480 (Section_id): Remove.
5481 (Icf::Section_id_hash): Remove.
5482 * object.h (Section_id, Const_section_id, Section_id_hash,
5483 Const_section_id_hash): New type definitions.
5484 * output.cc (Output_section::add_relaxed_input_section): Change to
5485 use Const_section_id instead of Input_section_specifier as key type.
5486 (Output_section::add_merge_input_section): Ditto.
5487 (Output_section::build_relaxation_map): Change to use Section_id
5488 instead of Input_section_specifier as key type.
5489 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5490 Ditto.
5491 (Output_section::convert_input_sections_to_relaxed_sections): Change
5492 to use Const_section_id instead of Input_section_specifier as key type.
5493 (Output_section::find_merge_section): Ditto.
5494 (Output_section::find_relaxed_input_section): Ditto.
5495 * output.h (Input_section_specifier): Remove class.
5496 (Output_section::Output_section_data_by_input_section_map): Change
5497 key type to Const_section_id.
5498 (Output_section::Output_relaxed_input_section_by_input_section_map):
5499 Ditto.
5500 (Output_section::Relaxation_map): Change key type to Section_id.
5501
a2162063
ILT
55022010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5503
5504 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5505 (class Arm_v4bx_stub): New class.
5506 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5507 (Stub_factory::make_arm_v4bx_stub): New method.
5508 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5509 (Stub_table::empty): Handle v4bx stubs.
5510 (Stub_table::add_arm_v4bx_stub): New method.
5511 (Stub_table::find_arm_v4bx_stub): New method.
5512 (Arm_relocate_functions::v4bx): New method.
5513 (Target_arm::fix_v4bx): New method.
5514 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5515 (Stub_table::relocate_stubs): Likewise.
5516 (Stub_table::do_write): Likewise.
5517 (Stub_table::update_data_size_and_addralign): Likewise.
5518 (Stub_table::finalize_stubs): Likewise.
5519 (Target_arm::Scan::local): Likewise.
5520 (Target_arm::Scan::global): Likewise.
5521 (Target_arm::do_finalize_sections): Likewise.
5522 (Target_arm::Relocate::relocate): Likewise.
5523 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5524 Likewise.
5525 (Target_arm::scan_reloc_for_stub): Likewise.
5526 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5527
5696ab0b
ILT
55282010-01-19 Ian Lance Taylor <iant@google.com>
5529
5530 * output.cc (Output_section_headers::do_sized_write): Write large
5531 segment count to sh_info field.
5532 (Output_file_header::do_sized_write): For large segment count,
5533 write PN_XNUM to e_phnum field.
5534
800d0f56
ILT
55352010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5536
5537 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5538 (Arm_relocate_functions::thm_jump8): New function.
5539 (Arm_relocate_functions::thm_jump11): New function.
5540 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5541 R_ARM_THM_JUMP11.
5542 (Target_arm::Scan::global): Likewise.
5543 (Target_arm::Relocate::relocate): Likewise.
5544 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5545 Likewise.
5546
41263c05
DK
55472010-01-14 Doug Kwan <dougkwan@google.com>
5548
5549 * arm.cc (map, utility): Include headers.
5550 (Target_arm::apply_cortex_a8_workaround): New method.
5551 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5552 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5553 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5554 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5555 the --[no-]fix-cortex-a8 command line options.
5556 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5557 (Target_arm::relocate_stub): Use addend in instruction template.
5558 * options.h (DEFINE_bool): Set the user-set flag.
5559 (General_options): Add --[no-]-fix-cortex options.
5560 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 5561 : Update fast look-up map after conversion.
41263c05 5562
459e9b03
ST
55632010-01-14 Sriraman Tallam <tmsriram@google.com>
5564
5565 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5566 in the first pass of do_layout.
5567
b521dfe4
DK
55682010-01-13 Doug Kwan <dougkwan@google.com>
5569
5570 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5571 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5572 apparent compiler problem of not folding static constant integral
5573 data members of elfcpp::Elf_sizes<32>.
5574
44272192
DK
55752010-01-13 Doug Kwan <dougkwan@google.com>
5576
5577 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5578 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5579 Arm_relobj::scan_section_for_cortex_a8_erratum,
5580 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5581 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5582 sections to scan for relocation stubs into a new method
5583 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5584 relocation and Cortex-A8 stub scanning.
5585 (Target_arm::do_relax): Force stubs to be after stubbed sections
5586 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 5587 the beginning of a new relaxation pass. Update a comment.
44272192
DK
5588 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5589
44b71ece
ILT
55902010-01-12 Ian Lance Taylor <iant@google.com>
5591
5592 * target-reloc.h (visibility_error): New inline function.
5593 (relocate_section): Call visibility_error.
5594 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5595 (MOSTLYCLEANFILES): Likewise.
5596 (protected_4_pic.o, protected_3.err): New targets.
5597 * testsuite/protected_4.cc: New file.
5598
a120bc7f
DK
55992010-01-12 Doug Kwan <dougkwan@google.com>
5600
5601 * arm.cc (Cortex_a8_reloc): New class.
5602 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5603 and cortex_a8_relocs_info_.
5604 (Target_arm::fix_cortex_a8): New method definition.
5605 (Target_arm::Cortex_a8_relocs_info): New type.
5606 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5607 New data member declarations.
5608 (Target_arm::scan_reloc_for_stub): Record information about
5609 relocations for THUMB branches that might be exempted from the
5610 Cortex-A8 workaround.
5611 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5612 at the beginning of a relaxation pass.
5613
20138696
DK
56142010-01-12 Doug Kwan <dougkwan@google.com>
5615
5616 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5617 (Arm_relobj::Mapping_symbol_position,
5618 Arm_reloj::Mapping_symbol_position_less,
5619 Arm_relobj::Mapping_symbols_info): New types.
5620 (Target_arm::is_mapping_symbol_name): New method definition.
5621 (Arm_relobj::do_count_local_symbols): Save information about mapping
5622 symbols.
5623
089d69dc
DK
56242010-01-11 Doug Kwan <dougkwan@google.com>
5625
5626 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5627 Arm_relocate_functions::thumb32_branch_upper,
5628 Arm_relocate_functions::thumb32_branch_lower,
5629 Arm_relocate_functions::thumb32_cond_branch_offset,
5630 Arm_relocate_functions::thumb32_cond_branch_upper,
5631 Arm_relocate_functions::thumb32_cond_branch_lower,
5632 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5633 branch offset encoding.
5634 (Arm_relocate_functions::thumb_branch_common): Use new branch
5635 offset encoding methods to avoid code duplication.
5636 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5637 (Stub_addend_reader::operator()): Use new branch encoding method
5638 to avoid code duplication.
5639
99e5bff2
DK
56402010-01-11 Doug Kwan <dougkwan@google.com>
5641
5642 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5643 (Target_arm::do_finalize_sections): Define special EXIDX section
5644 symbols only if referenced.
5645 * gc.h (Garbage_collection::add_reference): New method.
5646 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5647 code duplication.
5648
98e090bd
ILT
56492010-01-11 Ian Lance Taylor <iant@google.com>
5650
d0a91bd8
ILT
5651 * script.cc (Version_script_info::build_expression_list_lookup):
5652 Change complaing about duplicate wildcard match from error to
5653 warning.
5654
98e090bd
ILT
5655 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5656 of 2009-12-30.
5657 (Version_script_info::Version_script_info): Initialize globs_,
5658 default_version_, default_is_global_, and exact_. Don't
5659 initialize globals_ or locals_.
5660 (Version_script_info::build_lookup_tables): Build local symbols
5661 first.
5662 (Version_script_info::unquote): New function.
5663 (Version_script_info::add_exact_match): New function.
5664 (Version_script_info::build_expression_list_lookup): Remove lookup
5665 parameter. Add is_global parameter. Change all callers. Handle
5666 wildcard pattern specially. Unquote pattern. Call
5667 add_exact_match.
5668 (Version_script_info::get_name_to_match): New function.
5669 (Version_script_info::get_symbol_version): New function.
5670 (Version_script_info::get_symbol_version_helper): Remove.
5671 (Version_script_info::check_unmatched_names): Call unquote.
5672 * script.h (class Version_script_info): Change get_symbol_version
5673 to be non-inline and add is_global parameter; change all callers.
5674 Rewrite symbol_is_local. Update declarations. Define struct
5675 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5676 Remove globals_ and locals_ members. Add exact_, globs_,
5677 default_version_, is_global_.
5678 (Version_script_info::Glob): Remove pattern, add expression and
5679 is_global. Update constructor. Change all callers.
5680 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5681 default version.
5682 (Versions::symbol_section_contents): If a symbol is undefined, or
5683 defined in a dynamic object, set the version index to
5684 VER_NDX_LOCAL.
5685 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5686 symbol_is_local.
5687 (Symbol_table::add_from_pluginobj): Likewise.
5688 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5689
d56962d3
DK
56902010-01-11 Doug Kwan <dougkwan@google.com>
5691
5692 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5693 (incremental_dump_LDADD): Add linking option for libintl.
5694 * Makefile.in: Regenerate.
5695
94e6ee91
L
56962010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5697
5698 PR gold/11144
5699 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5700 instead of -Ds.
5701 * testsuite/Makefile.in: Regenerated.
5702
e96c574b
DK
57032010-01-10 Doug Kwan <dougkwan@google.com>
5704
5705 * options.h (DEFINE_var): Use parentheses around argument varname__
5706 in macro body to avoid any unintended subsequent substitutions.
5707
7198066b
ILT
57082010-01-10 Ian Lance Taylor <iant@google.com>
5709
ba4d53bf
ILT
5710 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5711 candidates before doing symbol resolution.
5712
7198066b
ILT
5713 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5714 ODR candidates if only one is weak.
5715
a2beed37
ILT
57162010-01-08 Ian Lance Taylor <iant@google.com>
5717
5718 * script.cc (Version_script_info::build_expression_list_lookup):
5719 Don't warn about ambiguous version, just record the ambiguity.
5720 (Version_script_info::get_symbol_version_helper): Give error if
5721 version is ambiguous.
5722
2fb7225c
DK
57232010-01-08 Doug Kwan <dougkwan@google.com>
5724
5725 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5726 prev_data_size_ and prev_addralign_. Remove initializer for
5727 deleted data member has_been_changed_.
5728 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5729 to determine if the table is empty.
5730 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5731 Remove.
5732 (Stub_table::add_reloc_stub): Define method in class definition
5733 instead of just declaring it there.
5734 (Stub_table::add_cortex_a8_stub): New method definition.
5735 (Stub_table::update_data_size_and_addralign): Ditto.
5736 (Stub_table::finalize_stubs): Ditto.
5737 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5738 (Stub_table::do_addralign_): Return address alignment in the
5739 (Stub_table::do_reset_address_and_file_offset): Define method in
5740 class definition instead of declaring it there. Set current data
5741 size to be the data size of the previous pass.
5742 (Stub_table::set_final_data_size): Use current data size as the
5743 final data size.
5744 (Stub_table::relocate_stub): Change parameter type of stub from
5745 Reloc_stub pointer to Stub pointer.
5746 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5747 (Stub_table::Cortex_a8_stub_list): New typedef.
5748 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5749 Stub_table::prev_addralign_): New data member.
5750 (Arm_relobj::Arm_relobj): Initialize data member
5751 section_has_cortex_a8_workaround_.
5752 (Arm_relobj::section_has_cortex_a8_workaround,
5753 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5754 definitions.
5755 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5756 declarations.
5757 (Target_arm::relocate_stub): Change parameter type of stub from
5758 Reloc_stub pointer to Stub pointer.
5759 (Insn_template::size, Insn_template::alignment): Handle
5760 THUMB16_SPECIAL_TYPE.
5761 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5762 Stub_table::update_data_size_and_addralign,
5763 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5764 definitions.
5765 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5766 (Stub_table::do_write): Ditto.
5767 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5768
880cd20d
ILT
57692010-01-08 Ian Lance Taylor <iant@google.com>
5770
5771 PR 11108
5772 * symtab.h (class Symbol): Remove fields is_target_special_ and
5773 has_plt_offset_. Add field is_defined_in_discarded_section_.
5774 (Symbol::is_defined_in_discarded_section): New function.
5775 (Symbol::set_is_defined_in_discarded_section): New function.
5776 (Symbol::has_plt_offset): Rewrite.
5777 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5778 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5779 Don't initialize is_target_special_ or has_plt_offset_.
5780 Initialize is_defined_in_discarded_section_.
5781 (Symbol_table::add_from_relobj): If appropriate, set
5782 is_defined_in_discarded_section.
5783 * resolve.cc (Symbol::override_base_with_special): Don't test
5784 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5785 * target-reloc.h (relocate_section): Do special handling for
5786 symbols defined in discarded sections for global symbols as well
5787 as local symbols.
5788
2703e3eb
ILT
57892010-01-08 Ian Lance Taylor <iant@google.com>
5790
5791 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5792 the SHT_SYMTAB case.
5793
339d40a3
ILT
57942010-01-08 Ian Lance Taylor <iant@google.com>
5795
5796 * object.cc (Sized_relobj::do_layout): Don't get confused if
5797 layout_eh_frame returns NULL.
5798
abecea76
ILT
57992010-01-08 Ian Lance Taylor <iant@google.com>
5800
5801 PR 11084
5802 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5803 dynamic symbol table, use the normal symbol table.
5804 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5805 symbol table.
5806
6b7dd3f3
ILT
58072010-01-08 Ian Lance Taylor <iant@google.com>
5808
5809 PR 11072
5810 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5811 sections.
5812
36c50e63
L
58132010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5814
5815 * version.cc (print_version): Change to "Copyright 2010".
5816
e291e7b9
ILT
58172010-01-08 Ian Lance Taylor <iant@google.com>
5818
5819 PR 10287
5820 PR 11063
5821 * i386.cc (class Target_i386): Change return type of plt_section
5822 to be non-const.
5823 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5824 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5825 tls_desc_rel_ field.
5826 (Output_data_plt_i386::rel_tls_desc): New function.
5827 (Target_i386::rel_tls_desc_section): New function.
5828 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5829 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5830 R_386_TLS_DESC reloc in rel_tls_desc_section.
5831 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5832 Define struct Tlsdesc_info.
5833 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5834 (Target_x86_64::do_reloc_symbol_index): New function.
5835 (Target_x86_64::add_tlsdesc_info): New function.
5836 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5837 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5838 tlsdesc_rel_ field.
5839 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5840 all callers.
5841 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5842 (Target_x86_64::rela_tlsdesc_section): New function.
5843 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5844 handling.
5845 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5846 (Target_x86_64::do_reloc_addend): New function.
5847 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5848 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5849 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5850 (Output_reloc::type): New function.
5851 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5852 (Output_reloc::is_target_specific): New function.
5853 (Output_reloc::target_arg): New function.
5854 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5855 absolute relocs and target specific relocs.
5856 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5857 add_target_specific.
5858 (class Output_data_reloc) [SHT_RELA]: Likewise.
5859 * output.cc (Output_reloc::Output_reloc): Add four new versions
5860 for absolute relocs and target specific relocs.
5861 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5862 (Output_reloc::get_symbol_index): Likewise.
5863 (Output_reloc::local_section_offset): Check that local_sym_index_
5864 is not TARGET_CODE or 0.
5865 (Output_reloc::symbol_value): Likewise.
5866 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5867 reloc.
5868 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5869 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5870 functions.
5871 * layout.cc (add_target_dynamic_tags): Use output section for
5872 DT_PLTRELSZ and DT_JMPREL.
5873
3a44184e
ILT
58742010-01-07 Ian Lance Taylor <iant@google.com>
5875
5876 PR 11061
5877 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5878 function.
5879 (class Output_data_reloc_generic): Define.
5880 (class Output_data_reloc_base): Change base class to
5881 Output_data_reloc_generic. Change add() method to call
5882 bump_relative_reloc_count for a relative reloc. Remove
5883 sort_relocs_ field.
5884 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5885 to sort_relocs().
5886 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5887 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5888 appropriate.
5889 * layout.h (class Layout): Update declaration.
5890
ea715a34
ILT
58912010-01-07 Ian Lance Taylor <iant@google.com>
5892
5893 * output.h (class Output_data): Add const version of
5894 output_section and do_output_section.
5895 (class Output_section_data): Add const version of
5896 do_output_section.
5897 (class Output_section): Likewise.
5898 * layout.cc (Layout::add_target_dynamic_tags): New function.
5899 * layout.h (class Layout): Update declarations.
5900 * arm.cc (Target_arm::do_finalize_sections): Use
5901 add_target_dynamic_tags.
5902 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5903 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5904 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5905 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5906
659948a4
ILT
59072010-01-07 Ian Lance Taylor <iant@google.com>
5908
5909 PR 11042
5910 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5911 object as needed.
5912
9d3b86f6
ILT
59132010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5914 Ian Lance Taylor <iant@google.com>
5915
5916 PR 11019
5917 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5918 Xindex::read_symtab_xindex.
5919
bb0d3eb0
DK
59202010-01-07 Doug Kwan <dougkwan@google.com>
5921
5922 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5923 (Insn_template::thumb16_bcond_insn): New method declaration.
5924 (Insn_template): Fix spelling.
5925 (Stub::thumb16_special): New method declaration.
5926 (Stub::do_write): Define virtual method which was previously pure
5927 virtual.
5928 (Stub::do_thumb16_special): New method declaration.
5929 (Stub::do_fixed_endian_write): New template member.
5930 (Reloc_stub::do_write): Remove.
5931 (Reloc_stub::do_fixed_endian_write): Remove.
5932 (Cortex_a8_stub): New class definition.
5933 (Stub_factory::make_cortex_a8_stub): New method definition.
5934 (Stub_factory::Stub_factory): Add missing static storage class
5935 qualifier for elf32_arm_stub_a8_veneer_blx.
5936
ffeef7df
ILT
59372010-01-07 Ian Lance Taylor <iant@google.com>
5938
dc3f80fe
ILT
5939 PR 10980
5940 * options.h (class General_options): Add --warn-unresolved-symbols
5941 and --error-unresolved-symbols.
5942 * errors.cc (Errors::undefined_symbol): Implement
5943 --warn-unresolved-symbols.
5944
ffeef7df
ILT
5945 * options.h (class General_options): Add -z text and -z textoff.
5946 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5947
f1ec9ded
ST
59482010-01-06 Sriraman Tallam <tmsriram@google.com>
5949
5950 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5951 (Garbage_collection::cident_sections): New function.
5952 (Garbage_collection::add_cident_section): New function.
5953 (Garbage_collection::cident_sections_): New member.
5954 (gc_process_relocs): Add references to sections whose names are C
5955 identifiers.
5956 * gold.h (cident_section_start_prefix): New constant.
5957 (cident_section_stop_prefix): New constant.
5958 (is_cident): New function.
5959 * layout.cc (Layout::define_section_symbols): Replace string constants
5960 with the newly defined constants.
5961 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5962 C identifiers.
5963 * testsuite/Makefile.am: Add gc_orphan_section_test.
5964 * testsuite/Makefile.in: Regenerate.
5965 * testsuite/gc_orphan_section_test.cc: New file.
5966 * testsuite/gc_orphan_section_test.sh: New file.
5967
6eda8c29
ILT
59682010-01-06 Ian Lance Taylor <iant@google.com>
5969
b9674e17
ILT
5970 PR 10980
5971 * options.h (class General_options): Add --warn-shared-textrel.
5972 * layout.cc (Layout::finish_dynamic_section): Implement
5973 --warn-shared-textrel.
5974
6eda8c29
ILT
5975 PR 10980
5976 * options.h (class General_options): Add --warn-multiple-gp.
5977
32dcd44e
ILT
59782010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5979
5980 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5981 $(THREADSLIB) and $(LIBDL).
5982 * Makefile.in: Rebuild.
5983
a192ba05
ILT
59842010-01-06 Ian Lance Taylor <iant@google.com>
5985
5986 PR 10980
5987 * options.cc (General_options::parse_section_start): New function.
5988 (General_options::section_start): New function.
5989 (General_options::General_options): Initialize all members.
5990 * options.h: Include <map>
5991 (class General_options): Add --section-start. Add section_starts_
5992 member.
5993 * layout.cc (Layout::attach_allocated_section_to_segment): If
5994 --section-start was used, set the address of the segment. Remove
5995 local sort_sections.
5996 (Layout::relaxation_loop_body): If the address of the load segment
5997 has been set by --section-start, don't use it.
5998 * output.h (Output_segment::update_flags_for_output_section): New
5999 function.
6000 * output.cc (Output_segment::add_output_section): Call
6001 update_flags_for_output_section.
6002
dde3f402
ILT
60032010-01-05 Ian Lance Taylor <iant@google.com>
6004
62dfdd4d
ILT
6005 PR 10980
6006 * options.h (class General_options): Add --undefined-version.
6007 * script.cc (struct Version_expression): Add was_matched_by_symbol
6008 field.
6009 (Version_script_info::matched_symbol): New function.
6010 (Version_script_info::get_symbol_version_helper): Call
6011 matched_symbol.
6012 (Version_script_info::check_unmatched_names): New function.
6013 * script.h (class Version_script_info): Update declarations.
6014 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6015
9c4ae156
ILT
6016 * options.h (class General_options): Use DEFINE_bool_alias for
6017 allow_multiple_definition.
6018 * resolve.cc (Symbol_table::should_override): Don't test
6019 allow_multiple_definition.
6020
dde3f402
ILT
6021 PR 10980
6022 * options.h (class General_options): Add --cref.
6023 * main.cc (main): Print cref table if --cref. Don't close mapfile
6024 until after printing cref table.
6025 * cref.cc: Include "symtab.h".
6026 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6027 (Cref_table_compare::operator()): New function.
6028 (Cref_inputs::gather_cref): New function.
6029 (filecol): New static const.
6030 (Cref_inputs::print_cref): New function.
6031 (Cref::print_cref): New function.
6032 * cref.h: Include <cstdio>.
6033 (class Cref): Update declarations.
6034 * mapfile.h (Mapfile::file): New function.
6035 * object.h (class Object): Define Symbols. Declare virtual
6036 do_get_global_symbols.
6037 (Object::get_global_symbols): New function.
6038 * object.cc (Input_objects::add_object): Pass object to cref_ if
6039 --cref.
6040 (Input_objects::archive_start): Likewise.
6041 (Input_objects::archive_stop): Likewise.
6042 (Input_objects::print_cref): New function.
6043 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6044 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6045 --cref.
6046 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6047 function.
6048 * plugin.h (class Sized_pluginobj): Update declarations.
6049
8781f709
ILT
60502010-01-05 Ian Lance Taylor <iant@google.com>
6051
6052 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6053 to is_default_version. Rename insdef to insdefault.
6054 (Symbol_table::add_from_relobj): Rename def to is_default_version
6055 and local to is_forced_local.
6056 (Symbol_table::add_from_pluginobj): Likewise.
6057 (Symbol_table::add_from_dynobj): Likewise.
6058 (Symbol_table::define_special_symbol): Rename insdef to
6059 insdefault.
6060
fe35d28d
ILT
60612010-01-04 Ian Lance Taylor <iant@google.com>
6062
30bc8c46
ILT
6063 PR 10980
6064 * options.h (class General_options): Add
6065 --allow-multiple-definition and -z muldefs.
6066 * resolve.cc (Symbol_table::should_override): Don't warn about a
6067 multiple symbol definition if --allow-multiple-definition or -z
6068 muldefs.
6069
7eaea549
ILT
6070 PR 10980
6071 * options.h (class General_options): Add --add-needed and
6072 --copy-dt-needed-entries. Tweak --as-needed help entry.
6073 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6074 error if --copy-dt-needed-entries aka --add-needed is used and
6075 would cause a change in behaviour.
6076
fe35d28d
ILT
6077 PR 10980
6078 * options.h (class General_options): Add -G as a short version of
6079 --shared. Add no-op options -assert, -g, and -i.
6080
55a2bb35
ST
60812010-01-04 Sriraman Tallam <tmsriram@google.com>
6082
6083 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6084 check for .text or .gnu.linkonce.t sections.
6085 * icf.cc (Icf::find_identical_sections): Ditto.
6086 Change the detection for mangled function name within the section
6087 name.
6088 * icf.h (is_section_foldable_candidate): New function.
6089
719328e1
ILT
60902009-12-30 Ian Lance Taylor <iant@google.com>
6091
6092 PR 10980
6093 * options.h (class General_options): Permit two dashes with
6094 --retain-symbols-file.
6095
d7bb5745
ILT
60962009-12-30 Ian Lance Taylor <iant@google.com>
6097
403a15dd
ILT
6098 PR 10979
6099 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6100 don't put the file header and segment headers in the text
6101 segment.
6102
eda294df
ILT
6103 PR 10979
6104 * common.cc (Sort_commons::operator()): Stabilize sort when both
6105 entries are NULL.
6106 (Symbol_table::do_allocate_commons_list): When allocating common
6107 symbols, skip a symbol which is no longer common.
6108 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6109 an object before checking its type.
6110 * testsuite/common_test_2.c: New file.
6111 * testsuite/common_test_3.c: New file.
6112 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6113 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6114 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6115 (common_test_2_pic.o, common_test_2.so): New targets.
6116 (common_test_3_pic.o, common_test_3.so): New targets.
6117 * testsuite/Makefile.in: Rebuild.
6118
d7bb5745
ILT
6119 PR 10979
6120 * script.cc (read_input_script): If we see a new SECTIONS clause,
6121 and we have added an input section, give an error.
6122 * layout.h (class Layout): Add have_added_input_section function.
6123 Add have_added_input_section_ field.
6124 * layout.cc (Layout::Layout): Initialize
6125 have_added_input_section_.
6126 (Layout::layout): Set have_added_input_section_.
6127 (Layout::layout_eh_frame): Likewise.
6128
fc59c572
ILT
61292009-12-30 Ian Lance Taylor <iant@google.com>
6130
6131 PR 10931
6132 * options.h (class General_options): Add --sort-common option.
6133 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6134 * common.cc (Sort_common): Add sort_order parameter to
6135 constructor. Add sort_order_ field.
6136 (Sort_commons::operator): Check sort_order_.
6137 (Symbol_table::allocate_commons): Determine the sort order.
6138 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6139 Change all callers.
6140 (Symbol_table::do_allocate_commons_list): Likewise.
6141
1c74fab0
ILT
61422009-12-30 Ian Lance Taylor <iant@google.com>
6143
6144 PR 10916
6145 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6146 symbols from this object, don't change the visibility of an
6147 undefined symbol.
6148 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6149
6affe781
ILT
61502009-12-30 Ian Lance Taylor <iant@google.com>
6151
6152 PR 10861
6153 * script.h (class Version_script_info): Define Language enum.
6154 Update declarations. Define Glob, Exact, and Lookup types. Add
6155 new fields globals_, locals_, and is_finalized_.
6156 * script.cc: Various formatting fixes.
6157 (class Parser_closure): Change language_stack_ from a vector of
6158 std::string to one of Version_script_info::Language. Adjust all
6159 uses accordingly.
6160 (class Lazy_demangler): Remove.
6161 (struct Version_expression): Change language from std::string to
6162 Version_script_info::Language.
6163 (Version_script_info::Version_script_info): New function.
6164 (Version_script_info::~Version_script_info): Don't call clear.
6165 (Version_script_info::finalize): New function.
6166 (Version_script_info::build_lookup_tables): New function.
6167 (Version_script_info::build_expression_list_lookup): New
6168 function.
6169 (Version_script_info::get_symbol_version_helper): Rewrite to use
6170 lookup tables.
6171 (Version_script_info::print_expression_list): Adjust to use
6172 Version_script_info::Language.
6173 (script_push_lex_into_version_mode): Check that the version script
6174 has not been finalized.
6175 (version_script_push_lang): Change language string to
6176 Version_script_info::Language.
6177 * options.cc (Command_line::version_script): New function.
6178 * options.h (class General_options): Add finalize_dynamic_list
6179 function. Change version_script from declaration to definition.
6180 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6181 * testsuite/version_script.map: Remove duplicate def of foo.
6182 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6183 version_script.map.
6184 * testsuite/Makefile.in: Rebuild.
6185
818bf354
ILT
61862009-12-30 Ian Lance Taylor <iant@google.com>
6187
6188 PR 10843
6189 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6190 if the input symbol index is 0, make the output symbol index 0.
6191
ebcc8304
ILT
61922009-12-30 Ian Lance Taylor <iant@google.com>
6193
6194 PR 10670
6195 * options.h (class General_options): Add -x/--discard-all.
6196 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6197 --discard-all. If the local symbol needs a dynamic entry, check
6198 that before handling --discard-locals.
6199
176fe33f
ILT
62002009-12-30 Ian Lance Taylor <iant@google.com>
6201
bb321bb1
ILT
6202 PR 10450
6203 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6204 flags to PF_R.
6205 (Output_segment::add_output_section): Don't change the flags if
6206 the type is PT_TLS.
6207
176fe33f
ILT
6208 PR 10450
6209 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6210 GNU hash table if they need a dynamic value. Otherwise, don't add
6211 them if they are defined in a dynamic object or are forced local.
6212
e8cd95c7
ILT
62132009-12-29 Ian Lance Taylor <iant@google.com>
6214
1b81fb71
ILT
6215 PR 10450
6216 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6217 .gnu.hash table for a 32-bit target.
6218
8d6d383d
ILT
6219 PR 10450
6220 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6221 regular and a dynamic object only needs a dynamic symbol table
6222 entry if it is externally visible.
6223
e785ec03
ILT
6224 PR 10450
6225 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6226 constructor. Add global_offset_table_ field.
6227 (Target_i386::got_section): Set global_offset_table_.
6228 (Target_i386::do_finalize_sections): Set global_offset_table_
6229 size.
6230 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6231 in constructor. Add global_offset_table_ field.
6232 (Target_x86_64::got_section): Set global_offset_table_.
6233 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6234 size.
6235
1a2dff53
ILT
6236 * layout.cc (Layout::Layout): Initialize increase_relro_.
6237 (Layout::get_output_section): Add is_relro, is_last_relro, and
6238 is_first_non_relro parameters. Change all callers.
6239 (Layout::choose_output_section): Likewise.
6240 (Layout::add_output_section_data): Likewise.
6241 (Layout::make_output_section): Likewise.
6242 (Layout::set_segment_offsets): Clear increase_relro when using a
6243 linker script.
6244 * layout.h (class Layout): Add increase_relro method. Add
6245 increase_relro_ field. Update declarations.
6246 * output.cc (Output_section::Output_section): Initialize
6247 is_last_relro_ and is_first_non_relro_.
6248 (Output_segment::add_output_section): Group relro sections is
6249 do_sort is true. Handle is_last_relro and is_first_non_relro.
6250 (Output_segment::maximum_alignment): Remove relro handling.
6251 (Output_segment::set_section_addresses): Add increase_relro
6252 parameter. Change all callers. Add initial alignment to align
6253 relro sections on separate page. Remove old relro handling.
6254 (Output_segment::set_section_list_addresses): Remove in_relro
6255 parameter. Change all callers.
6256 (Output_segment::set_offset): Add increase parameter. Change all
6257 callers. Remove old relro handling.
6258 * output.h (class Output_section): Add new methods: is_last_relro,
6259 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6260 Add is_last_relro_ and is_first_non_relro_ fields.
6261 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6262 Create separate .got.plt section. Call increase_relro.
6263 * x86_64.cc (Target_x86_64::got_section): Likewise.
6264 * testsuite/relro_script_test.t: Add .got.plt.
6265
f0ba79e2
ILT
6266 PR 10450
6267 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6268 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6269 (Layout::finalize): Call set_dynamic_symbol_size.
6270 (Layout::set_dynamic_symbol_size): New function.
6271 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6272 set_dynamic_symbol_size.
6273
e8cd95c7
ILT
6274 PR 10450
6275 * output.h (class Output_section): Add is_entsize_zero_ field.
6276 * output.cc (Output_section::Output_section): Initialize
6277 is_entsize_zero_.
6278 (Output_section::set_entsize): If two different entsizes are
6279 requested, force it to zero.
6280 (Output_section::add_input_section): Set flags for .debug_str
6281 before updating section flags. Set entsize.
6282 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6283 and SHF_STRING if all input sections have those flags.
6284
3e1b9a8a
RÁE
62852009-12-29 Rafael Espindola <espindola@google.com>
6286
6287 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
6288 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6289 reporting.
3e1b9a8a 6290
3dcad376
ST
62912009-12-29 Sriraman Tallam <tmsriram@google.com>
6292
6293 * options.cc (General_options::parse_version): Allow -v to exit
6294 without an error if there is nothing to link.
6295
084e2665
ILT
62962009-12-29 Ian Lance Taylor <iant@google.com>
6297
6298 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6299 using a version of gcc before 4.1.
6300 * configure: Rebuild.
6301
250acde3
CD
63022009-12-28 Chris Demetriou <cgd@google.com>
6303
6304 * attributes.cc (Output_attributes_section_data::do_write): Use
6305 std::vector::front rather than std::vector::data.
6306
99fff23b
ILT
63072009-12-28 Ian Lance Taylor <iant@google.com>
6308
6309 * symtab.h (class Symbol_table): Add enum Defined.
6310 * resolve.cc (Symbol_table::should_override): Add defined
6311 parameter. Change all callers. Test whether object is NULL
6312 before calling a method on it.
6313 (Symbol_table::report_resolve_problem): Add defined parameter.
6314 Change all callers.
6315 (Symbol_table::should_override_with_special): Likewise.
6316 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6317 parameter. Change all callers.
6318 (Symbol_table::do_define_in_output_data): Likewise.
6319 (Symbol_table::define_in_output_segment): Likewise.
6320 (Symbol_table::do_define_in_output_segment): Likewise.
6321 (Symbol_table::define_as_constant): Likewise.
6322 (Symbol_table::do_define_as_constant): Likewise.
6323 * script.h (class Symbol_assignment): Add is_defsym parameter to
6324 constructor; change all callers.
6325 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6326 parameter. Change all callers. Add is_defsym_ field.
6327 (class Parser_closure): Add parsing_defsym parameter to
6328 constructor; change all callers. Add parsing_defsym accessor
6329 function. Add parsing_defsym_ field.
6330
556bd683
ILT
63312009-12-28 Ian Lance Taylor <iant@google.com>
6332
6333 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 6334 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 6335
1782c879
ILT
63362009-12-23 Ian Lance Taylor <iant@google.com>
6337
6338 * i386.cc (Target_i386::do_calls_non_split): Recognize
6339 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
6340 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6341 -fsplit-stack prologue when using %r11.
1782c879 6342
329ca2b1
ST
63432009-12-21 Sriraman Tallam <tmsriram@google.com>
6344
6345 * options.cc (General_options::parse_version): Make -v continue and do
6346 the link like GNU ld does.
6347
d675ff46
RÁE
63482009-12-17 Rafael Avila de Espindola <espindola@google.com>
6349
6350 * Makefile.am (CCFILES): Add timer.cc.
6351 (HFILES): Add timer.h.
6352 * configure.ac: Check for sysconf and times.
6353 * main.cc: include timer.h.
6354 (main): Use Timer instead of get_run_time.
6355 * timer.cc: New.
6356 * timer.h: New.
6357 * workqueue.cc: include timer.h.
6358 (Workqueue::find_and_run_task):
6359 Report user, sys and wall time.
6360 * Makefile.in: Regenerate.
6361 * config.in: Regenerate.
6362 * configure: Regenerate.
6363
d6344fb5
DK
63642009-12-16 Doug Kwan <dougkwan@google.com>
6365
6366 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6367 sections.
6368 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6369 relaxed input sections.
6370 * output.cc (Output_section::find_relaxed_input_section): Change
6371 return type to Output_relaxed_input_section pointer. Adjust code
6372 for new type of relaxed_input_section_map_.
6373 * output.h (Output_section::find_relaxed_input_section): Change
6374 return type to Output_relaxed_input_section pointer.
6375 (Output_section::Output_relaxed_input_section_by_input_section_map):
6376 New type.
6377 (Output_section::relaxed_input_section_map_): Change type to
6378 Output_section::Output_relaxed_input_section_by_input_section_map.
6379 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6380 input section.
6381
0e0d5469
ILT
63822009-12-15 Ian Lance Taylor <iant@google.com>
6383
6384 * layout.cc (Layout::create_shstrtab): Only write out after input
6385 sections if we are compressing debug sections.
6386
0649a889
ILT
63872009-12-15 Ian Lance Taylor <iant@google.com>
6388
6389 * archive.cc (Archive::add_symbols): Only look up a symbol without
6390 a version if there is, in fact, a version.
6391
2ea97941
ILT
63922009-12-14 Ian Lance Taylor <iant@google.com>
6393
6394 Revert -Wshadow changes, all changes from:
6395 2009-12-11 Doug Kwan <dougkwan@google.com>
6396 2009-12-11 Nick Clifton <nickc@redhat.com>
6397 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6398
b0eec2cc
DK
63992009-12-11 Doug Kwan <dougkwan@google.com>
6400
6401 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6402 due to -Wshadow.
6403 * attributes.cc (Object_attribute::size): Ditto.
6404 (Attributes_section_data::size): Ditto.
6405 (Attributes_section_data::Attributes_section_data): Ditto.
6406 (Output_attributes_section_data::do_write): Ditto.
6407 * attributes.h (Object_attribute::set_type): Ditto.
6408 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6409
91d6fa6a
NC
64102009-12-11 Nick Clifton <nickc@redhat.com>
6411
6412 * archive.cc: Fix shadowed variable warnings.
6413 * arm.cc: Likewise.
6414 * compressed_output.cc: Likewise.
6415 * compressed_output.h: Likewise.
6416 * configure: Likewise.
6417 * dwarf_reader.cc: Likewise.
6418 * dynobj.cc: Likewise.
6419 * dynobj.h: Likewise.
6420 * ehframe.cc: Likewise.
6421 * ehframe.h: Likewise.
6422 * errors.cc: Likewise.
6423 * expression.cc: Likewise.
6424 * fileread.cc: Likewise.
6425 * fileread.h: Likewise.
6426 * freebsd.h: Likewise.
6427 * i386.cc: Likewise.
6428 * icf.cc: Likewise.
6429 * incremental.h: Likewise.
6430 * layout.cc: Likewise.
6431 * layout.h: Likewise.
6432 * mapfile.cc: Likewise.
6433 * merge.cc: Likewise.
6434 * merge.h: Likewise.
6435 * object.cc: Likewise.
6436 * object.h: Likewise.
6437 * options.h: Likewise.
6438 * output.cc: Likewise.
6439 * output.h: Likewise.
6440 * parameters.cc: Likewise.
6441 * plugin.cc: Likewise.
6442 * powerpc.cc: Likewise.
6443 * reduced_debug_output.cc: Likewise.
6444 * reduced_debug_output.h: Likewise.
6445 * reloc.cc: Likewise.
6446 * reloc.h: Likewise.
6447 * resolve.cc: Likewise.
6448 * script-sections.cc: Likewise.
6449 * script.cc: Likewise.
6450 * script.h: Likewise.
6451 * sparc.cc: Likewise.
6452 * symtab.cc: Likewise.
6453 * symtab.h: Likewise.
6454 * target-select.cc: Likewise.
6455 * target-select.h: Likewise.
6456 * token.h: Likewise.
6457 * workqueue.cc: Likewise.
6458 * workqueue.h: Likewise.
6459 * x86_64.cc: Likewise.
6460
a0351a69
DK
64612009-12-10 Doug Kwan <dougkwan@google.com>
6462
6463 * arm.cc (attributes.h): New include.
6464 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6465 (Arm_relobj::~Arm_relobj): Delete object pointed by
6466 attributes_section_data_.
6467 (Arm_relobj::attributes_section_data): New method definition.
6468 (Arm_relobj::attributes_section_data_): New data member declaration.
6469 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6470 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6471 attributes_section_data_.
6472 (Arm_dynobj::attributes_section_data): New method definition.
6473 (Arm_dynobj::attributes_section_data_): New data member declaration.
6474 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6475 initialization value of may_use_blx_ to false.
6476 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6477 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6478 object attributes to compute results instead of hard-coding.
6479 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6480 Target_arm::get_secondary_compatible_arch,
6481 Target_arm::set_secondary_compatible_arch
6482 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6483 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6484 New method declarations.
6485 (Target_arm::get_aeabi_object_attribute): New method definition.
6486 (Target_arm::attributes_section_data_): New data member declaration.
6487 (read_arm_attributes_section): New template definition.
6488 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6489 (Arm_dynobj::do_read_symbols): Ditto.
6490 (Target_arm::do_finalize_sections): Merge attributes sections from
6491 input. Check for BLX use after attributes section merging.
6492 Fix __exidx_start and __exidx_end visibility. Create an
6493 .ARM.attributes section if necessary.
6494 (Target_arm::get_secondary_compatible_arch,
6495 Target_arm::set_secondary_compatible_arch,
6496 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6497 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 6498 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
6499 New method definitions.
6500
b59befec
ILT
65012009-12-09 Ian Lance Taylor <iant@google.com>
6502
6503 * plugin.cc (Plugin::load): Don't cast from void* to a function
6504 pointer.
6505
1276bc89
ILT
65062009-12-09 Ian Lance Taylor <iant@google.com>
6507
6508 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6509 information fields.
6510
2f2de248
L
65112009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6512
6513 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6514 Replace two_file_shared_1.so with two_file_shared_2.so.
6515 * testsuite/Makefile.in: Regenerated.
6516
4f787271
DK
65172009-12-08 Doug Kwan <dougkwan@google.com>
6518
6519 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6520 (HFILES): Add attributes.h and int_encoding.h.
6521 * Makefile.in: Regenerate.
6522 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6523 function definitions to int_encoding.cc
6524 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6525 prototypes to int_encoding.h
6526 * reduced_debug_output.cc (int_encoding.h): New include.
6527 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6528 function definitions to int_encoding.cc
6529 (insert_into_vector, read_from_pointer): Move template definitions to
6530 int_encoding.h
6531 * attributes.cc: New file.
6532 * attributes.h: New file.
6533 * int_encoding.cc: New file.
6534 * int_encoding.h: New file.
6535
20b52f1a
RÁE
65362009-12-07 Rafael Avila de Espindola <espindola@google.com>
6537
6538 PR gold/11055
6539 * incremental-dump.cc (dump_incremental_inputs): New.
6540 (main): Use dump_incremental_inputs.
6541
53d7974c
L
65422009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6543
6544 PR gold/10893
6545 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6546 checking elfcpp::STT_FUNC.
6547 (Target_i386::Relocate::relocate): Likewise.
6548 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6549
6550 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6551 symbols from shared libraries into normal FUNC symbols.
6552
6553 * symtab.h (Symbol): Add is_func and use it.
6554
05a352e6
DK
65552009-12-05 Doug Kwan <dougkwan@google.com>
6556
6557 * arm.cc (Target_arm::arm_info): Initialize new fields
6558 attributes_section and attributes_vendor.
6559 * i386.cc (Target_i386::i386_info): Same.
6560 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6561 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6562 fields attributes_section and attributes_vendor.
53d7974c 6563 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
6564 * target.h (Target::attributes_section, Target::attributes_vendor,
6565 Target::is_attributes_section, Target::attribute_arg_type,
6566 Target::attributes_order): New method definitions.
6567 (Target::Target_info::attributes_section,
6568 Target::Target_info::attributes_vendor): New fields.
6569 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6570 virtual method definitions.
6571 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6572 attributes_section and attributes_vendor.
6573 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6574
f4e5969c
DK
65752009-12-05 Doug Kwan <dougkwan@google.com>
6576
6577 * arm.cc: Update comments about interworking and stub generation.
6578 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6579 considered as non-PIC.
6580 (Arm_relocate_functions::base_abs): Fix formatting.
6581 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6582 of function to use GOT entry address instead of offset.
6583 (Target_arm::Scan::global): Issue an error if a symbol would need a
6584 PLT does not get one because it is untyped. Remove code to create
6585 dynamic symbols for relative branches.
6586 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6587 takes unsigned integer instead of boolean.
6588
1abce4a6
L
65892009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6590
6591 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6592 (two_file_test_LDADD): Likewise.
6593 (common_test_1_LDADD): Likewise.
6594 (exception_test_LDADD) Likewise.
6595 (weak_test_LDADD): Likewise.
6596 (many_sections_test_LDADD): Likewise.
6597 (initpri1_LDADD): Likewise.
6598 (script_test_1_LDADD): Likewise.
6599 (script_test_2_LDADD): Likewise.
6600 (justsyms_LDADD): Likewise.
6601 (binary_test_LDADD): Likewise.
6602 (large_LDADD): Likewise.
6603 * testsuite/Makefile.in: Regenerated.
6604
adcf2816 66052009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 6606
adcf2816
L
6607 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6608 (Symbol_table::override_with_special): Likewise.
6609 (Symbol_table::add_from_object): Likewise.
6610
28e67f5d
RÁE
66112009-12-04 Rafael Avila de Espindola <espindola@google.com>
6612
6613 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6614 Don't set the data_offset twice.
6615
ae10a101
RÁE
66162009-12-04 Rafael Avila de Espindola <espindola@google.com>
6617
6618 * testsuite/Makefile.in: Regenerate.
6619
f59f41f3
DK
66202009-12-03 Doug Kwan <dougkwan@google.com>
6621
6622 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6623 (Target_arm::do_finalize_sections): Add parameter for symbol table
6624 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6625 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6626 parameter for symbol table pointer.
6627 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6628 an additional parameter for a pointer to symbol table.
6629 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6630 parameter for a symbol table pointer.
6631 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6632 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6633 Ditto.
6634 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6635 parameter for a symbol table pointer.
6636
ca55d848
RÁE
66372009-12-03 Rafael Avila de Espindola <espindola@google.com>
6638
6639 * incremental.cc (Incremental_inputs_header)
6640 (Incremental_inputs_header_write, Incremental_inputs_entry)
6641 (Incremental_inputs_entry_write): Move ...
6642 * incremental.h (Incremental_inputs_header)
6643 (Incremental_inputs_header_write, Incremental_inputs_entry)
6644 (Incremental_inputs_entry_write): here.
6645
3aec4f9c
RÁE
66462009-12-02 Rafael Avila de Espindola <espindola@google.com>
6647
6648 * incremental.cc (make_sized_incremental_binary): Set the target.
6649 Error if it is incompatible.
6650 * output.h (Output_file): Add filename method.
6651
9c0ae74d
RÁE
66522009-12-02 Rafael Avila de Espindola <espindola@google.com>
6653
6654 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6655 from the get_* methods.
6656
a45500ae
RÁE
66572009-12-02 Rafael Avila de Espindola <espindola@google.com>
6658
6659 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6660 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6661 Write 0 for the data_offset of scripts.
6662
325e6408
RÁE
66632009-12-02 Rafael Avila de Espindola <espindola@google.com>
6664
6665 * testsuite/Makefile.am: Add the incremental_test.sh test.
6666 * testsuite/incremental_test.sh: New.
6667 * testsuite/incremental_test_1.c: New.
6668 * testsuite/incremental_test_2.c: New.
6669
954c3e2e
RÁE
66702009-12-01 Rafael Avila de Espindola <espindola@google.com>
6671
6672 * incremental-dump.cc (main): Fix typos.
6673
f8086623
RÁE
66742009-11-27 Rafael Avila de Espindola <espindola@google.com>
6675
6676 PR gold/11025
6677 * incremental-dump.cc (main): Use llu to print 64 bit values.
6678
3b0dd6ac
L
66792009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6680 H.J. Lu <hongjiu.lu@intel.com>
6681
6682 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6683 $(LIBDL).
6684 (incremental_dump_LDADD): Likewise.
6685 * Makefile.in: Regenerated.
6686
a6d1ef57 66872009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 6688
a6d1ef57
DK
6689 Revert:
6690
6691 2009-11-25 Doug Kwan <dougkwan@google.com>
6692
6693 * arm.cc (Target_arm::Target_arm): Move method definition
6694 outside of class definition. Add code to handle
6695 --target1-rel, --target1-abs and --target2= options.
6696 (Target_arm::get_reloc_reloc_type): Change method to be
6697 non-static and const.
6698 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6699 New data member declaration.
6700 (Target_arm::Scan::local, Target_arm::Scan::global,
6701 Target_arm::Relocate::relocate,
6702 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6703 Adjust call to Target_arm::get_real_reloc_type.
6704 (Target_arm::get_real_reloc_type): Use command line options
6705 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6706 * options.h (--target1-rel, --target1-abs, --target2): New
6707 ARM-only options.
6708
50aeb7d4
DK
67092009-11-25 Doug Kwan <dougkwan@google.com>
6710
6711 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6712 class definition. Add code to handle --target1-rel, --target1-abs
6713 and --target2= options.
6714 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6715 and const.
6716 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6717 member declaration.
6718 (Target_arm::Scan::local, Target_arm::Scan::global,
6719 Target_arm::Relocate::relocate,
6720 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6721 call to Target_arm::get_real_reloc_type.
6722 (Target_arm::get_real_reloc_type): Use command line options to
6723 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6724 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6725 options.
6726
51938283
DK
67272009-11-25 Doug Kwan <dougkwan@google.com>
6728
6729 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6730 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6731 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6732 formatting.
6733 (Arm_relocate_functions::thm_call): Replace body with a call to
6734 Arm_relocate_functions::thumb_branch_common.
6735 (Arm_relocate_functions::thm_jump24,
6736 Arm_relocate_functions::thm_xpc22): New method definitions.
6737 (Arm_relocate_functions::thumb_branch_common): New method definition.
6738 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6739 operator.
6740 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6741 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6742
e2b8f3c4
RÁE
67432009-11-24 Rafael Avila de Espindola <espindola@google.com>
6744
6745 * Makefile.am: Build incremental-dump
6746 * Makefile.in: Regenerate.
6747 * incremental-dump.cc: New.
6748 * incremental.cc (Incremental_inputs_header_data,
6749 Incremental_inputs_entry_data): Move to incremental.h
6750 * incremental.h: (Incremental_inputs_header_data,
6751 Incremental_inputs_entry_data): Move from incremental.cc
6752
bcba9aec
RÁE
67532009-11-24 Rafael Avila de Espindola <espindola@google.com>
6754
6755 * incremental.cc (Incremental_inputs_header,
6756 Incremental_inputs_header_write, Incremental_inputs_entry,
6757 Incremental_inputs_entry_write): Add a typedef with the data type.
6758
7c3afe08
RÁE
67592009-11-24 Rafael Avila de Espindola <espindola@google.com>
6760
6761 * incremental.cc (Incremental_inputs_header,
6762 Incremental_inputs_header_write, Incremental_inputs_entry,
6763 Incremental_inputs_entry_write): Update comment about which
6764 type has the filed descriptions.
6765
d204b6e9
DK
67662009-11-15 Doug Kwan <dougkwan@google.com>
6767
6768 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6769 (Arm_relocate_functions::arm_branch_common): Change method defintion
6770 in class definition to a method declaration and update list of formal
6771 parameters.
6772 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6773 Arm_relocation_functions::jump24): Adjust call to
6774 Arm_relocate_functions::arm_branch_common. Update list of formal
6775 parameters.
6776 (Arm_relocate_functions::xpc25): New method definition.
6777 (Arm_relocate_functions::arm_branch_common): Move method defintion
6778 out from class definition. Use stubs for mode-switching and extending
6779 branch ranges.
6780 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6781 specially. Change code to enable use of stubs in ARM branches.
6782
43d12afe
DK
67832009-11-10 Doug Kwan <dougkwan@google.com>
6784
6785 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6786 in method declaration.
6787 (Target_arm::relocate_stub): New method declaration.
6788 (Target_arm::default_target): Change to return a pointer instead of
6789 a const reference.
6790 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6791 Target_arm::default_target.
6792 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6793 method definition.
6794 (Target_arm::relocate_section): Adjust view.
6795 (Target_arm::relocate_stub): New method definition.
6796
ac33a407
DK
67972009-11-10 Doug Kwan <dougkwan@google.com>
6798
6799 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6800 a format warning.
6801 * incremental.cc (open_incremental_binary): Initialized local
6802 variables to avoid warnings.
6803 * object.cc (make_elf_object): Ditto.
6804 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6805 a format warning.
e1df38aa 6806
88ee28e9
L
6807009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6808
6809 PR gold/10930
6810 * testsuite/plugin_test.c: Include "config.h".
6811
2daedcd6
DK
68122009-11-09 Doug Kwan <dougkwan@google.com>
6813
6814 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6815 (arm_symbol_value): Remove.
6816 (Arm_relocate_functions::arm_branch_common,
6817 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6818 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6819 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6820 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6821 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6822 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6823 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6824 Arm_relocate_functions::thm_mobw_abs_nc,
6825 Arm_relocate_functions::thm_mov_abs,
6826 Arm_relocate_functions::movw_prel_nc,
6827 Arm_relocate_functions::thm_movt_abs,
6828 Arm_relocate_functions::movt_prel,
6829 Arm_relocate_functions::thm_movw_prel_nc,
6830 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6831 (Target_arm::Relocate::relocate): Only decompose address into two
6832 parts if relocation type uses the thumb-bit and pass the actual
6833 bit instead of a flag indicating that the thumb-bit is used. Adjust
6834 calls to methods in Arm_relocate_functions for this change.
6835
1276bc89 68362009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6837
6838 PR 10925
6839 * reloc.cc: Instantiate
6840 Sized_relobj::initialize_input_to_output_maps and
6841 Sized_relobj:free_input_to_output_maps.
6842
e53ad1b5
ILT
68432009-11-06 Ian Lance Taylor <iant@google.com>
6844
6845 PR 10876
6846 * defstd.cc (in_segment): Set only_if_ref true for "end".
6847
eb44217c
DK
68482009-11-06 Doug Kwan <dougkwan@google.com>
6849
6850 * arm.cc (class Reloc_stub): Correct a comment.
6851 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6852 (Target_arm::scan_section_for_stubs): New method declaration.
6853 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6854 Change methods from private to protected.
6855 (Target_arm::do_may_relax): New method definition.
6856 (Target_arm::do_relax, Target_arm::group_sections,
6857 Target_arm::scan_reloc_for_stub,
6858 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6859 (Target_arm::arm_input_section_map_): New data member declaration.
6860 (Target_arm::scan_reloc_for_stub,
6861 Target_arm::scan_reloc_section_for_stubs,
6862 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6863 Target_arm::do_relax): New method definitions.
6864
5d329b7d
ILT
68652009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6866
6867 * configure.ac: Check for (struct stat)::st_mtim
6868 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6869 * config.in: Regenerate.
6870 * configure: Regenerate.
6871
96a0d71b
ILT
68722009-11-05 Ian Lance Taylor <iant@google.com>
6873
6874 PR 10910
6875 * output.cc (Output_segment::add_output_section): Add missing
6876 return statement.
6877
594c8e5e
ILT
68782009-11-04 Ian Lance Taylor <iant@google.com>
6879
6880 PR 10880
6881 * object.h (class Object): Add is_needed and set_is_needed
6882 methods. Add is_needed_ field. Make bool fields into bitfields.
6883 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6884 defined in a dynamic object and referenced by a regular object,
6885 set is_needed for the dynamic object.
6886 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6887 if the file is marked with as_needed and it is not needed.
6888
22b127cc
ILT
68892009-11-04 Ian Lance Taylor <iant@google.com>
6890
6891 PR 10887
6892 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6893 tags if data is discarded by linker script.
6894 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6895 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6896 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6897 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6898
f5c870d2
ILT
68992009-11-04 Ian Lance Taylor <iant@google.com>
6900
6901 * layout.cc (Layout::get_output_section): Add is_interp and
6902 is_dynamic_linker_section parameters. Change all callers.
6903 (Layout::choose_output_section): Likewise.
6904 (Layout::make_output_section): Likewise.
6905 (Layout::add_output_section_data): Add is_dynamic_linker_section
6906 parameter. Change all callers.
6907 * layout.h (class Layout): Update declarations.
6908 * output.h (class Output_section): Add is_interp, set_is_interp,
6909 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6910 Add is_interp_, is_dynamic_linker_section_ fields. Change
6911 generate_code_fills_at_write_ to a bitfield.
6912 * output.cc (Output_section::Output_sections): Initialize new
6913 fields.
6914 (Output_segment::add_output_section): Add do_sort parameter.
6915 Change all callers.
6916
1ae4d23b
ILT
69172009-11-03 Ian Lance Taylor <iant@google.com>
6918
6919 PR 10860
6920 * options.h (class General_options): Add --warn-common.
6921 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6922 merging two common symbols.
6923 (Symbol_table::should_override): Handle --warn-common when merging
6924 a common symbol with a defined symbol. Use report_resolve_problem
6925 for multiple definitions.
6926 (Symbol_table::report_resolve_problem): New function.
6927 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6928
55da9579
DK
69292009-11-03 Doug Kwan <dougkwan@google.com>
6930
6931 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6932 stub_factory_.
6933 (Target_arm::stub_factory): New method definition.
6934 (Target_arm::new_arm_input_section,
6935 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6936 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 6937 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
6938 New type definitions.
6939 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6940 member declarations.
6941 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6942 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6943 New method definitions.
6944
37a9ac43
ILT
69452009-11-03 Ian Lance Taylor <iant@google.com>
6946
6947 * options.h (class General_options): Add --warn_constructors.
6948
b3d6a3d4
ILT
69492009-11-03 Ian Lance Taylor <iant@google.com>
6950
6951 PR 10893
6952 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6953 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6954
934b01dd
ILT
69552009-11-03 Ian Lance Taylor <iant@google.com>
6956
6957 PR 10895
6958 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6959 --msgid-bugs-address.
6960 (install-pdf): New target.
6961 (install-data_yes): Look up one directory to find mkinstalldirs.
6962
03c1939b
L
69632009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6964
6965 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6966 tree.
6967
ebd95253
DK
69682009-10-30 Doug Kwan <dougkwan@google.com>
6969
6970 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6971
e9bbb538
DK
69722009-10-30 Doug Kwan <dougkwan@google.com>
6973
6974 * arm.cc (Stub_addend_reader): New struct template definition
6975 and partial specializations.
6976 (Stub_addend_reader::operator()): New method definition for a
6977 partially specialized template.
6978
d5b40221
DK
69792009-10-30 Doug Kwan <dougkwan@google.com>
6980
6981 * arm.cc (Arm_relobj::processor_specific_flags): New method
6982 definition.
6983 (Arm_relobj::do_read_symbols): New method declaration.
6984 (Arm_relobj::processor_specific_flags_): New data member declaration.
6985 (Arm_dynobj): New class definition.
6986 (Target_arm::do_finalize_sections): Add input_objects parameter.
6987 (Target_arm::do_adjust_elf_header): New method declaration.
6988 (Target_arm::are_eabi_versions_compatible,
6989 (Target_arm::merge_processor_specific_flags): New method declaration.
6990 (Target_arm::do_make_elf_object): New overloaded method definitions
6991 and declaration.
6992 (Arm_relobj::do_read_symbols): New method definition.
6993 (Arm_dynobj::do_read_symbols): Ditto.
6994 (Target_arm::do_finalize_sections): Add input_objects parameters.
6995 Merge processor-specific flags from all input objects.
6996 (Target_arm::are_eabi_versions_compatible,
6997 Target_arm::merge_processor_specific_flags,
6998 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6999 New method definitions.
7000 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7001 Input_objects pointer type parameter.
7002 * layout.cc (Layout::finalize): Pass input objects to target's.
7003 finalize_sections function.
7004 * output.cc (Output_file_header::do_sized_write): Set ELF file
7005 header's processor-specific flags.
7006 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7007 Input_objects pointer type parameter.
7008 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7009 * target.h (Input_objects): New forward class declaration.
7010 (Target::processor_specific_flags,
7011 Target::are_processor_specific_flags_sect): New method definitions.
7012 (Target::finalize_sections): Add input_objects parameter.
7013 (Target::Target): Initialize processor_specific_flags_ and
7014 are_processor_specific_flags_set_.
7015 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7016 parameter.
7017 (Target::set_processor_specific_flags): New method definition.
7018 (Target::processor_specific_flags_,
7019 Target::are_processor_specific_flags_set_): New data member
7020 declarations.
7021 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7022 Input_objects pointer type parameter.
7023
ebabffbd
DK
70242009-10-30 Doug Kwan <dougkwan@google.com>
7025
7026 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7027
ad0f2072
ILT
70282009-10-28 Ian Lance Taylor <iant@google.com>
7029
7030 * object.h (class Relobj): Drop options parameter from
7031 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7032 do_scan_relocs, do_relocate. Change all callers.
7033 (class Sized_relobj): Drop options parameters from
7034 do_gc_process_relocs, do_scan_relocs, do_relocate,
7035 do_relocate_sections, relocate_sections, emit_relocs_scan,
7036 emit_relocs_scan_reltype. Change all callers.
7037 (struct Relocate_info): Remove options field and all references to
7038 it.
7039 * reloc.h (class Read_relocs): Remove options constructor
7040 parameter and options_ field. Change all callers.
7041 (class Gc_process_relocs, class Scan_relocs): Likewise.
7042 (class Relocate_task): Likewise.
7043 * target-reloc.h (scan_relocs): Remove options parameter. Change
7044 all callers.
7045 (scan_relocatable_relocs): Likewise.
7046 * target.h (class Sized_target): Remove options parameter from
7047 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7048 all callers.
7049 * gc.h (gc_process_relocs): Remove options parameter. Change all
7050 callers.
7051 * arm.cc: Update functions to remove options parameters.
7052 * i386.cc: Likewise.
7053 * powerpc.cc: Likewise.
7054 * sparc.cc: Likewise.
7055 * x86_64.cc: Likewise.
7056 * testsuite/testfile.cc: Likewise.
7057
8ffa3667
DK
70582009-10-28 Doug Kwan <dougkwan@google.com>
7059
7060 * arm.cc (Arm_relobj): New class definition.
e1df38aa 7061 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
7062 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7063 New method definitions.
7064
40f36857
CC
70652009-10-28 Cary Coutant <ccoutant@google.com>
7066
7067 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7068 (Plugin::cleanup_done_): New member.
7069 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7070 (Plugin_manager::cleanup_done_): Remove.
7071 (Plugin_manager::add_input_file): Edit error message.
7072 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7073 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7074
2c849493
ILT
70752009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7076
7077 * fileread.cc: (File_read::View::~View): Use the new
7078 data_ownership_ filed.
7079 (File_read::~File_read): Dispose the new whole_file_view_.
7080 (File_read::open): Mmap the whole file if needed.
7081 (File_read::open): Use whole_file_view_ instead of contents_.
7082 (File_read::find_view): Use whole_file_view_ if applicable.
7083 (File_read::do_read): Use whole_file_view_ instead of contents_.
7084 (File_read::make_view): Use whole_file_view_ instead of contents_,
7085 update File_read::View::View call.
7086 (File_read::find_or_make_view): Update File_read::View::View
7087 call.
7088 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7089 remove contents_
7090 (File_read::View::Data_ownership): New enum.
7091 (File_read::View::View): Replace bool mapped_ with Data_ownership
7092 argument.
7093 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7094 (File_read::View::data_ownership_): New field.
7095 (File_read::contents_): Remove (replaced by whole_file_view_).
7096 (File_read::whole_file_view_): New field.
7097 * options.h (class General_options): Add --keep-files-mapped.
7098
24998053
CC
70992009-10-27 Cary Coutant <ccoutant@google.com>
7100
7101 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7102 * testsuite/Makefile.am (plugin_test_5): New test case.
7103 * testsuite/Makefile.in: Regenerate.
7104
72adc4fa
DK
71052009-10-25 Doug Kwan <dougkwan@google.com>
7106
7107 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7108 from private to protected to allow access by child class.
7109 (Sized_relobj::do_relocate_sections): New method declaration.
7110 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 7111 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
7112 Sized_relobj::relocate_sections. Instantiate template explicitly
7113 for different target sizes and endianity.
7114
07f508a2
DK
71152009-10-24 Doug Kwan <dougkwan@google.com>
7116
7117 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7118 (Arm_input_section::as_arm_input_section): New method.
7119 (Arm_output_section): New class definition.
7120 (Arm_output_section::create_stub_group,
7121 Arm_output_section::group_sections): New method definitions.
7122
10ad9fe5
DK
71232009-10-22 Doug Kwan <dougkwan@google.com>
7124
7125 * arm.cc (Arm_input_section): New class definition.
7126 (Arm_input_section::init, Arm_input_section:do_write,
7127 Arm_input_section::set_final_data_size,
7128 Arm_input_section::do_reset_address_and_file_offset): New method
7129 definitions.
7130
56ee5e00
DK
71312009-10-21 Doug Kwan <dougkwan@google.com>
7132
7133 * arm.cc (Stub_table, Arm_input_section): New forward class
7134 declarations.
7135 (Stub_table): New class defintion.
7136 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7137 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7138 New method definition.
7139
b569affa
DK
71402009-10-21 Doug Kwan <dougkwan@google.com>
7141
7142 * arm.cc: Update copyright comments.
7143 (Target_arm): New forward class template declaration.
7144 (Arm_address): New type.
7145 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7146 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7147 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7148 constants.
7149 (Insn_template): Same.
7150 (DEF_STUBS): New macro.
7151 (Stub_type): New enum type.
7152 (Stub_template): New class definition.
7153 (Stub): Same.
7154 (Reloc_stub): Same.
7155 (Stub_factory): Same.
7156 (Target_arm::Target_arm): Initialize may_use_blx_ and
7157 should_force_pic_veneer_.
7158 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7159 Target_arm::should_force_pic_veneer,
7160 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7161 Target_arm::using_thumb_only, Target_arm:;default_target): New
7162 method defintions.
7163 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7164 New data member declarations.
7165 (Insn_template::size, Insn_template::alignment): New method defintions.
7166 (Stub_template::Stub_template): New method definition.
7167 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7168 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7169 (Stub_factory::Stub_factory): New method definition.
7170 * gold.h (string_hash): New template.
7171 * output.h (Input_section_specifier::hash_value): Use
7172 gold::string_hash.
7173 (Input_section_specifier::string_hash): Remove.
7174 * stringpool.cc (Stringpool_template::string_hash): Use
7175 gold::string_hash.
7176
6c172549
DK
71772009-10-20 Doug Kwan <dougkwan@google.com>
7178
7179 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7180 symbols of relaxed input sections.
7181 * output.h (Output_section::find_relaxed_input_section): Make
7182 method public.
7183
c5617f2f
DK
71842009-10-16 Doug Kwan <dougkwan@google.com>
7185
7186 * dynobj.cc (Versions::Versions): Initialize version_script_.
7187 Only insert base version symbol definition for a shared object
7188 if version script defines any version versions.
7189 (Versions::define_base_version): New method definition.
7190 (Versions::add_def): Check that base version is not needed.
7191 (Versions::add_need): Define base version lazily.
7192 * dynobj.h (Versions::define_base_version): New method declaration.
7193 (Versions::needs_base_version_): New data member declaration.
7194 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7195 (check_DATA): Add no_version_test.stdout.
7196 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7197 New make rules.
7198 * testsuite/Makefile.in: Regenerate.
7199 * testsuite/no_version_test.c: New file.
7200 * testsuite/no_version_test.sh: Ditto.
7201
3c12dcdb
DK
72022009-10-16 Doug Kwan <dougkwan@google.com>
7203
7204 * expression.cc (class Segment_start_expression): New class definition.
7205 (Segment_start_expression::value): New method definition.
7206 (script_exp_function_segment_start): Return a new
7207 Segment_start_expression.
7208 * gold/script-c.h (script_saw_segment_start_expression): New function
7209 prototype.
7210 * script-sections.cc (Script_sections::Script_sections): Initialize
7211 SAW_SEGMENT_START_EXPRESSION_ to false.
7212 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7213 and -Tbbs options to specify section addresses if given in
7214 command line and no SEGMENT_START expression is seen in a script.
7215 * script-sections.h (Script_sections::saw_segment_start_expression,
7216 Script_sections::set_saw_segment_start_expression): New method
7217 definition.
7218 (Script_sections::saw_segment_start_expression_): New data member
7219 declaration.
7220 * script.cc (script_saw_segment_start_expression): New function.
7221 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7222 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7223 script_test_7.sh and script_test_8.sh.
7224 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7225 script_test_8.stdout.
7226 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7227 (script_test_6, script_test_6.stdout, script_test_7,
7228 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7229 * Makefile.in: Regenerate.
7230 * testsuite/script_test_6.sh: New file.
7231 * testsuite/script_test_6.t: Same.
7232 * testsuite/script_test_7.sh: Same.
7233 * testsuite/script_test_7.t: Same.
7234 * testsuite/script_test_8.sh: Same.
7235
64b1ae37
DK
72362009-10-16 Doug Kwan <dougkwan@google.com>
7237
7238 * output.cc (Output_segment::set_section_list_address): Cast
7239 expressions to unsigned long long type to avoid format warnings.
7240
661be1e2
ILT
72412009-10-15 Ian Lance Taylor <iant@google.com>
7242
12edd763 7243 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 7244 dot assignment to script_sections_.
12edd763
ILT
7245 * script-sections.cc (Script_sections::add_dot_assignment):
7246 Initialize if necessary.
7247
68b6574b
ILT
7248 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7249 program headers with no load segment if there is a linker script.
7250
661be1e2
ILT
7251 * layout.cc (Layout::set_segment_offsets): Align the file offset
7252 to the segment aligment for -N or -n with no load segment.
7253 * output.cc (Output_segment::add_output_section): Don't crash if
7254 the first section is a TLS section.
7255 (Output_segment::set_section_list_addresses): Print an error
7256 message if the address moves backward in a linker script.
7257 * script-sections.cc
7258 (Output_section_element_input::set_section_addresses): Don't
7259 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7260 (Orphan_output_section::set_section_addresses): Likewise.
7261
f15f61a7
DK
72622009-10-15 Doug Kwan <dougkwan@google.com>
7263
7264 * layout.cc (Layout::finish_dynamic_section): Generate tags
7265 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7266 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7267 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7268
82bb573a
ILT
72692009-10-14 Ian Lance Taylor <iant@google.com>
7270
7271 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7272 fields.
7273 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7274 data_shdr fields of relinfo.
7275 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7276 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7277 R_386_TLS_LDO_32, adjust based on section flags.
7278 (Target_i386::Relocate::fix_up_ldo): Remove.
7279
374ad285
ILT
72802009-10-13 Ian Lance Taylor <iant@google.com>
7281
7282 Add support for -pie.
7283 * options.h (class General_options): Add -pie and
7284 --pic-executable.
7285 (General_options::output_is_position_independent): Test -pie.
7286 (General_options::output_is_executable): Return true if not shared
7287 and not relocatable.
7288 (General_options::output_is_pie): Remove.
7289 * options.cc (General_options::finalize): Reject incompatible uses
7290 of -pie.
7291 * gold.cc (queue_middle_tasks): A -pie link is not static.
7292 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7293 * symtab.cc (Symbol::final_value_is_known): Return false if
7294 output_is_position_independent.
7295 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7296 output_is_position_independent.
7297 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7298 output_is_position_independent.
7299 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7300 output_is_position_independent.
7301 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7302 two_file_pie_test.
7303 (basic_pie_test.o, basic_pie_test): New targets.
7304 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7305 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7306 (two_file_pie_test): New target.
7307 * testsuite/Makefile.in: Rebuild.
7308 * README: Remove note saying that -pie is not supported.
7309
c6585162
ILT
73102009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7311
7312 * options.h (class General_options): Add -init and -fini.
7313 * layout.cc (Layout::finish_dynamic_section): Emit
7314 given init and fini functions.
7315
032ce4e9
ST
73162009-10-13 Sriraman Tallam <tmsriram@google.com>
7317
7318 * gc.h (gc_process_relocs): Check if icf is enabled using new
7319 function.
7320 * gold.cc (queue_initial_tasks): Likewise.
7321 (queue_middle_tasks): Likewise.
7322 * object.cc (do_layout): Likewise.
7323 * symtab.cc (is_section_folded): Likewise.
7324 * main.cc (main): Likewise.
7325 * reloc.cc (Read_relocs::run): Likewise.
7326 (Sized_relobj::do_scan_relocs): Likewise.
7327 * icf.cc (is_function_ctor_or_dtor): New function.
7328 (Icf::find_identical_sections): Check if function is ctor or dtor when
7329 safe icf is chosen.
7330 * options.h (General_options::icf): Change option to be an enum.
7331 (Icf_status): New enum.
7332 (icf_enabled): New method.
7333 (icf_safe_folding): New method.
7334 (set_icf_status): New method.
7335 (icf_status_): New variable.
7336 * (options.cc) (General_options::finalize): Set icf_status_.
7337 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7338 icf_test and icf_keep_unique_test to use the --icf enum flag.
7339 * testsuite/icf_safe_test.sh: New file.
e1df38aa 7340 * testsuite/icf_safe_test.cc: New file.
032ce4e9 7341
f345227a
ST
73422009-10-12 Sriraman Tallam <tmsriram@google.com>
7343
7344 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7345 includes to gc.h and icf.h.
7346 * arm.cc: Include gc.h.
7347 * gold.cc: Likewise.
7348 * i386.cc: Likewise.
7349 * powerpc.cc: Likewise.
7350 * sparc.cc: Likewise.
7351 * x86_64.cc: Likewise.
7352 * gc.h: Include icf.h.
7353
1c7814ed
ILT
73542009-10-11 Ian Lance Taylor <iant@google.com>
7355
7356 * plugin.cc: Include "gold.h" before other header files.
7357
ae3b5189
CD
73582009-10-10 Chris Demetriou <cgd@google.com>
7359
7360 * options.h (Input_file_argument::Input_file_type): New enum.
7361 (Input_file_argument::is_lib_): Replace with...
7362 (Input_file_argument::type_): New member.
7363 (Input_file_argument::Input_file_argument): Take Input_file_type
7364 'type' rather than boolean 'is_lib' as second argument.
7365 (Input_file_argument::is_lib): Use type_.
7366 (Input_file_argument::is_searched_file): New function.
7367 (Input_file_argument::may_need_search): Handle is_searched_file.
7368 * options.cc (General_options::parse_library): Support -l:filename.
7369 (General_options::parse_just_symbols): Update for Input_file_argument
7370 changes.
7371 (Command_line::process): Likewise.
7372 * archive.cc (Archive::get_file_and_offset): Likewise.
7373 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7374 * script.cc (read_script_file, script_add_file): Likewise.
7375 * fileread.cc (Input_file::Input_file): Likewise.
7376 (Input_file::will_search_for): Handle is_searched_file.
7377 (Input_file::open): Likewise.
7378 * readsyms.cc (Read_symbols::get_name): Likewise.
7379 * testsuite/Makefile.am (searched_file_test): New test.
7380 * testsuite/Makefile.in: Regenerate.
7381 * testsuite/searched_file_test.cc: New file.
7382 * testsuite/searched_file_test_lib.cc: New file.
7383
f3048a1d
ILT
73842009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7385 Ian Lance Taylor <iant@google.com>
7386
7387 * descriptor.cc: Include <cstdio> and "binary-io.h".
7388 (Descriptors::open): Open the files in binary mode always.
7389 * script.cc (Lex::get_token): Treat \r as whitespace.
7390
d4780e57
ILT
73912009-10-09 Ian Lance Taylor <iant@google.com>
7392
7393 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7394
d9a893b8
ILT
73952009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7396 Ian Lance Taylor <iant@google.com>
7397
7398 * configure.ac: Check for readv function also.
7399 * fileread.cc (readv): Define if not HAVE_READV.
7400 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7401 does not exist.
7402 * config.in: Regenerate.
7403 * configure: Regenerate.
7404
c0a62865
DK
74052009-10-09 Doug Kwan <dougkwan@google.com>
7406
7407 * layout.cc (Layout::make_output_section): Call target hook to make
7408 ordinary output section.
7409 (Layout::finalize): Adjust parameter list of call the
7410 Target::may_relax().
7411 * layout.h (class Layout::section_list): New method.
7412 * merge.h (Output_merge_base::entsize): Change visibility to public.
7413 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7414 New methods.
7415 (Output_merge_string::do_is_string): New method.
7416 * object.cc (Sized_relobj::do_setup): renamed from
7417 Sized_relobj::set_up.
7418 * object.h (Sized_relobj::adjust_shndx,
7419 Sized_relobj::initializ_input_to_output_maps,
7420 Sized_relobj::free_input_to_output_maps): Change visibilities to
7421 protected.
7422 (Sized_relobj::setup): Virtualize.
7423 (Sized_relobj::do_setup): New method declaration.
7424 (Sized_relobj::invalidate_section_offset,
7425 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7426 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7427 * options.cc (parse_int): New function.
7428 * options.h (parse_int): New declaration.
7429 (DEFINE_int): New macro.
7430 (stub_group_size): New option.
7431 * output.cc (Output_section::Output_section): Initialize memebers
7432 merge_section_map_, merge_section_by_properties_map_,
7433 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7434 (Output_section::add_input_section): Handled deferred code-fill
7435 generation and remove an old comment.
7436 (Output_section::add_relaxed_input_section): New method definition.
7437 (Output_section::add_merge_input_section): Use merge section by
7438 properties map to speed to search. Update merge section maps
7439 as appropriate.
7440 (Output_section::build_relaxation_map): New method definition.
7441 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7442 Same.
7443 (Output_section::relax_input_section): Renamed to
7444 Output_section::convert_input_sections_to_relaxed_sections and change
7445 interface to take a vector of pointers to relaxed sections.
7446 (Output_section::find_merge_section,
7447 Output_section::find_relaxed_input_section): New method definitions.
7448 (Output_section::is_input_address_mapped,
7449 Output_section::output_offset, Output_section::output_address):
7450 Use output section data maps to speed up searching.
7451 (Output_section::find_starting_output_address): Add comments.
7452 (Output_section::do_write,
7453 Output_section::write_to_postprocessing_buffer): Do code-fill
7454 generation as appropriate.
7455 (Output_section::get_input_sections): Invalidate relaxed input section
7456 map.
7457 (Output_section::restore_states): Adjust type of checkpoint .
7458 Invalidate relaxed input section map.
7459 * output.h (Output_merge_base): New class declaration.
7460 (Input_section_specifier): New class defintion.
7461 (class Output_relaxed_input_section) Change base class to
7462 Output_section_data_build.
7463 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7464 base class initializer.
7465 (Output_section::add_relaxed_input_section): New method declaration.
7466 (Output_section::Input_section): Change visibility to protected.
7467 (Output_section::Input_section::relobj,
7468 Output_section::Input_section::shndx): Handle relaxed input sections.
7469 Output_section::input_sections) Change visibility to protected. Also
7470 define overload to return a non-const pointer.
7471 (Output_section::Merge_section_properties): New class defintion.
7472 (Output_section::Merge_section_by_properties_map,
7473 Output_section::Output_section_data_by_input_section_map,
7474 Output_section::Relaxation_map): New types.
7475 (Output_section::relax_input_section): Rename method to
7476 Output_section::convert_input_sections_to_relaxed_sections and change
7477 interface to take a vector of relaxed section pointers.
7478 (Output_section::find_merge_section,
7479 Output_section::find_relaxed_input_section,
7480 Output_section::build_relaxation_map,
7481 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7482 New method declarations.
7483 (Output_section::merge_section_map_
7484 Output_section::merge_section_by_properties_map_,
7485 Output_section::relaxed_input_section_map_,
7486 Output_section::is_relaxed_input_section_map_valid_,
7487 Output_section::generate_code_fills_at_write_): New data members.
7488 * script-sections.cc
7489 (Output_section_element_input::set_section_addresses): Call
7490 current_data_size and addralign methods of relaxed input sections.
7491 (Orphan_output_section::set_section_addresses): Call current_data_size
7492 and addralign methods of relaxed input sections.
7493 * symtab.cc (Symbol_table::compute_final_value): Extract template
7494 from the body of Symbol_table::sized_finalize_symbol.
7495 (Symbol_table::sized_finalized_symbol): Call
7496 Symbol_table::compute_final_value.
7497 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7498 (Symbol_table::compute_final_value): New templated method declaration.
7499 * target.cc (Target::do_make_output_section): New method defintion.
7500 * target.h (Target::make_output_section): New method declaration.
7501 (Target::relax): Add more parameters for input objects, symbol table
7502 and layout. Adjust call to do_relax.
7503 (Target::do_make_output_section): New method declaration.
7504 (Target::do_relax): Add parameters for input objects, symbol table
7505 and layout.
7506
d446d6c4
ILT
75072009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7508
7509 * pread.c: Include stdio.h.
7510
bc06c745
ILT
75112009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7512
7513 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7514 defined.
7515
75aea3d0
ILT
75162009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7517
7518 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7519 Change read_shndx type to unsigned int.
7520 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7521 int.
7522 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7523 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7524 Change read_shndx type to unsigned int.
7525 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7526 int.
7527 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7528 * layout.cc (Layout::create_symtab_sections): Cast the result of
7529 local_symcount * symsize to off_t in the gold_assert.
7530
be8fcb75
ILT
75312009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7532
7533 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7534 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7535 R_ARM_BASE_ABS.
7536 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7537 (Arm_relocate_functions::thm_abs5): New function.
7538 (Arm_relocate_functions::abs12): New function.
7539 (Arm_relocate_functions::abs16): New function.
7540 (Arm_relocate_functions::base_abs): New function.
7541 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7542 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7543 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7544 R_ARM_BASE_ABS.
7545 (Scan::global): Likewise.
7546 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7547 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7548 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7549 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7550 R_ARM_BASE_ABS.
7551
c2a122b6
ILT
75522009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7553
7554 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7555 (Arm_relocate_functions::movt_prel): New function.
7556 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7557 (Arm_relocate_functions::thm_movt_prel): New function.
7558 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7559 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7560 (Scan::global, Relocate::relocate): Likewise.
7561 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7562
c4aa1e2d
ILT
75632009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7564
7565 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7566 Incremental_checker.
7567 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7568 unsigned int.
7569 (class Incremental_inputs_header): New class.
7570 (Incremental_inputs_header_writer): Edit comment.
7571 (Incremental_inputs_entry): New class.
7572 (Incremental_inputs_entry_writer): Edit comment.
7573 (Sized_incremental_binary::do_find_incremental_inputs_section):
7574 Add *strtab_shndx parameter, fill it.
7575 (Sized_incremental_binary::do_check_inputs): New method.
7576 (Incremental_checker::can_incrementally_link_output_file): Use
7577 Sized_incremental_binary::check_inputs.
7578 (Incremental_inputs::report_command_line): Save command line in
7579 command_line_.
7580 * incremental.h:
7581 (Incremental_binary::find_incremental_inputs_section): New
7582 method.
7583 (Incremental_binary::do_find_incremental_inputs_section): Add
7584 strtab_shndx parameter.
7585 (Incremental_binary::do_check_inputs): New pure virtual method.
7586 (Sized_incremental_binary::do_check_inputs): Declare.
7587 (Incremental_checker::Incremental_checker): Add incremental_inputs
7588 parameter, use it to initialize incremental_inputs_.
7589 (Incremental_checker::incremental_inputs_): New field.
7590 (Incremental_checker::command_line): New method.
7591 (Incremental_checker::inputs): New method.
7592 (Incremental_checker::command_line_): New field.
7593
c549a694
ILT
75942009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7595
7596 * incremental.cc: Include <cstdarg> and "target-select.h".
7597 (vexplain_no_incremental): New function.
7598 (explain_no_incremental): New function.
7599 (Incremental_binary::error): New method.
7600 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7601 method.
7602 (make_sized_incremental_binary): New function.
7603 (open_incremental_binary): New function.
7604 (can_incrementally_link_file): Add checks if output is ELF and has
7605 inputs section.
7606 * incremental.h: Include "elfcpp_file.h" and "output.h".
7607 (Incremental_binary): New class.
7608 (Sized_incremental_binary): New class.
7609 (open_incremental_binary): Declare.
7610 * object.cc (is_elf_object): Use
7611 elfcpp::Elf_recognizer::is_elf_file.
7612 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7613 * output.h (Output_file::filesize): New method.
7614
fd3c5f0b
ILT
76152009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7616
7617 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7618 New function.
7619 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7620 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7621 function.
7622 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7623 function.
7624 (Arm_relocate_functions::movw_abs_nc): New function.
7625 (Arm_relocate_functions::movt_abs): New function.
7626 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7627 (Arm_relocate_functions::thm_movt_abs): New function.
7628 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7629 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7630 (Scan::global): Likewise.
7631 (Relocate::relocate): Likewise.
7632 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7633
7f5309a5
ILT
76342009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7635
7636 * arm.cc (Arm_relocate_functions::got_prel) New function.
7637 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7638 (Relocate::relocate): Likewise.
7639 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7640
364c7fa5
ILT
76412009-10-06 Ian Lance Taylor <iant@google.com>
7642
7643 * options.h (class General_options): Define
7644 split_stack_adjust_size parameter.
7645 * object.h (class Object): Add uses_split_stack_ and
7646 has_no_split_stack_ fields. Add uses_split_stack and
7647 has_no_split_stack accessor functions. Declare
7648 handle_split_stack_section.
7649 (class Reloc_symbol_changes): Define.
7650 (class Sized_relobj): Define Function_offsets. Declare
7651 split_stack_adjust, split_stack_adjust_reltype, and
7652 find_functions.
7653 * object.cc (Object::handle_split_stack_section): New function.
7654 (Sized_relobj::do_layout): Call handle_split_stack_section.
7655 * dynobj.cc (Sized_dynobj::do_layout): Call
7656 handle_split_stack_section.
7657 * reloc.cc (Sized_relobj::relocate_sections): Call
7658 split_stack_adjust for executable sections in split_stack
7659 objects. Pass reloc_map to relocate_section.
7660 (Sized_relobj::split_stack_adjust): New function.
7661 (Sized_relobj::split_stack_adjust_reltype): New function.
7662 (Sized_relobj::find_functions): New function.
7663 * target-reloc.h: Include "object.h".
7664 (relocate_section): Add reloc_symbol_changes parameter. Change
7665 all callers.
7666 * target.h (class Target): Add calls_non_split method. Declare
7667 do_calls_non_split virtual method. Declare match_view and
7668 set_view_to_nop.
7669 * target.cc: Include "elfcpp.h".
7670 (Target::do_calls_non_split): New function.
7671 (Target::match_view): New function.
7672 (Target::set_view_to_nop): New function.
7673 * gold.cc (queue_middle_tasks): Give an error if mixing
7674 split-stack and non-split-stack objects with -r.
7675 * i386.cc (Target_i386::relocate_section): Add
7676 reloc_symbol_changes parameter.
7677 (Target_i386::do_calls_non_split): New function.
7678 * x86_64.cc (Target_x86_64::relocate_section): Add
7679 reloc_symbol_changes parameter.
7680 (Target_x86_64::do_calls_non_split): New function.
7681 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7682 parameter.
7683 * powerpc.cc (Target_powerpc::relocate_section): Add
7684 reloc_symbol_changes parameter.
7685 * sparc.cc (Target_sparc::relocate_section): Add
7686 reloc_symbol_changes parameter.
7687 * configure.ac: Call AM_CONDITIONAL for the default target.
7688 * configure: Rebuild.
7689 * testsuite/Makefile.am (TEST_AS): New variable.
7690 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7691 (check_DATA): Add split_i386 and split_x86_64 files.
7692 (SPLIT_DEFSYMS): Define.
7693 (split_i386_[1234n].o): New targets.
7694 (split_i386_[124]): New targets.
7695 (split_i386_[1234r].stdout): New targets.
7696 (split_x86_64_[1234n].o): New targets.
7697 (split_x86_64_[124]): New targets.
7698 (split_x86_64_[1234r].stdout): New targets.
7699 (MOSTLYCLEANFILES): Add new executables.
7700 * testsuite/split_i386.sh: New file.
7701 * testsuite/split_x86_64.sh: New file.
7702 * testsuite/split_i386_1.s: New file.
7703 * testsuite/split_i386_2.s: New file.
7704 * testsuite/split_i386_3.s: New file.
7705 * testsuite/split_i386_4.s: New file.
7706 * testsuite/split_i386_n.s: New file.
7707 * testsuite/split_x86_64_1.s: New file.
7708 * testsuite/split_x86_64_2.s: New file.
7709 * testsuite/split_x86_64_3.s: New file.
7710 * testsuite/split_x86_64_4.s: New file.
7711 * testsuite/split_x86_64_n.s: New file.
7712 * testsuite/testfile.cc (Target_test): Update relocation_section
7713 function.
7714 * testsuite/Makefile.in: Rebuild.
7715
e8a9fcda
ILT
77162009-10-06 Ian Lance Taylor <iant@google.com>
7717
7718 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7719 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7720 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7721 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7722 the address on ldo_addrs_.
7723 (Target_i386::Relocate::fix_up_ldo): New function.
7724
e99daf92
ILT
77252009-10-06 Rafael Espindola <espindola@google.com>
7726
7727 * plugin.cc (add_input_library): New.
7728 (Plugin::load): Add add_input_library to tv.
7729 (Plugin_manager::add_input_file): Add the is_lib argument.
7730 (add_input_file): Update call to Plugin_manager::add_input_file.
7731 (add_input_library): New.
7732 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7733
966d4097
DK
77342009-09-30 Doug Kwan <dougkwan@google.com>
7735
7736 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7737 symbol and call Symbol::may_need_copy_reloc to determine if
7738 a copy reloc is needed.
7739 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7740 nocopyreloc is given in command line.
7741 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7742 given in command line.
7743 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7744 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7745 of the removed Target_i386::may_need_copy_reloc.
7746 * options.h (copyreloc): New option with default value false.
7747 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7748 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7749 instead of the removed Target_powerpc::may_need_copy_reloc.
7750 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7751 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7752 instead of the removed Target_sparc::may_need_copy_reloc.
7753 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7754 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7755 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7756 instead of the removed Target_x86_64::may_need_copy_reloc.
7757
029ba973
ILT
77582009-09-30 Ian Lance Taylor <iant@google.com>
7759
7760 * object.h (class Object): Remove target_ field, and target,
7761 sized_target, and set_target methods.
7762 (Object::sized_target): Remove.
7763 (class Sized_relobj): Update declarations. Remove sized_target.
7764 * object.cc (Sized_relobj::setup): Remove target parameter.
7765 Change all callers.
7766 (Input_objects::add_object): Don't do anything with the target.
7767 (make_elf_sized_object): Add punconfigured parameter. Change all
7768 callers. Set or test parameter target.
7769 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7770 Change all callers.
7771 * parameters.cc (Parameters::set_target): Change parameter type to
7772 be non-const.
7773 (Parameters::default_target): Remove.
7774 (set_parameters_target): Change parameter type to be non-const.
7775 (parameters_force_valid_target): New function.
7776 (parameters_clear_target): New function.
7777 * parameters.h (class Parameters): Update declarations. Remove
7778 default_target method. Add sized_target and clear_target
7779 methods. Change target_ to be non-const.
7780 (set_parameters_target): Update declaration.
7781 (parameters_force_valid_target): Declare.
7782 (parameters_clear_target): Declare.
7783 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7784 as NULL if we aren't searching.
7785 (Add_symbols::run): Don't check for compatible target.
7786 * fileread.cc (Input_file::open_binary): Call
7787 parameters_force_valid_target.
7788 * gold.cc (queue_middle_tasks): Likewise.
7789 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7790 set_target on object.
7791 * dynobj.h (class Sized_dynobj): Update declarations.
7792 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7793 make_elf_object returns NULL.
7794 (Archive::include_member): Don't check whether object target is
7795 compatible.
7796 * output.cc (Output_section::add_input_section): Get target from
7797 parameters.
7798 (Output_section::relax_input_section): Likewise.
7799 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7800 parameters.
7801 (Sized_relobj::do_scan_relocs): Likewise.
7802 (Sized_relobj::relocate_sections): Likewise.
7803 * resolve.cc (Symbol_table::resolve): Likewise.
7804 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7805 parameter. Change all callers.
7806 (Symbol_table::add_from_object): Get target from parameters.
7807 (Symbol_table::add_from_relobj): Don't check object target.
7808 (Symbol_table::add_from_dynobj): Likewise.
7809 (Symbol_table::define_special_symbol): Get target from
7810 parameters.
7811 * symtab.h (class Symbol_table): Update declaration.
7812 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7813 parameter. Change all callers. Clear parameter target.
7814 (Binary_test): Test target here.
7815 * testsuite/object_unittest.cc (gold_testsuite): Remove
7816 target_test_pointer parameter. Change all callers.
7817 (Object_test): Test target here.
7818
a6a22b83
ILT
78192009-09-26 Ian Lance Taylor <iant@google.com>
7820
7821 * testsuite/initpri1.c: Don't try to use constructor priorities if
7822 compiling with gcc before 4.3.
7823
6a8f49fe
ILT
78242009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7825
7826 * testsuite/retain_symbols_file_test.sh (check_present): Change
7827 output file name to retain_symbols_file_test.stdout.
7828 (check_absent): Likewise.
7829
8c604651
CS
78302009-09-18 Craig Silverstein <csilvers@google.com>
7831
7832 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7833 * options.cc: Include <cerrno> and <fstream>.
7834 (General_options::finalize): Parse -retain-symbols-file tag.
7835 * options.h: New flag.
7836 (General_options): New method should_retain_symbol, new
7837 variable symbols_to_retain.
7838 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7839 should_retain_symbol map.
7840 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7841 * testsuite/Makefile.in: Regenerate.
7842 * testsuite/retain_symbols_file_test.sh: New file.
7843
ca58b19f
NC
78442009-09-18 Nick Clifton <nickc@redhat.com>
7845
7846 * po/es.po: Updated Spanish translation.
7847
20e6d0d6
DK
78482009-09-17 Doug Kwan <dougkwan@google.com>
7849
7850 * debug.h (DEBUG_RELAXATION): New constant.
7851 (DEBUG_ALL): Add DEBUG_RELAXATION.
7852 (debug_string_to_enum): Add relaxation debug option.
7853 * layout.cc
7854 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7855 Layout::Relaxation_debug_check::read_sections,
7856 Layout::Relaxation_debug_check::read_sections): New method definitions.
7857 (Layout::Layout): Initialize data members
7858 record_output_section_data_from_scrips_,
7859 script_output_section_data_list_ and relaxation_debug_check_.
7860 (Layout::save_segments, Layout::restore_segments,
7861 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7862 Layout::relaxation_loop_body): New method definitions.
7863 (Layout::finalize): Support relaxation. Move section layout code to
7864 Layout::relaxation_loop_body.
7865 (Layout::set_asection_address_from_script): Move code for orphan
7866 section placement out.
7867 (Layout::place_orphan_sections_in_script): New method definition.
7868 * layout.h (Output_segment_headers, Output_file_header):
7869 New forward class declarations.
7870 (Layout::~Layout): Define.
7871 (Layout::new_output_section_data_from_script): New method definition.
7872 (Layout::place_orphan_sections_in_script): New method declaration.
7873 (Layout::Segment_states): New type declaration.
7874 (Layout::save_segments, Layout::restore_segments,
7875 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7876 Layout::relaxation_loop_body): New method declarations.
7877 (Layout::Output_section_data_list): New type declaration.
7878 (Layout::Relaxation_debug_check): New class definition.
7879 (Layout::record_output_section_data_from_script_,
7880 Layout::script_output_section_data_list_, Layout::segment_states_,
7881 Layout::relaxation_debug_check_): New data members.
7882 * output.cc: (Output_section_headers::do_size): New method definition.
7883 (Output_section_headers::Output_section_headers): Move size
7884 computation to Output_section_headers::do_size.
7885 (Output_segment_headers::do_size): New method definition.
e1df38aa 7886 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
7887 Output_file_header::do_size and call it.
7888 (Output_file_header::do_size): New method definition.
7889 (Output_data_group::Output_data_group): Adjust call to
7890 Output_section_data.
7891 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7892 (Output_symtab_xindex::do_write): Add array bound check.
7893 (Output_section::Input_section::print_to_mapfile): Handle
7894 RELAXED_INPUT_SECTION_CODE.
7895 (Output_section::Output_section): Initialize data member checkpoint_.
7896 (Output_section::~Output_section): Delete checkpoint object pointed
7897 by checkpoint_.
7898 (Output_section::add_input_section): Always add an Input_section if
7899 relaxing.
7900 (Output_section::add_merge_input_section): Add assert.
7901 (Output_section::relax_input_section): New method definition.
7902 (Output_section::set_final_data_size): Set load address to zero for
7903 an unallocated section.
7904 (Output_section::do_address_and_file_offset_have_reset_values):
7905 New method definition.
7906 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7907 Handle relaxed input section.
7908 (Output_section::sort_attached_input_sections): Checkpoint input
7909 section list lazily.
7910 (Output_section::get_input_sections): Change type of input_sections to
7911 list of Simple_input_section pointers. Checkpoint input section list
7912 lazily. Also handle relaxed input sections.
7913 (Output_section::add_input_section_for_script): Take a reference to
7914 a Simple_input_section object instead of Relobj pointer and section
7915 index as parameter. Handle relaxed input sections.
7916 (Output_section::save_states, Output_section::restore_states): New
7917 method definitions.
7918 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7919 (Output_data::is_data_size_fixed): New method definition.
7920 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7921 if it is fixed.
7922 (Output_data::address_and_file_offset_have_reset_values): New method
7923 definition.
7924 (Output_data::do_address_and_file_offset_have_reset_values): New method
7925 definition.
7926 (Output_data::set_data_size): Check that data size is not fixed.
7927 (Output_data::fix_data_size): New method definition.
7928 (Output_data::is_data_size_fixed_): New data member.
7929 (Output_section_headers::set_final_data_size): New method definition.
7930 (Output_section_headers::do_size): New method declaration.
7931 (Output_segment_headers::set_final_data_size): New method definition.
7932 (Output_segment_headers::do_size): New method declaration.
7933 (Output_file_header::set_final_data_size)::New method definition.
7934 (Output_file_header::do_size)::New method declaration.
7935 (Output_section_data::Output_section_data): Add new parameter
7936 is_data_size_fixed and use it to fix data size.
7937 (Output_data_const::Output_data_const): Adjust call to base class
7938 constructor and fix data size.
7939 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7940 base class constructor and fix data size.
7941 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7942 base class constructor and fix data size.
7943 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7944 class constructor and fix data size.
7945 (Output_data_group::set_final_data_size): New method definition.
7946 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7947 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7948 class constructor and fix data size.
7949 (Output_relaxed_input_section): New class definition.
7950 (Output_section::Simple_input_section): New class definition.
7951 (Output_section::get_input_sections): Adjust parameter list.
7952 (Output_section::add_input_section_for_script): Same.
7953 (Output_section::save_states, Output_section::restore_states,
7954 Output_section::do_address_and_file_offset_have_reset_values,
7955 (Output_section::Input_section::Input_section): Handle
7956 RELAXED_INPUT_SECTION_CODE. Add new overload for
7957 Output_relaxed_input_section.
7958 (Output_section::Input_section::is_input_section,
7959 Output_section::Input_section::set_output_section): Handle relaxed
7960 input section.
7961 (Output_section::Input_section::is_relaxed_input_section,
7962 Output_section::Input_section::output_section_data,
7963 Output_section::Input_section::relaxed_input_section): New method
7964 definitions.
7965 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7966 value.
7967 (Output_section::Input_section::u1_): Update comments.
7968 (Output_section::Input_section::u2_): Add new union member poris.
7969 (Output_section::Checkpoint_output_section): New classs definition.
7970 (Output_section::relax_input_section): New method declaration.
7971 (Output_section::checkpoint_): New data member.
7972 (Output_segment): Update comments.
7973 (Output_segment::Output_segment): Un-privatize copy constructor.
7974 (Output_segment::operator=): Un-privatize.
7975 * script-sections.cc (Output_section_element::Input_section_list):
7976 Change element type to Output_section::Simple_input_section.
7977 (Output_section_element_dot_assignment::set_section_addresses):
7978 Register output section data for relaxation clean up.
7979 (Output_data_exression::Output_data_expression): Adjust call to base
7980 constructor to fix data size.
7981 (Output_section_element_data::set_section_addresses): Register
7982 Output_data_expression object for relaxation clean up.
7983 (struct Input_section_info): Replace Relobj pointer and section index
7984 pair with Output_section::Simple_input_section and Convert struct to a
7985 class.
7986 (Input_section_sorter::operator()): Adjust access to
e1df38aa 7987 Input_section_info data member to use accessors.
20e6d0d6
DK
7988 (Output_section_element_input::set_section_addresses): Use layout
7989 parameter. Adjust code to use Output_section::Simple_input_section
7990 and Input_secction_info classes. Register filler for relaxation
7991 clean up.
7992 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7993 and section index pair with Output_section::Simple_input_section
7994 class. Adjust code accordingly.
7995 (Phdrs_element::release_segment): New method definition.
7996 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7997 segment list.
7998 (Script_sections::release_segments): New method definition.
7999 * gold/script-sections.h (Script_sections::release_segments): New
8000 method declaration.
8001 * gold/target.h (Target::may_relax, Target::relax,
8002 Target::do_may_relax, Target::do_relax): New method definitions.
8003
5e445df6
ILT
80042009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8005
8006 * arm.cc (has_signed_unsigned_overflow): New function.
8007 (Arm_relocate_functions::abs8): New function.
8008 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8009 (Target_arm::Scan::global): Likewise.
8010 (Target_arm::relocate::relocate): Likewise.
8011 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8012 Likewise.
8013
8c604651 80142009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8015
8016 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8017 * testsuite/Makefile.in: Regenerate.
8018
1e9cc1c2
NC
80192009-09-11 Nick Clifton <nickc@redhat.com>
8020
8021 * po/gold.pot: Updated by the Translation project.
8022
6a89f575
CC
80232009-09-08 Cary Coutant <ccoutant@google.com>
8024
8025 * output.cc (Output_file::open): Add execute permission to empty file.
8026 * testsuite/Makefile.am (permission_test): New test.
8027 * testsuite/Makefile.in: Regenerate.
8028
fdcac5af
ILT
80292009-09-02 Ian Lance Taylor <iant@google.com>
8030
8031 * output.cc (Output_file::resize): Call map_no_anonymous rather
8032 than map.
8033
44453f85
ILT
80342009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8035
8036 * gold.cc: Include "incremental.h".
8037 (queue_initial_tasks): Call Incremental_checker methods.
8038 * incremental.cc: Include "output.h".
8039 (Incremental_checker::can_incrementally_link_output_file): New
8040 method.
8041 * incremental.h (Incremental_checker): New class.
8042
8043 * output.cc (Output_file::open_for_modification): New method.
8044 (Output_file::map_anonymous): Changed return type to bool. Record
8045 map in base_ field.
8046 (Output_file::map_no_anonymous): New method, broken out of map.
8047 (Output_file::map): Use map_no_anonymous and map_anonymous.
8048 * output.h (class Output_file): Update declarations.
8049
293c1386
CC
80502009-08-24 Cary Coutant <ccoutant@google.com>
8051
8052 * options.h (Command_line::Pre_options): New class.
8053 (Command_line::pre_options): New member.
8054 * options.cc (gold::options::ready_to_register): New variable.
8055 (One_option::register_option): Do nothing if not registering options.
8056 Assert if same short option registered twice.
8057 (General_options::General_options): Turn off option registration when
8058 done constructing.
8059 (Command_line::Pre_options::Pre_options): New constructor.
8060
f773f3d2
CC
80612009-08-24 Cary Coutant <ccoutant@google.com>
8062
06a73cfe
CC
8063 * options.h (General_options::no_keep_memory): Remove incorrect
8064 short option.
f773f3d2 8065
a15af8e2
RW
80662009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8067
8068 * Makefile.am (am__skiplex, am__skipyacc): New.
8069 * Makefile.in: Regenerate.
8070
c462b41b
RW
80712009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8072
14ec8efd
RW
8073 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8074 (INCLUDES): ... this.
8075 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8076 (AM_CPPFLAGS): Renamed from ...
8077 (INCLUDE): ... this.
8078 * Makefile.in, testsuite/Makefile.in: Regenerate.
8079
81ecdfbb
RW
8080 * Makefile.in: Regenerate.
8081 * aclocal.m4: Likewise.
8082 * config.in: Likewise.
8083 * configure: Likewise.
8084 * testsuite/Makefile.in: Likewise.
8085
c462b41b
RW
8086 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8087 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8088 * Makefile.in: Regenerate.
8089 * testsuite/Makefile.in: Regenerate.
8090
2da73f13
CC
80912009-08-19 Cary Coutant <ccoutant@google.com>
8092
8093 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8094 symbols in shared libraries overridden by hidden or internal symbols
8095 in the main program.
8096
2db70501
CD
80972009-08-19 Chris Demetriou <cgd@google.com>
8098
8099 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8100 checking source file names in error messages.
8101
f733487b
DK
81022009-08-18 Doug Kwan <dougkwan@google.com>
8103
8104 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8105 an elcpp::Ehdr as parameter. Adjust call to set_target.
8106 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8107 an elfcpp::Ehdr as parameter.
8108 * object.cc (Object::set_target): Remove the version that looks up
8109 a target and sets it.
8110 (Sized_relobj::setup): Take a Target object instead of
8111 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8112 (make_elf_sized_object): Find target and ask target to
8113 make an ELF object.
8114 * object.h: (Object::set_target): Remove the version that looks up
8115 a target and sets it.
8116 (Sized_relobj::setup): Take a Target object instead of
8117 an elfcpp:Ehdr as parameter.
8118 * target.cc: Include dynobj.h.
8119 (Target::do_make_elf_object_implementation): New.
8120 (Target::do_make_elf_object): New.
8121 * target.h (Target::make_elf_object): New template declaration.
8122 (Target::do_make_elf_object): New method declarations.
8123 (Target::do_make_elf_object_implementation): New template declaration.
8124
cc70f101
ILT
81252009-08-14 Ian Lance Taylor <iant@google.com>
8126
8127 * gold.h (FUNCTION_NAME): Define.
8128 (gold_unreachable): Use FUNCTION_NAME.
8129
ef5e0cb1
ST
81302009-08-12 Sriraman Tallam <tmsriram@google.com>
8131
8132 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8133 symbol in the --keep-unique list is not found.
8134
48c187ce
ST
81352009-08-12 Sriraman Tallam <tmsriram@google.com>
8136
8137 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8138 been maked as --keep-unique.
8139 (Icf::unfold_section): New function.
8140 * icf.h (Icf::unfold_section): New function.
8141 * options.h (General_options::keep_unique): New option.
8142 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8143 * testsuite/Makefile.in: Regenerate.
8144 * testsuite/icf_keep_unique_test.sh: New file.
8145 * testsuite/icf_keep_unique_test.cc: New file.
8146
645afe0c
CC
81472009-08-12 Cary Coutant <ccoutant@google.com>
8148
8149 PR 10471
8150 * resolve.cc (Symbol_table::resolve): Check for references from
8151 dynamic objects to hidden and internal symbols.
8152 * testsuite/Makefile.am (hidden_test.sh): New test.
8153 * testsuite/Makefile.in: Regenerate.
8154 * testsuite/hidden_test.sh: New script.
8155 * testsuite/hidden_test_1.c: New test source.
8156 * testsuite/hidden_test_main.c: New test source.
8157
11af873f
DK
81582009-08-11 Doug Kwan <dougkwan@google.com>
8159
8160 * arm.cc: Update comments.
8161 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8162 segment to locate the .ARM.exidx section if present.
8163
b9f7d72d
DK
81642009-08-09 Doug Kwan <dougkwan@google.com>
8165
8166 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8167 patch.
8168
ddd3c53c
ST
81692009-08-07 Sriraman Tallam <tmsriram@google.com>
8170 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8171 compiler warnings.
8172
27721062
ST
81732009-08-06 Sriraman Tallam <tmsriram@google.com>
8174
8175 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8176 valid tls_segment only for non-debug-section relocations.
8177 * testsuite/Makefile.am: Add gc_tls_test.
8178 * testsuite/Makefile.in: Regenerate.
8179 * testsuite/gc_tls_test.cc: New file.
8180 * testsuite/gc_tls_test.sh: New file.
8181
ef15dade 81822009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 8183
ef15dade
ST
8184 * icf.cc: New file.
8185 * icf.h: New file.
8186 * Makefile.am (CCFILES): Add icf.cc.
8187 (HFILES): Add icf.h
8188 * Makefile.in: Regenerate.
8189 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8190 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8191 section, symbol and addend information for the relocs.
8192 * gold.cc (queue_middle_tasks): Call identical code folding.
8193 * gold.h: Add defines for multimap.
8194 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8195 to the call of finalize_local_symbols.
8196 * main.cc (main): Create object of class Icf.
8197 * object.cc (Sized_relobj::do_layout): Allow this function to be
8198 called twice during icf.
8199 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8200 to sections marked as identical by icf.
8201 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8202 when available.
8203 (Sized_relobj::do_section_entsize): New function.
8204 * object.h (Object::section_entsize): New function.
8205 (Object::do_section_entsize): New pure virtual function.
8206 (Relobj::finalize_local_symbols): Add new parameter.
8207 (Relobj::do_section_entsize): New function.
8208 * options.h (General_options::icf): New option.
8209 (General_options::icf_iterations): New option.
8210 (General_options::print_icf_sections): New option.
8211 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8212 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8213 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8214 icf.
8215 * symtab.cc (Symbol_table::is_section_folded): New function.
8216 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8217 to sections marked as identical by icf.
8218 * symtab.h (Symbol_table::set_icf): New function.
8219 (Symbol_table::icf): New function.
8220 (Symbol_table::is_section_folded): New function.
8221 (Symbol_table::icf_): New data member.
8222 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8223 * testsuite/Makefile.am: Add commands to build icf_test.
8224 * testsuite/Makefile.in: Regenerate.
8225 * testsuite/icf_test.sh: New file.
8226 * testsuite/icf_test.cc: New file.
8227
c3b65ac4
CD
82282009-07-24 Chris Demetriou <cgd@google.com>
8229
8230 * layout.cc (is_compressible_debug_section): Fix incorrect
8231 comment about compressed section names.
8232
1caf2c51
ILT
82332009-07-20 Ian Lance Taylor <ian@airs.com>
8234
8235 PR 10419
8236 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8237
1ef4d87f
ILT
82382009-07-16 Ian Lance Taylor <iant@google.com>
8239
8240 PR 10400
8241 * layout.h: #include <map>.
8242 (class Kept_section): Change from struct to class. Add accessors
8243 and setters. Add section size to Comdat_group mapping. Change
8244 Comdat_group to std::map. Add is_comdat_ field. Add
8245 linkonce_size field in union.
8246 (class Layout): Update declaration of find_or_add_kept_section.
8247 Don't declare find_kept_object.
8248 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8249 parameter. Add object, shndx, is_comdat, and is_group_name
8250 parameters. Change all callers. Adjust for new Kept_section.
8251 (Layout::find_kept_object): Remove.
8252 * object.cc (Sized_relobj::include_section_group): Update use of
8253 Kept_section. Rename secnum to shndx. Only record
8254 Kept_comdat_section if sections are the same size.
8255 (Sized_relobj::include_linkonce_section): Update use of
8256 Kept_section. Only record Kept_comdat_section if sections are the
8257 same size. Set size of linkonce section.
8258 (Sized_relobj::map_to_kept_section): Update call to
8259 get_kept_comdat_section.
8260 * object.h (class Sized_relobj): Rename fields in
8261 Kept_comdat_section to drop trailing underscores; change object
8262 field to Relobj*. Change Kept_comdat_section_table to store
8263 struct rather than pointer.
8264 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8265 Add kept_object and kept_shndx parameters. Change all callers.
8266 (Sized_relobj::get_kept_comdat_section): Change return type to
8267 bool. Add kept_object and kept_shndx parameters. Change all
8268 callers.
8269 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8270 Layout::find_or_add_kept_section.
8271
37c3b7b0
ILT
82722009-07-09 Ian Lance Taylor <iant@google.com>
8273
8274 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8275 Reserve space in the hash table.
8276
98fa85cb
ILT
82772009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8278
8279 * fileread.cc (File_read::get_mtime): New method.
8280 * fileread.h (Timespec): New structure.
8281 (File_read::get_mtime): New method.
8282 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8283 Renamed from timestamp_nsec.
8284 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8285 Elf_Xword.
e1df38aa 8286 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 8287 timestamp_nsec.
e1df38aa 8288 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
8289 (Incremental_inputs::report_obejct): Save mtime; style fix.
8290 (Incremental_inputs::report_script): Save mtime; style fix.
8291 (Incremental_inputs::finalize_inputs): Style fix.
8292 (Incremental_inputs::finalize): Style fix.
8293 (Incremental_inputs::create_input_section_data): Store inputs
8294 mtime.
8295 * incremental.h (Incremental_inputs::report_script): Add mtime
8296 argument.
8297 (Incremental_inputs::Input_info::Input_info): Intialize only one
8298 union member.
8299 (Incremental_inputs::Input_info::archive): Move to nameless
8300 union.
8301 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8302 (Incremental_inputs::Input_info::script): Move to nameless union.
8303 (Incremental_inputs::mtime): New field.
8304 * script.cc (read_input_script): Pass file mtime to
8305 Incremental_input.
8306 * script.h (Script_info::inputs): Style fix.
8307
c9d70757
ILT
83082009-07-01 Ian Lance Taylor <ian@airs.com>
8309
8310 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8311 instead of 32.
8312
9c547ec3
ILT
83132009-06-24 Ian Lance Taylor <iant@google.com>
8314
8315 PR 10156
8316 * layout.cc (Layout::choose_output_section): If we find an
8317 existing section, update the flags.
8318 (Layout::create_notes): New function, broken out of
8319 Layout::finalize.
8320 (Layout::finalize): Don't create note sections.
8321 (Layout::create_note): Don't crash if linker script discards
8322 section.
8323 (Layout::create_gold_note): Likewise.
8324 (Layout::create_build_id): Likewise. Don't set
8325 after_input_sections on the section.
8326 (Layout::create_executable_stack_info): Remove target parameter.
8327 Change caller.
8328 * layout.h (class Layout): Declare create_notes. Update
8329 declaration of create_executable_stack_info.
8330 * gold.cc (queue_middle_tasks): Call create_notes.
8331 * output.cc (Output_section::update_flags_for_input_section): Move
8332 here from output.h. If SHF_ALLOC flag is newly set, mark address
8333 invalid.
8334 * output.h (Output_data::mark_address_invalid): New function.
8335 (class Output_section): Only declare, not define,
8336 update_flags_for_input_section. Remove set_flags.
8337
55458500
ILT
83382009-06-24 Ian Lance Taylor <iant@google.com>
8339
8340 * script-sections.cc (Output_section_definition::
8341 set_section_addresses): Rename shadowing local load_address to
8342 laddr.
8343
1307d6cd
ILT
83442009-06-24 Ian Lance Taylor <iant@google.com>
8345
8346 PR 10244
8347 * reloc.cc (relocate_sections): Skip empty relocation sections.
8348
ec3f783e
ILT
83492009-06-23 Ian Lance Taylor <iant@google.com>
8350
8351 PR 10156
8352 * layout.cc (Layout::create_note): Use choose_output_section
8353 rather than make_output_section.
8354
459c9f1c
ILT
83552009-06-23 Ian Lance Taylor <iant@google.com>
8356
8357 PR 10237
8358 * options.cc (General_options::parse_V): Set printed_version_.
8359 (General_options::General_options): Initialize printed_version_.
8360 * options.h (class General_options): Add printed_version_ field.
8361 * gold.cc (queue_initial_tasks): If there are no input files,
8362 don't give a fatal error if we printed the version information.
8363 (queue_middle_tasks): If using -r with a shared object, give a
8364 fatal error rather than an ordinary error.
8365
1518dc8f
ILT
83662009-06-23 Ian Lance Taylor <iant@google.com>
8367
8368 PR 10219
8369 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8370 (Layout::make_output_section): Set have_stabstr_section_ if we see
8371 a .stab*str section.
8372 (Layout::finalize): Call link_stabs_sections.
8373 (Layout::link_stabs_sections): New file.
8374 * layout.h (class Layout): Add have_stabstr_section_ field.
8375 Declare link_stabs_sections.
8376
3d857b98
DK
83772009-06-23 Doug Kwan <dougkwan@google.com>
8378
8379 * Makefile.am (libgold_a_LIBADD): New.
8380 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8381 * Makefile.in: Regenerate.
8382 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8383 * configure: Regenerate.
8384 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8385 * fileread.cc: Include sys/state.h
8386 * gold.h: Declare memmem and strndup if found missing.
8387 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8388
0639a6f6
ILT
83892009-06-23 Ian Lance Taylor <iant@google.com>
8390
8391 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8392 * configure: Rebuild.
8393
8d63875c
ILT
83942009-06-23 Ian Lance Taylor <iant@google.com>
8395
8396 PR 10147
8397 * object.cc (Object::section_contents): Don't try to get a view if
8398 the section has length zero.
8399 (Object::handle_gnu_warning_section): If the section is empty, use
8400 the name of the section as the warning.
8401
f7c8a183
ILT
84022009-06-23 Ian Lance Taylor <iant@google.com>
8403
8404 PR 10133
8405 * stringpool.h (class Stringpool_template): Add optimize_ field.
8406 (Stringpool_template::set_optimize): New function.
8407 * stringpool.cc (Stringpool_template::Stringpool_template):
8408 Initialize optimize_ field.
8409 (Stringpool_template::set_string_offsets): Test local optimize
8410 fild rather than parameter.
8411 * layout.cc (Layout::Layout): Call set_optimize on the section
8412 name stringpool.
8413
e6a307ba
ILT
84142009-06-22 Ian Lance Taylor <iant@google.com>
8415
8416 PR 10030
8417 * yyscript.y: Parse TARGET.
8418 * script.cc (script_set_target): New function.
8419 * script-c.h (script_set_target): Declare.
8420 * options.cc (General_options::string_to_object_format): Rename
8421 from string_to_object_format in anonymous namespace. Change
8422 callers.
8423 * options.h (class General_options): Declare
8424 string_to_object_format.
8425
3ee173de
ILT
84262009-06-22 Ian Lance Taylor <iant@google.com>
8427
8428 * script-sections.cc (Script_sections::create_segments): Don't put
8429 program headers in a PT_LOAD segment if -n or -N.
8430
84312009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
8432
8433 PR 10141
8434 * options.h (class General_options): Add -z lazy and -z now. Sort
8435 -z options into alphabetical order.
8436 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8437
cd6739a1 84382009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
8439
8440 * layout.cc (Layout::make_output_section): Call
8441 Target::new_output_section.
8442 (Layout::attach_allocated_section_to_segment): Put large section
8443 sections in a separate load segment with the large segment flag
8444 set.
8445 (Layout::segment_precedes): Sort large data segments after other
8446 load segments.
8447 (align_file_offset): New static function.
8448 (Layout::set_segment_offsets): Use align_file_offset.
8449 * output.h (class Output_section): Add is_small_section_ and
8450 is_large_section_ fields.
8451 (Output_section::is_small_section): New function.
8452 (Output_section::set_is_small_section): New function.
8453 (Output_section::is_large_section): New function.
8454 (Output_section::set_is_large_section): New function.
8455 (Output_section::is_large_data_section): New function.
8456 (class Output_segment): Add is_large_data_segment_ field.
8457 (Output_segment::is_large_data_segment): New function.
8458 (Output_segment::set_is_large_data_segment): New function.
8459 * output.cc (Output_section::Output_section): Initialize new
8460 fields.
8461 (Output_segment::Output_segment): Likewise.
8462 (Output_segment::add_output_section): Add assertion that large
8463 data sections always go in large data segments. Force small data
8464 sections to the end of the list of data sections. Force small BSS
8465 sections to the start of the list of BSS sections. For large BSS
8466 sections to the end of the list of BSS sections.
8467 * symtab.h (class Symbol): Declare is_common_shndx.
8468 (Symbol::is_defined): Check Symbol::is_common_shndx.
8469 (Symbol::is_common): Likewise.
8470 (class Symbol_table): Define enum Commons_section_type. Update
8471 declarations. Add small_commons_ and large_commons_ fields.
8472 * symtab.cc (Symbol::is_common_shndx): New function.
8473 (Symbol_table::Symbol_table): Initialize new fields.
8474 (Symbol_table::add_from_object): Put small and large common
8475 symbols in the right list.
8476 (Symbol_table::sized_finalized_symbol): Check
8477 Symbol::is_common_shndx.
8478 (Symbol_table::sized_write_globals): Likewise.
8479 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8480 common symbol lists. Don't call do_allocate_commons_list if the
8481 list is empty.
8482 (Symbol_table::do_allocate_commons_list): Remove is_tls
8483 parameter. Add comons_section_type parameter. Change all
8484 callers. Handle small and large common symbols.
8485 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8486 Symbol::is_common_shndx.
8487 * resolve.cc (symbol_to_bits): Likewise.
8488 * target.h (Target::small_common_shndx): New function.
8489 (Target::small_common_section_flags): New function.
8490 (Target::large_common_shndx): New function.
8491 (Target::large_common_section_flags): New function.
8492 (Target::new_output_section): New function.
8493 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8494 small_common_section_flags, and large_common_section_flags
8495 fields.
8496 (Target::do_new_output_section): New virtual function.
8497 * arm.cc (Target_arm::arm_info): Initialize new fields.
8498 * i386.cc (Target_i386::i386_info): Likewise.
8499 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8500 Likewise.
8501 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8502 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8503 (Target_x86_64::do_new_output_section): New function.
8504 * configure.ac: Define conditional MCMODEL_MEDIUM.
8505 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8506 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8507 (large_LDFLAGS): Define.
8508 * testsuite/large.c: New file.
8509 * testsuite/testfile.cc (Target_test::test_target_info):
8510 Initialize new fields.
8511 * configure, testsuite/Makefile.in: Rebuild.
8512
bb04269c
DK
85132009-06-05 Doug Kwan <dougkwan@google.com>
8514
8515 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 8516 * Makefile.in: Regenerate.
bb04269c
DK
8517 * i386.cc (class Target_i386): Define new virtual method to
8518 override do_is_local_label_name in parent.
8519 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8520 local symbols if --discard-locals or -X is given.
8521 * options.h (class General_options): Declare new options
8522 '--discard-locals' and '-X' for discarding locals.
8523 * target.h (class Target): Define new methods is_local_label_name.
8524 Declare new virtual method do_is_local_label_name.
8525 * target.cc: New file.
8526 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8527 (check_SCRIPTS): Add discard_locals_test.sh.
8528 (check_DATA): Add discard_local_tests.syms.
8529 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8530 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8531 * testsuite/Makefile.in: Regenerate.
8532 * testsuite/discard_locals_test.c: New file.
8533 * testsuite/discard_locals_test.sh: Same.
8534
805bb01c
DK
85352009-06-05 Doug Kwan <dougkwan@google.com>
8536
8537 * object.cc (Sized_relobj::Sized_relobj): Initialize
8538 discarded_eh_frame_shndx_ to -1U.
8539 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8540 section.
8541 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8542 a discarded .eh_frame section.
8543 (Sized_relobj::do_finalize_local_symbols): Ditto.
8544 * object.h (class Sized_relobj): Declare new member
8545 discarded_eh_frame_shndx_.
8546 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8547 (local_labels_test.o, local_labels_test): New rules.
8548 * testsuite/Makefile.in: Regenerate.
8549
1dcd334d
DK
85502009-06-04 Doug Kwan <dougkwan@google.com>
8551
8552 * layout.cc (Layout::section_name_mapping): Add mapping for
8553 special ARM sections.
8554
96d49306
DK
85552009-06-03 Doug Kwan <dougkwan@google.com>
8556
8557 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8558 (utils::has_overflow): Same.
8559
dff16297
ILT
85602009-06-03 Ian Lance Taylor <iant@google.com>
8561
8562 * layout.cc (Layout::section_name_mapping): New array, replacing
8563 Layout::linkonce_mapping.
8564 (Layout::section_name_mapping_count): New variable, replacing
8565 Layout::linkonce_mapping_count.
8566 (Layout::linkonce_output_name): Remove.
8567 (Layout::output_section_name): Rewrite.
8568 * layout.h (class Layout): Rename Linkonce_mapping to
8569 Section_name_mapping, linkonce_mapping to section_name_mapping,
8570 linkonce_mapping_count to section_name_mapping_count. Don't
8571 declare linkonce_output_name.
8572
c121c671
DK
85732009-06-03 Doug Kwan <dougkwan@google.com>
8574
8575 * gold/arm.cc (namespace utils): New.
8576 (Target_arm::reloc_is_non_pic): Define new method.
8577 (class Arm_relocate_functions): New.
8578 (Target_arm::Relocate::relocate): Handle relocation types used by
8579 Android.
8580
07800fab
ILT
85812009-06-03 Ian Lance Taylor <iant@google.com>
8582
8583 * arm.cc (Target_arm::scan::global): Use || instead of |.
8584
c121c671
DK
85852009-06-02 Doug Kwan <dougkwan@google.com>
8586
8587 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8588 issued_non_pic_error_.
8589 (class Target_arm::Scan): Declare new method check_non_pic.
8590 Define new method symbol_needs_plt_entry.
8591 Declare new data member issued_non_pic_error_.
8592 (class Target_arm::Relocate): Declare new method
8593 should_apply_static_reloc.
8594 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8595 (Target_arm::Scan::check_non_pic): Define new method.
8596 (Target_arm::Scan::local): Handle a small subset of reloc types used
8597 by Android.
8598 (Target_arm::Scan::local): Same.
8599 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8600
b19b0c6d
ILT
86012009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8602
8603 * incremental.cc (Incremental_inputs::report_command_line): Filter
8604 out --incremental-* options.
8605
94cdfcff
DK
86062009-05-29 Doug Kwan <dougkwan@google.com>
8607
8608 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8609 template class.
8610 (class Target_arm): Update comment.
8611 (Target_arm::Target_arm): Initialize new data members GOT_,
8612 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8613 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8614 and Target_arm::rel_dyn_section.
8615 Declare new_enum Target_arm::Got_type.
8616 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8617 and DYNBSS_.
8618 Update commments for member do_dynsym_value.
8619 (Target_arm::got_size, Target_arm::plt_section,
8620 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8621 new methods inside class defintion.
8622 (Target_arm::got_section): Define new method.
8623 (Target_arm::rel_dyn_section): Same.
8624 (Output_data_plt_arm): New template class.
8625 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8626 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8627 (Output_data_plt_arm::add_entry): Same.
8628 (Output_data_plt_arm::first_plt_entry): Define new
8629 static data member for PLT instruction template.
8630 (Output_data_plt_arm::plt_entry): Same.
8631 (Output_data_plt_arm::do_write): Define new method.
8632 (Target_arm::make_plt_entry): Same.
8633 (Target_arm::do_finalize_sections): Same.
8634 (Target_arm::do_dynsym_value): Same.
8635
4a657b0d
DK
86362009-05-28 Doug Kwan <dougkwan@google.com>
8637
8638 * Makefile.am (TARGETSOURCES): Add arm.cc.
8639 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8640 * Makefile.in: Regenerate.
8641 * arm.cc: New file.
8642 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8643
e7ae8c36
DK
86442009-05-26 Doug Kwan <dougkwan@google.com>
8645
8646 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8647 (General_options::check_excluded_libs): Strip off directories in
8648 archive name before matching like GNU ld does.
8649 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8650 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8651 (exclude_libs_test_LDFLAGS): Add linker option
8652 -Wl,--exclude-libs,libexclude_libs_test_3
8653 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8654 an explicit archive without using -l.
8655 (alt/libexclude_libs_test_3.a): New make rule.
8656 * testsuite/Makefile.in: Regenerate.
8657 * testsuite/exclude_libs_test.c : Declare lib3_default().
8658 (main): Call it.
8659 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8660 * exclude_libs_test_3.c: New file.
8661
f12e7348
NC
86622009-05-26 Nick Clifton <nickc@redhat.com>
8663
8664 * po/id.po: New Indonesian translation.
8665 * po/gold.pot: Updated template file.
8666
4daadc0d
ST
86672009-05-22 Sriraman Tallam <tmsriram@google.com>
8668
e1df38aa 8669 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
8670 gc_comdat_test files. Add -Wl,--gc-sections to build
8671 gc_comdat_test.
8672 * testsuite/Makefile.in: Regenerate.
8673 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8674
531813ad
ST
86752009-05-21 Sriraman Tallam <tmsriram@google.com>
8676
8677 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8678 kept comdat section was garbage collected.
8679 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8680 * testsuite/Makefile.in: Regenerate.
8681 * testsuite/gc_comdat_test.sh: New file.
8682 * testsuite/gc_comdat_test_1.cc: New file.
8683 * testsuite/gc_comdat_test_2.cc: New file.
8684
65514900
CC
86852009-05-19 Doug Kwan <dougkwan@google.com>
8686
8687 * archive.cc (Archive::Archive): Move constructor from archive.h
8688 to here. Initialize no_export_.
8689 (Archive::get_elf_object_for_member): Set no_export flag of object.
8690 * archive.h (Archive::Archive): Move constructor body to
8691 archive.cc.
8692 (Archive::no_export): New method.
8693 (Archive::no_export_): New field.
8694 * object.h (Object::Object): Initialize no_export_ to false.
8695 (Object::no_export, Object::set_no_export): New methods.
8696 (Object::no_export_): New field.
8697 * options.cc (General_options::parse_exclude_libs): New method.
8698 (General_options::check_excluded_libs) Same.
8699 * options.h (exclude_libs): New option.
8700 (General_options::check_excluded_libs): New method declaration.
8701 (General_options::excluded_libs_): New field.
8702 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8703 default or protected visibility if an object has no-export flag set.
8704 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8705 (check_SCRIPTS): Add exclude_libs_test.sh.
8706 (check_DATA): Add exclude_libs_test.syms.
8707 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8708 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8709 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8710 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8711 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8712 libexclude_libs_test_2.a): New rules.
8713 * testsuite/Makefile.in: Regenerate.
8714 * testsuite/exclude_libs_test.c: New file.
8715 * testsuite/exclude_libs_test.sh: Ditto.
8716 * testsuite/exclude_libs_test_1.c: Ditto.
8717 * testsuite/exclude_libs_test_2.c: Ditto.
8718
1b77ea50
ILT
87192009-05-15 Ian Lance Taylor <iant@google.com>
8720
8721 * configure.ac: Check for declarations for cases where libiberty.h
8722 checks HAVE_DECL_xxx.
8723 * configure, config.in: Rebuild.
8724
072fe7ce
ILT
87252009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8726
8727 * gold.h (Incremental_argument_list): Remove (invalid) forward
8728 declaration.
8729 * incremental.cc (Incremental_inputs::report_achive): New method.
8730 (Incremental_inputs::report_object): New method.
8731 (Incremental_inputs::report_script): New method.
8732 (Incremental_inputs::finalize_inputs): New method.
8733 (Incremental_inputs::finalize): Call finalize_inputs().
8734 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8735 Create inputs entries.
8736 * incremental.h (Incremental_input_type): New enum.
8737 (Incremental_inputs::Incremental_input): Initialize new fields.
8738 (Incremental_inputs::report_inputs): New method.
8739 (Incremental_inputs::report_achive): New method.
8740 (Incremental_inputs::report_object): New method.
8741 (Incremental_inputs::report_script): New method.
8742 (Incremental_inputs::finalize_inputs): New method.
8743 (Incremental_inputs::Input_info): New struct.
8744 (Incremental_inputs::Input_info_map): New typedef.
8745 (Incremental_inputs::lock_): New field.
8746 (Incremental_inputs::Inputs_): New field.
8747 (Incremental_inputs::Inputs_map): New field.
8748 * main.cc (main): Call Incremental_input::report_inputs.
8749 * options.h (Input_argument_list): Typedef moved from
8750 Input_arguments.
8751 (Input_file_group::Files): Remove, use ::Input_argument_list.
8752 (Input_file_group::Input_argument_list): Remove, use
8753 ::Input_argument_list.
8754 * plugin.cc (Plugin_manager::add_input_file): Add error in
8755 incremental build.
8756 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8757 functions.
8758 * script.cc (read_input_script): Call
8759 Incremental_input::report_script.
8760 * script.h (Script_info): New class.
8761
b0481b0b
ILT
87622009-04-27 Ian Lance Taylor <iant@google.com>
8763
8764 * x86_64.cc (do_adjust_output_section): Set entsize to
8765 plt_entry_size.
8766
b22a5a41 87672009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
8768
8769 * output.cc (Output_file::close): After short writes, continue
8770 writing from the correct offset in the buffer being written.
8771
40fde488
CD
87722009-04-23 Chris Demetriou <cgd@google.com>
8773
8774 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8775 * configure: Regenerate.
8776 * config.in: Regenerate.
8777 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8778 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8779
3ce2c28e
ILT
87802009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8781
8782 * incremental.cc (Incremental_inputs_header_data): Renamed from
8783 Incremental_input_header_data.
8784 (Incremental_inputs_header_data::data_size): New field.
8785 (Incremental_inputs_header_data::put_input_file_count): Renamed
8786 from input_file_count.
8787 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8788 from command_line_offset.
8789 (Incremental_inputs_header_data::put_reserved): Renamed from
8790 put_reserved.
8791 (Incremental_inputs_entry_data): Renamed from
8792 Incremental_input_entry_data.
8793 (Incremental_inputs_entry_data::data_size): New field.
8794 (Incremental_inputs::report_command_line): New method.
8795 (Incremental_inputs::finalize): New method.
8796 (Incremental_inputs::create_incremental_inputs_data): New method.
8797 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8798 * incremental.h: New file.
8799 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8800 (Layout::finalize): Create incremental inputs section in
8801 incremental builds.
8802 (Layout::create_incremental_info_sections): New method.
8803 * layout.h (Layout::incremental_inputs): New method.
8804 (Layout::create_incremental_info_sections): New method.
8805 (Layout::incremental_inputs_): New field.
8806 * main.cc (main): Notify Incremental_input of the command line.
8807
e55bde5e
ILT
88082009-04-01 Ian Lance Taylor <iant@google.com>
8809 Mikolaj Zalewski <mikolajz@google.com>
8810
8811 * gold.h (reserve_unordered_map): Define, three versions, one for
8812 each version of Unordered_map.
8813 * layout.cc (Layout::Layout): Remove options parameter. Add
8814 number_of_input_files parameter. Don't initialize options_.
8815 Initialize number_of_input_files_ and resized_signatures_. Move
8816 sections_are_attached_.
8817 (Layout::layout_group): Reserve space for group_signatures_.
8818 (Layout::find_or_add_kept_section): Change name parameter to be a
8819 reference. Resize signatures_ map when it gets large enough.
8820 (Layout::layout_eh_frame): Use parameters->options() instead of
8821 this->options_.
8822 (Layout::make_output_section): Likewise.
8823 (Layout::attach_allocated_section_to_segment): Likewise.
8824 (Layout::finalize, Layout::create_executable_stack): Likewise.
8825 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8826 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8827 * layout.h (class Layout): Update declarations. Remove options_
8828 field. Add number_of_input_files_ and resized_signatures_
8829 fields. Move sections_are_attached_ field.
8830 * main.cc (main): Pass number of input files to Layout
8831 constructor. Don't pass options.
8832
154b857c
ILT
88332009-03-30 Ian Lance Taylor <iant@google.com>
8834
8835 * ffsll.c (ffsll): Correct implementation.
8836
2f35ab9b
ILT
88372009-03-27 Ian Lance Taylor <iant@google.com>
8838
fd03461a
ILT
8839 * ffsll.c: New file.
8840 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8841 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8842 * ftruncate.c (ftruncate): Declare before definition.
8843 * mremap.c (mremap): Likewise.
8844 * pread.c (pread): Likewise.
8845 * configure, Makefile.in, config.in: Rebuild.
8846
2f35ab9b
ILT
8847 * mremap.c: New file.
8848 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8849 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8850 (mremap): Declare if HAVE_MREMAP is not defined.
8851 * configure, Makefile.in, config.in: Rebuild.
8852
33aea2fd
CC
88532009-03-27 Cary Coutant <ccoutant@google.com>
8854
8855 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8856 position independent.
8857 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8858 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8859
6d479619
CC
88602009-03-24 Cary Coutant <ccoutant@google.com>
8861
8862 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8863 an executable.
8864 (needs_dynamic_reloc): Likewise.
8865
afc06bb8
ILT
88662009-03-24 Ian Lance Taylor <iant@google.com>
8867
8868 * yyscript.y (file_cmd): Recognize EXTERN.
8869 (extern_name_list, extern_name_list_body): New nonterminals.
8870 * script.cc (script_add_extern): Define.
8871 * script-c.h (script_add_extern): Declare.
8872
f6060a4d
ILT
88732009-03-24 Rafael Avila de Espindola <espindola@google.com>
8874
8875 * object.cc (is_elf_object): Define.
8876 * object.h (is_elf_object): Declare.
8877 * archive.cc (Archive::get_elf_object_for_member): Call
8878 is_elf_object.
33aea2fd 8879 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 8880
26736d8e
ILT
88812009-03-24 Elliott Hughes <enh@google.com>
8882
8883 * output.cc (Output_file::map_anonymous): Define.
8884 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8885 try an anonymous one. Report the size if the mmap fails.
8886 * output.h (class Output_file): Declare map_anonymous.
8887
22fd9730
ILT
88882009-03-24 Ian Lance Taylor <iant@google.com>
8889
8890 * target-select.cc (instantiate_target): Don't acquire the lock if
8891 the instantiated_target_ field has already been set.
8892
cb010894
ILT
88932009-03-23 Ian Lance Taylor <iant@google.com>
8894
7f055c20
ILT
8895 * gold-threads.h (class Initialize_lock): Define.
8896 * gold-threads.cc (class Initialize_lock_once): Define.
8897 (initialize_lock_control): New static variable.
8898 (initialize_lock_pointer): New static variable.
8899 (initialize_lock_once): New static function.
8900 (Initialize_lock::Initialize_lock): Define.
8901 (Initialize_lock::initialize): Define.
8902 * target-select.h: Include "gold-threads.h".
8903 (class Target_selector): Add lock_ and initialize_lock_ fields.
8904 Don't define instantiate_target, just declare it.
8905 * target-select.cc (Target_selector::Target_selector): Initialize
8906 new fields.
8907 (Target_selector::instantiate_target): Define.
8908 * descriptors.h: Include "gold-threads.h".
8909 (class Descriptors): Add initialize_lock_ field.
8910 * descriptors.cc (Descriptors::Descriptors): Initialize new
8911 field.
8912 (Descriptors::open): Use initialize_lock_ field
8913 * errors.h (class Errors): Add initialize_lock_ field.
8914 * errors.cc (Errors::Errors): Initialize new field.
8915 (Errors::initialize_lock): Use initialize_lock_ field.
8916 * powerpc.cc (class Target_selector_powerpc): Remove
8917 instantiated_target_ field. In do_recognize call
8918 instantiate_target rather than do_instantiate_target. In
8919 do_instantiate_target just allocate a new target.
8920 * sparc.cc (class Target_selector_sparc): Likewise.
8921
36959681
ILT
8922 * freebsd.h: New file.
8923 * i386.cc: Include "freebsd.h".
8924 (Target_i386): Derive from Target_freebsd rather than
8925 Sized_target.
8926 (Target_selector_i386): Derive from Target_selector_freebsd rather
8927 than Target_selector.
8928 * x86_64.cc: Include "freebsd.h".
8929 (Target_x86_64): Derive from Target_freebsd rather than
8930 Sized_target.
8931 (Target_selector_x86_64): Derive from Target_selector_freebsd
8932 rather than Target_selector.
8933 * target.h (class Target): Add adjust_elf_header and
8934 do_adjust_elf_header.
8935 * output.cc (Output_file_header:: do_sized_write): Call target
8936 adjust_elf_header routine.
8937 * configure.tgt: Set targ_osabi.
8938 * configure.ac: Define GOLD_DEFAULT_OSABI.
8939 * parameters.cc (Parameters::default_target): Pass
8940 GOLD_DEFAULT_OSABI to select_target.
8941 * target-select.h (class Target_selector): Make instantiate_target
8942 protected rather than private.
8943 * Makefile.am (HFILES): Add freebsd.h.
8944 * configure, Makefile.in, config.in: Rebuild.
8945
cb010894
ILT
8946 * merge.cc (do_add_input_section): Correct pend value. Change
8947 message about last entry not being null terminated from error to
8948 warning.
8949
0e879927
ILT
89502009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8951
8952 * incremental.cc: New file.
8953 * Makefile.am (CCFILES): Add incremental.cc.
8954 * Makefile.in: Rebuild.
8955
41105937
PP
89562009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8957
8958 * layout.cc (Layout::output_section_name): Preserve names
8959 of '.note.' sections.
e1df38aa 8960
60439920
ILT
89612009-03-19 Ian Lance Taylor <iant@google.com>
8962
8963 * descriptors.cc (Descriptors::open): Check that the options are
8964 valid before using them.
8965
0d371ad3
ILT
89662009-03-18 Ian Lance Taylor <iant@google.com>
8967
8968 * script-sections.h: Include <list>.
8969 (class Script_sections): Change Sections_elements from std::vector
8970 to std::list. Typedef public Elements_iterator. Add
8971 orphan_section_placement_, data_segment_align_start_, and
8972 saw_data_segment_align_ fields. Remove data_segment_align_index_
8973 field.
8974 * script-sections.cc (class Orphan_section_placement): New class.
8975 (class Sections_element): Add virtual functions is_relro and
8976 orphan_section_init. Remove virtual function place_orphan_here.
8977 (class Output_section_definition): Add is_relro and
8978 orphan_section_init. Remove place_orphan_here.
8979 (class Orphan_output_section): Likewise.
8980 (Script_sections::Script_sections): Update for field changes.
8981 (Script_sections::data_segment_align): Set saw_data_segment_align_
8982 and data_segment_align_start_, not data_segment_align_index.
8983 (Script_sections::data_segment_relro_end): Check
8984 saw_data_segment_align_. Use data_segment_align_start_ rather
8985 than data_segment_align_index_.
8986 (Script_sections::place_orphan): Rewrite to use
8987 Orphan_section_placement.
8988
9201d894
ILT
89892009-03-17 Ian Lance Taylor <iant@google.com>
8990
9c5b8369
ILT
8991 * archive.cc (Archive::add_symbols): Check for a version attached
8992 to the symbol name in the archive map.
8993 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8994 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8995 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8996 (ver_test_11.a): New target.
8997 * testsuite/Makefile.in: Rebuild.
8998
9201d894
ILT
8999 * configure.ac: Check for chsize and posix_fallocate. Replace
9000 ftruncate.
9001 * ftruncate.c: New file, from gnulib.
9002 * output.cc (posix_fallocate): Define dummy version if not
9003 HAVE_POSIX_FALLOCATE.
9004 (Output_file::map): Call posix_fallocate rather than lseek and
9005 write.
9006 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9007 * configure, Makefile.in, config.in: Rebuild.
9008
ef4ab7a8 90092009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9010
ef4ab7a8
PP
9011 * layout.h (Layout::create_note): Add section_name parameter.
9012 * layout.cc (Layout::create_note): Likewise.
9013 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9014
8c500701
ILT
90152009-03-17 Ian Lance Taylor <iant@google.com>
9016
e85b18e1
ILT
9017 * descriptors.cc: Include "options.h".
9018 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9019 (Descriptors::open): Always use O_CLOEXEC when opening a new
9020 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9021 then set FD_CLOEXEC.
9022
9efe6174
ILT
9023 * sparc.cc (class Target_sparc): Add has_got_section.
9024 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9025 make sure we have a GOT section.
9026
9027 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9028 (Target_sparc::Scan::local): Likewise.
9029 (Target_sparc::Scan::global): Likewise.
9030 (Target_sparc::Relocate::relocate): Likewise.
9031 (Target_sparc::Relocate::relocate_tls): Likewise.
9032
8c500701
ILT
9033 * symtab.cc (Symbol_table::define_default_version): New function,
9034 broken out of add_from_object.
9035 (Symbol_table::add_from_object): Call define_default_version.
9036 (Symbol_table::define_special_symbol): Add resolve_oldsym
9037 parameter. Change all callers. If the version for a symbol comes
9038 from a version script, resolve it with the symbol with the same
9039 name with no version. Also add the symbol without a version if
9040 appropriate.
9041 (do_define_in_output_data): If resolving with oldsym, don't delete
9042 sym.
9043 (do_define_in_output_segment): Likewise.
9044 (do_define_as_constant): Likewise.
9045 * symtab.h (class Symbol_table): Update declarations.
9046
f1ed28fb
ILT
90472009-03-13 Ian Lance Taylor <iant@google.com>
9048
15f8229b
ILT
9049 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9050 (Read_symbols::requeue): New function.
9051 (Read_symbols::do_read_symbols): If make_elf_object fails because
9052 the target type is not configured, and the file was searched for,
9053 issue a warning and retry with the next directory.
9054 (Add_symbols::run): If the file has an incompatible format, and
9055 it was searched for, requeue the Read_symbols task. On error,
9056 release the object.
9057 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9058 dirindex parameter to constructor. Change all callers. Declare
9059 incompatible_warning and requeue.
9060 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9061 input_argument_ and input_group_ fields. Add them to
9062 constructor. Change all callers.
9063 (class Read_script): Add dirindex_ field. Add it to constructor.
9064 Change all callers.
9065 * archive.cc (Archive::setup): Remove input_objects parameter.
9066 Change all callers.
9067 (Archive::get_file_and_offset): Likewise.
9068 (Archive::read_all_symbols): Likewise.
9069 (Archive::read_symbols): Likewise.
9070 (Archive::get_elf_object_for_member): Remove input_objects
9071 parameter. Add punconfigured parameter. Change all callers.
9072 (Archive::add_symbols): Change return type to bool. Check return
9073 value of include_member.
9074 (Archive::include_all_members): Likewise.
9075 (Archive::include_member): Change return type to bool. Return
9076 false if first included object has incompatible target. Set
9077 included_member_ field.
9078 (Add_archive_symbols::run): If add_symbols returns false, requeue
9079 Read_symbols task.
9080 * archive.h (class Archive): Add included_member_ field.
9081 Initialize it in constructor. Add input_file and searched_for
9082 methods. Update declarations.
9083 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9084 input_argument_ fields. Add them to constructor. Change all
9085 callers.
9086 * script.cc: Include "target-select.h".
9087 (class Parser_closure): Add skip_on_incompatible_target_ and
9088 found_incompatible_target_ fields. Add
9089 skip_on_incompatible_target parameter to constructor. Change all
9090 callers. Add methods skip_on_incompatible_target,
9091 clear_skip_on_incompatible_target, found_incompatible_target, and
9092 set_found_incompatible_target.
9093 (read_input_script): Add dirindex parameter. Change all callers.
9094 If parser finds an incompatible target, requeue Read_symbols
9095 task.
9096 (script_set_symbol): Clear skip_on_incompatible_target in
9097 closure.
9098 (script_add_assertion, script_parse_option): Likewise.
9099 (script_start_sections, script_add_phdr): Likewise.
9100 (script_check_output_format): New function.
9101 * script.h (read_input_script): Update declaration.
9102 * script-c.h (script_check_output_format): Declare.
9103 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9104 (ignore_cmd): Remove OUTPUT_FORMAT.
9105 * fileread.cc (Input_file::Input_file): Add explicit this.
9106 (Input_file::will_search_for): New function.
9107 (Input_file::open): Add pindex parameter. Change all callers.
9108 * fileread.h (class Input_file): Add input_file_argument method.
9109 Declare will_search_for. Update declarations.
9110 * object.cc (make_elf_object): Add punconfigured parameter.
9111 Change all callers.
9112 * object.h (class Object): Make input_file public. Add
9113 searched_for method.
9114 (make_elf_object): Update declaration.
9115 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9116 restart search.
9117 * dirsearch.h (class Dirsearch): Update declaration.
9118 * options.h (class General_options): Add --warn-search-mismatch.
9119 * parameters.cc (Parameters::is_compatible_target): New function.
9120 * parameters.h (class Parameters): Declare is_compatible_target.
9121 * workqueue.cc (Workqueue::add_blocker): New function.
9122 * workqueue.h (class Workqueue): Declare add_blocker.
9123
f1ed28fb
ILT
9124 * fileread.cc (Input_file::open): Remove options parameter.
9125 Change all callers.
9126 (Input_file::open_binary): Likewise.
9127 * script.cc (read_input_script): Likewise.
9128 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9129 options parameter from constructor. Change all callers.
9130 (class Read_script): Likewise.
9131 * fileread.h (class Input_file): Update declarations.
9132 * script.h (read_input_script): Update declaration.
9133
34dd024a
NC
91342009-03-10 Nick Clifton <nickc@redhat.com>
9135
9136 * po/es.po: New Spanish translation.
9137
6d71b17c
CC
91382009-03-06 Cary Coutant <ccoutant@google.com>
9139
9140 * options.cc (parse_short_option): Keep dash_z from registering itself.
9141
031cdbed
ILT
91422009-03-03 Ian Lance Taylor <iant@google.com>
9143
9144 PR 9918
9145 * target-reloc.h (relocate_section): Pass output_section to
9146 relocate.
9147 * i386.cc (Target_i386::should_apply_static_reloc): Add
9148 output_section parameter. Change all callers.
9149 (Target_i386::Relocate::relocate): Add output_section parameter.
9150 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9151 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9152 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9153 * testsuite/two_file_shared.sh: New script.
9154 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9155 (check_DATA): Add two_file_shared.dbg.
9156 (two_file_shared.dbg): New target.
9157 * testsuite/Makefile.in: Rebuild.
9158
15d5fa16
ILT
91592009-03-01 Ian Lance Taylor <iant@google.com>
9160
9161 * configure.ac: Check for byteswap.h.
9162 * configure: Rebuild.
9163 * config.in: Rebuild.
9164
8a4c0b0d
ILT
91652009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9166
9167 * layout.cc (Layout::find_or_add_kept_section): New function.
9168 (Layout::add_comdat): Removed.
9169 * layout.h (struct Kept_section): Move out of class Layout.
9170 Remove trailing underscores from field names. Add group_sections
9171 field. Rename group_ field to is_group. Change all uses.
9172 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9173 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9174 comdat_groups_ field.
9175 (Sized_relobj::include_section_group): Use
9176 find_or_add_kept_section and Kept_section::group_sections.
9177 (Sized_relobj::include_linkonce_section): Likewise.
9178 * object.cc (class Sized_relobj): Don't define Comdat_group or
9179 Comdat_group_table. Remove find_comdat_group and
9180 add_comdat_group. Remove comdat_groups_ field.
9181 * plugin.cc (include_comdat_group): Use
9182 Layout::find_or_add_kept_section.
9183
b4ecf66b
ILT
91842009-02-28 Ian Lance Taylor <iant@google.com>
9185
14359ca0
ILT
9186 * README: --gc-sections and map files are now supported. Document
9187 some build requirements.
9188
b4ecf66b
ILT
9189 PR 6992
9190 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9191 relocatable link set the value of the section symbol to zero.
9192 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9193 relocatable link don't include the section address in the local
9194 symbol value.
9195
0602e05a
ILT
91962009-02-27 Ian Lance Taylor <iant@google.com>
9197
fd9d194f
ILT
9198 PR 6811
9199 * options.h (class Search_directory): Add is_system_directory.
9200 (class General_options): Declare is_in_system_directory.
9201 * options.cc (get_relative_sysroot): Make static.
9202 (get_default_sysroot): Make static.
9203 (General_optoins::is_in_system_directory): New function.
9204 * fileread.cc (Input_file::is_in_system_directory): New function.
9205 * fileread.h (class Input_file): Declare is_in_system_directory.
9206 * object.h (class Object): Add is_in_system_directory.
9207 (class Input_objects): Remove system_library_directory_ field.
9208 * object.cc (Input_objects::add_object): Don't set
9209 system_library_directory_.
9210 (input_objects::found_in_system_library_directory): Remove.
9211 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9212 parameter. Change all callers.
9213 (Symbol_table::sized_write_globals): Likewise.
9214 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9215 Call Object::is_in_system_directory.
9216 * symtab.h (class Symbol_table): Update declarations.
9217
61edd21f
ILT
9218 PR 5990
9219 * descriptors.h (Open_descriptor): Add is_on_stack field.
9220 * descriptors.cc (Descriptors::open): If the descriptor is on the
9221 top of the stack, remove it. Initialize is_on_stack field.
9222 (Descriptors::release): Only add pod to stack if it is not on the
9223 stack already.
9224 (Descriptors::close_some_descriptor): Clear stack_next and
9225 is_on_stack fields.
9226
e29e076a
ILT
9227 PR 7091
9228 * output.cc (Output_section::find_starting_output_address): Rename
9229 from starting_output_address; add PADDR parameter; change return
9230 type.
9231 * output.h (class Output_section): Declare
9232 find_starting_output_address instead of starting_output_address.
9233 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9234 section symbol for which we can't find a merge section.
9235
0602e05a
ILT
9236 PR 9836
9237 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9238 hidden or internal, force the symbol to be local.
9239 * resolve.cc (Symbol::override_visibility): Define.
9240 (Symbol::override_base): Use override_visibility.
9241 (Symbol_table::resolve): Likewise.
9242 (Symbol::override_base_with_special): Likewise.
9243 (Symbol_table::override_with_special): If the visibility is hidden
9244 or internal, force the symbol to be local.
9245 * symtab.h (class Symbol): Add set_visibility and
9246 override_visibility.
9247 * testsuite/ver_test_1.sh: New file.
9248 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9249 (check_DATA): Add ver_test_1.syms.
9250 (ver_test_1.syms): New target.
9251 * testsuite/Makefile.in: Rebuild.
9252
401a9a73
CC
92532009-02-25 Cary Coutant <ccoutant@google.com>
9254
9255 * layout.cc (Layout::choose_output_section): Don't rename sections
9256 when using a linker script that has a SECTIONS clause.
9257 * Makefile.in: Regenerate.
9258
9259 * testsuite/Makefile.am (script_test_5.sh): New test case.
9260 * testsuite/Makefile.in: Regenerate.
9261 * testsuite/script_test_5.cc: New file.
9262 * testsuite/script_test_5.sh: New file.
9263 * testsuite/script_test_5.t: New file.
9264
f488e4b0
CC
92652009-02-13 Rafael Avila de Espindola <espindola@google.com>
9266
9267 * archive.cc (Archive::include_member): Update calls to add_symbols.
9268 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9269 the Layout argument.
9270 * dynobj.h (do_add_symbols): Add the Layout argument.
9271 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9272 Layout argument.
9273 * object.h (Object::add_symbols): Add the Layout argument.
9274 (Object::do_add_symbols): Add the Layout argument.
9275 (Sized_relobj::do_add_symbols): Add the Layout argument.
9276 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9277 Unify the two versions.
9278 (Add_plugin_symbols): Remove.
9279 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9280 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9281 (Add_plugin_symbols): Remove.
9282 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9283 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9284 (Add_symbols::run): Make it work with Pulginobj.
9285
89dd1680
ILT
92862009-02-06 Ian Lance Taylor <iant@google.com>
9287
9288 * object.cc (Sized_relobj::do_layout): Make info message start
9289 with lower case letter.
9290
266d0a74
ILT
92912009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9292
602b464e
ILT
9293 * binary.cc: Fix file comment.
9294
266d0a74
ILT
9295 * options.h (enum Incremental_disposition): Define.
9296 (class General_options): Add new options: --incremental,
9297 --incremental_changed, --incremental_unchanged,
9298 --incremental_unknown. Add incremental_disposition_ and
9299 implicit_incremental_ fields.
9300 (General_options::incremental_disposition): New function.
9301 (class Position_dependent_options): Add incremental_disposition
9302 option.
9303 (Position_dependent_options::copy_from_options): Set incremental
9304 dispositions.
9305 * options.cc (General_options::parse_incremental_changed): New
9306 function.
9307 (General_options::parse_incremental_unchanged): New function.
9308 (General_options::parse_incremental_unknown): New function.
9309 (General_options::General_options): Initialize new fields
9310 incremental_disposition_ and implicit_incremental_.
9311 (General_options::finalize): Check for uasge of --incremental-*
9312 without --incremental.
9313
f073bbf7
CD
93142009-02-06 Chris Demetriou <cgd@google.com>
9315
9316 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9317 pointer and to report location as the file name associated with
9318 the symbol.
9319 (gold_undefined_symbol_at_location): New function to replace the
9320 old gold_undefined_symbol functionality.
9321 * target-reloc.h (relocate_section): Update to use
9322 gold_undefined_symbol_at_location.
9323 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9324 Call gold_undefined_symbol function rather than gold_error.
9325 * errors.h (Errors::undefined_symbol): Take location as a
9326 string, rather than calculating it from a relocation.
9327 * errors.cc (Errors::fatal): Print "fatal error:" before the
9328 formatted message.
9329 (Errors::error, Errors::error_at_location): Print "error: "
9330 before the formatted message.
9331 (Errors::undefined_symbol): Take location as a string, rather
9332 than calculating it from a relocation.
9333 (gold_undefined_symbol_at_location): New function akin to
9334 old gold_undefined_symbol, calculates location from relocation.
9335 (gold_undefined_symbol): Change to take only a Symbol pointer
9336 and to report location as the file name associated with the symbol.
9337 * testsuite/debug_msg.sh: Update for changed error messages.
9338 * testsuite/undef_symbol.sh: Likewise.
9339
8e94a90c
ILT
93402009-02-04 Duncan Sands <baldrick@free.fr>
9341
9342 PR 9812
9343 * reduced_debug_output.h
9344 (Output_reduced_debug_abbrev_section::failed): Use format for
9345 gold_warning.
9346 (Output_reduced_debug_info_section::faild): Likewise.
9347
88a0e15b
ILT
93482009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9349
9350 * script.cc (Lazy_demangler): New class.
9351 (Version_script_info::get_symbol_version_helper): Demangle a
9352 symbol only once.
9353
5efc7cd2
CC
93542009-01-29 Cary Coutant <ccoutant@google.com>
9355
9356 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9357 to __tls_get_addr.
9358 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9359
e0ebcf42
ILT
93602009-01-28 Ian Lance Taylor <iant@google.com>
9361
5efc7cd2 9362 * version.cc (version_string): Bump to 1.9.
75fe7426 9363
e0ebcf42
ILT
9364 * gold.h: Include <cstring> and <stdint.h>.
9365 * version.cc: Include <cstdio>.
9366 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9367 warning.
9368 * reduced_debug_output.cc (insert_into_vector): Rename from
9369 Insert_into_vector; change all callers. Use Swap_unaligned to
9370 avoid aliasing issue; remove union since it is unnecessary.
9371
8e2813be 93722009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
9373
9374 * Makefile.am (CCFILES): Add gc.cc.
9375 (HFILES): Add gc.h.
9376 * Makefile.in: Regenerate.
9377 * gold.cc (Gc_runner): New class.
9378 (queue_initial_tasks): Call garbage collection related tasks
9379 when corresponding options are invoked.
9380 (queue_middle_gc_tasks): New function.
9381 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9382 processed early before laying out sections during garbage collection.
9383 * gold.h (queue_middle_gc_tasks): New function.
9384 (is_prefix_of): Move from "layout.cc".
9385 * i386.cc (Target_i386::gc_process_relocs): New function.
9386 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9387 * main.cc (main): Create object of class "Garbage_collection".
9388 * object.cc (Relobj::copy_symbols_data): New function.
9389 (Relobj::is_section_name_included): New function.
e1df38aa
NC
9390 (Sized_relobj::do_layout): Allow this function to be called twice
9391 during garbage collection and defer layout of section during the
6d03d481
ST
9392 first call.
9393 * object.h (Relobj::get_symbols_data): New function.
9394 (Relobj::is_section_name_included): New function.
9395 (Relobj::copy_symbols_data): New function.
9396 (Relobj::set_symbols_data): New function.
9397 (Relobj::get_relocs_data): New function.
9398 (Relobj::set_relocs_data): New function.
9399 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9400 (Relobj::gc_process_relocs): New function.
9401 (Relobj::do_gc_process_relocs): New pure virtual function.
9402 (Relobj::sd_): New data member.
9403 (Sized_relobj::is_output_section_offset_invalid): New function.
9404 (Sized_relobj::do_gc_process_relocs): New function.
9405 * options.h (General_options::gc_sections): Modify to not be a no-op.
9406 (General_options::print_gc_sections): New option.
9407 * plugin.cc (Plugin_finish::run): Remove function call to
9408 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9409 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9410 * reloc.cc (Read_relocs::run): Add task to process relocs and
9411 determine unreferenced sections when doing garbage collection.
9412 (Gc_process_relocs): New class.
9413 (Sized_relobj::do_gc_process_relocs): New function.
9414 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9415 sections that are garbage collected.
9416 * reloc.h (Gc_process_relocs): New class.
9417 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9418 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9419 symbols whose corresponding sections are garbage collected.
9420 (Symbol_table::Symbol_table): Add new parameter for the garbage
9421 collection object.
9422 (Symbol_table::gc_mark_undef_symbols): New function.
9423 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9424 (Symbol_table::gc_mark_dyn_syms): New function.
9425 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9426 as garbage.
9427 (Symbol_table::add_from_object): Likewise.
9428 (Symbol_table::add_from_relobj): When building shared objects, do not
9429 treat externally visible symbols as garbage.
9430 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9431 table information for static and relocatable links.
9432 * symtab.h (Symbol_table::set_gc): New function.
9433 (Symbol_table::gc): New function.
9434 (Symbol_table::gc_mark_undef_symbols): New function.
9435 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9436 (Symbol_table::gc_mark_dyn_syms): New function.
9437 (Symbol_table::gc_): New data member.
e1df38aa 9438 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
9439 function.
9440 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9441 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9442
3b293544
CF
94432009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9444
9445 * options.h (General_options::gc_sections): Define as a no-op for now.
9446 (General_options::no_keep_memory): Ditto.
9447 (General_options::Bshareable): Define.
9448 * options.cc (General_options::finalize): Honor -Bshareable.
9449
83d22aa8
AS
94502009-01-20 Andreas Schwab <schwab@suse.de>
9451
9452 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9453 read the value in the contents, since we don't use it. Use the
9454 template endianness when writing.
9455 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9456
cd536b21
AS
94572009-01-19 Andreas Schwab <schwab@suse.de>
9458
9459 * configure.tgt (powerpc64-*): Fix targ_obj.
9460
99e9a495
ILT
94612009-01-15 Ian Lance Taylor <iant@google.com>
9462
9463 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9464 local symbols when stripping all symbols.
9465
bbbfea06
CC
94662009-01-14 Cary Coutant <ccoutant@google.com>
9467
99e9a495 9468 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 9469
0f7c0701
CC
94702009-01-14 Cary Coutant <ccoutant@google.com>
9471
9472 * archive.cc (Archive::get_elf_object_for_member): Remove call
9473 to File_read::claim_for_plugin.
9474 * descriptors.cc (Descriptors::open): Remove reference to
9475 is_claimed.
9476 (Descriptors::claim_for_plugin): Remove.
9477 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9478 (Descriptors::is_claimed): Remove.
9479 (claim_descriptor_for_plugin): Remove.
9480 * fileread.cc (File_read::claim_for_plugin): Remove.
9481 * fileread.h (File_read::claim_for_plugin): Remove.
9482 (File_read::descriptor): Reopen descriptor if necessary.
9483 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9484 (Plugin_manager::all_symbols_read): Add task parameter. Change
9485 all callers.
9486 (Plugin_manager::get_input_file): New function.
9487 (Plugin_manager::release_input_file): New function.
9488 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9489 corresponding data member.
9490 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9491 and pass to base constructor. Change all callers.
9492 (get_input_file, release_input_file): New functions.
9493 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9494 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9495 (Plugin_manager::all_symbols_read): Add task parameter.
9496 (Plugin_manager::get_input_file): New function.
9497 (Plugin_manager::release_input_file): New function.
9498 (Plugin_manager::task_): New data member.
9499 (Pluginobj::Pluginobj): Add filesize parameter.
9500 (Pluginobj::filename): New function.
9501 (Pluginobj::descriptor): New function.
9502 (Pluginobj::filesize): New function.
9503 (Pluginobj::filesize_): New data member.
9504 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9505 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9506 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9507
9508 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9509 with archive libraries.
9510 * testsuite/Makefile.in: Regenerate.
9511 * testsuite/plugin_test.c (struct sym_info): New type.
9512 (get_input_file, release_input_file): New static variables.
9513 (onload): Capture new transfer vector entries.
9514 (claim_file_hook): Stop reading at end of file according to filesize.
9515 Factor out parsing of readelf output into separate function.
9516 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9517 APIs and get the source file name from the symbol table. Convert
9518 source file name to corresponding object file name. Print info
9519 message when adding new input files.
9520 (parse_readelf_line): New function.
9521 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9522 * testsuite/plugin_test_2.sh: Likewise.
9523 * testsuite/plugin_test_3.sh: Likewise.
9524 * testsuite/plugin_test_4.sh: New test case.
9525
62a6d109
ILT
95262009-01-07 Ian Lance Taylor <iant@google.com>
9527
9528 * version.cc (version_string): Bump to 1.8.
9529
483620e8
CC
95302008-12-23 Cary Coutant <ccoutant@google.com>
9531
9532 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9533 * plugin.cc (Plugin_manager::finish): Rename as
9534 layout_deferred_objects. Move cleanup to separate function.
9535 (Plugin_manager::cleanup): New function.
9536 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9537 separately.
9538 * plugin.h (Plugin_manager::finish): Rename as
9539 layout_deferred_objects.
9540 (Plugin_manager::cleanup): New function.
9541 (Plugin_manager::cleanup_done): New field.
9542
d66a9eb3
CC
95432008-12-23 Cary Coutant <ccoutant@google.com>
9544
9545 * plugin.cc (is_visible_from_outside): New function.
9546 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9547 so we don't return "IR only" status for exported symbols or -r links.
9548
9549 * testsuite/Makefile.am (plugin_test_3): New test case.
9550 * testsuite/Makefile.in: Regenerate.
9551 * testsuite/plugin_test_3.sh: New file.
9552
5995b570
CC
95532008-12-22 Cary Coutant <ccoutant@google.com>
9554
9555 * object.cc (Sized_relobj::layout_section): New function.
9556 (Sized_relobj::do_layout): Defer layout of input sections until after
9557 plugin has provided replacement files.
9558 (Sized_relobj::do_layout_deferred_sections): New function.
9559 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9560 (Relobj::layout_deferred_sections): New function.
9561 (Relobj::do_layout_deferred_sections): New function.
9562 (Sized_relobj::do_layout_deferred_sections): New function.
9563 (Sized_relobj::layout_section): New function.
9564 (Sized_relobj::Deferred_layout): New structure.
9565 (Sized_relobj::deferred_layout_): New field.
9566 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9567 Change all callers. Layout deferred sections.
9568 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9569 references.
9570 (Plugin_hook::run): Move code from do_plugin_hook inline.
9571 (Plugin_hook::do_plugin_hook): Remove.
9572 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9573 (Plugin_manager::finish): Renamed, was cleanup.
9574 (Plugin_manager::should_defer_layout): New function.
9575 (Plugin_manager::add_deferred_layout_object): New function.
9576 (Plugin_manager::Deferred_layout_list): New type.
9577 (Plugin_manager::deferred_layout_objects_): New field.
9578 (Plugin_hook::do_plugin_hook): Remove.
9579
ee769c88
ILT
95802008-12-17 Ian Lance Taylor <iant@google.com>
9581
9582 * options.h (class General_options): Add --no case for
9583 --export-dynamic.
9584
abc8dcba
CC
95852008-12-16 Cary Coutant <ccoutant@google.com>
9586
9587 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9588 vector.
9589 (Plugin_manager::claim_file): Create plugin object even if
9590 plugin did not call the add_symbols callback.
9591 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9592 asking for more symbols than were added.
9593 * testsuite/Makefile.am (plugin_test_1): Add test case with
9594 no global symbols.
9595 (empty.syms): New target.
9596 * testsuite/Makefile.in: Regenerate.
9597 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9598 message. Don't call add_symbols if no globals.
9599 (all_symbols_read_hook): Don't provide replacement for empty
9600 claimed file.
9601
b0074644
ILT
96022008-12-12 Ian Lance Taylor <iant@google.com>
9603
68943102
ILT
9604 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9605 r_type == 0 for a local symbol with r_sym == 0.
9606 (scan_relocatable_relocs): Pass r_sym to
9607 local_non_section_strategy.
9608 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9609 r_sym parameter.
9610
b0074644
ILT
9611 * configure.ac: Update test for TLS descriptors: they are
9612 supported as of glibc 2.9.
9613 * configure: Rebuild.
9614
c2508178
ILT
96152008-12-11 Ian Lance Taylor <iant@google.com>
9616
9617 PR 7091
9618 * target-reloc.h (Default_scan_relocatable_relocs): For each
9619 function, map r_type == 0 to RELOC_DISCARD.
9620
2756a258
CC
96212008-12-10 Cary Coutant <ccoutant@google.com>
9622
9623 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9624 object to override a kept COMDAT group from a plugin object.
9625
bb6f53d3
ILT
96262008-12-09 Ian Lance Taylor <iant@google.com>
9627
fbc558e1
ILT
9628 PR 7088
9629 * yyscript.y (file_cmd): Handle INPUT.
9630
bb6f53d3
ILT
9631 * testsuite/initpri1.c: Change all declarations to be full
9632 prototypes by adding void, to avoid compiler warnings.
9633
4674ecfc
CC
96342008-12-05 Rafael Avila de Espindola <espindola@google.com>
9635
9636 * options.cc (General_options::parse_plugin_opt): New.
9637 (General_options::add_plugin): The argument now is just the filename.
9638 (General_options::add_plugin_option): New.
9639 * options.h (plugin_opt): New.
9640 (add_plugin): Change argument name.
9641 (add_plugin_option): New.
9642 * plugin.cc (Plugin::load): Don't parse the plugin option.
9643 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9644 (Plugin::add_option): New.
9645 (Plugin::args_): Change type.
9646 (Plugin::filename_): New.
9647 (Plugin_manager::add_plugin_option): New.
9648 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9649 * testsuite/Makefile.in: Regenerate.
9650
fd06b4aa
CC
96512008-12-05 Cary Coutant <ccoutant@google.com>
9652
9653 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9654 Handle --strip-lto-sections option.
9655 * options.h (strip_lto_sections): New option.
9656
6c52134c
CC
96572008-12-01 Cary Coutant <ccoutant@google.com>
9658
9659 * plugin.cc (ld_plugin_message): Change format parameter to const.
9660 Fix mismatch between new[] and delete.
9661
a45248e0
CC
96622008-11-14 Cary Coutant <ccoutant@google.com>
9663
9664 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9665 instead of -1U.
9666
c82fbeee
CS
96672008-11-05 Craig Silverstein <csilvers@google.com>
9668
9669 * options.cc (General_options::parse_dynamic_list): New function.
9670 * options.h (General_options): New flags dynamic_list,
9671 dynamic_list_data, dynamic_list_cpp_new, and
9672 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9673 (General_options::in_dynamic_list): New function.
9674 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9675 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9676 (Lex::can_continue_name): Likewise.
9677 (yylex): Likewise.
9678 (read_script_file): New parameter script_options.
9679 (read_dynamic_list): New function.
9680 (Script_options::define_dynamic_list): New function.
9681 (dynamic_list_keyword_parsecodes): New variable.
9682 (dynamic_list_keywords): New variable.
9683 * script.h (Script_options::define_dynamic_list): New function
9684 prototype.
9685 (read_dynamic_list): New function prototype.
9686 * symtab.cc (strprefix): New macro.
9687 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9688 dynamic_list_data, dynamic_list_cpp_new, and
9689 dynamic_list_cpp_typeinfo.
9690 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9691 (dynamic_list_expr): New rule.
9692 (dynamic_list_nodes): Likewise.
9693 (dynamic_list_node): Likewise.
9694 * testsuite/Makefile.am (dynamic_list): New test.
9695 * testsuite/Makefile.in: Regenerated.
9696 * testsuite/dynamic_list.t: New file.
9697 * testsuite/dynamic_list.sh: New file.
9698
e0bb29a5
CS
96992008-11-05 Craig Silverstein <csilvers@google.com>
9700
9701 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9702 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9703 (t11_last): Likewise.
9704 * testsuite/ver_test_6.c (main): Likewise.
9705
4e1e25e0
CC
97062008-10-07 Cary Coutant <ccoutant@google.com>
9707
9708 * options.c (General_options::finalize): Add check for -static and
9709 -shared.
9710 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9711 is not empty.
9712
92f03fcb
CC
97132008-10-02 Cary Coutant <ccoutant@google.com>
9714
9715 * plugin.cc (make_sized_plugin_object): Fix conditional
9716 compilation to work when not all targets are enabled.
9717
fbd8a257
CC
97182008-09-29 Cary Coutant <ccoutant@google.com>
9719
9720 * archive.cc (Archive::get_file_and_offset): Use filename instead
9721 of name to get library path.
9722 (Archive::include_member): Unlock external member of a thin archive.
9723
9724 * testsuite/Makefile.am (TEST_AR): New variable.
9725 (thin_archive_test_1): New test.
9726 (thin_archive_test_2): New test.
81636b3f
CC
9727 * testsuite/Makefile.in: Regenerate.
9728 * testsuite/thin_archive_main.cc: New file.
9729 * testsuite/thin_archive_test_1.cc: New file.
9730 * testsuite/thin_archive_test_2.cc: New file.
9731 * testsuite/thin_archive_test_3.cc: New file.
9732 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 9733
eff45813
CC
97342008-09-29 Cary Coutant <ccoutant@google.com>
9735
9736 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9737 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9738 instead of -1U.
9739 (Sized_relobj::do_finalize_local_symbols): Likewise.
9740 (Sized_relobj::map_to_kept_section): Likewise.
9741 * object.h (Sized_relobj::invalid_address): New constant.
9742 (Sized_relobj::do_output_section_offset): Check for invalid_address
9743 and return -1ULL.
9744 * output.cc (Output_reloc::local_section_offset): Use constant
9745 invalid_address instead of -1U.
9746 (Output_reloc::get_address): Likewise.
9747 (Output_section::output_address): Change -1U to -1ULL.
9748 * output.h (Output_reloc::invalid_address): New constant.
9749 * reloc.cc (Sized_relobj::write_sections): Use constant
9750 invalid_address instead of -1U.
9751 (Sized_relobj::relocate_sections): Likewise.
9752 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9753 values for merge sections.
9754 * target-reloc.h (relocate_for_relocatable): Use constant
9755 invalid_address instead of -1U.
9756
89fc3421
CC
97572008-09-19 Cary Coutant <ccoutant@google.com>
9758
9759 Add plugin functionality for link-time optimization (LTO).
9760 * configure.ac (plugins): Add --enable-plugins option.
9761 * configure: Regenerate.
9762 * config.in: Regenerate.
9763 * Makefile.am (LIBDL): New variable.
9764 (CCFILES): Add plugin.cc.
9765 (HFILES): Add plugin.h.
9766 (ldadd_var): Add LIBDL.
9767 * Makefile.in: Regenerate.
9768
9769 * archive.cc: Include "plugin.h".
9770 (Archive::setup): Don't preread archive symbols when using a plugin.
9771 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9772 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9773 files.
9774 (Archive::include_member): Add symbols from plugin objects.
9775 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9776 * descriptors.cc (Descriptors::open): Check for file descriptors
9777 abandoned by plugins.
9778 (Descriptors::claim_for_plugin): New function.
9779 * descriptors.h (Descriptors::claim_for_plugin): New function.
9780 (Open_descriptor::is_claimed): New field.
9781 (claim_descriptor_for_plugin): New function.
9782 * fileread.cc (File_read::claim_for_plugin): New function.
9783 * fileread.h (File_read::claim_for_plugin): New function.
9784 (File_read::descriptor): New function.
9785 * gold.cc: Include "plugin.h".
9786 (queue_initial_tasks): Add task to call plugin hooks for generating
9787 new object files.
9788 * main.cc: Include "plugin.h".
9789 (main): Load plugin libraries.
9790 * object.h (Pluginobj): Declare.
9791 (Object::pluginobj): New function.
9792 (Object::do_pluginobj): New function.
9793 (Object::set_target): New function.
9794 * options.cc: Include "plugin.h".
9795 (General_options::parse_plugin): New function.
9796 (General_options::General_options): Initialize plugins_ field.
9797 (General_options::add_plugin): New function.
9798 * options.h (Plugin_manager): Declare.
9799 (General_options): Add --plugin option.
9800 (General_options::has_plugins): New function.
9801 (General_options::plugins): New function.
9802 (General_options::add_plugin): New function.
9803 (General_options::plugins_): New field.
9804 * plugin.cc: New file.
9805 * plugin.h: New file.
9806 * readsyms.cc: Include "plugin.h".
9807 (Read_symbols::do_read_symbols): Check for archive before checking
9808 for ELF file. Call plugin hooks to claim files.
9809 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9810 from a real object file; force override when processing replacement
9811 files.
9812 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9813 (Symbol::init_base_object): Likewise.
9814 (Symbol::init_base_output_data): Likewise.
9815 (Symbol::init_base_output_segment): Likewise.
9816 (Symbol::init_base_constant): Likewise.
9817 (Symbol::init_base_undefined): Likewise.
9818 (Symbol::output_section): Assert that object is not a plugin.
9819 (Symbol_table::add_from_pluginobj): New function.
9820 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9821 undefined.
9822 (Symbol_table::sized_write_globals): Likewise.
9823 (Symbol_table::add_from_pluginobj): Instantiate template.
9824 * symtab.h (Sized_pluginobj): Declare.
9825 (Symbol::in_real_elf): New function.
9826 (Symbol::set_in_real_elf): New function.
9827 (Symbol::in_real_elf_): New field.
9828 (Symbol_table::add_from_pluginobj): New function.
9829
9830 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9831 (LIBDL): New variable.
9832 (LDADD): Add LIBDL.
9833 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9834 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9835 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9836 (MOSTLYCLEANFILES): Likewise.
9837 * testsuite/Makefile.in: Regenerate.
9838 * testsuite/plugin_test.c: New file.
9839 * testsuite/plugin_test_1.sh: New file.
9840 * testsuite/plugin_test_2.sh: New file.
9841
de31bda5
ILT
98422008-09-16 Ian Lance Taylor <iant@google.com>
9843
9c2d0ef9
ILT
9844 * target-reloc.h (relocate_section): Check whether a symbol is
9845 defined by the ABI before reporting an undefined symbol error.
9846 * target.h (Target::is_defined_by_abi): Make parameter const.
9847 (Target::do_is_defined_by_abi): Likewise.
9848 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9849 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9850 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9851 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9852 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9853 * testsuite/Makefile.in: Rebuild.
9854
de31bda5
ILT
9855 * fileread.cc (make_view): Add casts to avoid warning.
9856
9fa33bee
AO
98572008-09-16 Alexandre Oliva <aoliva@redhat.com>
9858
9859 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9860 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9861
183fd0e3
AO
98622008-09-16 Alexandre Oliva <aoliva@redhat.com>
9863
9864 * options.h (General_options::output_is_executable): New.
9865 (General_options::output_is_pie): New.
9866 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9867 for shared libraries.
9868 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9869
7be8330a
CD
98702008-09-11 Chris Demetriou <cgd@google.com>
9871
9872 * options.h (origin): New -z option.
9873 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9874 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9875 in DT_FLAGS_1.
9876
a9caad02
CC
98772008-09-05 Cary Coutant <ccoutant@google.com>
9878
9879 * fileread.cc (File_read::make_view): Add check for attempt to map
9880 beyond end of file.
9881
ae6dce4d
CC
98822008-09-05 Cary Coutant <ccoutant@google.com>
9883
9884 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9885 explicit instantiations.
9886
d7ab2a47
KVH
98872008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9888
9889 PR gold/6858
9890 * options.cc (General_options::finalize): Allow undefined symbols
9891 in shlibs if linking -shared.
9892
9893 PR gold/6859
9894 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9895 symbols as not needing a dynsym entry.
9896
1e52a9c1
CS
98972008-08-20 Craig Silverstein <csilvers@google.com>
9898
9899 * fileread.cc (File_read::open): Do not lock the file unless it
9900 was successfully opened.
9901
d85c80a3
CC
99022008-08-14 Cary Coutant <ccoutant@google.com>
9903
9904 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9905 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9906 * testsuite/tls_test.cc (struct int128): 128-bit struct
9907 for testing TLS relocs with non-zero addend.
9908 (v12): New TLS variable.
9909 (t12): New test.
9910 (t_last): Add check for v12.
9911 * testsuite/tls_test.h (t12): New function.
9912 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9913
2d924fd9
ILT
99142008-08-13 Ian Lance Taylor <iant@google.com>
9915
9916 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9917 set tls_segment_ or relro_segment_.
9918 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9919 when appropriate.
9920 * output.h (Output_section::clear_is_relro): New function.
9921 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9922 sections specially even when output_data_ is empty.
9923 (Output_segment::maximum_alignment): When first section is relro,
9924 only force alignment for PT_LOAD segments.
9925 * script.cc (script_data_segment_align): New function.
9926 (script_data_segment_relro_end): New function.
9927 * script-c.h (script_data_segment_align): Declare.
9928 (script_data_segment_relro_end): Declare.
9929 * script-sections.h (class Script_sections): Declare
9930 data_segment_align and data_segment_relro_end. Add fields
9931 segment_align_index_ and saw_relro_end_.
9932 * script-sections.cc (class Sections_element): Add set_is_relro
9933 virtual function. Add new bool* parameter to place_orphan_here.
9934 Add get_output_section virtual function.
9935 (class Output_section_definition): Add set_is_relro. Add new
9936 bool* parameter to place_orphan_here. Add get_output_section.
9937 Add is_relro_ field.
9938 (Output_section_definition::Output_section_definition): Initialize
9939 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9940 and is_relro_ fields.
9941 (Output_section_definition::place_orphan_here): Add is_relro
9942 parameter.
9943 (Output_section_definition::set_section_addresses): Set relro for
9944 output section.
9945 (Output_section_definition::alternate_constraint): Likewise.
9946 (class Orphan_output_section): Add new bool* parameter to
9947 place_orphan_here. Add get_output_section.
9948 (Orphan_output_section::place_orphan_here): Add is_relro
9949 parameter.
9950 (Script_sections::Script_sections): Initialize
9951 data_segment_align_index_ and saw_relro_end_.
9952 (Script_sections::data_segment_align): New function.
9953 (Script_sections::data_segment_relro_end): New function.
9954 (Script_sections::place_orphan): Set or clear is_relro.
9955 (Script_sections::set_section_addresses): Force alignment of first
9956 TLS section.
9957 * yyscript.y (exp): Call script_data_segment_align and
9958 script_data_segment_relro_end.
9959 * testsuite/relro_script_test.t: New file.
9960 * testsuite/relro_test.cc (using_script): Declare.
9961 (t1, t2): Test using_script.
9962 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9963 (relro_script_test_SOURCES): Define.
9964 (relro_script_test_DEPENDENCIES): Define.
9965 (relro_script_test_LDFLAGS): Define.
9966 (relro_script_test_LDADD): Define.
9967 (relro_script_test.so): New target.
9968 * testsuite/Makefile.in: Rebuild.
9969
f827c9a9
CC
99702008-08-06 Cary Coutant <ccoutant@google.com>
9971
9972 * archive.cc (Archive::total_archives, Archive::total_members)
9973 (Archive::total_members_loaded): New variables.
9974 (Archive::setup): Add parameter. Add option to preread
9975 archive symbols.
9976 (Archive::read_armap): Add counter.
9977 (Archive::get_file_and_offset): New function.
9978 (Archive::get_elf_object_for_member): New function.
9979 (Archive::read_all_symbols): New function.
9980 (Archive::read_symbols): New function.
9981 (Archive::add_symbols): Add counters.
9982 (Archive::include_all_members): Use armap to find members if it's
9983 already built.
9984 (Archive::include_member): Skip reading symbols if already read.
9985 Factored code into Archive::get_file_and_offset and
9986 Archive::get_elf_object_for_member. Changed call to
9987 Mapfile::report_include_archive_member.
9988 (Archive::print_stats): New function.
9989 * archive.h: Declare Object and Read_symbols_data classes.
9990 (Archive::Archive): Add initializers for new members.
9991 (Archive::setup): Add parameter.
9992 (Archive::print_stats): New function.
9993 (Archive::total_archives, Archive::total_members)
9994 (Archive::total_members_loaded): New variables.
9995 (Archive::get_file_and_offset): New function.
9996 (Archive::get_elf_object_for_member): New function.
9997 (Archive::read_all_symbols): New function.
9998 (Archive::read_symbols): New function.
9999 (Archive::Archive_member): New class.
10000 (Archive::members_): New member.
10001 (Archive::num_members_): New member.
10002 * main.cc: Include archive.h.
10003 (main): Call Archive::print_stats.
10004 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10005 archive parameter; member_name is now the fully-decorated name.
10006 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10007 * options.h: (General_options): Add --preread-archive-symbols option.
10008 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10009 Archive::setup.
10010
de4c45bd
ILT
100112008-08-04 Ian Lance Taylor <iant@google.com>
10012
10013 * symtab.h (Symbol::use_plt_offset): New function.
10014 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10015 * powerpc.cc (Relocate::relocate): Likewise.
10016 * sparc.cc (Relocate::relocate): Likewise.
10017 * x86_64.cc (Relocate::relocate): Likewise.
10018 * testsuite/weak_plt.sh: New test.
10019 * testsuite/weak_plt_main.cc: New test.
10020 * testsuite/weak_plt_shared.cc: New test.
10021 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10022 (check_PROGRAMS): Add weak_plt.
10023 (check_DATA): Add weak_plt_shared.so.
10024 (weak_plt_main_pic.o, weak_plt): New targets.
10025 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10026 * testsuite/Makefile.in: Rebuild.
10027
10028 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10029 gcctestdir/ld.
10030 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10031 * testsuite/Makefile.in: Rebuild.
10032
323ee3f4
AM
100332008-08-04 Alan Modra <amodra@bigpond.net.au>
10034
10035 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10036 * Makefile.in: Regenerate.
10037 * po/POTFILES.in: Regenerate.
10038
7c07ecec
ILT
100392008-07-29 Ian Lance Taylor <iant@google.com>
10040
10041 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10042 symbols before other symbols.
10043 * testsuite/script_test_2.cc (test_addr): Declare.
10044 (test_addr_alias): Declare.
10045 (main): Check that test_addr and test_addr_alias have the right
cd536b21 10046 values.
7c07ecec
ILT
10047 * testsuite/script_test_2.t: Define test_addr_alias and
10048 test_addr.
10049
5778530e
ILT
100502008-07-24 Ian Lance Taylor <iant@google.com>
10051
2a00e4fb
ILT
10052 PR 5990
10053 * descriptors.cc: New file.
10054 * descriptors.h: New file.
10055 * gold-threads.h (class Hold_optional_lock): New class.
10056 * fileread.cc: Include "descriptors.h".
10057 (File_read::~File_read): Release descriptor rather than closing
10058 it.
10059 (File_read::open) [file]: Call open_descriptor rather than open.
10060 Set is_descriptor_opened_.
10061 (File_read::open) [memory]: Assert that descriptor is not open.
10062 (File_read::reopen_descriptor): New function.
10063 (File_read::release): Release descriptor.
10064 (File_read::do_read): Make non-const. Reopen descriptor.
10065 (File_read::read): Make non-const.
10066 (File_read::make_view): Reopen descriptor.
10067 (File_read::do_readv): Likewise.
10068 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10069 Update declarations.
10070 * layout.cc: Include "descriptors.h".
10071 (Layout::create_build_id): Use open_descriptor rather than open.
10072 * output.cc: Include "descriptors.h".
10073 (Output_file::open): Use open_descriptor rather than open.
10074 * archive.cc (Archive::const_iterator): Change Archive to be
10075 non-const.
10076 (Archive::begin, Archive::end): Make non-const.
10077 (Archive::count_members): Likewise.
10078 * archive.h (class Archive): Update declarations.
10079 * object.h (Object::read): Make non-const.
10080 * Makefile.am (CCFILES): Add descriptors.cc.
10081 (HFILES): Add descriptors.h.
10082 * Makefile.in: Rebuild.
10083
801647d1
ILT
10084 PR 6716
10085 * gold.h: Always include <clocale>. Add Solaris workarounds
10086 following code in binutils/sysdep.h.
10087
5edd166e
ILT
10088 PR 6048
10089 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10090 this->eh_frame_hdr_ is NULL before using it.
10091
c89ad728
ILT
10092 * dynobj.cc (Versions::Versions): Update comment.
10093
aa86f06b
ILT
10094 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10095 the base version name.
10096
5778530e
ILT
10097 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10098 array size plus one.
10099 (Stringpool_template::set_string_offsets): Subtract one from key
10100 before using it as an array index.
10101 (Stringpool_template::get_offset_with_length): Likewise.
10102 (Stringpool_template::write_to_buffer): Likewise.
10103 * stringpool.h (Stringpool_template::get_offset_from_key):
10104 Likewise.
10105
057ead22
ILT
101062008-07-23 Ian Lance Taylor <iant@google.com>
10107
7f649c59
ILT
10108 PR 6658
10109 * object.h (Merged_symbol_value::value): Do our best to handle a
10110 negative addend.
10111
057ead22
ILT
10112 PR 6647
10113 * script.cc (Version_script_info::get_versions): Don't add empty
10114 version tag to return value.
10115 (Version_script_info::get_symbol_version_helper): Change return
10116 type to bool. Add pversion parameter. Change all callers.
10117 (script_register_vers_node): Don't require a non-NULL tag.
10118 * script.h (class Version_script_info): Update declarations.
10119 (Version_script_info::get_symbol_version): Change return type to
10120 bool. Add version parameter. Change all callers.
10121 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10122 handling. Handle an empty version from a version script.
10123 (Symbol_table::define_special_symbol): Likewise.
10124 * testsuite/ver_test_10.script: New file.
10125 * testsuite/ver_test_10.sh: New file.
10126 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10127 (check_DATA): Add ver_test_10.syms.
10128 (ver_test_10.syms, ver_test_10.so): New target.
10129 * testsuite/Makefile.in: Rebuild.
10130
58e54ac2
CD
101312008-07-23 Simon Baldwin <simonb@google.com>
10132
10133 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10134 to zero for undefined symbols from dynamic libraries.
10135
95d14cd3
ILT
101362008-07-23 Ian Lance Taylor <iant@google.com>
10137
10138 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10139 Change all callers.
10140 * symtab.h (class Symbol_table): Update declaration.
10141 * testsuite/ver_test_9.cc: New file.
10142 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10143 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10144 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10145 (ver_test_9.so, ver_test_9.o): New targets.
10146 * testsuite/Makefile.in: Rebuild.
10147
92de84a6
ILT
101482008-07-22 Ian Lance Taylor <iant@google.com>
10149
34810851
ILT
10150 * options.h (class General_options): Define --check-sections.
10151 * layout.cc (Layout::set_segment_offsets): Handle
10152 --check-sections.
10153
af6156ef
ILT
10154 * options.h (class General_options): Define -n/--nmagic and
10155 -N/--omagic.
10156 * options.cc (General_options::finalize): For -n/--nmagic or
10157 -N/--omagic, set -static.
10158 * layout.cc (Layout::attach_allocated_section_to_segment): If
10159 -N/--omagic, don't put read-only and read-write sections in
10160 different segments.
10161 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10162 finding a read-only segment.
10163 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10164 don't set the minimum segment alignment to the common page size,
10165 and don't set the file offset to the address modulo the page size.
10166 * script-sections.cc (Script_sections::create_segments): If
10167 -n/--omagic, don't put read-only and read-write sections in
10168 different segments.
10169
92de84a6
ILT
10170 * cref.cc: New file.
10171 * cref.h: New file.
10172 * options.h (class General_options): Add --print-symbol-counts.
10173 * main.cc (main): Issue defined symbol report if requested.
10174 * archive.cc (Archive::interpret_header): Make into a const member
10175 function.
10176 (Archive::add_symbols): Call Input_objects::archive_start and
10177 archive_stop.
10178 (Archive::const_iterator): Define new class.
10179 (Archive::begin, Archive::end): New functions.
10180 (Archive::include_all_members): Rewrite to use iterator.
10181 (Archive::count_members): New function.
10182 * archive.h (class Archive): Update declarations.
10183 (Archive::filename): New function.
10184 * object.cc: Include "cref.h".
10185 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10186 (Sized_relobj::do_get_global_symbol_counts): New function.
10187 (Input_objects::add_object): Add object to cross-referencer.
10188 (Input_objects::archive_start): New function.
10189 (Input_objects::archive_stop): New function.
10190 (Input_objects::print_symbol_counts): New function.
10191 * object.h: Declare Cref and Archive.
10192 (Object::get_global_symbol_counts): New function.
10193 (Object::do_get_global_symbol_counts): New pure virtual function.
10194 (class Sized_relobj): Add defined_count_ field. Update
10195 declarations.
10196 (class Input_objects): Add cref_ field. Update constructor.
10197 Update declarations.
10198 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10199 defined_count_.
10200 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10201 symbol counts.
10202 (Sized_dynobj::do_get_global_symbol_counts): New function.
10203 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10204 defined_count_. Update declarations. Define Symbols typedef.
10205 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10206 parameter. Change all callers.
10207 (Symbol_table::add_from_dynobj): Add sympointers and defined
10208 parameters. Change all callers.
10209 * symtab.h (class Symbol_table): Update declarations.
10210 * Makefile.am (CCFILES): Add cref.cc.
10211 (HFILES): Add cref.h.
10212 * Makefile.in: Rebuild.
10213
3f7c5e1d
CD
102142008-07-22 Simon Baldwin <simonb@google.com>
10215
10216 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10217 to zero when writing undefined symbols.
10218
e0b64032
ILT
102192008-07-22 Ian Lance Taylor <iant@google.com>
10220
10221 * output.cc (Output_section::add_input_section): Don't try to
10222 merge empty merge sections.
10223
096b02cf
CS
102242008-07-21 Craig Silverstein <csilvers@google.com>
10225
10226 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10227 Include symbol version in error message.
cd536b21 10228
1d1f116d
CD
102292008-07-20 Chris Demetriou <cgd@google.com>
10230
cd536b21 10231 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
10232 (RANDOM_SEED_CFLAGS): New substituted variable.
10233 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10234 * configure: Rebuild.
10235 * Makefile.in: Likewise.
10236 * testsuite/Makefile.in: Likewise.
10237
a18f591e
ILT
102382008-07-18 Ian Lance Taylor <iant@google.com>
10239
10240 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10241 where we see NAME/NULL and NAME/VERSION as separate symbols.
10242 * testsuite/ver_test_main.cc (main): Call t4.
10243 (t4, t4_2a): Define.
10244 * testsuite/ver_test_2.cc (t4_2): Define.
10245 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10246 * testsuite/ver_test_4.cc (t4_2a): Define.
10247 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10248 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10249
c6e3f6ed
ILT
102502008-07-17 Ian Lance Taylor <iant@google.com>
10251
10252 * dynobj.cc (Versions::add_def): If we give an error about a
10253 missing version, go ahead and create the version anyhow.
10254
ef9beddf
ILT
102552008-07-10 Ian Lance Taylor <iant@google.com>
10256
10257 Handle output sections with more than 0x7fffffff bytes.
10258 * object.h (class Relobj): Change map_to_output_ to
10259 output_sections_, and just keep a section pointer. Change all
10260 uses. Move comdat group support to Sized_relobj.
10261 (Relobj::is_section_specially_mapped): Remove.
10262 (Relobj::output_section): Remove poff parameter. Change all
10263 callers.
10264 (Relobj::output_section_offset): New function.
10265 (Relobj::set_section_offset): Rewrite.
10266 (Relobj::map_to_output): Remove.
10267 (Relobj::output_sections): New function.
10268 (Relobj::do_output_section_offset): New pure virtual function.
10269 (Relobj::do_set_section_offset): Likewise.
10270 (class Sized_relobj): Add section_offsets_ field. Add comdat
10271 group support from Relobj. Update declarations.
10272 (Sized_relobj::get_output_section_offset): New function.
10273 (Sized_relobj::do_output_section_offset): New function.
10274 (Sized_relobj::do_set_section_offset): New function.
10275 * object.cc (Relobj::output_section_address): Remove.
10276 (Sized_relobj::Sized_relobj): Initialize new fields.
10277 (Sized_relobj::include_section_group): Cast find_kept_object to
10278 Sized_relobj.
10279 (Sized_relobj::include_linkonce_section): Likewise.
10280 (Sized_relobj::do_layout): Use separate arrays for output section
10281 and output offset.
10282 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10283 output_sections.
10284 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10285 output_sections and section_offsets.
10286 (Sized_relobj::write_local_symbols): Likewise.
10287 (map_to_kept_section): Compute output address directly.
10288 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10289 output_sections and section_offsets.
10290 (Sized_relobj::write_sections): Likewise.
10291 (Sized_relobj::relocate_sections): Likewise.
10292 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10293 * output.h (class Output_reloc): Update declarations. Change
10294 u2_.relobj to Sized_relobj*.
10295 (class Output_data_reloc): Change add functions to use
10296 Sized_relobj*.
10297 * output.cc (Output_reloc::Output_reloc): Change relobj to
10298 Sized_relobj*.
10299 (Output_reloc::local_section_offset): Change return type to
10300 Elf_Addr. Use get_output_section_offset.
10301 (Output_reloc::get_address): Likewise.
10302 (Output_section::is_input_address_mapped): Don't call
10303 is_section_specially_mapped.
10304 (Output_section::output_offset): Likewise.
10305 (Output_section::output_address): Likewise.
10306 (Output_section::starting_output_address): Likewise.
10307 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10308 parameter to Sized_relobj*.
10309 (Copy_relocs::need_copy_reloc): Likewise.
10310 (Copy_relocs::save): Likewise.
10311 * copy-relocs.h (class Copy_relocs): Update declarations.
10312 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10313 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10314 * target-reloc.h (relocate_for_relocatable): Change
10315 offset_in_output_section type to Elf_Addr. Change code that uses
10316 it as well.
10317 * layout.cc (Layout::layout): Always set *off.
10318 * mapfile.cc (Mapfile::print_input_section): Use
10319 output_section_offset.
10320 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10321 Sized_relobj*.
10322 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10323 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10324 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10325
5cb66f97
ILT
103262008-07-03 Ian Lance Taylor <iant@google.com>
10327
10328 * layout.cc (Layout::include_section): Do not discard unrecognized
10329 SHT_STRTAB sections.
10330
afe47622
CS
103312008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10332
10333 * script.cc (Lex::can_continue_name): Make '?' allowable in
10334 version-script names.
10335 * testsuite/version_script.map: Change glob pattern to use '?'
10336
5adf9721
ILT
103372008-06-30 Manish Singh <yosh@gimp.org>
10338
10339 PR 6585
10340 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10341 Correct typo.
10342
e6fde208
ILT
103432008-06-30 Ian Lance Taylor <iant@google.com>
10344
10345 PR 6660
10346 PR 6682
10347 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10348 versions]: Don't try to read the value in the contents, since we
10349 don't use it. Use the template endianness when writing.
10350
3f2e6a2d
CC
103512008-06-25 Cary Coutant <ccoutant@google.com>
10352
10353 * fileread.cc (File_read::make_view): Assert on zero-length view.
10354 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10355 symbol table when there are no symbols to read.
10356
c43d3a48
CS
103572008-06-23 Craig Silverstein <csilvers@google.com>
10358
10359 * version.cc (version_string): Bump to 1.7
10360
5f494ea0
CS
103612008-06-18 Craig Silverstein <csilvers@google.com>
10362
10363 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10364 constant 0xFFFF to type Valtype.
10365 (Powerpc_relocate_functions::rel16_ha): Likewise.
10366
c42e122e
ILT
103672008-06-17 Ian Lance Taylor <iant@google.com>
10368
f34787f8
ILT
10369 * output.h (Output_section::Input_section): Initialize p2align_ to
10370 zero for Output_section_data constructors.
10371 (Output_section::Input_section::addralign): If not an input
10372 section, return the alignment of the Output_section_data.
10373 * testsuite/copy_test.cc: New file.
10374 * testsuite/copy_test_1.cc: New file.
10375 * testsuite/copy_test_2.cc: New file.
10376 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10377 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10378 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10379 (copy_test_1_pic.o, copy_test_1.so): New targets.
10380 (copy_test_2_pic.o, copy_test_2.so): New targets.
10381 * testsuite/Makefile.in: Rebuild.
10382
c42e122e
ILT
10383 * script-sections.cc (Script_sections::place_orphan): Initialize
10384 local variable exact.
10385
ce3ac18a
DE
103862008-06-13 David Edelsohn <edelsohn@gnu.org>
10387
10388 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10389
42cacb20
DE
103902008-06-12 David Edelsohn <edelsohn@gnu.org>
10391 David S. Miller <davem@davemloft.net>
10392
10393 * powerpc.cc: New file.
10394 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10395 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10396 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10397 * Makefile.in: Rebuild.
10398
7b308235
ILT
103992008-06-09 Ian Lance Taylor <iant@google.com>
10400
10401 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10402 <exception>.
10403 (throwing, orig_terminate): New static variables.
10404 (terminate_handler): New static function.
10405 (t2): Set terminate handler.
10406
f0b886e3
ILT
104072008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10408
10409 PR 6584
cd536b21 10410 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
10411 alignment.
10412
3e90f135
CC
104132008-05-30 Cary Coutant <ccoutant@google.com>
10414
10415 * archive.cc (Archive::include_all_members) Correct to step
10416 over symbol table and extended name table in thin archives.
10417
e09ad04a
ILT
104182008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10419
10420 PR 6407
10421 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10422 calculation.
10423
62b01cb5
ILT
104242008-05-28 Caleb Howe <cshowe@google.com>
10425
10426 * reduced_debug_output.cc: New file.
10427 * reduced_debug_output.h: New file.
92de84a6 10428 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
10429 * options.cc (General_options::finalize): Add strip_debug_non_line
10430 to the strip heirarchy.
10431 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10432 fields.
10433 * layout.cc: Include "reduced_debug_output.h".
10434 (Layout::Layout): Initialize new fields.
10435 (line_only_debug_sections): New static array.
10436 (is_lines_only_debug_sections): New static inline function.
10437 (Layout::include_section): Handle --strip-debug-non-line.
10438 (Layout::make_output_section): If --strip-debug-non-line, build
10439 new output sections for .debug_abbrev and .debug_info.
10440 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10441 gold. Warn about possible overflow.
10442 (read_signed_LEB_128): Likewise.
10443 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10444 (read_signed_LEB_128): Declare.
10445 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10446 (HFILES): Add reduced_debug_output.h.
10447 * Makefile.in: Rebuild.
10448
7d9e3d98
ILT
104492008-05-21 Ian Lance Taylor <iant@google.com>
10450
10451 * mapfile.cc: New file.
10452 * mapfile.h: New file.
10453 * options.h (class General_options): Add -M/--print-map and -Map.
10454 * options.cc (General_options::finalize): Make -M equivalent to
10455 -Map -.
10456 * main.cc: Include <cstdio> and "mapfile.h".
10457 (main): Open mapfile if requested.
10458 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10459 constructor. Change caller.
10460 (queue_initial_tasks): Add mapfile parameter. Change caller.
10461 (queue_middle_tasks): Likewise.
10462 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10463 declarations.
10464 * archive.cc: Include "mapfile.h".
10465 (Archive::add_symbols): Add mapfile parameter. Change all
10466 callers. Pass mapfile, symbol, and reason to include_member.
10467 (Archive::include_all_members): Add mapfile parameter. Change all
10468 callers.
10469 (Archive::include_member): Add mapfile, sym, and why parameters.
10470 Change all callers. Report inclusion to map file.
10471 * archive.h: Include "fileread.h".
10472 (class Archive): Update declarations.
10473 (Archive::file): New const method.
10474 (class Add_archive_symbols): Add mapfile_ field. Update
10475 constructor. Change all callers.
10476 * readsyms.h (class Read_symbols): Likewise.
10477 (class Finish_group): Likewise.
10478 (class Read_script): Likewise.
10479 * common.cc: Include "mapfile.h".
10480 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10481 all callers.
10482 (Symbol_table::do_allocate_commons): Likewise.
10483 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10484 symbol allocation to mapfile.
10485 * common.h (class Allocate_commons_task): Add mapfile_ field.
10486 Update constructor. Change all callers.
10487 * symtab.h (class Symbol_table): Update declarations.
10488 * layout.cc: Include "mapfile.h".
10489 (Layout_task_runner::run): Print information to mapfile.
10490 (Layout::create_gold_note): Change Output_data_fixed_space to
10491 Output_data_zero_fill.
10492 (Layout::create_build_id): Likewise.
10493 (Layout::print_to_mapfile): New function.
10494 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10495 constructor. Change caller.
10496 (class Layout): Declare print_to_mapfile.
10497 * output.cc (Output_section::Input_section::print_to_mapfile): New
10498 function.
10499 (Output_section::add_input_section): If producing a map, always
10500 add to input_sections_ list.
10501 (Output_section::do_print_to_mapfile): New function.
10502 (Output_segment::print_sections_to_mapfile): New function.
10503 (Output_segment::print_section_list_to_mapfile): New function.
10504 * output.h: Include "mapfile.h".
10505 (Output_data::print_to_mapfile): New function.
10506 (Output_data::do_print_to_mapfile): New virtual function.
10507 (Output_segment_headers::do_print_to_mapfile): New function.
10508 (Output_file_header::do_print_to_mapfile): New function.
10509 (Output_data_const::do_print_to_mapfile): New function.
10510 (class Output_data_const_buffer): Add map_name_ field. Update
10511 constructor. Change all callers. Add do_print_to_mapfile
10512 function.
10513 (class Output_data_fixed_space): Likewise.
10514 (class Output_data_space): Likewise.
10515 (class Output_data_zero_fill): New class.
10516 (Output_data_strtab::do_print_to_mapfile): New function.
10517 (Output_data_reloc_base::do_print_to_mapfile): New function.
10518 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10519 (Output_data_group::do_print_to_mapfile): New function.
10520 (Output_data_got::do_print_to_mapfile): New function.
10521 (Output_data_dynamic::do_print_to_mapfile): New function.
10522 (Output_symtab_xindex::do_print_to_mapfile): New function.
10523 (class Output_section): Declare do_print_to_mapflie. Declare
10524 print_to_mapfile in Input_section.
10525 (class Output_segment): Declare new functions.
10526 * object.h (Sized_relobj::symbol_count): New function.
10527 * script-sections.cc
10528 (Output_section_element_dot_assignment::set_section_addresses):
10529 Change Output_data_fixed_space to Output_data_zero_fill.
10530 (Output_data_expression::do_print_to_mapfile): New function.
10531 * script.cc (read_input_script): Add mapfile parameter. Change
10532 all callers.
10533 * script.h (read_input_script): Update declaration.
10534 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10535 (Eh_frame::do_print_to_mapfile): New function.
10536 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10537 (Output_merge_string::do_print_to_mapfile): New function.
10538 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10539 function.
10540 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10541 function.
10542 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10543 function.
10544 * Makefile.am (CCFILES): Add mapfile.cc.
10545 (HFILES): Add mapfile.h.
10546 * Makefile.in: Rebuild.
10547
9f1d377b
ILT
105482008-05-19 Ian Lance Taylor <iant@google.com>
10549
10550 * options.h (class General_options): Add -z relro.
10551 * layout.cc (Layout::Layout): Initialize relro_segment_.
10552 (Layout::add_output_section_data): Return the output section.
10553 (Layout::make_output_section): Rcognize relro sections and mark
10554 them appropriately.
10555 (Layout::attach_allocated_section_to_segment): Put relro sections
10556 in a PT_GNU_RELRO segment.
10557 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10558 section as relro.
10559 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10560 PT_TLS segments.
10561 (Layout::linkonce_mapping): Map d.rel.ro.local to
10562 .data.rel.ro.local.
10563 (Layout::output_section_name): Us .data.rel.ro.local for any
10564 section which begins with that.
10565 * layout.h (class Layout): Update add_output_section_data
10566 declaration. Add relro_segment_ field.
10567 * output.cc (Output_section::Output_section): Initialize is_relro_
10568 and is_relro_local_ fields.
10569 (Output_segment::add_output_section): Group relro sections.
10570 (Output_segment::is_first_section_relro): New function.
10571 (Output_segment::maximum_alignment): If there is a relro section,
10572 align the segment to the common page size.
10573 (Output_segment::set_section_addresses): Track whether we are
10574 looking at relro sections. If the last section is a relro
10575 section, align to the common page size.
10576 (Output_segment::set_section_list_addresses): Add in_relro
10577 parameter. Change all callers. Align to the page size when
10578 moving from relro to non-relro section.
10579 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10580 segment.
10581 * output.h (class Output_section): Add is_relro_ and
10582 is_relro_local_ fields.
10583 (Output_section::is_relro): New function.
10584 (Output_section::set_is_relro): New function.
10585 (Output_section::is_relro_local): New function.
10586 (Output_section::set_is_relro_local): New function.
10587 (class Output_segment): Update declarations.
10588 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10589 * sparc.cc (Target_sparc::got_section): Likewise.
10590 * x86_64.cc (Target_x86_64::got_section): Likewise.
10591 * testsuite/relro_test_main.cc: New file.
10592 * testsuite/relro_test.cc: New file.
10593 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10594 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10595 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10596 (relro_test.so, relro_test_pic.o): New targets.
10597 * testsuite/Makefile.in: Rebuild.
10598
a984ee1d
ILT
105992008-05-16 Ian Lance Taylor <iant@google.com>
10600
01676dcd
ILT
10601 * output.cc (Output_segment::add_output_section): Remove front
10602 parameter.
10603 * output.h (class Output_segment): Remove
10604 add_initial_output_section and overloaded add_output_section.
10605 Update declaration of remaining add_output_section.
10606 * layout.cc (Layout::create_interp): Call add_output_section
10607 rather than add_initial_output_section.
10608 (Layout::finish_dynamic_section): Likewise.
10609
497897f9
ILT
10610 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10611 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10612 know the dynamic type.
10613 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10614 field. Initialize it in constructor.
10615 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10616 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10617 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10618 reloc.
10619
a984ee1d
ILT
10620 * output.cc (Output_reloc::get_address): Change return type to
10621 Elf_Addr.
10622 * output.h (class Output_reloc): Update get_address declaration.
10623 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10624 for section addresses.
10625
55ba0940
ILT
106262008-05-09 Ian Lance Taylor <iant@google.com>
10627
10628 PR 6493
10629 * gold.cc (gold_nomem): Use return value of write.
10630
75517b77
ILT
106312008-05-08 Ian Lance Taylor <iant@google.com>
10632
10633 * symtab.c (Symbol::init_base_output_data): Add version
10634 parameter. Change all callers.
10635 (Symbol::init_base_output_segment): Likewise.
10636 (Symbol::init_base_constant): Likewise.
10637 (Symbol::init_base_undefined): Likewise.
10638 (Sized_symbol::init_output_data): Likewise.
10639 (Sized_symbol::init_output_segment): Likewise.
10640 (Sized_symbol::init_constant): Likewise.
10641 (Sized_symbol::init_undefined): Likewise.
10642 (Symbol_table::do_define_in_output_data): If the new symbol has a
10643 version, mark it as the default.
10644 (Symbol_table::do_define_in_output_segment): Likewise.
10645 (Symbol_table::do_define_as_constant): Likewise.
10646 * symtab.h (class Symbol): Update declarations.
10647 (class Sized_symbol): Likewise.
10648 * resolve.cc (Symbol::override_version): New function.
c42e122e 10649 (Symbol::override_base): Call override_version.
75517b77
ILT
10650 (Symbol::override_base_with_special): Likewise.
10651 * testsuite/ver_script_8.script: New file.
10652 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10653 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10654 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10655 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10656
f1f70eae
ILT
106572008-05-06 Ian Lance Taylor <iant@google.com>
10658
f3e9c5c5
ILT
10659 PR 6049
10660 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10661 functions.
10662 (class General_options): Remove existing --undefined, and add
10663 --no-undefined instead. Add new --undefined as synonym for -u.
10664 * archive.cc (Archive::add_symbols): Check whether symbol was
10665 named with -u.
10666 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10667 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10668 all uses. Add IS_UNDEFINED. Update declarations to split
10669 different versions of init_base. Declare init_base_undefined.
10670 (Symbol::is_defined): Handle IS_UNDEFINED.
10671 (Symbol::is_undefined): Likewise.
10672 (Symbol::is_weak_undefined): Call is_undefined.
10673 (Symbol::is_absolute): Handle IS_CONSTANT.
10674 (class Sized_symbol): Update declarations to split different
10675 versions of init. Declare init_undefined.
10676 (class Symbol_table): Declare new functions.
10677 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10678 Change all callers.
10679 (Symbol::init_base_output_data): Likewise.
10680 (Symbol::init_base_output_segment): Likewise.
10681 (Symbol::init_base_constant): Likewise.
10682 (Symbol::init_base_undefined): New function.
10683 (Sized_symbol::init_object): Rename from init. Change all
10684 callers.
10685 (Sized_symbol::init_output_data): Likewise.
10686 (Sized_symbol::init_output_segment): Likewise.
10687 (Sized_symbol::init_constant): Likewise.
10688 (Sized_symbol::init_undefined): New function.
10689 (Symbol_table::add_undefined_symbols_from_command_line): New
10690 function.
10691 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10692 function.
10693 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10694 (Symbol::output_section): Likewise.
10695 (Symbol::set_output_section): Likewise.
10696 (Symbol_table::sized_finalize_symbol): Likewise.
10697 (Symbol_table::sized_write_globals): Likewise.
10698 * resolve.cc (Symbol_table::should_override): Likewise.
10699 (Symbol::override_base_with_special): Likewise.
10700
8bdcdf2c
ILT
10701 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10702 symbol, change it to have default visibility.
10703 * testsuite/protected_1.cc: New file.
10704 * testsuite/protected_2.cc: New file.
10705 * testsuite/protected_3.cc: New file.
10706 * testsuite/protected_main_1.cc: New file.
10707 * testsuite/protected_main_2.cc: New file.
10708 * testsuite/protected_main_3.cc: New file.
10709 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10710 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10711 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10712 (protected_1.so): New target.
10713 (protected_1_pic.o, protected_2_pic.o): New targets.
10714 (protected_3_pic.o): New target.
10715 (check_PROGRAMS): Add protected_2.
10716 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10717 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10718 * testsuite/Makefile.in: Rebuild.
10719
2b706932
ILT
10720 * options.h (DEFINE_var): Add set_user_set_##varname__.
10721 (DEFINE_bool_alias): New macro.
10722 (class General_options): Define -Bstatic using DEFINE_bool_alias
10723 rather than DEFINE_special. Add --undefined as an alias for -z
10724 defs.
10725 * options.cc (General_options::parse_Bstatic): Remove.
10726
d82a5bcc
ILT
10727 * options.h (class General_options): Add --fatal-warnings.
10728 * main.cc (main): Implement --fatal-warnings.
10729 * errors.h (Errors::warning_count): New function.
10730
f1f70eae
ILT
10731 * options.h (class General_options): Add -Bsymbolic-functions.
10732 * symtab.h (Symbol::is_preemptible): Check for
10733 -Bsymbolic-functions.
10734
8825ac63
ILT
107352008-05-05 Ian Lance Taylor <iant@google.com>
10736
d98bc257
ILT
10737 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10738 as noVARNAME rather than no-VARNAME.
10739 (class General_options): Add option -z combreloc.
10740 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10741 get_address.
10742 (Output_reloc::sort_before) [SHT_REL]: New function.
10743 (Output_reloc::sort_before) [SHT_RELA]: New function.
10744 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10745 Sort_relocs_comparison.
10746 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10747 parameter. Change all callers.
10748 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10749 sort_relocs parameter. Change all callers.
10750 * output.cc (Output_reloc::get_address): New function, broken out
10751 of write_rel.
10752 (Output_reloc::write_rel): Call it.
10753 (Output_reloc::compare): New function.
10754 (Output_data_reloc_base::do_write): Optionally sort relocs.
10755
60b2b4e7
ILT
10756 * configure.ac: If targ_extra_obj is set, link it in.
10757 * configure.tgt: Initialize all variables.
10758 (x86_64*): Set targ_extra_obj and targ_extra_size.
10759 * configure: Rebuild.
10760
8825ac63
ILT
10761 * object.cc (Sized_relobj::include_section_group): Adjust section
10762 indexes read from group data. Build vector to pass to
10763 layout_group.
10764 * layout.cc (Layout::layout_group): Add flags and shndxes
10765 parameters. Remove contents parameter. Change caller. Update
10766 explicit instantiations.
10767 * layout.h (class Layout): Update layout_group declaration.
10768 * output.cc (Output_data_group::Output_data_group): Add flags and
10769 input_shndxes parameters. Remove contents parameter. Change
10770 caller.
10771 (Output_data_group::do_write): Change input_sections_ to
10772 input_shndxes_.
10773 * output.h (class Output_data_group): Update constructor
10774 declaration. Rename input_sections_ to input_shndxes_.
10775 * testsuite/many_sections_test.cc: Add template.
10776
e94cf127
CC
107772008-04-30 Cary Coutant <ccoutant@google.com>
10778
4418b2d5
CC
10779 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10780
e94cf127
CC
10781 * layout.cc (Layout::include_section): Refactored check for debug
10782 info section.
10783 (Layout::add_comdat): Add new parameters. Change type
10784 of signature parameter. Add object and shndx to signatures table.
10785 (Layout::find_kept_object): New function.
10786 * layout.h: Include <cstring>.
10787 (Layout::is_debug_info_section): New function.
10788 (Layout::add_comdat): Add new parameters.
10789 (Layout::find_kept_object): New function.
10790 (Layout::Kept_section): New struct.
10791 (Layout::Signatures): Change type of map range.
10792 * object.cc (Relobj::output_section_address): New function.
10793 (Sized_relobj::include_section_group): Add new parameters. Change
10794 calls to Layout::add_comdat. Change to build table of kept comdat
10795 groups and table mapping discarded sections to kept sections.
10796 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10797 (Sized_relobj::do_layout): Change calls to include_section_group and
10798 include_linkonce_section.
10799 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10800 value to zero when section is discarded.
10801 (Sized_relobj::map_to_kept_section): New function.
10802 * object.h (Relobj::output_section_address): New function.
10803 (Relobj::Comdat_group): New type.
10804 (Relobj::find_comdat_group): New function.
10805 (Relobj::Comdat_group_table): New type.
10806 (Relobj::Kept_comdat_section): New type.
10807 (Relobj::Kept_comdat_section_table): New type.
10808 (Relobj::add_comdat_group): New function.
10809 (Relobj::set_kept_comdat_section): New function.
10810 (Relobj::get_kept_comdat_section): New function.
10811 (Relobj::comdat_groups_): New field.
10812 (Relobj::kept_comdat_sections_): New field.
10813 (Symbol_value::input_value): Update comment.
10814 (Sized_relobj::map_to_kept_section) New function.
10815 (Sized_relobj::include_linkonce_section): Add new parameter.
10816 * target-reloc.h (Comdat_behavior): New type.
10817 (get_comdat_behavior): New function.
10818 (relocate_section): Add code to map a discarded section to the
10819 corresponding kept section when applying a relocation.
10820
e4e5049b
CS
108212008-04-30 Craig Silverstein <csilvers@google.com>
10822
10823 * dwarf_reader.cc (next_generation_count): New static var.
10824 (Addr2line_cache_entry): New struct.
10825 (addr2line_cache): New static var.
10826 (Dwarf_line_info::one_addr2line): Added caching.
10827 (Dwarf_line_info::clear_addr2line_cache): New function.
10828 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10829 cache-size parameter.
10830 (Dwarf_line_info::one_addr2line_cache): New function.
10831 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10832 new cache-size argument to one_addr2line(), and clear cache.
10833
d09e9154
CC
108342008-04-28 Cary Coutant <ccoutant@google.com>
10835
10836 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10837 R_386_PC8 relocations.
10838
7ef73768
ILT
108392008-04-23 Ian Lance Taylor <iant@google.com>
10840
55438702
ILT
10841 * object.cc (Sized_relobj::include_section_group): Check for
10842 invalid section group.
10843
c165fb93
ILT
10844 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10845 header size.
10846
7ef73768
ILT
10847 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10848 than read for file header.
10849 * archive.cc (Archive::include_member): Likewise.
10850
6194aaab
L
108512008-04-23 Paolo Bonzini <bonzini@gnu.org>
10852
10853 * aclocal.m4: Regenerate.
10854 * configure: Regenerate.
10855
d491d34e
ILT
108562008-04-19 Ian Lance Taylor <iant@google.com>
10857
5ea2bac6
ILT
10858 * version.cc (version_string): Bump to 1.6.
10859
7bc3e21a
ILT
10860 * testsuite/Makefile.am (many_sections_r_test): New target.
10861 (many_sections_r_test_SOURCES): Remove.
10862 (many_sections_r_test_DEPENDENCIES): Remove.
10863 (many_sections_r_test_LDFLAGS): Remove.
10864 (many_sections_r_test_LDADD): Remove.
10865
7fcd3aa9
ILT
10866 * object.cc (Sized_relobj::do_add_symbols): Always pass
10867 local_symbol_count_ to add_from_relobj.
10868
4c94d6ae
ILT
10869 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10870 every thousand variables.
10871 * testsuite/Makefile.in: Rebuild.
10872
d491d34e
ILT
10873 * object.cc (Xindex::initialize_symtab_xindex): New function.
10874 (Xindex::read_symtab_xindex): New function.
10875 (Xindex::sym_xindex_to_shndx): New function.
10876 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10877 available.
10878 (Sized_relobj::do_initialize_xindex): New function.
10879 (Sized_relobj::do_read_symbols): Adjust section links.
10880 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10881 parameter. Change all callers.
10882 (Sized_relobj::include_section_group): Adjust section links and
10883 symbol section indexes.
10884 (Sized_relobj::do_layout): Adjust section links.
10885 (Sized_relobj::do_count_local_symbols): Adjust section links and
10886 symbol section indexes.
10887 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10888 ordinary and special symbols.
10889 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10890 dynsym_xindex parameters. Change all callers. Adjust section
10891 links. Use SHN_XINDEX when needed.
10892 (Sized_relobj::get_symbol_location_info): Adjust section links.
10893 Don't get fooled by special symbols.
10894 * object.h (class Xindex): Define.
10895 (class Object): Add xindex_ parameter. Declare virtual functoin
10896 do_initialize_xindex.
10897 (Object::adjust_sym_shndx): New function.
10898 (Object::set_xindex): New protected function.
10899 (class Symbol_value): Add is_ordinary_shndx_ field.
10900 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10901 (Symbol_value::value): Assert ordinary section.
10902 (Symbol_value::initialize_input_to_output_map): Likewise.
10903 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10904 Change all callers.
10905 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10906 all callers.
10907 (class Sized_relobj): Update declarations.
10908 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10909 parameter. Change all callers.
10910 (Sized_relobj::adjust_shndx): New function.
10911 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10912 field.
10913 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10914 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10915 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10916 (Sized_dynobj::read_dynsym_section): Adjust section links.
10917 (Sized_dynobj::read_dynamic): Likewise.
10918 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10919 section links.
10920 (Sized_dynobj::do_initialize_xindex): New function.
10921 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10922 do_initialize_xindex.
10923 (Sized_dynobj::adjust_shndx): New function.
10924 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10925 dynsym_xindex_ fields.
10926 (Layout::finalize): Add a call to set_section_indexes before
10927 creating the symtab sections.
10928 (Layout::set_section_indexes): Don't do anything if the section
10929 already has a section index.
10930 (Layout::create_symtab_sections): Add shnum parameter. Change
10931 caller. Create .symtab_shndx section if needed.
10932 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10933 caller.
10934 (Layout::allocated_output_section_count): New function.
10935 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10936 needed.
10937 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10938 fields. Update declarations.
10939 (Layout::symtab_xindex): New function.
10940 (Layout::dynsym_xindex): New function.
10941 (class Write_symbols_task): Add layout_ field.
10942 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10943 Change caller.
10944 * output.cc (Output_section_headers::Output_section_headers): Add
10945 shstrtab_section parameter. Change all callers.
10946 (Output_section_headers::do_sized_write): Store overflow values
10947 for section count and section string table section index in
10948 section header zero.
10949 (Output_file_header::do_sized_write): Check for overflow of
10950 section count and section string table section index.
10951 (Output_symtab_xindex::do_write): New function.
10952 (Output_symtab_xindex::endian_do_write): New function.
10953 * output.h (class Output_section_headers): Add shstrtab_section_.
10954 Update declarations.
10955 (class Output_symtab_xindex): Define.
10956 (Output_section::has_out_shndx): New function.
10957 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10958 field.
10959 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10960 Change all callers.
10961 (Sized_symbol::init): Likewise.
10962 (Symbol::output_section): Check for ordinary symbol.
10963 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10964 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10965 callers.
10966 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10967 Change all callers. Simplify handling of symbols from sections
10968 not included in the link.
10969 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10970 distinction.
10971 (Weak_alias_sorter::operator()): Assert that symbols are
10972 ordinary.
10973 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10974 distinction.
10975 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10976 parameters. Change all callers.
10977 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10978 symbol distinction. Use SHN_XINDEX when needed.
10979 (Symbol_table::write_section_symbol): Add symtab_xindex
10980 parameter. Change all callers.
10981 (Symbol_table::sized_write_section_symbol): Likewise. Use
10982 SHN_XINDEX when needed.
10983 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10984 declarations.
10985 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10986 (Symbol::is_defined): Check is_ordinary.
10987 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10988 (Symbol::is_absolute, Symbol::is_common): Likewise.
10989 (class Sized_symbol): Update declarations.
10990 (class Symbol_table): Update declarations.
10991 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10992 parameters. Change all callers.
10993 (Sized_symbol::override): Likewise.
10994 (Symbol_table::override): Likewise.
10995 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10996 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10997 is_ordinary, and orig_st_shndx parameters. Change all callers.
10998 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10999 to be in an ordinary section.
11000 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11001 object and is_ordinary parameters. Change all callers.
11002 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11003 Change all callers. Don't add undefined or non-ordinary symbols
11004 to reloc_map_.
11005 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11006 Change all callers.
11007 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11008 declarations.
11009 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11010 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11011 (Sized_relobj::relocate_sections): Likewise.
11012 * target-reloc.h (scan_relocs): Adjust section symbol index.
11013 (scan_relocatable_relocs): Likewise.
11014 * i386.cc (Scan::local): Check for ordinary symbols.
11015 * sparc.cc (Scan::local): Likewise.
11016 * x86_64.cc (Scan::local): Likewise.
11017 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11018 to symbol_section_and_value.
11019 * testsuite/many_sections_test.cc: New file.
11020 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11021 (check_PROGRAMS): Add many_sections_test.
11022 (many_sections_test_SOURCES): Define.
11023 (many_sections_test_DEPENDENCIES): Define.
11024 (many_sections_test_LDFLAGS): Define.
11025 (BUILT_SOURCES): Add many_sections_define.h.
11026 (many_sections_define.h): New target.
11027 (BUILT_SOURCES): Add many_sections_check.h.
11028 (many_sections_check.h): New target.
11029 (check_PROGRAMS): Add many_sections_r_test.
11030 (many_sections_r_test_SOURCES): Define.
11031 (many_sections_r_test_DEPENDENCIES): Define.
11032 (many_sections_r_test_LDFLAGS): Define.
11033 (many_sections_r_test_LDADD): Define.
11034 (many_sections_r_test.o): New target.
11035 * testsuite/Makefile.in: Rebuild.
11036
c5818ff1
CC
110372008-04-17 Cary Coutant <ccoutant@google.com>
11038
11039 * errors.cc (Errors::info): New function.
11040 (gold_info): New function.
11041 * errors.h (Errors::info): New function.
11042 * gold.h (gold_info): New function.
11043 * object.cc (Input_objects::add_object): Print trace output.
11044 * options.cc (options::parse_set): New function.
11045 (General_options::parse_wrap): Deleted.
11046 (General_options::General_options): Deleted initializer.
11047 * options.h (options::String_set): New typedef.
11048 (options::parse_set): New function.
11049 (DEFINE_set): New macro.
11050 (General_options::wrap): Changed to use DEFINE_set. Changed
11051 callers of any_wrap_symbols and is_wrap_symbol.
11052 (General_options::trace, General_options::trace_symbol):
11053 New options.
11054 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11055 (General_options::wrap_symbols_): Deleted.
11056 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11057
b5be4a7c
DM
110582008-04-17 David S. Miller <davem@davemloft.net>
11059
11060 * options.cc (General_options::parse_V): New function.
11061 * options.h: Add entries for -V and -Qy.
11062
155a0dd7
ILT
110632008-04-17 Ian Lance Taylor <iant@google.com>
11064
11065 * common.cc (Symbol_table::allocate_commons): Remove options
11066 parameter. Change caller.
11067 (Symbol_table::do_allocate_commons): Remove options parameter.
11068 Change caller. Just call do_allocate_commons_list twice.
11069 (Symbol_table::do_allocate_commons_list): New function, broken out
11070 of do_allocate_commons.
11071 * common.h (class Allocate_commons_task): Remove options_ field.
11072 Update constructor.
11073 * symtab.cc (Symbol_table::Symbol_table): Initialize
11074 tls_commons_.
11075 (Symbol_table::add_from_object): Put TLS common symbols on
11076 tls_commons_ list.
11077 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11078 which are IN_OUTPUT_DATA.
11079 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11080 allocate_commons and do_allocate_commons declarations. Declare
11081 do_allocate_commons_list.
11082 * gold.cc (queue_middle_tasks): Update creation of
11083 Allocate_commons_task to not pass options.
11084 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11085 (TLS_TEST_C_FLAGS): New variable.
11086 (tls_test_c_pic.o): New target.
11087 (tls_test_shared.so): Link in tls_test_c_pic.o.
11088 (tls_test_c_pic_ie.o): New target.
11089 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11090 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11091 (tls_test_c.o): New target.
11092 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11093 (tls_pic_test_LDADD): Likewise.
11094 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11095 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11096 (tls_test_c_gnu2.o): New target.
11097 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11098 tls_test_c_gnu2.o.
11099 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11100 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11101 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11102 * testsuite/tls_test.cc: Include "config.h".
11103 (t_last): Call t11_last.
11104 * testsuite/tls_test.h (t11, t11_last): Declare.
11105 * testsuite/tls_test_c.c: New file.
11106 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11107 * configure.ac: Check for OpenMP support.
11108 * configure, config.in, Makefile.in: Rebuild.
11109 * testsuite/Makefile.in: Rebuild.
11110
edfbb029
CC
111112008-04-16 Cary Coutant <ccoutant@google.com>
11112
11113 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11114 (Target_i386::tls_base_symbol_defined_): New field.
11115 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11116 (Target_i386::Scan::global): Likewise.
11117 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11118 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11119 (Target_x86_64::tls_base_symbol_defined_): New field.
11120 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11121 (Target_x86_64::Scan::global): Likewise.
11122
f3c69fca
CC
111232008-04-16 Cary Coutant <ccoutant@google.com>
11124
11125 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11126 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11127 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11128 building shared libraries.
11129 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11130 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11131 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11132 * testsuite/Makefile.in: Rebuild.
11133 * testsuite/weak_undef.h: New file.
11134 * testsuite/weak_undef_file1.cc: Add extra test cases.
11135 * testsuite/weak_undef_file2.cc: Likewise.
11136 * testsuite/weak_undef_test.cc: Likewise.
11137
7c414435
DM
111382008-04-16 David S. Miller <davem@davemloft.net>
11139
32b769e1
DM
11140 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11141 Add issued_non_pic_error_ field. Declare check_non_pic.
11142 (Target_sparc::Scan::check_non_pic): New function.
11143 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11144 (Target_sparc::Scan::global): Likewise.
11145
11936fb1
DM
11146 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11147 * configure: Rebuild.
11148
7c414435
DM
11149 * options.h (DEFINE_enable): New macro.
11150 (new_dtags): New enable option.
11151 (initfirst, interpose, loadfltr, nodefaultlib,
11152 nodelete, nodlopen, nodump): New -z options.
11153 * layout.cc (Layout:finish_dynamic_section): If new
11154 dtags enabled, emit DT_RUNPATH. Also, emit a
11155 DT_FLAGS_1 containing any specified -z flags.
11156
85c7bf8b
ILT
111572008-04-16 Ian Lance Taylor <iant@google.com>
11158
12c0daef
ILT
11159 * copy-relocs.cc: New file.
11160 * copy-relocs.h: New file.
11161 * reloc.cc: Remove Copy_relocs code.
11162 * reloc.h: Likewise.
11163 * reloc-types.h (struct Reloc_types) [both versions]: Add
11164 get_reloc_addend_noerror.
11165 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11166 variants of add_global which take an addend which must be zero.
11167 * i386.cc: Include "copy-relocs.h".
11168 (class Target_i386): Change type of copy_relocs_ to variable,
11169 update initializer.
11170 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11171 Change all callers.
11172 (Target_i386::do_finalize_sections): Change handling of
11173 copy_relocs_.
11174 * sparc.cc: Include "copy-relocs.h".
11175 (class Target_sparc): Change type of copy_relocs_ to variable,
11176 update initializer.
11177 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11178 Change all callers.
11179 (Target_sparc::do_finalize_sections): Change handling of
11180 copy_relocs_.
11181 * x86_64.cc: Include "copy-relocs.h".
11182 (class Target_x86_64): Change type of copy_relocs_ to variable,
11183 update initializer.
11184 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11185 class. Change all callers.
11186 (Target_x86_64::do_finalize_sections): Change handling of
11187 copy_relocs_.
11188 * Makefile.am (CCFILES): Add copy-relocs.cc.
11189 (HFILES): Add copy-relocs.h.
11190
4f4995b6
ILT
11191 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11192
85c7bf8b
ILT
11193 * testsuite/script_test_4.sh: Permit leading zeroes.
11194
4f2a9edd
ILT
111952008-04-15 Ian Lance Taylor <iant@google.com>
11196
e6188289
ILT
11197 * script-sections.cc (Script_sections::create_segments): Use
11198 header_size_adjustment even when there is enough room for the
11199 headers.
11200 * testsuite/script_test_4.sh: New file.
11201 * testsuite/script_test_4.t: New file.
11202 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11203 (check_DATA): Add script_test_4.stdout.
11204 (MOSTLYCLEANFILES): Likewise.
11205 (script_test_4): New target.
11206 (script_test_4.stdout): New target.
11207 * testsuite/Makefile.in: Rebuild.
11208
4f2a9edd
ILT
11209 * sparc.cc: Add definitions for Output_data_plt_sparc class
11210 constants.
11211
f5314dd5
DM
112122008-04-14 David S. Miller <davem@davemloft.net>
11213
11214 * sparc.cc: New file.
11215 * Makefile.am (TARGETSOURCES): Add sparc.cc
11216 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11217 * configure.tgt: Document targ_extra_size and
11218 targ_extra_big_endian. Add entries for sparc-* and
11219 sparc64-*.
11220 * configure.ac: Handle targ_extra_size and
11221 targ_extra_big_endian.
11222 * Makefile.in: Rebuild.
11223 * configure: Likewise.
11224 * po/POTFILES.in: Likewise.
11225 * po/gold.pot: Likewise.
11226
154e0e9a
ILT
112272008-04-14 Ian Lance Taylor <iant@google.com>
11228
11229 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11230 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11231 in the name/type/flags to section mapping. Don't call
11232 allocate_output_section.
11233 (Layout::choose_output_section): Change parameter from adjust_name
11234 to is_input_section. Don't permit input sections after sections
11235 are attached to segments. Don't call allocate_output_section.
11236 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11237 not write_enable_output_section.
11238 (Layout::make_output_section): Don't push to
11239 unattached_section_list_ nor call attach_to_segment. Call
11240 attach_section_to_segment if sections are attached.
11241 (Layout::attach_sections_to_segments): New function.
11242 (Layout::attach_section_to_segment): New function.
11243 (Layout::attach_allocated_section_to_segment): Rename from
11244 attach_to_segment. Remove flags parameter.
11245 (Layout::allocate_output_section): Remove function.
11246 (Layout::write_enable_output_section): Remove function.
11247 * layout.h (class Layout): Update for above changes. Add new
11248 field sections_are_attached_.
11249 * output.h (Output_section::update_flags_for_input_section): New
11250 function.
11251 * output.cc (Output_section::add_input_section): Call
11252 update_flags_for_input_section.
11253 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11254
009a67a2
CC
112552008-04-11 Cary Coutant <ccoutant@google.com>
11256
11257 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11258 thought unnecessary.
11259 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11260
759b1a24
ILT
112612008-04-11 Ian Lance Taylor <iant@google.com>
11262
11263 * output.h (class Output_section_data): Remove inline definition
11264 of set_addralign.
11265 * output.cc (Output_section_data::set_addralign): New function.
11266
c2b45e22
CC
112672008-04-11 Cary Coutant <ccoutant@google.com>
11268
11269 Add support for TLS descriptors for i386 and x86_64.
11270 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11271 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11272 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11273 GOT_TYPE_TLS_DESC.
11274 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11275 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11276 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11277 relocations.
11278 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11279 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11280 Fix problem with initial-exec relocations.
11281 (Target_i386::Relocate::relocate_tls): Likewise.
11282 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11283 relaxation.
11284 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11285 support for section-plus-offset dynamic table entries.
11286 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11287 (Output_data_dynamic::Dynamic_entry): Add support for
11288 section-plus-offset dynamic table entries.
11289 (Output_data_dynamic::Classification): Likewise.
11290 (Output_data_dynamic::classification_): Renamed offset_.
11291 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11292 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11293 (Target_x86_64::make_plt_section): New function.
11294 (Target_x86_64::reserve_tlsdesc_entries): New function.
11295 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11296 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11297 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11298 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11299 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11300 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11301 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11302 add extra PLT entry for TLS descriptors.
11303 (Output_data_plt_x86_64::got_): New field.
11304 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11305 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11306 fields.
11307 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11308 descriptors.
11309 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11310 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11311 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11312 R_386_TLS_DESC_CALL relocations.
11313 (Target_x86_64::Scan::global): Likewise.
11314 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11315 for TLS descriptors.
11316 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11317 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11318 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11319 GD-to-IE relaxation.
11320 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11321 and TLS_DESCRIPTORS.
11322 * Makefile.in: Rebuild.
11323 * configure: Rebuild.
11324 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11325 (tls_test_shared2.so): New target.
11326 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11327 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11328 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11329 (tls_shared_gd_to_ie_test_LDADD): New variable.
11330 (tls_shared_gnu2_gd_to_ie_test): New target.
11331 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11332 New targets.
11333 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11334 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11335 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11336 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11337 (tls_shared_gnu2_test): New target.
11338 (tls_test_gnu2_shared.so): New target.
11339 (tls_shared_gnu2_test_SOURCES): New variable.
11340 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11341 (tls_shared_gnu2_test_LDFLAGS): New variable.
11342 (tls_shared_gnu2_test_LDADD): New variable.
11343 * testsuite/Makefile.in: Rebuild.
11344 * testsuite/Makefile.
11345
83bfb6b7
ILT
113462008-04-11 Ian Lance Taylor <iant@google.com>
11347
11348 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11349 justsyms.t.
11350 * testsuite/Makefile.in: Rebuild.
11351
11352 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11353 long.
11354 * testsuite/script_test_2.cc (main): Adjust test.
11355
706e1f5e
ILT
113562008-04-11 David S. Miller <davem@davemloft.net>
11357 Ian Lance Taylor <iant@google.com>
11358
11359 * options.h (General_options): Add entries for '-Y' and
11360 '-relax'.
11361 * options.cc (General_options:finalize): If -Y was used, add those
11362 entries to the library path instead of the default "/lib" and
11363 "/usr/lib".
11364
7c98e6bb
DM
113652008-04-11 David S. Miller <davem@davemloft.net>
11366
11367 * testsuite/justsyms.t: Start at 0x100.
11368 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
11369 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11370 long.
11371 * testsuite/script_test_2.cc: Adjust string and section length
11372 checks.
7c98e6bb 11373
99a37bfd
ILT
113742008-04-09 Ian Lance Taylor <iant@google.com>
11375
2cefc357
ILT
11376 PR gold/5996
11377 * script-sections.cc (Sections_element::allocate_to_segment): Add
11378 orphan parameter.
11379 (Output_section_definition::allocate_to_segment): Likewise.
11380 (Orphan_output_section::allocate_to_segment): Likewise.
11381 (Script_sections::attach_sections_using_phdrs_clause): Don't
11382 propagate non-PT_LOAD segments to orphan sections.
11383 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11384 readelf rather than objdump.
11385 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11386 .interp section and PT_INTERP segment are the same size.
11387 * testsuite/Makefile.in: Rebuild.
11388
99a37bfd
ILT
11389 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11390 aliases for symbols defined in the same object.
11391 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11392 (weak_alias_test_SOURCES): New variable.
11393 (weak_alias_test_DEPENDENCIES): New variable.
11394 (weak_alias_test_LDFLAGS): New variable.
11395 (weak_alias_test_LDADD): New variable.
11396 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11397 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11398 (weak_alias_test_3.o): New target.
11399 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11400 * testsuite/weak_alias_test_main.cc: New file.
11401 * testsuite/weak_alias_test_1.cc: New file.
11402 * testsuite/weak_alias_test_2.cc: New file.
11403 * testsuite/weak_alias_test_3.cc: New file.
11404
780e49c5
ILT
114052008-04-08 Ian Lance Taylor <iant@google.com>
11406
cdb0b8f5
ILT
11407 * options.h (class General_options): Add --noinhibit-exec option.
11408 * main.cc (main): Check --noinhibit-exec.
11409
0864d551
ILT
11410 * options.h (class General_options): Define --wrap as a special
11411 option. Add wrap_symbols_ field.
11412 (General_options::any_wrap_symbols): New function.
11413 (General_options::is_wrap_symbol): New function.
11414 * options.cc (General_options::parse_wrap): New function.
11415 (General_options::General_options): Initialize wrap_symbols_.
11416 * symtab.cc (Symbol_table::wrap_symbol): New function.
11417 (Symbol_table::add_from_object): Handle --wrap.
11418 * symtab.h (class Symbol_table): Declare wrap_symbol.
11419 * target.h (Target::wrap_char): New function.
11420 (Target::Target_info): Add wrap_char field.
11421 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11422 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11423 * testsuite/testfile.cc (Target_test::test_target_info):
11424 Likewise.
11425
789aa6de
ILT
11426 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11427 there is one.
11428
2c38906f
ILT
11429 * layout.h (class Layout): Add added_eh_frame_data_ field.
11430 * layout.cc (Layout::Layout): Initialize new field.
11431 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11432 output section until we find a section we merged successfully.
11433 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11434 that the size be non-zero.
11435
780e49c5
ILT
11436 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11437 qualifier.
11438
7fcd0256
ILT
114392008-04-08 Craig Silverstein <csilvers@google.com>
11440
11441 * configure.ac: Export new conditional variable HAVE_ZLIB.
11442 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11443 on HAVE_ZLIB.
11444 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11445 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11446
6835af53
ILT
114472008-04-07 Ian Lance Taylor <iant@google.com>
11448
e24f324c
ILT
11449 * version.cc (version_string): Set to "1.5".
11450
a036edd8
ILT
11451 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11452 Add issued_non_pic_error_ field. Declare check_non_pic.
11453 (Target_x86_64::Scan::check_non_pic): New function.
11454 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11455 (Target_x86_64::Scan::global): Likewise.
11456
624f8810
ILT
11457 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11458 addend parameter. Change caller. Handle merge sections.
11459 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11460 Address to Addend. Don't add in the result of
11461 local_section_offset, pass down the addend and use the returned
11462 value.
11463 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11464 Update declarations of local_section_offset and symbol_value.
11465 * testsuite/two_file_test_1.cc (t18): New function.
11466 * testsuite/two_file_test_2.cc (f18): New function.
11467 * testsuite/two_file_test_main.cc (main): Call t18.
11468 * testsuite/two_file_test.h (t18, f18): Declare.
11469
6835af53
ILT
11470 * configure.ac: Don't test for objdump, c++filt, or readelf.
11471 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11472 conditionals.
11473 (TEST_READELF): New variable.
11474 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11475 (check_PROGRAMS): Add two_file_strip_test.
11476 (two_file_strip_test): New target.
11477 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11478 (two_file_same_shared_strip_test_SOURCES): New variable.
11479 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11480 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11481 (two_file_same_shared_strip_test_LDADD): New variable.
11482 (two_file_shared_strip.so): New target.
11483 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11484 (ver_test_5.syms, ver_test_7.syms): Likewise.
11485 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11486 (strip_test_3.stdout): Use TEST_OBJDUMP.
11487 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11488
86925eef
CC
114892008-04-04 Cary Coutant <ccoutant@google.com>
11490
11491 * symtab.h (Symbol::is_weak_undefined): New function.
11492 (Symbol::is_strong_undefined): New function.
11493 (Symbol::is_absolute): New function.
11494 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11495 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11496 absolute symbols.
11497 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11498 (weak_undef_test): New target.
11499 * testsuite/Makefile.in: Rebuild.
11500 * testsuite/weak_undef_file1.cc: New file.
11501 * testsuite/weak_undef_file2.cc: New file.
11502 * testsuite/weak_undef_test.cc: New file.
11503
126f3ece
ILT
115042008-04-03 Craig Silverstein <csilvers@google.com>
11505
11506 * compressed_output.h (class Output_compressed_section): Use
11507 unsigned buffer.
11508 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11509 add zlib header.
11510 (zlib_compressed_suffix): Removed.
11511 (Output_compressed_section::set_final_data_size): Use unsigned
11512 buffers.
11513 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11514 Fix linker invocation.
11515 (flagstest_o_specialfile_and_compress_debug_sections):
11516 Likewise.
11517 * testsuite/Makefile.in: Regenerated.
11518
deae2a14
DM
115192008-04-02 David S. Miller <davem@davemloft.net>
11520
11521 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11522 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11523
70752818
ILT
115242008-04-02 Craig Silverstein <csilvers@google.com>
11525
11526 * TODO: New file.
11527
39d0cb0e
ILT
115282008-04-02 Ian Lance Taylor <iant@google.com>
11529
11530 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11531 parameters. Update for new key type to views_. Change all
11532 callers.
11533 (File_read::read): Adjust for byteshift in returned view.
11534 (File_read::add_view): New function, broken out of
11535 find_and_make_view.
11536 (File_read::make_view): New function, broken out of
11537 find_and_make_view.
11538 (File_read::find_or_make_view): Add offset and aligned
11539 parameters. Rewrite accordingly. Change all callers.
11540 (File_read::get_view): Add offset and aligned parameters. Adjust
11541 for byteshift in return value.
11542 (File_read::get_lasting_view): Likewise.
11543 * fileread.h (class File_read): Update declarations.
11544 (class File_read::View): Add byteshift_ field. Add byteshift to
11545 constructor. Add byteshift method.
11546 * archive.h (Archive::clear_uncached_views): New function.
11547 (Archive::get_view): Add aligned parameter. Change all callers.
11548 * object.h (Object::get_view): Add aligned parameter. Change all
11549 callers.
11550 (Object::get_lasting_view): Likewise.
11551
11552 * fileread.cc (File_read::release): Don't call clear_views if
11553 there are multiple objects.
11554 * fileread.h (File_read::clear_uncached_views): New function.
11555 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11556 on the archive.
11557
a1207466
CC
115582008-03-31 Cary Coutant <ccoutant@google.com>
11559
11560 Add thin archive support.
11561 * archive.cc (Archive::armagt): New const.
11562 (Archive::setup): Remove task parameter and calls to unlock.
11563 (Archive::unlock_nested_archives): New function.
11564 (Archive::read_header): Add nested_off parameter. Change
11565 all callers.
11566 (Archive::interpret_header): Likewise.
11567 (Archive::include_all_members): Change to handle thin
11568 archives.
11569 (Archive::include_member): Likewise.
11570 * archive.h (Archive::Archive): Add new parameters and
11571 initializers.
11572 (Archive::armagt): New const.
11573 (Archive::setup): Remove task parameter.
11574 (Archive::unlock_nested_archives): New function.
11575 (Archive::read_header): Add nested_off parameter.
11576 (Archive::interpret_header): Likewise.
11577 (Archive::Nested_archive_table): New typedef.
11578 (Archive::is_thin_archive_): New field.
11579 (Archive::nested_archives_): New field.
11580 (Archive::options_): New field.
11581 (Archive::dirpath_): New field.
11582 (Archive::task_): New field.
11583 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11584 for thin archives. Pass additional parameters to
11585 Archive::Archive. Unlock the archive file after calling
11586 Archive::setup.
cd536b21 11587
479f6503
ILT
115882008-03-29 Ian Lance Taylor <iant@google.com>
11589
686c8caf
ILT
11590 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11591 version symbol to be local.
11592 * testsuite/ver_test_4.sh: New file.
11593 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11594 (check_DATA): Add ver_test_4.syms.
11595 (ver_test_4.syms): New target.
11596 * testsuite/Makefile.in: Rebuild.
11597
ab794b6b
ILT
11598 * output.cc
11599 (Output_section::Input_section_sort_entry::has_priority): New
11600 function.
11601 (Output_section::Input_section_sort_entry::match_file_name): New
11602 function.
11603 (Output_section::Input_section_sort_entry::match_section_name):
11604 Remove.
11605 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11606 Remove.
11607 (Output_section::Input_section_sort_entry::match_section_file):
11608 Remove.
11609 (Output_section::Input_section_sort_compare::operator()): Rewrite
11610 using new Input_section_sort_entry functions. Sort crtbegin and
11611 crtend first. Sort sections with no priority before sections with
11612 a priority.
11613 * testsuite/initpri1.c (d3): Check j != 4.
11614 (cd5): New constructor/destructor function.
11615 (main): Check j != 2.
11616
479f6503
ILT
11617 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11618 new symbol when resolving, don't call set_is_default.
11619 * testsuite/ver_test_7.cc: New file.
11620 * testsuite/ver_test_7.sh: New file.
11621 * testsuite/Makefile.am (ver_test_7.so): New target.
11622 (ver_test_7.o): New target.
11623 (check_SCRIPTS): Add ver_test_7.sh.
11624 (check_DATA): Add ver_test_7.syms.
11625 (ver_test_7.syms): New target.
11626
2fd32231
ILT
116272008-03-28 Ian Lance Taylor <iant@google.com>
11628
11629 * layout.cc (Layout::layout): If we see an input section with a
11630 name that needs sorting, set the must_sort flag for the output
11631 section.
11632 (Layout::make_output_section): If the name of the output section
11633 indicates that it might require sorting, set the may_sort flag.
11634 * output.h (Output_section::may_sort_attached_input_sections): New
11635 function.
11636 (Output_section::set_may_sort_attached_input_sections): New
11637 function.
11638 (Output_section::must_sort_attached_input_sections): New
11639 function.
11640 (Output_section::set_must_sort_attached_input_sections): New
11641 function.
11642 (class Output_section): Declare Input_section_sort_entry. Define
11643 Input_section_sort_compare. Declare
11644 sort_attached_input_sections. Add new fields:
11645 may_sort_attached_input_sections_,
11646 must_sort_attached_input_sections_,
11647 attached_input_sections_are_sorted_.
11648 * output.cc (Output_section::Output_section): Initialize new
11649 fields.
11650 (Output_section::add_input_section): Add an entry to
11651 input_sections_ if may_sort or must_sort are true.
11652 (Output_section::set_final_data_size): Call
11653 sort_attached_input_sections if necessary.
11654 (Output_section::Input_section_sort_entry): Define new class.
11655 (Output_section::Input_section_sort_compare::operator()): New
11656 function.
11657 (Output_section::sort_attached_input_sections): New function.
11658 * configure.ac: Check whether the compiler supports constructor
11659 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11660 * testsuite/initpri1.c: New file.
11661 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11662 CONSTRUCTOR_PRIORITY.
11663 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11664 (initpri1_LDFLAGS): New variable.
11665 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11666
18e6b24e
ILT
116672008-03-27 Ian Lance Taylor <iant@google.com>
11668
49bdd526
ILT
11669 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11670 * testsuite/common_test_1.c: New file.
11671 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11672 (common_test_1_SOURCES): New variable.
11673 (common_test_1_DEPENDENCIES): New variable.
11674 (common_test_1_LDFLAGS): New variable.
11675
18e6b24e
ILT
11676 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11677 and commons_ correctly when NAME/VERSION does not override
11678 NAME/NULL.
11679 * testsuite/ver_test_6.c: New file.
11680 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11681 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11682 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11683
04bf7072
ILT
116842008-03-26 Ian Lance Taylor <iant@google.com>
11685
5871526f
ILT
11686 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11687 of an undefined symbol from a version script.
11688 * testsuite/Makefile.am (ver_test_5.so): New target.
11689 (ver_test_5.o): New target.
11690 (check_SCRIPTS): Add ver_test_5.sh.
11691 (check_DATA): Add ver_test_5.syms.
11692 (ver_test_5.syms): New target.
11693 * testsuite/ver_test_5.cc: New file.
11694 * testsuite/ver_test_5.script: New file.
11695 * testsuite/ver_test_5.sh: New file.
11696 * Makefile.in, testsuite/Makefile.in: Rebuild.
11697
04bf7072
ILT
11698 PR gold/5986
11699 Fix problems building gold with gcc 4.3.0.
11700 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11701 (gold_error_at_location, gold_warning_at_location): Use it.
11702 * configure.ac: Check whether we can compile and use a template
11703 function with a printf attribute.
11704 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11705 when jumping over bytes.
11706 * object.cc: Instantiate Object::read_section_data.
11707 * debug.h: Include <cstring>
11708 * dwarf_reader.cc: Include <algorithm>
11709 * main.cc: Include <cstring>.
11710 * options.cc: Include <cstring>.
11711 * output.cc: Include <cstring>.
11712 * script.cc: Include <cstring>.
11713 * script.h: Include <string>.
11714 * symtab.cc: Include <cstring> and <algorithm>.
11715 * target-select.cc: Include <cstring>.
11716 * version.cc: Include <string>.
11717 * testsuite/testmain.cc: Include <cstdlib>.
11718 * configure, config.in: Rebuild.
11719
874c5b28
ILT
117202008-03-25 Ian Lance Taylor <iant@google.com>
11721
819d6c3a
ILT
11722 * options.cc: Include "../bfd/bfdver.h".
11723 (options::help): Print bug reporting address.
11724
f4b2c6f5
ILT
11725 * version.cc (print_version): Adjust output for current value of
11726 BFD_VERSION_STRING.
11727
11728 * NEWS: New file.
11729
e96caa79
ILT
11730 * options.cc (options::help): Print list of supported targets.
11731 * target-select.h: Include <vector>.
11732 (class Target_selector): Make machine_, size_, and is_big_endian_
11733 fields const. Add bfd_name_ and instantiated_target_ fields.
11734 (Target_selector::Target_selector): Add bfd_name parameter.
11735 (Target_selector::recognize): Make non-virtual, call
11736 do_recognize.
11737 (Target_selector::recognize_by_name): Make non-virtual, call
11738 do_recognize_by_name.
11739 (Target_selector::supported_names): New function.
11740 (Target_selector::bfd_name): New function.
11741 (Target_selector::do_instantiate_target): New pure virtual
11742 function.
11743 (Target_selector::do_recognize): New virtual function.
11744 (Target_selector::do_recognize_by_name): New virtual function.
11745 (Target_selector::instantiate_target): New private function.
11746 (supported_target_names): Declare.
11747 * target-select.cc (Target_selector::Target_selector): Update for
11748 new parameter and fields.
11749 (select_target_by_name): Check that the name matches before
11750 calling recognize_by_name.
11751 (supported_target_names): New function.
11752 * i386.cc (class Target_selector_i386): Update Target_selector
11753 constructor call. Remove recognize and recognize_by_name. Add
11754 do_instantiate_target.
11755 * x86_64.cc (class Target_selector_x86_64): Likewise.
11756 * testsuite/testfile.cc (class Target_selector_test): Update for
11757 changes to Target_selector.
11758
874c5b28
ILT
11759 * README: Rewrite, with some notes on unsupported features.
11760
0a65a3a7
CC
117612008-03-24 Cary Coutant <ccoutant@google.com>
11762
11763 * i386.cc (Target_i386::Got_type): New enum declaration.
11764 (Target_i386::Scan::local): Updated callers of Output_data_got
11765 member functions.
11766 (Target_i386::Scan::global): Likewise.
11767 (Target_i386::Relocate::relocate): Likewise.
11768 (Target_i386::Relocate::relocate_tls): Likewise.
11769 * object.h (Got_offset_list): New class.
11770 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11771 (Sized_relobj::local_got_offset): Likewise.
11772 (Sized_relobj::set_local_got_offset): Likewise.
11773 (Sized_relobj::local_has_tls_got_offset): Removed.
11774 (Sized_relobj::local_tls_got_offset): Removed.
11775 (Sized_relobj::set_local_tls_got_offset): Removed.
11776 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11777 * output.cc (Output_data_got::add_global): Added got_type parameter.
11778 (Output_data_got::add_global_with_rel): Likewise.
11779 (Output_data_got::add_global_with_rela): Likewise.
11780 (Output_data_got::add_global_pair_with_rel): New function.
11781 (Output_data_got::add_global_pair_with_rela): New function.
11782 (Output_data_got::add_local): Added got_type parameter.
11783 (Output_data_got::add_local_with_rel): Likewise.
11784 (Output_data_got::add_local_with_rela): Likewise.
11785 (Output_data_got::add_local_pair_with_rel): New function.
11786 (Output_data_got::add_local_pair_with_rela): New function.
11787 (Output_data_got::add_global_tls): Removed.
11788 (Output_data_got::add_global_tls_with_rel): Removed.
11789 (Output_data_got::add_global_tls_with_rela): Removed.
11790 (Output_data_got::add_local_tls): Removed.
11791 (Output_data_got::add_local_tls_with_rel): Removed.
11792 (Output_data_got::add_local_tls_with_rela): Removed.
11793 * output.h (Output_data_got::add_global): Added got_type parameter.
11794 (Output_data_got::add_global_with_rel): Likewise.
11795 (Output_data_got::add_global_with_rela): Likewise.
11796 (Output_data_got::add_global_pair_with_rel): New function.
11797 (Output_data_got::add_global_pair_with_rela): New function.
11798 (Output_data_got::add_local): Added got_type parameter.
11799 (Output_data_got::add_local_with_rel): Likewise.
11800 (Output_data_got::add_local_with_rela): Likewise.
11801 (Output_data_got::add_local_pair_with_rel): New function.
11802 (Output_data_got::add_local_pair_with_rela): New function.
11803 (Output_data_got::add_global_tls): Removed.
11804 (Output_data_got::add_global_tls_with_rel): Removed.
11805 (Output_data_got::add_global_tls_with_rela): Removed.
11806 (Output_data_got::add_local_tls): Removed.
11807 (Output_data_got::add_local_tls_with_rel): Removed.
11808 (Output_data_got::add_local_tls_with_rela): Removed.
11809 * resolve.cc (Symbol::override_base_with_special): Removed
11810 reference to has_got_offset_ field.
11811 * symtab.cc (Symbol::init_fields): Replaced initialization
11812 of got_offset_ with got_offsets_. Removed initialization
11813 of has_got_offset_
53fcba31 11814 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
11815 (Symbol::got_offset): Likewise.
11816 (Symbol::set_got_offset): Likewise.
11817 (Symbol::has_tls_got_offset): Removed.
11818 (Symbol::tls_got_offset): Removed.
11819 (Symbol::set_tls_got_offset): Removed.
11820 (Symbol::got_offset_): Removed.
11821 (Symbol::tls_mod_got_offset_): Removed.
11822 (Symbol::tls_pair_got_offset_): Removed.
11823 (Symbol::got_offsets_): New field.
11824 (Symbol::has_got_offset): Removed.
11825 (Symbol::has_tls_mod_got_offset): Removed.
11826 (Symbol::has_tls_pair_got_offset): Removed.
11827 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11828 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11829 member functions.
11830 (Target_x86_64::Scan::global): Likewise.
11831 (Target_x86_64::Relocate::relocate): Likewise.
11832 (Target_x86_64::Relocate::relocate_tls): Likewise.
11833
bd52eafb
BE
118342008-03-25 Ben Elliston <bje@au.ibm.com>
11835
11836 * yyscript.y: Fix spelling error in comment.
11837
8b105e34
ILT
118382008-03-24 Ian Lance Taylor <iant@google.com>
11839
8ed814a9
ILT
11840 * options.h (class General_options): Define build_id option.
11841 * layout.h (class Layout): Declare write_build_id, create_note,
11842 create_build_id. Add build_id_note_ member.
11843 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11844 "libiberty.h", "md5.h", "sha1.h".
11845 (Layout::Layout): Initialize eh_frame_data_,
11846 eh_frame_hdr_section_, and build_id_note_.
11847 (Layout::finalize): Call create_build_id.
11848 (Layout::create_note): New function, broken out of
11849 Layout::create_gold_note.
11850 (Layout::create_gold_note): Call create_note.
11851 (Layout::create_build_id): New function.
11852 (Layout::write_build_id): New function.
11853 (Close_task_runner::run): Call write_build_id.
11854
8b105e34
ILT
11855 * x86_64.cc: Correct license to GPLv3.
11856
086a1841
ILT
118572008-03-23 Ian Lance Taylor <iant@google.com>
11858
11859 * options.cc: Include "demangle.h".
11860 (parse_optional_string): New function.
11861 (parse_long_option): Handle takes_optional_argument.
11862 (parse_short_option): Update dash_z initializer. Handle
11863 takes_optional_argument.
11864 (General_options::General_options): Initialize do_demangle_.
11865 (General_options::finalize): Set do_demangle_. Handle demangling
11866 style.
11867 * options.h (parse_optional_string): Declare.
11868 (struct One_option): Add optional_arg field. Update constructor.
11869 Update call constructor calls. Add takes_optional_argument
11870 function.
11871 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11872 (DEFINE_optional_string): Define.
11873 (General_options::demangle): Change from DEFINE_bool to
11874 DEFINE_optional_string.
11875 (General_options::no_demangle): New function.
11876 (General_options::do_demangle): New function.
11877 (General_options::set_do_demangle): New function.
11878 (General_options::execstack_status_): Move definition to end of
11879 class definition.
11880 (General_options::static_): Likewise.
11881 (General_options::do_demangle_): New field.
11882 * object.cc (big_endian>::get_symbol_location_info): Call
11883 Options::do_demangle, not Options::demangle.
11884 * symtab.cc (demangle): Likewise.
11885
cbb93e63
ILT
118862008-03-22 Ian Lance Taylor <iant@google.com>
11887
11888 * gold.h: Include <cstddef> and <sys/types.h>
11889 * options.h: Include <cstring>.
11890
ec531623
ILT
118912008-03-21 Ian Lance Taylor <iant@google.com>
11892
11893 * Added source code to GNU binutils.