Remove redundant include of "output.h".
[binutils-gdb.git] / gold / ChangeLog
1 2015-02-16 Cary Coutant <ccoutant@google.com>
2
3 PR gold/17971
4 * incremental.cc: Remove redundant include of "output.h".
5
6 2015-02-12 Jing Yu <jingyu@google.com>
7
8 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
9 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
10 New relocation.
11 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
12 TLSLE_MOVW_* relocations.
13 (Target_aarch64::Scan::global): Likewise.
14 (Target_aarch64::Relocate::relocate): Likewise.
15 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
16 for new TLSLE_MOVW_* relocations.
17
18 2015-02-11 Will Newton <will.newton@linaro.org>
19
20 PR gold/13321
21 * arm.cc (Target_arm::make_plt_section): Create an ARM
22 state mapping symbol at the start of the PLT.
23
24 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
25
26 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
27 Replace two_file_shared_2.so with two_file_shared_1.so.
28 * testsuite/Makefile.in: Regenerated.
29
30 2015-02-09 Alan Modra <amodra@gmail.com>
31
32 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
33 plugin_test_thin.a and defsym_test.
34 * testsuite/Makefile.in: Regenerate.
35
36 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
37
38 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
39 body.
40
41 2015-02-04 Peter Collingbourne <pcc@google.com>
42
43 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
44 forwarding symbols when computing symbol resolution info for plugins.
45 * plugin.h (Plugin_manager::symtab): New method.
46 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
47
48 2015-02-03 Cary Coutant <ccoutant@google.com>
49 Peter Collingbourne <pcc@google.com>
50
51 PR gold/15660
52 * archive.cc (Thin_archive_object_unlocker): New class.
53 (Archive::include_member): Unlock external members of thin archives.
54 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
55 (plugin_test_2): Likewise.
56 (plugin_test_3): Likewise.
57 (plugin_test_4): Likewise.
58 (plugin_test_5): Likewise.
59 (plugin_test_6): Likewise.
60 (plugin_test_7): Likewise.
61 (plugin_test_8): Likewise.
62 (plugin_test_9): Likewise.
63 (plugin_test_10): Likewise.
64 (plugin_test_11): New test case.
65 * testsuite/Makefile.in: Regenerate.
66 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
67 file to decide whether to claim file.
68 (all_symbols_read_hook): Likewise.
69 * testsuite/plugin_test_1.sh: Adjust expected output.
70 * testsuite/plugin_test_2.sh: Likewise.
71 * testsuite/plugin_test_3.sh: Likewise.
72 * testsuite/plugin_test_6.sh: Likewise.
73 * testsuite/plugin_test_tls.sh: Likewise.
74 * testsuite/plugin_test_11.sh: New testcase.
75
76 2015-02-03 Cary Coutant <ccoutant@google.com>
77
78 * descriptors.cc (Descriptors::open): Set artificially-low limit for
79 file descriptors when debugging enabled. Add debug output.
80 (Descriptors::release): Add debug output.
81 (Descriptors::close_some_descriptor): Likewise.
82 (Descriptors::close_all): Likewise.
83 * fileread.cc (File_read::lock): Likewise.
84 (File_read::unlock): Likewise.
85
86 2015-02-02 Cary Coutant <ccoutant@google.com>
87
88 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
89 executable output file.
90
91 2015-01-22 Han Shen <shenhan@google.com>
92
93 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
94 (Target_arm::do_plt_address_for_global): New method.
95 (Target_arm::do_plt_address_for_local): New method.
96 (Target_arm::rel_irelative_section): New method.
97 (Target_arm::make_data_plt): Add more parameters for plt ctor.
98 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
99 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
100 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
101 (Target_arm::Scan::check_non_pic): Add ifunc support.
102 (Target_arm::Scan::local): Add ifunc support.
103 (Target_arm::Scan::global): Add ifunc support.
104 (Target_arm::make_plt_section): New method.
105 (Target_arm::make_plt_entry): Change to call to make_plt_section.
106 (Target_arm::make_local_ifunc_plt_entry): New method.
107 (Target_arm::got_irelative_): New member.
108 (Target_arm::rel_irelative_): New member.
109 (Target_arm::got_section): Add creation for got_irelative_.
110 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
111 (Target_arm::Relocate::relocate): Properly set local ifunc address.
112 (Target_arm::do_dynsym_value): Properly set global ifunc address.
113 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
114 (Output_data_plt_arm::IRelative_data): New type.
115 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
116 (Output_data_plt_arm::add_entry): Add more parameters.
117 (Output_data_plt_arm::add_relocation): New method.
118 (Output_data_plt_arm::add_local_ifunc_entry): New method.
119 (Output_data_plt_arm::rel_irelative): New method.
120 (Output_data_plt_arm::entry_count): Modified.
121 (Output_data_plt_arm::address_for_global): New method.
122 (Output_data_plt_arm::address_for_local): New method.
123 gold/
124 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
125 (Output_data_plt_arm::insert_irelative_data): New method.
126 (Output_data_plt_arm::irelative_rel_): New member.
127 (Output_data_plt_arm::got_): New member.
128 (Output_data_plt_arm::got_irelative_): New member.
129 (Output_data_plt_arm::irelative_count_): New member.
130 (Output_data_plt_arm::IRelative_data_vec): New typedef.
131 (Output_data_plt_arm::irelative_data_vec_): New member.
132 (Output_data_plt_arm::do_write): Write out irelative entries.
133 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
134 more parameters to ctor.
135 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
136 more parameters to ctor.
137 * output.h (Output_data_reloc::add_local_relative): New method.
138 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
139
140 2015-01-29 Alan Modra <amodra@gmail.com>
141
142 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
143 and GOT_TLSGD to LE optimization.
144
145 2015-01-28 Cary Coutant <ccoutant@google.com>
146
147 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
148 for undef TLS symbols.
149 (Target_x86_64::Relocate::relocate_tls): Likewise.
150 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
151
152 2015-01-25 Cary Coutant <ccoutant@google.com>
153
154 * output.cc (Output_segment::set_section_addresses): Fix calculation
155 of size of relro segment.
156
157 2015-01-22 Alan Modra <amodra@gmail.com>
158
159 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
160 condition for need of ifunc plt entry.
161 (Target_powerpc::Scan::global <got relocs>): Likewise.
162
163 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
164
165 * mips.cc (reloc_high): Add r_sym.
166 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
167 reloc_high constructor.
168 (Mips_relocate_functions::relgot16_local): Likewise.
169 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
170 r_type to decide whether LO16 matches HI16.
171 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
172 rello16 and relgot16_local.
173
174 2015-01-09 Cary Coutant <ccoutant@google.com>
175
176 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
177 unless alignment is larger than page size.
178
179 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
180 Cary Coutant <ccoutant@google.com>
181
182 PR gold/17729
183 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
184 (DEFAULT_TARGET_X32): Set for x32.
185 * x86_64.cc (cmp_insn_32): New.
186 (lea_r10_insn_32): Likewise.
187 (lea_r11_insn_32): Likewise.
188 (cmp_insn_64): Likewise.
189 (lea_r10_insn_64): Likewise.
190 (lea_r11_insn_64): Likewise.
191 (Target_x86_64<size>::do_calls_non_split): Handle x32.
192 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
193 (check_DATA): Add split_x32 files.
194 (split_x32_[1234n].o): New targets.
195 (split_x32_[124]): New targets.
196 (split_x32_[1234r].stdout): New targets.
197 * testsuite/split_x32.sh: New file.
198 * testsuite/split_x32_1.s: Likewise.
199 * testsuite/split_x32_2.s: Likewise.
200 * testsuite/split_x32_3.s: Likewise.
201 * testsuite/split_x32_4.s: Likewise.
202 * testsuite/split_x32_n.s: Likewise.
203 * configure: Regenerated.
204 * testsuite/Makefile.in: Likewise.
205
206 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
207
208 PR gold/17809
209 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
210 x32.
211
212 2015-01-02 Alan Modra <amodra@gmail.com>
213
214 * version.cc (print_version): Just print current year.
215 * dwp.cc (print_version): Likewise.
216
217 2015-01-01 Alan Modra <amodra@gmail.com>
218
219 Update year range in copyright notice of all files.
220
221 2014-12-25 Alan Modra <amodra@gmail.com>
222
223 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
224 new enums.
225 (Target_arm::merge_object_attributes, ): Likewise.
226
227 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
228
229 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
230 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
231 AEABI_VFP_args_vfp to check that.
232 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
233 value and replace hardcoded values by enum values.
234
235 2014-12-22 Cary Coutant <ccoutant@google.com>
236
237 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
238
239 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
240
241 PR gold/14608
242 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
243 to "return i * i * 3;".
244
245 2014-12-16 Cary Coutant <ccoutant@google.com>
246
247 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
248 (Mapfile::print_output_data): Use current_data_size() to avoid
249 assert for sections requiring postprocessing; if address is not valid,
250 print 0.
251 (Mapfile::print_output_section): Use current_data_size(); print note
252 that addresses and sizes are before compression.
253
254 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
255
256 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
257 Cast current_group_size to unsigned long when reporting error.
258
259 2014-12-10 Jing Yu <jingyu@google.com>
260
261 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
262 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
263 Update error message.
264 (Target_aarch64::do_relax): Use absolute value of option
265 stub_group_size. Replace local variable with class member
266 stub_group_size_.
267
268 2014-12-04 Alan Modra <amodra@gmail.com>
269
270 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
271 addend of PLTREL24 reloc when not generating a plt stub. Make
272 max_branch_offset an "Address".
273 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
274 (Target_powerpc::Relocate::relocate): Likewise.
275
276 2014-12-04 Alan Modra <amodra@gmail.com>
277
278 PR 17670
279 * symtab.cc (Symbol::set_undefined): Remove assertion.
280 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
281 on symbols defined in discarded sections, instead return false.
282 Rearrange params, update all callers.
283 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
284 branches to syms in discarded sections.
285 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
286 undefined and flag as discarded.
287 (Target_powerpc::Relocate::relocate): Localize variable.
288
289 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
290
291 PR gold/17675
292 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
293 * testsuite/Makefile.in: Regenerated.
294
295 2014-12-03 Alan Modra <amodra@gmail.com>
296
297 PR 17566
298 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
299 when adding dynamic relocations against section symbols.
300
301 2014-12-01 Dimitry Ivanov <dimitry@google.com>
302
303 * layout.cc (Layout::finish_dynamic_section): When '-z global'
304 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
305 * options.h (General_options): New -z option (global).
306
307 2014-12-01 Cary Coutant <ccoutant@google.com>
308
309 PR gold/17578
310 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
311 is given.
312 (Layout::create_executable_stack_info): Warn when -z noexecstack is
313 given but some inputs require executable stack.
314
315 2014-11-26 Cary Coutant <ccoutant@google.com>
316
317 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
318 .debug_str_offsets; strip .debug_gnu_pubnames and
319 .debug_gnu_pubtypes.
320 (lines_only_debug_sections): Strip all four new sections.
321
322 2014-11-26 Jing Yu <jingyu@google.com>
323
324 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
325 register to be x0 when to relax TLSDESC_LD64_LO12.
326
327 2014-11-26 Alan Modra <amodra@gmail.com>
328
329 * powerpc.cc (struct Stub_table_owner): New.
330 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
331 unsigned int vector. Update all references.
332 (powerpc_relobj::set_stub_table): Take an unsigned int param
333 rather than a Stub_table. Update callers.
334 (Powerpc_relobj::clear_stub_table): New function.
335 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
336 stub_group_size_ vars.
337 (Target_powerpc::new_stub_table): Delete.
338 (max_branch_delta): New function, extracted from..
339 (Target_powerpc::Relocate::relocate): ..here..
340 (Target_powerpc::Branch_info::make_stub): ..and here. Return
341 status on whether stub created successfully.
342 (Stub_control::Stub_control): Add "no_size_errors" param. Move
343 default sizing to..
344 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
345 reduce on relax failure.
346 (Target_powerpc::group_sections): Add "no_size_errors" param.
347 Use stub_group_size_. Set up group info in a temp vector,
348 before building Stub_table vector. Account for input sections
349 possibly already converted to relaxed sections.
350 (Stub_table::init): Delete. Merge into..
351 (Stub_table::Stub_table): ..here.
352 (Stub_table::can_reach_stub): New function.
353 (Stub_table::add_plt_call_entry): Add "from" parameter and
354 return true iff stub could be reached.
355 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
356 param too.
357 (Stub_table::clear_stubs): Add "all" param.
358
359 2014-11-26 Alan Modra <amodra@gmail.com>
360
361 * powerpc.cc (Stub_control::set_output_and_owner): New function.
362 (Target_powerpc::group_sections): Use it.
363
364 2014-11-25 Cary Coutant <ccoutant@google.com>
365
366 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
367 (Binary_to_elf::write_symbol): Add st_size parameter.
368 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
369
370 2014-11-25 Cary Coutant <ccoutant@google.com>
371
372 PR gold/17639
373 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
374 (Sized_relobj_file::do_layout): Handle deferred sections properly
375 during GC pass 1. Don't add reloc sections to deferred list twice.
376 * object.h (Sized_relobj_file::is_deferred_layout): New function.
377 (Sized_relobj_file::is_deferred_layout_): New data member.
378
379 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
380
381 PR gold/17619
382 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
383 Check PC-relative offset overflow in PLT entry.
384
385 2014-11-21 Alan Modra <amodra@gmail.com>
386
387 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
388 for undefined weaks.
389
390 2014-11-20 Alan Modra <amodra@gmail.com>
391
392 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
393 from --stub-group-size parameter divided by 1024.
394 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
395 template parameter. Update all uses.
396 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
397 has_stub_value. Set for long branches. Don't report overflow for
398 branch to undefined weak symbols. Print info message on
399 overflowing branch to stub.
400
401 2014-11-20 Alan Modra <amodra@gmail.com>
402
403 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
404
405 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
406
407 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
408 entry for R_X86_64_GOTPLT64.
409 (Target_x86_64<size>::Relocate::relocate): Update comments for
410 R_X86_64_GOTPLT64.
411
412 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
413
414 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
415 * plugin.h: add lock definition
416
417 2014-10-29 Han Shen <shenhan@google.com>
418 Jing Yu <jingyu@google.com>
419
420 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
421 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
422 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
423 Symbol::TLS_REF.
424 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
425 method.
426 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
427 (Target_aarch64::tls_ld_to_le): New method.
428 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
429 for 64bit targets.
430 (Output_data_plt_aarch64::irelative_rel_): New data member.
431 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
432 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
433 (Output_data_plt_aarch64::add_relocation): New method.
434 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
435 offset. Add got_irelative size to got size.
436 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
437 type string with the new typename.
438 (AArch64_relocate_functions::update_adr): Replace parameter x with
439 immed.
440 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
441 (AArch64_relocate_functions::reloc_common): New method.
442 (AArch64_relocate_funcsions::rela_general): Extract common part out
443 into reloc_common method.
444 (AArch64_relocate_functions::rela_general): Likewise.
445 (AArch64_relocate_functions::pcrela_general): Likewise.
446 (AArch64_relocate_functions::adr): New method.
447 (AArch64_relocate_functions::adrp): Calculate immed before calling
448 update_adr.
449 (AArch64_relocate_functions::adrp): Likewise.
450 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
451 comparing x to 0. Calculate immed from ~x when x < 0.
452 (Target_aarch64::optimize_tls_reloc): Add new cases for
453 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
454 TLSLD_MOVW_DTPREL_G0_NC.
455 (Target_aarch64::possible_function_pointer_reloc): Implement this
456 method.
457 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
458 comment.
459 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
460 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
461 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
462 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
463 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
464 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
465 (Target_aarch64::make_plt_entry): Call add_entry with two more
466 parameters.
467 (Target_aarch64::make_local_ifunc_plt_entry): New method.
468 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
469 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
470 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
471 (Target_aarch64::Relocate::relocate_tls): Add cases for
472 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
473 TLSLD_MOVW_DTPREL_G0_NC.
474 * testsuite/icf_safe_so_test.cc: Correct test comment.
475 * testsuite/icf_safe_test.sh: Add AArch64 arch.
476
477 2014-10-22 Alan Modra <amodra@gmail.com>
478
479 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
480 thread_starter.
481
482 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
483
484 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
485
486 2014-10-17 Cary Coutant <ccoutant@google.com>
487
488 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
489 Add "typename" keyword.
490
491 2014-10-15 Han Shen <shenhan@google.com>
492 Jing Yu <jingyu@google.com>
493
494 Patch for gold aarch64 backend to support relaxation.
495 * aarch64-reloc.def: Change format.
496 * aarch64.cc (class Reloc_stub): New class.
497 (class Stub_table): New class.
498 (class AArch64_relobj): New class.
499 (class AArch64_input_section): New class.
500 (class AArch64_output_section): New class.
501 (Target_aarch64::new_stub_table): New method.
502 (Target_aarch64::new_aarch64_input_section): New method.
503 (Target_aarch64::find_aarch64_input_section): New method.
504 (Target_aarch64::scan_section_for_stubs): New method.
505 (Target_aarch64::scan_reloc_section_for_stubs): New method.
506 (Target_aarch64::relocate_stub): New method.
507 (Target_aarch64::current_target): New method.
508 (Target_aarch64::do_make_elf_object): New method.
509 (Target_aarch64::do_may_relax): New method.
510 (Target_aarch64::do_relax): New method.
511 (Target_aarch64::group_sections): New method.
512 (Target_aarch64::scan_reloc_for_stub): New method.
513 (Target_aarch64::do_make_output_section): New method.
514 (Target_aarch64::stub_tables_): New data member.
515 (Target_aarch64::aarch64_input_section_map_): New data member.
516 (AArch64_relocate_functions::maybe_apply_stub): New method.
517
518 2014-09-30 Cary Coutant <ccoutant@google.com>
519
520 PR gold/17432
521 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
522
523 2014-09-30 Kito Cheng <kito@0xlab.org>
524
525 PR gold/13597
526 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
527 hash table before sysv-style hash table.
528
529 2014-09-29 Sriraman Tallam <tmsriram@google.com>
530
531 * options.h (--pic-executable): Add negative to alias to -no-pie.
532
533 2014-09-26 Cary Coutant <ccoutant@google.com>
534
535 PR gold/16773
536 * object.cc (Sized_relobj_file): Compute value of section symbols
537 for TLS sections the same as TLS symbols.
538
539 2014-09-25 Cary Coutant <ccoutant@google.com>
540
541 PR gold/17432
542 * resolve.cc (Symbol_table::resolve): Override common placeholder
543 symbols, but adjust sizes.
544 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
545 symbols to common lists.
546
547 2014-09-24 Alan Modra <amodra@gmail.com>
548
549 * po/POTFILES.in: Regenerate.
550
551 2014-09-23 Taiju Tsuiki <tzik@google.com>
552 Cary Coutant <ccoutant@google.com>
553
554 PR gold/14860
555 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
556 on input_sections_blocker.
557 * layout.cc (Write_sections_task::locks): Unblock
558 input_sections_blocker_.
559 * layout.h (Write_sections_task::Write_sections_task): Add
560 input_sections_blocker.
561 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
562 to DEPENDENCIES.
563 * testsuite/Makefile.in: Regenerate.
564
565 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
566
567 * testsuite/Makefile.am (plugin_test_10): New test.
568 * testsuite/Makefile.in: Regenerate
569 * testsuite/plugin_common_test_2.c (c1): Align to 8.
570 * testsuite/plugin_test_10.sh: New file.
571
572 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
573
574 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
575 * resolve.cc (Symbol_table::resolve): Don't override common symbols
576 during the replacement phase.
577
578 2014-09-17 Han Shen <shenhan@google.com>
579 Jing Yu <jingyu@google.com>
580
581 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
582 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
583 * aarch64.cc (Target_aarch64): Add data members
584 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
585 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
586 constructor.
587 (Target_aarch64::do_reloc_symbol_index): New method.
588 (Target_aarch64::do_reloc_addend): New method.
589 (Target_aarch64::add_tlsdesc_info): New method.
590 (Target_aarch64::do_dynsym_value): New method.
591 (Target_aarch64::do_make_data_plt): Add new parameters: got,
592 got_irelative. Pass them to Output_data_plt_aarch64_standard.
593 (Target_aarch64::make_data_plt): Add new parameters: got,
594 got_irelative. Pass them to do_make_data_plt.
595 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
596 (Target_aarch64::Relocate:tls_gd_to_le): New method.
597 (Target_aarch64::Relocate:tls_ie_to_le): New method.
598 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
599 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
600 (Target_aarch64::got_tlsdesc_section): New method.
601 (Target_aarch64::make_local_ifunc_plt_entry): New method.
602 (Target_aarch64::define_tls_base_symbol): New method.
603 (Target_aarch64::reserve_tlsdesc_entries): New method.
604 (Target_aarch64::got_mod_index_entry): New method.
605 (Target_aarch64::rela_tlsdesc_section): New method.
606 (Target_aarch64::rela_irelative_section): New method.
607 (Target_aarch64::Tlsdesc_info): New struct.
608 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
609 relocations and tlsdesc relocations.
610 (Target_aarch64::optimize_tls_reloc): Implement method.
611 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
612 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
613 in constructor.
614 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
615 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
616 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
617 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
618 (Output_data_plt_aarch64::rela_tlsdesc): New method.
619 (Output_data_plt_aarch64::rela_irelative): New method.
620 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
621 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
622 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
623 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
624 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
625 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
626 (Output_data_plt_aarch64_standard): New member variables:
627 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
628 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
629 New parameter: got, got_irelative.
630 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
631 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
632 (Output_data_plt_aarch64::do_write): Replace got_address with
633 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
634 (AArch64_relocate_functions::update_movnz): New method.
635 (AArch64_relocate_functions): Correct format.
636 (AArch64_relocate_functions::movnz): New method.
637 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
638 before the switch. Add new cases to switch.
639 Check ie_to_le relaxation on tlsie relocations. Add code handling
640 tlsgd tlsdesc cases.
641 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
642 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
643 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
644 Call reloc_name_in_error_message to print unsupported reloc.
645 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
646 make_data_plt.
647 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
648 relocs. Fill in some more dynamic tags.
649 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
650 Skip call tls_get_addr when tlsgd is relaxed.
651 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
652 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
653 tlsdesc->ie relaxation.
654
655 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
656
657 * mips.cc (Target_mips_nacl): New class.
658 (Target_selector_mips_nacl): New class.
659 (target_selector_mips32): Rename from target_selector_mips32be and use
660 Target_selector_mips_nacl instead of Target_selector_mips.
661 (target_selector_mips32el): Rename from target_selector_mips32 and use
662 Target_selector_mips_nacl instead of Target_selector_mips.
663 (target_selector_mips64): Rename from target_selector_mips64be and use
664 Target_selector_mips_nacl instead of Target_selector_mips.
665 (target_selector_mips64el): Rename from target_selector_mips64 and use
666 Target_selector_mips_nacl instead of Target_selector_mips.
667 (Target_mips::mips_info): Add const attribute.
668
669 2014-09-02 Cary Coutant <ccoutant@google.com>
670
671 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
672 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
673 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
674 (Sized_incr_dynobj::do_section_name): Likewise.
675 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
676 (Sized_incr_dynobj::do_section_name): Likewise.
677 * object.h (Object::section_name): Likewise.
678 (Object::do_section_name): Likewise.
679 (Sized_relobj_file::do_section_name): Likewise.
680 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
681 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
682
683 2014-09-02 Cary Coutant <ccoutant@google.com>
684
685 PR gold/17005
686 * ehframe.cc (Fde::write): Add output_offset parameter.
687 (Cie::write): Likewise.
688 (Eh_frame::set_final_data_size): Account for offset within output
689 section.
690 (Eh_frame::do_sized_write): Likewise.
691 * ehframe.h (Fde::write): Add output_offset parameter.
692 (Cie::write): Likewise.
693 * output.cc (Output_section::Input_section_sort_entry): Remove
694 section_has_name_; add output_section_name parameter. Use
695 output section name for non-input sections.
696 (Output_section::Input_section_sort_entry::section_has_name): Remove.
697 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
698 (Output_section::Input_section_sort_compare): Remove logic for
699 sections without names.
700 (Output_section::Input_section_sort_init_fini_compare): Likewise.
701 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
702 Likewise.
703 (Output_section::Input_section_sort_section_name_compare): Likewise.
704
705 2014-08-29 Han Shen <shenhan@google.com>
706 Jing Yu <jingyu@google.com>
707
708 * aarch64-reloc-property.cc
709 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
710 reference reloc property in the table.
711 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
712 3 other entries.
713 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
714 2 new overloaded methods.
715 (Output_data_got_aarch64::do_write): Add code to write out
716 static relocs.
717 (class Output_data_got_aarch64::Static_reloc): New class to wrap
718 static relocs.
719 (Output_data_got_aarch64::static_relocs): New vector to
720 hold static relocs.
721 (Target_aarch64::TCB_SIZE): New const static memeber.
722 (Target_aarch64::tcb_size): New method.
723 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
724 (Target_aarch64::Relocate::relocate_tls): New method.
725 (Target_aarch64::Scan::local): Add code handling new reloc types.
726 (Target_aarch64::Scan::global): Add code handling new reloc types.
727
728 2014-08-13 Sriraman Tallam <tmsriram@google.com>
729
730 * options.h (-no-pie): Add option.
731
732 2014-08-08 Jing Yu <jingyu@google.com>
733 Han Shen <shenhan@google.com>
734
735 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
736 (DEFFILES): add aarch64-reloc.def.
737 (TARGETSOURCES): Add aarch64-reloc-property.cc.
738 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
739 * Makefile.in: Regenerate.
740 * aarch64-reloc-property.cc: New file.
741 * aarch64-reloc-property.h: New file.
742 * aarch64-reloc.def: New file.
743 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
744 with tab to make the format consistent.
745 (Output_data_got_aarch64::symbol_table_): New method.
746 (Target_aarch64::do_plt_address_for_global): New method.
747 (Target_aarch64::do_plt_address_for_local): New method.
748 (Target_aarch64::do_select_as_default_target): New method.
749 (Target_aarch64::do_make_data_plt): New method.
750 (Target_aarch64::make_data_plt): New method.
751 (Output_data_plt_aarch64::has_irelative_section): New method.
752 (Output_data_plt_aarch64::address_for_global): New method.
753 (Output_data_plt_aarch64::address_for_local): New method.
754 (Output_data_plt_aarch64::irelative_rel_): New parameter.
755 (Output_data_plt_aarch64::add_entry): Implement contents.
756 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
757 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
758 the got_pov entry to plt0.
759 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
760 Implement contents.
761 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
762 (AArch64_howto): New struct.
763 (aarch64_howto[]): New static const array.
764 (AArch64_relocate_functions): New class.
765 (Target_aarch64::Scan::get_reference_flags): Remove method.
766 (Target_aarch64::Scan::local): Implement to support a few relocations.
767 (Target_aarch64::Scan::global): Implement to support a few relocations.
768 (Target_aarch64::make_plt_section): Implement contents.
769 (Target_aarch64::make_plt_entry): Implement contents.
770 (Target_aarch64::do_finalize_sections): Implement contents.
771 (Target_aarch64::Relocate::relocate): Implement a few relocations.
772 (Target_aarch64::relocate_section): Implement contents.
773
774 2014-08-06 Alan Modra <amodra@gmail.com>
775
776 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
777
778 2014-08-06 Alan Modra <amodra@gmail.com>
779
780 PR 13227
781 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
782
783 2014-07-21 Sriraman Tallam <tmsriram@google.com>
784
785 * object.cc (Relobj::is_section_name_included): Add
786 ".rodata.nptl_version" to not garbage collect this section.
787
788 2014-07-08 Cary Coutant <ccoutant@google.com>
789
790 * expression.cc (struct Expression::Expression_eval_info): Add
791 new fields type_pointer, vis_pointer, and nonvis_pointer.
792 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
793 nonvis_pointer parameters. Adjust all calls.
794 (Symbol_expression::value): Update type, visibility, and nonvis bits
795 in caller.
796 * script.cc (Symbol_assignment::sized_finalize): Update type,
797 visibility, and remaining st_other bits for new symbol.
798 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
799 vis_pointer, and nonvis_pointer parameters.
800 * symtab.h (Symbol::set_type): New method.
801
802 * testsuite/Makefile.am (defsym_test): New test.
803 * testsuite/Makefile.in: Regenerate.
804 * testsuite/defsym_test.c: New file.
805 * testsuite/defsym_test.sh: New file.
806
807 2014-07-08 Cary Coutant <ccoutant@google.com>
808
809 PR gold/15639
810 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
811 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
812 (Sized_dynobj::base_read_symbols): ...new method.
813 * object.h (Sized_relobj_file::base_read_symbols): New method.
814 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
815 (Sized_relobj_file::base_read_symbols): ...new method.
816 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
817 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
818 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
819
820 2014-07-04 Alan Modra <amodra@gmail.com>
821
822 * po/POTFILES.in: Regenerate.
823
824 2014-07-02 Jing Yu <jingyu@google.com>
825
826 * aarch64.cc: New file
827 * Makefile.am (TARGETSOURCES): Add aarch64.cc
828 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
829 * Makefile.in: Regenerate.
830 * configure.tgt: Add entries for aarch64*.
831 * configure.ac: Likewise.
832 * configure: Likewise.
833
834 2014-06-27 Alan Modra <amodra@gmail.com>
835
836 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
837
838 2014-06-24 Cary Coutant <ccoutant@google.com>
839
840 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
841 sections.
842 (Dwo_file::sized_read_unit_index): Likewise.
843
844 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
845
846 * mips.cc: New file.
847 * Makefile.am (TARGETSOURCES): Add mips.cc
848 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
849 * configure.tgt: Add entries for mips*.
850 * configure.ac: Likewise.
851 * Makefile.in: Regenerate.
852 * configure: Likewise.
853
854 2014-06-09 Cary Coutant <ccoutant@google.com>
855
856 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
857 unit_length is within section bounds.
858
859 2014-06-09 Cary Coutant <ccoutant@google.com>
860
861 PR gold/16980
862 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
863 map.
864
865 2014-06-07 Alan Modra <amodra@gmail.com>
866
867 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
868
869 2014-06-06 Cary Coutant <ccoutant@google.com>
870
871 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
872 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
873 (Dwarf_pubnames_table::read_header): Likewise.
874 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
875 .debug_gnu_pubtypes.
876
877 2014-06-05 Joel Brobecker <brobecker@adacore.com>
878
879 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
880 * Makefile.in, configure: Regenerate.
881
882 2014-06-03 Alan Modra <amodra@gmail.com>
883
884 * powerpc.cc (addis_12_2): Define.
885 (Stub_table::do_write): Support fusion on ELFv2 stubs.
886
887 2014-06-03 Alan Modra <amodra@gmail.com>
888
889 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
890 st_other output.
891
892 2014-06-02 Alan Modra <amodra@gmail.com>
893
894 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
895 Only ignore relocs on ELFv1.
896 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
897
898 2014-05-30 Cary Coutant <ccoutant@google.com>
899
900 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
901 * testsuite/Makefile.in: Regenerate.
902 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
903
904 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
905
906 PR gold/16945
907 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
908 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
909
910 2014-05-15 Alan Modra <amodra@gmail.com>
911
912 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
913 Compare FDE contents with DW_CFA_nop rather than 0.
914
915 2014-05-13 Sriraman Tallam <tmsriram@google.com>
916
917 * symtab.h (may_need_copy_reloc): Remove check for position independent
918 code.
919 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
920 position independence before pc absolute may_need_copy_reloc call.
921 Add check for executable output befor pc relative may_need_copy_reloc
922 call.
923 * i386.cc: Ditto.
924 * arm.cc: Ditto.
925 * sparc.cc: Ditto.
926 * tilegx.cc: Ditto.
927 * powerpc.cc: Add check for no position independence before
928 may_need_copy_reloc calls.
929 * testsuite/pie_copyrelocs_test.cc: New file.
930 * testsuite/pie_copyrelocs_shared_test.cc: New file.
931 * Makefile.am (pie_copyrelocs_test): New test.
932 * Makefile.in: Regenerate.
933
934 2014-05-08 Martin Liška <mliska@suse.cz>
935
936 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
937
938 2014-05-06 Cary Coutant <ccoutant@google.com>
939
940 PR gold/16900
941 * i386.cc (Output_data_got_plt_i386): New class.
942 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
943 parameter. Change all callers.
944 (Output_data_plt_i386::layout_): Remove.
945 (Output_data_plt_i386::got_plt_): Change type.
946 (Target_i386::got_plt_): Change type. Change all references.
947 (Target_i386::got_section): Create instance of new class.
948 (Output_data_got_plt_i386::do_write): New function.
949 * x86_64.cc (Output_data_got_plt_x86_64): New class.
950 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
951 parameter. Change all callers.
952 (Output_data_plt_x86_64::layout_): Remove.
953 (Output_data_plt_x86_64::got_plt_): Change type.
954 (Target_x86_64::got_plt_): Change type. Change all references.
955 (Target_x86_64::got_section): Create instance of new class.
956 (Output_data_got_plt_x86_64::do_write): New function.
957 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
958 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
959 class.
960
961 2014-05-05 Cary Coutant <ccoutant@google.com>
962
963 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
964 if we have pubnames/pubtypes.
965
966 2014-05-02 Cary Coutant <ccoutant@google.com>
967
968 * defstd.cc (in_segment): Define __ehdr_start here...
969 * layout.cc (Layout::finalize): ...Instead of here. Set the
970 output segment when known.
971 * resolve.cc (Symbol::override_base_with_special): Remember
972 the original binding.
973 * symtab.cc (Symbol::set_output_segment): New function.
974 (Symbol::set_undefined): New function.
975 * symtab.h (Symbol::is_weak_undefined): Check original undef
976 binding.
977 (Symbol::is_strong_undefined): New function.
978 (Symbol::set_output_segment): New function.
979 (Symbol::set_undefined): New function.
980 * target-reloc.h (is_strong_undefined): Remove.
981 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
982 Check for hidden undefs.
983 (relocate_section): Call Symbol::is_strong_undefined.
984
985 * testsuite/Makefile.am (ehdr_start_test_1)
986 (ehdr_start_test_2, ehdr_start_test_3)
987 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
988 * testsuite/Makefile.in: Regenerate.
989 * testsuite/ehdr_start_def.cc: New source file.
990 * testsuite/ehdr_start_test.cc: New source file.
991 * testsuite/ehdr_start_test.t: New linker script.
992 * testsuite/ehdr_start_test_4.sh: New shell script.
993
994 2014-04-23 Cary Coutant <ccoutant@google.com>
995
996 PR gold/16870
997 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
998
999 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1000
1001 * layout.cc (Layout::include_section): Allow a target to decide
1002 whether to include a section.
1003 * target.h (Target::should_include_section): New function.
1004 (Target::do_should_include_section): New function.
1005
1006 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1007
1008 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1009 inline into ...
1010 (Copy_relocs::emit): ... here.
1011 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1012 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1013 (Copy_reloc_entry::entries_): Change from private to protected.
1014
1015 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1016
1017 * icf.cc (get_section_contents): Replace copies of reloc
1018 vectors with const references.
1019
1020 2014-04-02 Cary Coutant <ccoutant@google.com>
1021
1022 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1023 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1024 * configure: Regenerate.
1025 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1026 -fno-use-linker-plugin.
1027 (LINK1, CXXLINK1): Add it to the link command.
1028 * testsuite/Makefile.in: Regenerate.
1029
1030 2014-03-12 Alan Modra <amodra@gmail.com>
1031
1032 * Makefile.in: Regenerate.
1033
1034 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1035
1036 * symtab.h (Symbol::set_nonvis): New function.
1037
1038 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1039
1040 * symtab.cc (Sized_symbol<32>::init_output_data):
1041 Instantiate the template.
1042 (Sized_symbol<64>::init_output_data): Likewise.
1043
1044 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1045
1046 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1047 adjust dynamic symbol value.
1048 * target.h (Target::adjust_dyn_symbol): New function.
1049 (Target::do_adjust_dyn_symbol): New function.
1050
1051 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1052
1053 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1054 Get the value of DYNAMIC_CUSTOM dynamic entry.
1055 * output.h (Output_data_dynamic::add_custom): New function.
1056 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1057 dynamic entry.
1058 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1059 * target.h (Target::dynamic_tag_custom_value): New function.
1060 (Target::do_dynamic_tag_custom_value): New function.
1061
1062 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1063
1064 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1065 dynsym indexes.
1066 * target.h (Target::has_custom_set_dynsym_indexes): New function.
1067 (Target::do_has_custom_set_dynsym_indexes): New function.
1068 (Target::set_dynsym_indexes): New function.
1069 (Target::do_set_dynsym_indexes): New function.
1070
1071 2014-03-07 Alan Modra <amodra@gmail.com>
1072
1073 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1074 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1075 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1076 (Powerpc_relocate_functions::has_overflow_bitfield,
1077 overflowed): Use the above.
1078 (Target_powerpc::Relocate::relocate): Correct overflow checking
1079 for a number of relocations. Modify overflow test for 16-bit
1080 fields in instructions to signed/unsigned according to whether
1081 the field takes a signed or unsigned value.
1082
1083 2014-03-05 Alan Modra <amodra@gmail.com>
1084
1085 Update copyright years.
1086
1087 2014-03-05 Alan Modra <amodra@gmail.com>
1088
1089 * powerpc.cc (Target_powerpc::Scan::local, global): Support
1090 R_PPC64_ADDR64_LOCAL.
1091 (Target_powerpc::Relocate::relocate): Likewise.
1092
1093 2014-03-03 Alan Modra <amodra@gmail.com>
1094
1095 * dwp.cc (print_version): Update copyright year to current.
1096
1097 2014-02-10 Alan Modra <amodra@gmail.com>
1098
1099 * po/gold.pot: Regenerate.
1100
1101 2014-02-06 Cary Coutant <ccoutant@google.com>
1102
1103 Fix problem where -u is ignored when a weak undef is seen.
1104
1105 * archive.cc (Library_base::should_include_member): Reorder
1106 code to check for -u option if a weak undef has already been seen.
1107 * testsuite/Makefile.am (weak_undef_test_2): New test case.
1108 * testsuite/Makefile.in: Regenerate.
1109 * testsuite/weak_undef_file3.cc: New file.
1110 * testsuite/weak_undef_file4.cc: New file.
1111 * testsuite/weak_undef_test_2.cc: New file.
1112
1113 2014-02-05 Cary Coutant <ccoutant@google.com>
1114
1115 Fix issues with gold undefined symbol diagnostics.
1116
1117 PR binutils/15435
1118 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1119 check to here.
1120 * target-reloc.h (is_strong_undefined): New function.
1121 (relocate_section): Move undef vtable symbol check from here.
1122 Check for is_strong_undefined.
1123
1124 2014-02-05 Cary Coutant <ccoutant@google.com>
1125
1126 Fix problems with the --dynamic-list option.
1127
1128 PR gold/13577
1129 * options.cc (General_options::parse_dynamic_list):
1130 Set have_dynamic_list_.
1131 (General_options::General_options): Initialize have_dynamic_list_.
1132 (General_options::finalize): Turn off -Bsymbolic and
1133 -Bsymbolic-functions if --dynamic-list provided.
1134 * options.h (General_options::have_dynamic_list): New function.
1135 (General_options::have_dynamic_list_): New data member.
1136 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1137 correctly.
1138
1139 PR gold/16530
1140 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1141 in --dynamic-list, mark it.
1142
1143 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1144 (dynamic_list_2): New test case.
1145 * testsuite/Makefile.in: Regenerate.
1146 * testsuite/dynamic_list_2.cc: New file.
1147 * testsuite/dynamic_list_2.t: New file.
1148 * testsuite/dynamic_list_lib1.cc: New file.
1149 * testsuite/dynamic_list_lib2.cc: New file.
1150 * testsuite/gc_dynamic_list_test.c: New file.
1151 * testsuite/gc_dynamic_list_test.sh: New file.
1152 * testsuite/gc_dynamic_list_test.t: New file.
1153
1154 2014-01-28 Cary Coutant <ccoutant@google.com>
1155
1156 Add .gdb_index version 7 support.
1157
1158 * gold/dwarf_reader.cc: include <utility> (for make_pair).
1159 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1160 debug sections.
1161 (Dwarf_ranges_table::read_ranges_table): Likewise.
1162 (Dwarf_pubnames_table::read_section): Check for GNU-style
1163 sections, and for compressed debug sections.
1164 (Dwarf_pubnames_table::read_header): Compute end address of table.
1165 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
1166 for end of list by offset, not by offset == 0.
1167 (Dwarf_info_reader::do_read_string_table): Check for compressed
1168 debug sections.
1169 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1170 Initialize new data members.
1171 (Dwarf_pubnames_table::next_name): return flag_byte.
1172 (Dwarf_pubnames_table::end_of_table_): New data member.
1173 (Dwarf_pubnames_table::is_gnu_style_): New data member.
1174 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1175 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1176 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1177 read skeleton type unit DIEs.
1178 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1179 (Gdb_index::do_write): Write flag_byte.
1180 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1181 (Gdb_index::Cu_vector): Store flags along with cu indexes.
1182 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1183 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1184
1185 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
1186
1187 * version.cc (print_version): Update copyright year to 2014.
1188
1189 2013-12-19 Dimitry Andric <dimitry@andric.com>
1190
1191 * stringpool.cc (Stringpool_template::reserve): Add
1192 HAVE_UNORDERED_MAP case.
1193 * stringpool.cc (Stringpool_template::print_stats): Likewise.
1194
1195 2013-12-18 Cary Coutant <ccoutant@google.com>
1196
1197 * configure.ac: Check for <unordered_set> and <unordered_map>.
1198 * config.in: Regenerate.
1199 * configure: Regenerate.
1200 * system.h: Use <unordered_set> and <unordered_map> if available.
1201
1202 2013-12-10 Roland McGrath <mcgrathr@google.com>
1203
1204 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1205 with $(INSTALL_PROGRAM_ENV).
1206 * Makefile.in: Regenerate.
1207
1208 2013-11-22 Cary Coutant <ccoutant@google.com>
1209
1210 * configure.ac: Add check for which library is needed for
1211 dlopen.
1212 * configure: Regenerate.
1213
1214 2013-11-22 Cary Coutant <ccoutant@google.com>
1215
1216 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1217 assembler.
1218 * testsuite/Makefile.in: Regenerate.
1219
1220 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
1221
1222 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1223 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1224 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1225 (Target_x86_64<size>::Scan::local): Likewise.
1226 (Target_x86_64<size>::Scan::global): Likewise.
1227 (Target_x86_64<size>::Relocate::relocate): Likewise.
1228 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1229 Likewise.
1230 (Target_x86_64<size>::Scan::check_non_pic(): Handle
1231 R_X86_64_PC32_BND.
1232
1233 * testsuite/Makefile.am (check_PROGRAMS): Add
1234 exception_x86_64_bnd_test.
1235 (exception_x86_64_bnd_test_SOURCES): New macro.
1236 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1237 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1238 (exception_x86_64_bnd_test_LDADD): Likewise.
1239 (exception_x86_64_bnd_1.o): New rule.
1240 (exception_x86_64_bnd_2.o): Likewise.
1241 * testsuite/Makefile.in: Regenerated.
1242
1243 2013-11-15 Alan Modra <amodra@gmail.com>
1244
1245 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1246 accessor.
1247 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1248 Only call ppc64_local_entry_offset for 64-bit. Restrict
1249 symval_for_branch lookup to ELFv1.
1250 (Stub_table::add_plt_call_entry): Use unsigned int off.
1251 (Output_data_glink::Address, invalid_address): New.
1252 (Output_data_glink::add_eh_frame): Move out of line. Add
1253 support for ELFv2.
1254 (Output_data_glink::add_global_entry, find_global_entry,
1255 global_entry_address): New functions.
1256 (Output_data_glink::global_entry_stubs_, end_branch_table_,
1257 ge_size): New variables.
1258 (Output_data_glink::set_final_data_size): Add global entry
1259 stub sizing.
1260 (Output_data_glink::do_write): Write global entry stubs.
1261 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1262 parameter. Return true for ELFv2. Adjust callers.
1263 (Target_powerpc::Scan::local, global): Restrict opd lookup to
1264 ELFv1. Similarly for ifunc and dynamic relocation processing
1265 specific to ELFv1. Recognize that symbols are defined on
1266 their plt entries for ELFv2.
1267 (Target_powerpc::symval_for_branch): Assert if called for
1268 ELFv2 or ppc32.
1269 (Target_powerpc::Relocate::relocate): Use global entry plt
1270 stub for symbol value if such exists on ELFv2.
1271 (Target_powerpc::Relocate::relocate): Don't call
1272 symval_for_branch when ELFv2. Do adjust for local entry
1273 offset when ELFv2.
1274 (Target_powerpc::do_dynsym_value): Set symbols to global entry
1275 plt stub for ELFv2.
1276 (Target_powerpc::do_plt_address_for_global): Similarly.
1277
1278 2013-11-14 Cary Coutant <ccoutant@google.com>
1279
1280 Revert patch -- this did not fix the problem, and there is
1281 no race there.
1282
1283 2013-11-14 Cary Coutant <ccoutant@google.com>
1284
1285 PR gold/14860
1286 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1287 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1288 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1289 updating fde_offsets_.
1290 (Eh_frame_hdr::lock_): New data member.
1291
1292 2013-11-14 Cary Coutant <ccoutant@google.com>
1293
1294 * dwp.cc (Dwo_file_entry): New type.
1295 (File_list): Use Dwo_file_entry.
1296 (Dwo_file::verify): New function.
1297 (Dwo_file::verify_dwo_list): New function.
1298 (Dwo_file::sized_verify_dwo_list): New function.
1299 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1300 list.
1301 (Dwp_options): New enum type.
1302 (dwp_options): Add --verify-only.
1303 (usage): Likewise.
1304 (main): Likewise.
1305 * dwp.h (gold_info): Add declaration.
1306
1307 2013-11-14 Cary Coutant <ccoutant@google.com>
1308
1309 PR gold/14860
1310 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1311 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1312 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1313 updating fde_offsets_.
1314 (Eh_frame_hdr::lock_): New data member.
1315
1316 2013-11-06 Cary Coutant <ccoutant@google.com>
1317
1318 PR gold/15758
1319 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1320 before reloc sections.
1321
1322 2013-11-04 Alan Modra <amodra@gmail.com>
1323
1324 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1325 (Symbol::needs_dynamic_reloc): Test new flag.
1326 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1327 (Target_powerpc::Scan::get_reference_flags): Add target param.
1328 Return FUNC_DESC_ABI for 64-bit ELFv1.
1329 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1330 call.
1331 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1332 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1333
1334 2013-10-31 Cary Coutant <ccoutant@google.com>
1335
1336 Restore support for dwp v2 DWARF package file format.
1337
1338 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1339 tu_length parameter. Adjust all callers.
1340 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1341 * dwp.cc: Include dwarf.h.
1342 (Section_bounds): New struct type.
1343 (Unit_set): New struct type.
1344 (Dwo_file::Dwo_file): Initialize new data member.
1345 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1346 Combine and rename to...
1347 (Dwo_file::read_unit_index): ...this.
1348 (Dwo_file::sized_read_compunit_index)
1349 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1350 (Dwo_file::sized_read_unit_index): ...this.
1351 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1352 parameters; add section_id parameter.
1353 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1354 (Dwo_file::add_unit_set): ...this.
1355 (Dwo_file::shndx_map_): Remove.
1356 (Dwo_file::sect_offsets_): New data member.
1357 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1358 (Dwp_output_file::add_section): Rename to...
1359 (Dwp_output_file::add_contribution): ...this.
1360 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1361 (Dwp_output_file::add_tu_set): Likewise.
1362 (Dwp_output_file::Contribution): New type.
1363 (Dwp_output_file::Section::contributions): New data member.
1364 (Dwp_output_file::Cu_or_tu_set): Remove.
1365 (Dwp_output_file::Section::Section): New ctor.
1366 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1367 (Dwp_output_file::Dwp_index::Section_table): New type.
1368 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1369 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1370 parameter.
1371 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1372 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1373 (Dwp_output_file::Dwp_index::section_table): New member function.
1374 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1375 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1376 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1377 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1378 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1379 (Dwp_output_file::Dwp_index::section_table_): New data member.
1380 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1381 (Dwp_output_file::add_output_section): New member function.
1382 (Dwp_output_file::write_new_section): New member function.
1383 (Dwp_output_file::write_contributions): New member function.
1384 (Dwp_output_file::section_id_map_): New data member.
1385 (class Dwo_id_info_reader): Remove.
1386 (class Unit_reader): New class.
1387 (get_dwarf_section_name): New function.
1388 (Dwo_file::read_executable): Adjust initializations of class data.
1389 (Dwo_file::read): Add support for v2 package file format.
1390 (Dwo_file::read_unit_index): Likewise.
1391 (Dwo_file::sized_read_unit_index): Likewise.
1392 (Dwo_file::copy_section): Likewise.
1393 (Dwo_file::add_unit_set): Likewise.
1394 (Dwp_output_file::add_output_section): Likewise.
1395 (Dwp_output_file::add_contribution): Likewise.
1396 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1397 for empty slot.
1398 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1399 file format.
1400 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1401 slot.
1402 (Dwp_output_file::initialize): Remove unused function.
1403 (Dwp_output_file::finalize): Add support for v2 package file format.
1404 (Dwp_output_file::write_index): Likewise.
1405 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1406 function prototype.
1407
1408 2013-10-31 Cary Coutant <ccoutant@google.com>
1409
1410 * configure.ac: Fix check for -fmerge-constants.
1411 * configure.ac: Regenerate.
1412
1413 2013-10-30 Roland McGrath <mcgrathr@google.com>
1414
1415 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1416 Correct 9-byte nop sequence to match what the assembler generates.
1417
1418 2013-10-30 Alan Modra <amodra@gmail.com>
1419
1420 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1421 ppc64_local_entry_offset, ppc64_local_entry_offset,
1422 do_read_symbols): New functions.
1423 (Powerpc_relobj::e_flags_, st_other_): New vars.
1424 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1425 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1426 (Powerpc_relobj::e_flags_): New var.
1427 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1428 and adjust for ELFv2.
1429 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1430 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1431 (Powerpc_dynobj::do_find_special_sections): Likewise.
1432 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1433 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1434 to ELFv2 local entry.
1435 (Target_powerpc::do_relax): No thread safe barriers needed for
1436 ELFv2.
1437 (Output_data_plt_powerpc::initial_plt_entry_size_,
1438 plt_entry_size): Delete. Replace all uses with
1439 first_plt_entry_offset() and plt_entry_size().
1440 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1441 reserved_size parm. Update callers.
1442 (Output_data_plt_powerpc::entry_count): Update.
1443 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1444 and use Target_powerpc::first_plt_entry_offset().
1445 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1446 rename to plt_entry_size.
1447 (Output_data_plt_powerpc::add_ifunc_entry,
1448 add_local_ifunc_entry): Adjust reloc for ELFv2.
1449 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1450 (glink_eh_frame_fde_64v2): New.
1451 (Stub_table::plt_call_size): Support ELFv2 sizing.
1452 (Output_data_glink::add_eh_frame): Use the new FDE.
1453 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1454 (Stub_table::do_write): Write ELFv2 stubs and glink.
1455 (Target_powerpc::Relocate::relocate): Replaces nop after call
1456 with ld 2,24(1) and adjust local offset destination for ELFv2.
1457
1458 2013-10-30 Alan Modra <amodra@gmail.com>
1459
1460 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1461 (Target_powerpc::Scan::global, local): Likewise.
1462 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
1463 on all ppc64 @h and @ha relocs.
1464
1465 2013-10-14 Alan Modra <amodra@gmail.com>
1466
1467 * output.h (Output_data_got::add_constant): Tidy.
1468 (Output_data_got::add_constant_pair): New function.
1469 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1470 methods used so as to first call reserve_ent().
1471
1472 2013-10-11 Roland McGrath <mcgrathr@google.com>
1473
1474 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1475 add_got_entry and add_got_entry_pair.
1476
1477 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1478 (HAVE_PUBNAMES): Likewise.
1479 * configure: Regenerate.
1480
1481 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1482 * testsuite/Makefile.in: Regenerate.
1483
1484 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1485 Remove const from declaration.
1486 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1487 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1488 * output.h (Output_file_header): Remove const from member target_
1489 and corresponding constructor argument.
1490 * output.cc (Output_file_header::Output_file_header): Update prototype.
1491 (Output_file_header::do_sized_write): Use this->target_ in place
1492 of parameters()->target().
1493
1494 * testsuite/undef_symbol.cc (Foo::get_a): New method.
1495
1496 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1497 * configure: Regenerate.
1498 * Makefile.in: Regenerate.
1499 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1500 * testsuite/merge_string_literals_2.c: Likewise.
1501 * testsuite/Makefile.am
1502 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1503 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1504 literal -fmerge-constants.
1505 * testsuite/Makefile.in: Regenerate.
1506
1507 * i386.cc (Target_i386): Remove unused member dynbss_.
1508 * arm.cc (Target_arm): Likewise.
1509 * powerpc.cc (Target_powerpc): Likewise.
1510 * sparc.cc (Target_sparc): Likewise.
1511 * tilegx.cc (Target_tilegx): Likewise.
1512 * x86_64.cc (Target_x86_64): Likewise.
1513 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1514 type_signature_, type_offset_.
1515 * plugin.h (Plugin_hook): Remove unused member layout_.
1516 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1517 mapfile_.
1518 (Read_member): Remove unused members input_objects_, symtab_,
1519 mapfile_, layout_.
1520 (Check_library): Remove unused member symtab_.
1521 * archive.h (Lib_group): Remove unused member lib_.
1522 * archive.cc (Lib_group::Lib_group): Update initializer.
1523 * incremental.h (Incremental_binary): Remove unused member target_.
1524 (Incremental_script_entry): Removed unused member script_.
1525 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1526 * icf.h (Icf): Remove unused member num_tracked_relocs.
1527
1528 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1529 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1530 its only use.
1531 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1532
1533 * archive.h: Use struct rather than class for forward declaration
1534 of Read_symbols_data.
1535
1536 2013-10-07 Cary Coutant <ccoutant@google.com>
1537
1538 PR gold/16010
1539 * testsuite/Makefile.am (icf_test): Fix dependencies.
1540 (icf_safe_test): Likewise.
1541 (icf_safe_so_test): Likewise.
1542 (large_symbol_alignment): Add empty _LDADD rule.
1543 * testsuite/Makefile.in: Regenerate.
1544
1545 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
1546
1547 PR gold/15927
1548 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1549 relocation for R_X86_64_32 on x32.
1550
1551 2013-08-27 Roland McGrath <mcgrathr@google.com>
1552
1553 * output.cc (Output_segment::set_section_addresses): Take new
1554 Target* argument. If target->isolate_execinstr() and the segment
1555 is executable and starts at a target->abi_pagesize() boundary,
1556 pad its end out to a target->abi_pagesize() boundary with code fill.
1557 * output.h (Output_segment::set_section_addresses): Update decl.
1558 * layout.h (Layout::check_output_data_for_reset_values): Take new
1559 argument RELAX_OUTPUTS.
1560 (Layout): New member relax_output_list_.
1561 (Layout::add_relax_output): New method.
1562 * layout.cc (Layout::Layout): Update constructor.
1563 (Layout::reset_relax_output): New method.
1564 (Layout::clean_up_after_relaxation): Call it.
1565 (Layout::prepare_for_relaxation): Update caller.
1566 (Layout::set_segment_offsets): Update callers of set_section_addresses.
1567 Call reset_relax_output before re-processing segments for
1568 isolate_execinstr case.
1569 (Layout::write_data): Handle relax_output_list_.
1570 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1571 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1572
1573 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1574
1575 PR binutils/15834
1576 * object.h: Fix typos.
1577
1578 2013-08-16 Roland McGrath <mcgrathr@google.com>
1579
1580 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1581 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1582
1583 2013-08-07 Cary Coutant <ccoutant@google.com>
1584
1585 Revert support for v2 DWP files:
1586
1587 2013-03-01 Cary Coutant <ccoutant@google.com>
1588
1589 Add dwp support for v2 DWARF package file format.
1590 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1591 tu_length parameter. Adjust all callers.
1592 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1593 * dwp.cc: Include dwarf.h.
1594 (Section_bounds): New struct type.
1595 (Unit_set): New struct type.
1596 (Dwo_file::Dwo_file): Initialize new data member.
1597 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1598 Combine and rename to...
1599 (Dwo_file::read_unit_index): ...this.
1600 (Dwo_file::sized_read_compunit_index)
1601 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1602 (Dwo_file::sized_read_unit_index): ...this.
1603 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1604 parameters; add section_id parameter.
1605 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1606 (Dwo_file::add_unit_set): ...this.
1607 (Dwo_file::shndx_map_): Remove.
1608 (Dwo_file::sect_offsets_): New data member.
1609 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1610 (Dwp_output_file::add_section): Rename to...
1611 (Dwp_output_file::add_contribution): ...this.
1612 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1613 (Dwp_output_file::add_tu_set): Likewise.
1614 (Dwp_output_file::Contribution): New type.
1615 (Dwp_output_file::Section::contributions): New data member.
1616 (Dwp_output_file::Cu_or_tu_set): Remove.
1617 (Dwp_output_file::Section::Section): New ctor.
1618 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1619 (Dwp_output_file::Dwp_index::Section_table): New type.
1620 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1621 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1622 parameter.
1623 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1624 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1625 (Dwp_output_file::Dwp_index::section_table): New member function.
1626 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1627 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1628 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1629 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1630 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1631 (Dwp_output_file::Dwp_index::section_table_): New data member.
1632 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1633 (Dwp_output_file::add_output_section): New member function.
1634 (Dwp_output_file::write_new_section): New member function.
1635 (Dwp_output_file::write_contributions): New member function.
1636 (Dwp_output_file::section_id_map_): New data member.
1637 (class Dwo_id_info_reader): Remove.
1638 (class Unit_reader): New class.
1639 (get_dwarf_section_name): New function.
1640 (Dwo_file::read_executable): Adjust initializations of class data.
1641 (Dwo_file::read): Add support for v2 package file format.
1642 (Dwo_file::read_unit_index): Likewise.
1643 (Dwo_file::sized_read_unit_index): Likewise.
1644 (Dwo_file::copy_section): Likewise.
1645 (Dwo_file::add_unit_set): Likewise.
1646 (Dwp_output_file::add_output_section): Likewise.
1647 (Dwp_output_file::add_contribution): Likewise.
1648 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1649 for empty slot.
1650 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1651 file format.
1652 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1653 slot.
1654 (Dwp_output_file::initialize): Remove unused function.
1655 (Dwp_output_file::finalize): Add support for v2 package file format.
1656 (Dwp_output_file::write_index): Likewise.
1657 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1658 function prototype.
1659
1660 2013-07-31 Cary Coutant <ccoutant@google.com>
1661
1662 * object.cc (Sized_relobj::do_output_section_address): New function.
1663 (Sized_relobj): Instantiate explicitly.
1664 * object.h (Object::output_section_address): New function.
1665 (Object::do_output_section_address): New function.
1666 (Sized_relobj::do_output_section_address): New function.
1667 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1668
1669 2013-07-30 Cary Coutant <ccoutant@google.com>
1670 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1671
1672 * parameters.cc (Parameters::entry): Return target-specific entry
1673 symbol name.
1674 * target.h (Target::entry_symbol_name): New function.
1675 (Target_info::entry_symbol_name): New data member.
1676
1677 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1678 * i386.cc (Target_i386::i386_info): Likewise.
1679 (Target_i386_nacl::i386_nacl_info): Likewise.
1680 * sparc.cc (Target_sparc::sparc_info): Likewise.
1681 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1682 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1683 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1684 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1685
1686 2013-07-22 Sterling Augustine <saugustine@google.com>
1687
1688 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1689 Convert parameter shndx to local variable. Add parameters symtab
1690 and symtab_size. Scan over section names. Find relocation
1691 section corresponding to current section. Create and initialize
1692 reloc_mapper_ and reloc_type_.
1693 (Dwarf_pubnames_table::read_header): Add assertion. Change
1694 unit_length to off_t. Initialize member unit_length_. Fill in field
1695 cu_offset_.
1696 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1697 Initialize new fields unit_length_ and cu_offset_.
1698 (Dwarf_pubnames_table::read_section): Update prototype.
1699 (Dwarf_pubnames_table::cu_offset): New member function.
1700 (Dwarf_pubnames_table::subsection_size): Likewise.
1701 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1702 New fields.
1703 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1704 member functions public.
1705 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1706 Update comment. Rework logic. Move repeated parts to...
1707 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1708 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1709 pubtypes_table_, and stmt_list_offset.
1710 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1711 Gdb_index::find_pubtype_offset,
1712 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1713 (Gdb_index::pubnames_read): Update prototype and rework logic.
1714 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1715 Forward declare.
1716 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1717 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1718 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1719 Gdb_index::map_pubtable_to_dies):
1720 Declare functions.
1721 (Gdb_index::pubnames_read): Update declaration.
1722 (Gdb_index::Pubname_offset_map): New type.
1723 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1724 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1725 Gdb_index::stmt_list_offset): Declare.
1726 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1727 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1728 Gdb_index::pubtypes_offset_): Remove.
1729
1730 2013-07-19 Roland McGrath <mcgrathr@google.com>
1731
1732 * options.h (General_options): Add -Trodata-segment option.
1733 * parameters.cc (Parameters::check_rodata_segment): New function.
1734 (Parameters::set_target_once): Call it.
1735 * parameters.h (Parameters): Declare it (private member function).
1736 * layout.cc (load_seg_unusable_for_headers): New function, broken
1737 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1738 then validate rodata segment rather than text segment.
1739 (relaxation_loop_body): Call that.
1740 (is_text_segment): New function. Don't admit a non-executable
1741 segment if TARGET->isolate_execinstr().
1742 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1743
1744 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1745
1746 PR gold/15070
1747 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1748 * nacl.h (Sniff_file::View::View): Request aligned view.
1749
1750 2013-07-11 Cary Coutant <ccoutant@google.com>
1751
1752 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1753 correct BRLT entry size.
1754
1755 2013-07-03 Alan Modra <amodra@gmail.com>
1756
1757 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1758 comment.
1759
1760 2013-07-01 Cary Coutant <ccoutant@google.com>
1761
1762 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1763 reloc_type_.
1764 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1765 (Dwarf_ranges_table::lookup_reloc): New function.
1766 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1767 reloc_type_.
1768 (Dwarf_ranges_table::lookup_reloc): New function.
1769 (Dwarf_ranges_table::reloc_type_): New data member.
1770
1771 2013-06-27 Jing Yu <jingyu@google.com>
1772
1773 PR gold/15662
1774 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1775 function.
1776 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1777 (Target_powerpc::do_relax): Call the above.
1778
1779 2013-06-27 Cary Coutant <ccoutant@google.com>
1780
1781 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1782 on garbage collected .opd section.
1783
1784 2013-06-27 Alan Modra <amodra@gmail.com>
1785
1786 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1787 is non-zero.
1788 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1789 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1790
1791 2013-06-14 Cary Coutant <ccoutant@google.com>
1792
1793 * resolve.cc (Symbol::override_base): Don't override st_type
1794 from plugin placeholder symbols.
1795 (Symbol_table::resolve): Likewise.
1796 (Symbol_table::should_override): Don't complain about TLS mismatch
1797 if the TO symbol is a plugin placeholder.
1798 * testsuite/Makefile.am (plugin_test_tls): New test.
1799 * testsuite/Makefile.in: Regenerate.
1800 * testsuite/plugin_test_tls.sh: New test script.
1801 * testsuite/two_file_test_2_tls.cc: New test source.
1802 * testsuite/two_file_test_tls.cc: New test source.
1803
1804 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1805
1806 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1807 the maximum segment alignment is larger than the page size.
1808 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1809 correctly aligns the symbols with large alignemnt.
1810 * testsuite/Makefile.in: Regenerate.
1811 * testsuite/large_symbol_alignment.cc: New file.
1812
1813 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1814 Sriraman Tallam <tmsriram@google.com>
1815
1816 * options.h (sort_section): New option.
1817 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1818 Rename from Input_section_sort_section_name_special_ordering_compare.
1819 (Input_section_sort_section_name_compare): New struct.
1820 * output.cc (Output_section::Input_section_sort_section_name_compare::
1821 operator()): New function.
1822 (Output_section::sort_attached_input_sections): Use new sort function
1823 for .text if --sort-section=name is specified.
1824 * layout.cc (Layout::make_output_section):
1825 Add sorting by name when --sort-section=name is specified.
1826 * testsuite/Makefile.am (text_section_grouping): Test option
1827 --sort-section=name.
1828 * testsuite/Makefile.in: Regenerate.
1829 * testsuite/section_sorting_name.cc: New file.
1830 * testsuite/section_sorting_name.sh: New file.
1831
1832 2013-05-21 Cary Coutant <ccoutant@google.com>
1833
1834 * symtab.h (Symbol::is_cxx_vtable): New function.
1835 * target-reloc.h (relocate_section): Check for vtable symbol.
1836 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1837 * testsuite/Makefile.in: Regenerate.
1838 * testsuite/missing_key_func.cc: New test source.
1839 * testsuite/missing_key_func.sh: New test script.
1840
1841 2013-05-21 Cary Coutant <ccoutant@google.com>
1842
1843 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1844 type of enclosing symbol.
1845 (Relocate_info::location): Check symbol type when describing symbol.
1846 * object.h (Symbol_location_info): Remove unused line_number;
1847 add enclosing_symbol_type.
1848 * testsuite/debug_msg.sh: Adjust expected output.
1849
1850 2013-05-13 Cary Coutant <ccoutant@google.com>
1851
1852 * configure.ac: Export DEFAULT_TARGET.
1853 * configure: Regenerate.
1854 * Makefile.in: Regenerate.
1855 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1856 * testsuite/Makefile.in: Regenerate.
1857 * testsuite/debug_msg.sh: Delete duplicate tests.
1858 Don't check undef_int error message match for powerpc where the
1859 source file and line number aren't available.
1860
1861 2013-05-10 Roland McGrath <mcgrathr@google.com>
1862
1863 * options.h (General_options): Add --rosegment-gap option.
1864 * options.cc (finalize): --rosegment-gap implies --rosegment.
1865 * layout.cc (set_segment_offsets): Let user option override
1866 target->rosegment_gap().
1867
1868 2013-05-10 Roland McGrath <mcgrathr@google.com>
1869
1870 * options.h (General_options): Remove leading space from help
1871 messages for -nostdlib and --rosegment.
1872
1873 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1874
1875 PR ld/15365
1876 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1877
1878 2013-05-03 Alan Modra <amodra@gmail.com>
1879
1880 * merge.cc (Output_merge_string::do_add_input_section): Correct
1881 scan for number of strings. Rename vars to avoid shadowing.
1882 Include missing terminator in input_size_.
1883
1884 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1885
1886 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1887 Restore empty string handling.
1888
1889 2013-05-01 Cary Coutant <ccoutant@google.com>
1890
1891 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1892 uninitialized warning.
1893
1894 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1895
1896 * output.cc (Output_section::add_merge_input_section): Allow
1897 to merge sections if the alignment is more than character size.
1898 * merge.h (Output_merge_string::Output_merge_string): Remove
1899 assert.
1900 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1901 only not-null strings. Check the alignment of strings.
1902 * stringpool.h
1903 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1904 alignment as the argument.
1905 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1906 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1907 Align non-zero length strings according to the addralign_.
1908 (Stringpool_template<Stringpool_char>::set_string_offsets):
1909 Updating offsets according to the given alignment.
1910 * testsuite/Makefile.am (text_section_grouping): Test if string
1911 literals are getting merged.
1912 * testsuite/Makefile.in: Regenerate.
1913 * testsuite/merge_string_literals_1.c: New file.
1914 * testsuite/merge_string_literals_2.c: Ditto.
1915 * testsuite/merge_string_literals.sh: Ditto.
1916
1917 2013-04-26 Ian Lance Taylor <iant@google.com>
1918
1919 * target-reloc.h (relocate_section): If the reloc offset is out of
1920 range, pass VIEW as NULL to relocate.relocate.
1921 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1922 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1923 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1924 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1925 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1926 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1927
1928 2013-04-26 Geoff Pike <gpike@chromium.org>
1929
1930 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1931 * layout.cc (Hash_task): New class.
1932 (Layout::queue_build_id_tasks): New function.
1933 (Layout::write_build_id): Handle single-thread portion of build ID
1934 computation. (In some cases, all of it is single-threaded.) Replace
1935 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1936 functionality in fewer lines of code.
1937 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1938 * options.h (General_options): make "--build-id" default to tree
1939 rather than sha1. Add two new options related to --build-id=tree:
1940 --build-id-chunk-size-for-treehash and
1941 --build-id-min-file-size-for-treehash.
1942 * Makefile.am: add testing of --build-id=tree and related new options
1943 (these tests will be invoked by "make check").
1944 * Makefile.in: Regenerate.
1945
1946 2013-04-25 Alan Modra <amodra@gmail.com>
1947
1948 * configure.tgt: Add powerpcle and powerpc64le.
1949
1950 2013-04-22 Alan Modra <amodra@gmail.com>
1951
1952 PR gold/15355
1953 * layout.cc (Layout::segment_precedes): Allow more than one
1954 segment with the same type and flags.
1955
1956 2013-04-15 Cary Coutant <ccoutant@google.com>
1957
1958 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1959 allocate space in file for BSS sections.
1960
1961 2013-04-15 Cary Coutant <ccoutant@google.com>
1962
1963 * script-sections.cc (Orphan_output_section): Reset address
1964 to zero after each orphaned section for relocatable links.
1965
1966 2013-04-15 Cary Coutant <ccoutant@google.com>
1967
1968 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1969 section starting address for relocatable link.
1970 * testsuite/Makefile.am (script_test_11): New test.
1971 * testsuite/Makefile.in: Regenerate.
1972 * testsuite/script_test_11.c: New source file.
1973 * testsuite/script_test_11.t: New linker script.
1974
1975 2013-04-13 Alan Modra <amodra@gmail.com>
1976
1977 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1978 owner when sections are not adjacent and exceed group size.
1979 (Target_powerpc::group_sections): Handle corner case.
1980 (Target_powerpc::Branch_info::make_stub): Handle case where
1981 stub table doesn't exist due to branches in non-exec sections.
1982 (Target_powerpc::Relocate::relocate): Likewise.
1983
1984 2013-04-11 Alan Modra <amodra@gmail.com>
1985
1986 PR gold/15354
1987 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1988 .branch_lt to match bfd ld. Adjust comments throughout file.
1989
1990 2013-04-04 Ian Lance Taylor <iant@google.com>
1991
1992 GCC PR c++/56840
1993 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1994 sections before checking whether they are included in the link.
1995
1996 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1997
1998 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1999 object before calling the plugin claim_file handler. Pass the elf
2000 object of the archive to the plugin. Delete the elf object if the
2001 plugin claims the file.
2002
2003 2013-03-21 Alan Modra <amodra@gmail.com>
2004
2005 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2006 segment when omagic.
2007
2008 2013-03-21 Alan Modra <amodra@gmail.com>
2009
2010 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2011 comparison warning.
2012 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2013 uninitialized" warning.
2014
2015 2013-03-20 Alan Modra <amodra@gmail.com>
2016
2017 * symtab.h (Symbol::clear_version): New function.
2018 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2019 is_needed by weak references. Clear version for symbols defined
2020 in as-needed objects that are not needed.
2021
2022 2013-03-15 Alan Modra <amodra@gmail.com>
2023
2024 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2025 static and public. Add report_err param. Return false for data refs.
2026 (Target_powerpc::rela_dyn_section): New overloaded function.
2027 (Target_powerpc::plt_, iplt_): Elucidate.
2028 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2029 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2030 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2031 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2032 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2033 push_branch and make_plt_entry for ifunc syms when
2034 reloc_needs_plt_for_ifunc.
2035 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2036 for ifunc unless reloc_needs_plt_for_ifunc.
2037
2038 2013-03-15 Alan Modra <amodra@gmail.com>
2039
2040 * gc.h (gc_process_relocs): Don't look through function descriptors.
2041 * icf.cc (get_section_contents): Do so here instead.
2042
2043 2013-03-13 Alan Modra <amodra@gmail.com>
2044
2045 * powerpc.cc (is_branch_reloc): Forward declare.
2046 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2047 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2048 false for 64-bit, true for 32-bit non-branch relocs.
2049 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2050 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2051 nm output.
2052 (icf_safe_test): Generate linker map file as well as nm output.
2053 (icf_safe_so_test): Likewise.
2054 * testsuite/Makefile.in: Regenerate.
2055 * testsuite/icf_test.sh: Parse linker map file to determine
2056 section folding.
2057 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2058 * testsuite/icf_safe_so_test.sh: Likewise.
2059 (X86_32_or_ARM_specific_safe_fold): Merge into..
2060 (arch_specific_safe_fold): ..this.
2061 (X86_64_specific_safe_fold): Delete unused function.
2062
2063 2013-03-12 Alan Modra <amodra@gmail.com>
2064
2065 * gc.h (gc_process_relocs): Look through function descriptors
2066 to determine shndx, symvalue and addend used by ICF. Tidy
2067 variable duplication.
2068
2069 2013-03-11 Alan Modra <amodra@gmail.com>
2070
2071 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2072 * layout.cc (Layout_task_runner::run): ..to here.
2073 * symtab.h (struct Symbol_location): Extract from..
2074 (class Symbol_table): ..here.
2075 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2076 * target.h (class Target): Add function_location and
2077 do_function_location functions.
2078 (class Sized_target): Add do_function_location.
2079 * object.h (class Sized_relobj_file): Move find_shdr..
2080 (class Object): ..to here.
2081 * object.cc: Likewise. Update to suit. Instantiate.
2082 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2083 * powerpc.cc (class Powerpc_dynobj): New.
2084 (Target_powerpc::do_function_location): New function.
2085 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2086 (Powerpc_dynobj::do_read_symbols): New function.
2087 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2088
2089 2013-03-08 Ian Lance Taylor <iant@google.com>
2090
2091 * options.cc (General_options::string_to_object_format): Accept
2092 "default".
2093
2094 2013-03-08 Alan Modra <amodra@gmail.com>
2095
2096 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2097 pointer to Post_fde.
2098 (struct Post_fde): Move definition to here..
2099 * ehframe.cc (struct Post_fde): ..from here.
2100 (Cie::write): Don't alloc Post_fde.
2101 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2102
2103 2013-03-07 Alan Modra <amodra@gmail.com>
2104
2105 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2106 relocation referencing .LC0.
2107 * testsuite/discard_locals_test.sh: Remove FIXMEs.
2108
2109 2013-03-07 Alan Modra <amodra@gmail.com>
2110
2111 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2112 always_inline. Add assembly for powerpc to avoid GOT.
2113
2114 2013-03-07 Alan Modra <amodra@gmail.com>
2115
2116 * testsuite/script_test_10.sh: Don't test .bss section
2117 header number.
2118
2119 2013-03-06 Alan Modra <amodra@gmail.com>
2120
2121 * powerpc.cc (class Powerpc_relobj): Move some member functions.
2122 (Target_powerpc::symval_for_branch): Add symtab param. Update
2123 all callers. Handle folded sections.
2124 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2125 to Powerpc_relobj.
2126 (Global_symbol_visitor_opd::operator()): Likewise.
2127
2128 2013-03-04 Alan Modra <amodra@gmail.com>
2129
2130 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2131 * testsuite/Makefile.in: Regenerate.
2132
2133 2013-03-01 Cary Coutant <ccoutant@google.com>
2134
2135 Add dwp support for v2 DWARF package file format.
2136 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2137 tu_length parameter. Adjust all callers.
2138 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2139 * dwp.cc: Include dwarf.h.
2140 (Section_bounds): New struct type.
2141 (Unit_set): New struct type.
2142 (Dwo_file::Dwo_file): Initialize new data member.
2143 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2144 Combine and rename to...
2145 (Dwo_file::read_unit_index): ...this.
2146 (Dwo_file::sized_read_compunit_index)
2147 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2148 (Dwo_file::sized_read_unit_index): ...this.
2149 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2150 parameters; add section_id parameter.
2151 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2152 (Dwo_file::add_unit_set): ...this.
2153 (Dwo_file::shndx_map_): Remove.
2154 (Dwo_file::sect_offsets_): New data member.
2155 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2156 (Dwp_output_file::add_section): Rename to...
2157 (Dwp_output_file::add_contribution): ...this.
2158 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2159 (Dwp_output_file::add_tu_set): Likewise.
2160 (Dwp_output_file::Contribution): New type.
2161 (Dwp_output_file::Section::contributions): New data member.
2162 (Dwp_output_file::Cu_or_tu_set): Remove.
2163 (Dwp_output_file::Section::Section): New ctor.
2164 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2165 (Dwp_output_file::Dwp_index::Section_table): New type.
2166 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2167 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2168 parameter.
2169 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2170 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2171 (Dwp_output_file::Dwp_index::section_table): New member function.
2172 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2173 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2174 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2175 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2176 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2177 (Dwp_output_file::Dwp_index::section_table_): New data member.
2178 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2179 (Dwp_output_file::add_output_section): New member function.
2180 (Dwp_output_file::write_new_section): New member function.
2181 (Dwp_output_file::write_contributions): New member function.
2182 (Dwp_output_file::section_id_map_): New data member.
2183 (class Dwo_id_info_reader): Remove.
2184 (class Unit_reader): New class.
2185 (get_dwarf_section_name): New function.
2186 (Dwo_file::read_executable): Adjust initializations of class data.
2187 (Dwo_file::read): Add support for v2 package file format.
2188 (Dwo_file::read_unit_index): Likewise.
2189 (Dwo_file::sized_read_unit_index): Likewise.
2190 (Dwo_file::copy_section): Likewise.
2191 (Dwo_file::add_unit_set): Likewise.
2192 (Dwp_output_file::add_output_section): Likewise.
2193 (Dwp_output_file::add_contribution): Likewise.
2194 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2195 for empty slot.
2196 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2197 file format.
2198 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2199 slot.
2200 (Dwp_output_file::initialize): Remove unused function.
2201 (Dwp_output_file::finalize): Add support for v2 package file format.
2202 (Dwp_output_file::write_index): Likewise.
2203 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2204 function prototype.
2205
2206 2013-03-01 Cary Coutant <ccoutant@google.com>
2207
2208 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2209 function into class definition in header file.
2210 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2211 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2212 New function.
2213 (Dwarf_info_reader::check_buffer): Move here from .cc file.
2214
2215 2013-02-28 Alan Modra <amodra@gmail.com>
2216
2217 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2218 * target.cc (Target::do_plt_fde_location): New function.
2219 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2220 accessor function, and constructor param.
2221 (struct Post_fde, Post_fdes): Declare.
2222 (Cie::write): Add post_fdes param.
2223 * ehframe.cc (Fde::write): Use plt_fde_location.
2224 (struct Post_fde): Define.
2225 (Cie::write): Stash FDEs added post merge mapping.
2226 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2227 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
2228 (Eh_frame::do_sized_write): Arrange to write post map FDES after
2229 other FDEs.
2230 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2231 (Target_powerpc::has_glink): New function.
2232 (Target_powerpc::do_relax): Add eh_frame info for stubs.
2233 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2234 glink_eh_frame_fde_32, default_fde): New data.
2235 (Stub_table::eh_frame_added_): New var.
2236 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2237 Make const.
2238 (Stub_table::add_eh_frame): New function.
2239 (Output_data_glink::add_eh_frame): New function.
2240 (Target_powerpc::make_glink_section): Call add_eh_frame.
2241
2242 2013-02-15 Ian Lance Taylor <iant@google.com>
2243
2244 * options.h (DEFINE_uint64_alias): Define.
2245 (class General_options): Add -Ttext-segment as an alias for
2246 -Ttext.
2247
2248 2013-02-15 Alan Modra <amodra@gmail.com>
2249
2250 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2251 (Stub_table::do_write): ..here, two places.
2252 (Stub_table::plt_call_size): Use it here too.
2253
2254 2013-02-11 Ian Lance Taylor <iant@google.com>
2255
2256 * descriptors.cc (Descriptors::close_all): New function.
2257 * descriptors.h (class Descriptors): Declare close_all.
2258 (close_all_descriptors): New inline function.
2259 * plugin.cc: Include "descriptors.h".
2260 (Plugin_manager::cleanup): Call close_all_descriptors.
2261
2262 2013-02-06 Alan Modra <amodra@gmail.com>
2263
2264 * README: Update coding style link.
2265
2266 2013-01-28 Cary Coutant <ccoutant@google.com>
2267
2268 * dwp.cc (File_list): New typedef.
2269 (Dwo_name_info_reader): New class.
2270 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2271 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2272 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2273 (Dwo_file::read_executable): New function.
2274 (Dwo_file::read): Move common setup code to ...
2275 (Dwo_file::make_object): ... here.
2276 (dwp_options): Add --exec/-e.
2277 (usage): Likewise.
2278 (main): Likewise.
2279
2280 2013-01-24 Sriraman Tallam <tmsriram@google.com>
2281
2282 * layout.cc (Layout::layout): Check for option text_reorder.
2283 (Layout::make_output_section): Ditto.
2284 * options.h (text_reorder): New option.
2285 * output.cc (Input_section_sort_compare): Remove special ordering
2286 of section names.
2287 (Output_section::
2288 Input_section_sort_section_name_special_ordering_compare::
2289 operator()): New function.
2290 (Output_section::sort_attached_input_sections): Use new sort function
2291 for .text.
2292 * output.h (Input_section_sort_section_name_special_ordering_compare):
2293 New struct.
2294 * testsuite/Makefile.am (text_section_grouping): Test option
2295 --no-text-reorder
2296 * testsuite/Makefile.in: Regenerate.
2297 * testsuite/text_section_grouping.sh: Check order of functions without
2298 default text reordering.
2299
2300 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2301
2302 * options.h (General_options): Change default to true for new_dtags.
2303
2304 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2305
2306 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2307 when enable_new_dtags is false. Only add DT_RUNPATH when
2308 enable_new_dtags is true.
2309
2310 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
2311
2312 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2313 used in declaration and definition consistent.
2314 (Target_powerpc::symval_for_branch): Ditto.
2315
2316 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2317
2318 * testsuite/plugin_final_layout.cc: Fix comment.
2319
2320 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2321
2322 * layout.cc (Layout::layout): Do not do default sorting for
2323 text sections when section ordering is specified.
2324 (make_output_section): Ditto.
2325 * testsuite/plugin_final_layout.cc: Name the function sections
2326 to catch reordering issues.
2327
2328 2013-01-15 Alan Modra <amodra@gmail.com>
2329
2330 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2331 plt-thread-safe.
2332
2333 2013-01-15 Alan Modra <amodra@gmail.com>
2334
2335 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2336 * testsuite/Makefile.in: Regenerate.
2337
2338 2013-01-14 Alan Modra <amodra@gmail.com>
2339
2340 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2341 * testsuite/Makefile.in: Regenerate.
2342
2343 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
2344
2345 PR bfd/14430
2346 Fix mingw gold build with plugins enabled
2347 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2348 * configure.ac: Export DLOPEN_LIBS and add headers check.
2349 * plugin.cc: Handle non-dlfcn case.
2350 * Makefile.in: Regenerate.
2351 * config.in: Regenerate.
2352 * configure: Regenerate.
2353 * testsuite/Makefile.in: Regenerate.
2354
2355 2013-01-09 Sriraman Tallam <tmsriram@google.com>
2356
2357 * output.h (sort_attached_input_sections): Change to be public.
2358 * script-sections.cc
2359 (Output_section_definition::set_section_addresses): Sort
2360 attached input sections according to section order before linker
2361 script assigns section addresses.
2362 (Orphan_output_section::set_section_addresses): Sort
2363 attached input sections according to section order before linker
2364 script assigns section addresses.
2365 * Makefile.am (final_layout.sh): Use a simple linker script to
2366 check if section ordering still works.
2367 * Makefile.in: Regenerate.
2368
2369 2013-01-09 Ben Cheng <bccheng@google.com>
2370
2371 * arm.cc (Target_arm::attributes_accept_div): New function.
2372 (Target_arm::attributes_forbid_div): New function.
2373 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2374 attribute using the same new functions as what bfd/elf32_arm.c
2375 does.
2376
2377 2013-01-07 Cary Coutant <ccoutant@google.com>
2378
2379 PR gold/14993
2380 * output.cc (Output_section::add_input_section): For incremental
2381 updates, don't track input sections that are allocated from patch
2382 space.
2383
2384 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2385 Ian Lance Taylor <iant@google.com>
2386
2387 PR gold/14897
2388 * configure.ac (--enable-ld): Removed.
2389 (install_as_default): Set to yes only for --enable-gold=default
2390 or --disable-ld.
2391 * configure: Regenerated.
2392
2393 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2394
2395 * options.h (General_options): Add -fuse-ld= for GCC linker
2396 option compatibility.
2397
2398 2013-01-04 Cary Coutant <ccoutant@google.com>
2399
2400 * configure.ac: Fix typo restoring CXXFLAGS.
2401 * configure: Regenerate.
2402
2403 2013-01-04 Cary Coutant <ccoutant@google.com>
2404
2405 * testsuite/Makefile.am (CXXLINK_S): New macro.
2406 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2407 * testsuite/Makefile.in: Regenerate.
2408
2409 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
2410
2411 * version.cc (print_version): Update copyright year to 2013.
2412
2413 2012-12-20 Ian Lance Taylor <iant@google.com>
2414
2415 * layout.cc (Layout::special_ordering_of_input_section): New
2416 function.
2417 (Layout::layout): If input section requires special ordering, must
2418 sort input sections.
2419 (Layout::make_output_section): May sort .text input sections.
2420 (Layout::is_section_name_prefix_grouped): Remove.
2421 * layout.h (class Layout): Declare
2422 special_ordering_of_input_section. Don't declare
2423 is_section_name_prefix_grouped.
2424 * output.cc (Output_section::add_input_section): Revert last
2425 change.
2426 (Output_section::Input_section_sort::match_file_name): Don't crash
2427 if called on output section data.
2428 (Output_section::Input_section_sort_compare): Sort based on
2429 special ordering.
2430 (Output_section::Input_section_sort_section_order_index_compare):
2431 Revert last patch.
2432 (Output_section::sort_attached_input_sections): Likewise.
2433
2434 2012-12-18 Sriraman Tallam <tmsriram@google.com>
2435
2436 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2437 * layout.h (Layout::is_section_name_prefix_grouped): New function.
2438 * output.cc (Output_section::add_input_section): Check if section
2439 name contains special prefix. Keep input sections to sort such
2440 sections.
2441 (Output_section::Input_section_sort_section_order_index_compare
2442 ::operator()): Group sections according to prefixes.
2443 (Output_section::sort_attached_input_sections): Add condition to
2444 Input_section_entry constructor call.
2445 * testsuite/Makefile.am (text_section_grouping): New test.
2446 * testsuite/Makefile.in: Regenerate.
2447 * testsuite/text_section_grouping.cc: New file.
2448 * testsuite/text_section_grouping.sh: New file.
2449
2450 2012-12-17 Nick Clifton <nickc@redhat.com>
2451
2452 * Makefile.am: Add copyright notice.
2453 * NEWS: Likewise.
2454 * README: Likewise.
2455 * configure.ac: Likewise.
2456 * ftruncate.c: Likewise.
2457 * Makefile.in: Regenerate.
2458
2459 2012-12-14 Cary Coutant <ccoutant@google.com>
2460
2461 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2462 --no-as-needed flag.
2463 (exception_separate_shared_12_test): Likewise.
2464 (incremental_copy_test): Likewise.
2465 * testsuite/Makefile.in: Regenerate.
2466
2467 2012-12-14 Cary Coutant <ccoutant@google.com>
2468
2469 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2470 (Dwp_output_file::Dwp_index::enter_set): Add assert.
2471
2472 2012-12-12 Alan Modra <amodra@gmail.com>
2473
2474 * powerpc.cc (class Track_tls): New.
2475 (class Relocate, class Scan): Inherit Track_tls.
2476 (Target_powerpc::Scan::local, global): Track tls optimization
2477 and avoid creating plt entry for __tls_get_addr if all uses
2478 are optimized away.
2479 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2480
2481 2012-12-12 Alan Modra <amodra@gmail.com>
2482
2483 * options.h (General_options): Add --toc-sort/--no-toc-sort.
2484 Replace no_toc_optimize with toc_optimize.
2485 * output.h (Output_section::input_sections): Provide non-const variant.
2486 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2487 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2488 accessors.
2489 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2490 (class Sort_toc_sections): New.
2491 (Target_powerpc::do_finalize_sections): Sort toc sections.
2492 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2493
2494 2012-12-10 Roland McGrath <mcgrathr@google.com>
2495
2496 * testsuite/binary_unittest.cc (read_all): New function.
2497 (Sized_binary_test): Use it instead of ::read.
2498 * fileread.cc (do_read): Don't assume pread always reads the whole
2499 amount in a single call.
2500
2501 2012-12-10 Alan Modra <amodra@gmail.com>
2502
2503 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2504 Set EM_PPC64 or EM_PPC here.
2505 (Target_selector_powerpc::do_recognize): Delete.
2506
2507 2012-12-10 Alan Modra <amodra@gmail.com>
2508
2509 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2510 stub_table_.
2511 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2512
2513 2012-12-07 Roland McGrath <mcgrathr@google.com>
2514
2515 * testsuite/binary_unittest.cc (Sized_binary_test):
2516 Use open_descriptor rather than ::open.
2517
2518 2012-12-07 Alan Modra <amodra@gmail.com>
2519
2520 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2521 typedef and invalid_address constant.
2522 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2523 instantiate constants.
2524
2525 2012-12-06 Roland McGrath <mcgrathr@google.com>
2526
2527 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2528 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2529 * aclocal.m4: Regenerate.
2530 * configure: Regenerate.
2531 * Makefile.in: Regenerate.
2532 * testsuite/Makefile.in: Regenerate.
2533
2534 2012-12-07 Alan Modra <amodra@gmail.com>
2535
2536 * options.h (General_options): Add no_toc_optimize.
2537 * powerpc.cc (ok_lo_toc_insn): New function.
2538 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2539
2540 2012-12-06 Alan Modra <amodra@gmail.com>
2541
2542 * options.h (General_options): Add plt_align, plt_static_chain,
2543 plt_thread_safe. Update stub_group_size help text.
2544 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2545 for new plt_thread_safe_ var.
2546 (use_plt_offset): Correct comments.
2547 (Target_powerpc::do_relax): Look for thread creation symbols to
2548 determine default plt_thread_safe value. Clear plt call stubs
2549 as well as branch stubs each iteration.
2550 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2551 insn constants.
2552 (l, hi, ha, write_insn): Move earlier.
2553 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2554 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2555 plt stubs too.
2556 (Stub_table::update_size): Adjust.
2557 (Stub_table::prev_size, set_prev_size): Delete.
2558 (Stub_table::stub_align): Let --plt-align affect result.
2559 (Stub_table::plt_call_size): Calculate sizes for various stubs.
2560 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2561 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2562 (Stub_table::do_write): Support more stub variants.
2563
2564 2012-12-04 Alan Modra <amodra@gmail.com>
2565
2566 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2567 (Target_powerpc::do_define_standard_symbols): New function.
2568
2569 2012-12-03 Alan Modra <amodra@gmail.com>
2570
2571 * output.h: Formatting, whitespace.
2572
2573 2012-12-03 Alan Modra <amodra@gmail.com>
2574
2575 * layout.h (Layout::get_executable_sections): Declare.
2576 * layout.cc (Layout::get_executable_sections): New function.
2577 * arm.cc (Target_arm::group_sections): Use it.
2578 (Arm_output_section::group_sections): Delete now redundant test.
2579 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2580 param to handle relative relocs.
2581 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2582 (Output_data_reloc::add_absolute): Adjust.
2583 (Output_data_reloc::add_relative): New function.
2584 (Output_data::reset_data_size): New function.
2585 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2586 (Output_section::set_addralign): New function.
2587 (Output_section::checkpoint_set_addralign): New function.
2588 (Output_section::clear_section_offsets_need_adjustment): New function.
2589 (Output_section::input_sections): Make public.
2590 * powerpc.cc (class Output_data_brlt_powerpc): New.
2591 (class Stub_table, class Stub_control): New.
2592 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2593 stub_table_, set_stub_table, stub_table): New vectors and accessor
2594 functions.
2595 (Target_powerpc::do_may_relax, do_relax, push_branch,
2596 new_stub_table, stub_tables, brlt_section, group_sections,
2597 add_branch_lookup_table, find_branch_lookup_table,
2598 write_branch_lookup_table, make_brlt_section): New functions.
2599 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2600 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2601 branch_info_): New vars.
2602 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2603 make call stubs here.
2604 (Output_data_glink): Remove all call stub handling from this class.
2605 (Target_powerpc::Scan::local, global): Save interesting branch
2606 relocs and relocs for ifunc. Adjust calls to plt entry functions.
2607 (Target_powerpc::do_finalize_sections): Only make reg save/restore
2608 functions on final link.
2609 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2610 Handle long branch destinations too.
2611 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2612 do_plt_address_for_local): Adjust lookup of plt call stubs.
2613
2614 2012-11-30 Alan Modra <amodra@gmail.com>
2615
2616 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2617 relocs against protected symbols when building 32-bit shared libs.
2618
2619 2012-11-30 Alan Modra <amodra@gmail.com>
2620
2621 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2622 param. Call got_section() to make .got. Update all callers
2623 and their callers and so on.
2624
2625 2012-11-30 Alan Modra <amodra@gmail.com>
2626
2627 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2628 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2629 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2630 value if it already exists.
2631
2632 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
2633
2634 PR gold/14858
2635 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2636
2637 2012-11-14 Roland McGrath <mcgrathr@google.com>
2638
2639 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2640 than bfc instruction for data sandboxing.
2641
2642 2012-11-08 Alan Modra <amodra@gmail.com>
2643
2644 * po/POTFILES.in: Regenerate.
2645
2646 2012-11-05 Alan Modra <amodra@gmail.com>
2647
2648 * configure.ac: Apply 2012-09-10 change to config.in here.
2649 * configure: Regenerate.
2650
2651 2012-11-05 Alan Modra <amodra@gmail.com>
2652
2653 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2654 (struct Opd_ent): Use "Address" rather than "Offset".
2655 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2656 (Target_powerpc::got_section): Make public.
2657 (Target_powerpc::scan_relocs): Move code setting symbols..
2658 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2659 Create _SDA_BASE_ only when referenced.
2660
2661 2012-11-02 Roland McGrath <mcgrathr@google.com>
2662
2663 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2664 from last change.
2665
2666 2012-11-01 Roland McGrath <mcgrathr@google.com>
2667
2668 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2669 for offset_in_output_section parameter.
2670 (Sized_target::relocate_special_relocatable): Likewise.
2671 * arm.cc (Target_arm::relocate_relocs): Likewise.
2672 (Target_arm::relocate_special_relocatable): Likewise.
2673 * i386.cc (Target_i386::relocate_relocs): Likewise.
2674 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2675 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2676 * target-reloc.h (relocate_relocs): Likewise.
2677 * testsuite/testfile.cc (Target_test): Likewise.
2678 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2679 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2680
2681 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2682 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2683
2684 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2685 parameter, which is unused in the [!F_SETFD] case.
2686
2687 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2688 SYMNDX to off_t before comparing it to this->data_size().
2689 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2690 * incremental.cc (Output_section_incremental_inputs::do_write):
2691 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2692
2693 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2694
2695 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2696
2697 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2698 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2699 in EABI_VER5.
2700
2701 2012-10-29 Cary Coutant <ccoutant@google.com>
2702
2703 * dwp.cc (usage): Add file and exit status parameters;
2704 add --help and --version options.
2705 (print_version): New function.
2706 (main): Add --help and --version options.
2707
2708 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2709
2710 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2711 final_layout_sequence.txt.
2712 * testsuite/Makefile.in: Regenerated.
2713
2714 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2715
2716 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2717 COMPILE generated by automake.
2718 (LINK1): Likewise.
2719 (CXXCOMPILE1): Likewise.
2720 (CXXLINK1): Likewise.
2721 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2722 (LINK): Likewise.
2723 (CXXCOMPILE): Likewise.
2724 (CXXLINK): Likewise.
2725 * testsuite/Makefile.in: Regenerated.
2726
2727 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2728
2729 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2730 on bad fwrite return.
2731
2732 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2733
2734 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2735 on val.
2736
2737 2012-10-23 Cary Coutant <ccoutant@google.com>
2738
2739 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2740 * testsuite/Makefile.in: Regenerate.
2741 * testsuite/dwp_test.h: New source file.
2742 * testsuite/dwp_test_1.cc: New source file.
2743 * testsuite/dwp_test_1.s: New source file.
2744 * testsuite/dwp_test_1.sh: New source file.
2745 * testsuite/dwp_test_1b.cc: New source file.
2746 * testsuite/dwp_test_1b.s: New source file.
2747 * testsuite/dwp_test_2.cc: New source file.
2748 * testsuite/dwp_test_2.s: New source file.
2749 * testsuite/dwp_test_2.sh: New source file.
2750 * testsuite/dwp_test_main.cc: New source file.
2751 * testsuite/dwp_test_main.s: New source file.
2752
2753 2012-10-23 Cary Coutant <ccoutant@google.com>
2754
2755 * dwp.h: New header file.
2756 * dwp.cc: New source file.
2757 * gold.h: Move shared declarations to system.h.
2758 * system.h: New header file.
2759 * Makefile.am: Add dwp.
2760 * Makefile.in: Regenerate.
2761
2762 2012-10-23 Cary Coutant <ccoutant@google.com>
2763
2764 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2765 Dwarf_info_reader::read_from_pointer.
2766 (Dwarf_pubnames_table::read_header): Likewise.
2767 (Dwarf_pubnames_table::next_name): Likewise.
2768 (Dwarf_die::read_attributes): Likewise.
2769 (Dwarf_die::skip_attributes): Likewise.
2770 (Dwarf_info_reader::read_from_pointer): New function template.
2771 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2772 (Dwarf_pubnames_table): Likewise.
2773 (Dwarf_info_reader::read_from_pointer): New function template.
2774 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2775 Dwarf_pubnames_table ctor.
2776
2777 2012-10-23 Cary Coutant <ccoutant@google.com>
2778
2779 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2780 abbrev_shndx.
2781 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2782 abbrev_shndx_.
2783 (Dwarf_info_reader::set_abbrev_shndx): New method.
2784 (Dwarf_info_reader::abbrev_shndx_): New data member.
2785
2786 2012-10-23 Cary Coutant <ccoutant@google.com>
2787
2788 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2789 from object, not parameters.
2790 (Dwarf_info_reader::parse): Likewise.
2791 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2792 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2793 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2794 methods.
2795
2796 2012-10-23 Cary Coutant <ccoutant@google.com>
2797
2798 * fileread.cc (Input_file::Input_file): New constructor.
2799 * fileread.h (class Input_file): Add new constructor.
2800
2801 2012-10-18 Alan Modra <amodra@gmail.com>
2802
2803 PR gold/14727
2804 * object.cc (Relobj::is_section_name_included): Also match
2805 .sdata personality section.
2806
2807 2012-10-18 Alan Modra <amodra@gmail.com>
2808
2809 * target-reloc.h (class Default_comdat_behavior): New, package up..
2810 (get_comdat_behaviour): ..this.
2811 (relocate_section): Add Relocate_comdat_behavior template arg,
2812 adjust code to suit.
2813 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2814 (Target_arm::scan_reloc_section): Likewise.
2815 * i386.cc (Target_i386::relocate_section): Likewise.
2816 * sparc.cc (Target_sparc::relocate_section): Likewise.
2817 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2818 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2819 * powerpc.cc (class Relocate_comdat_behavior): New.
2820 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2821 gold::relocate_section with new template arg.
2822
2823 2012-10-18 Alan Modra <amodra@gmail.com>
2824
2825 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2826 dynamic relocs for GOT_TPREL got entries, without symbol if
2827 resolving locally.
2828 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2829 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2830 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2831
2832 2012-10-17 Alan Modra <amodra@gmail.com>
2833
2834 PR gold/14726
2835 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2836
2837 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2838
2839 * layout.cc (Layout::include_section): Keep sections marked
2840 SHF_EXCLUDE when doing relocatable links.
2841
2842 2012-10-16 Alan Modra <amodra@gmail.com>
2843
2844 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2845 (Target_powerpc::do_finalize_sections): Call it.
2846 (Output_data_save_res): New class and supporting functions.
2847 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2848 normal symbols defined in object files.
2849
2850 2012-10-12 Alan Modra <amodra@gmail.com>
2851
2852 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2853 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2854 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2855 section if scan_opd_relocs not yet called.
2856 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2857
2858 2012-10-12 Alan Modra <amodra@gmail.com>
2859
2860 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2861 add_local_ifunc_entry): Revert last change.
2862 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2863
2864 2012-10-05 Alan Modra <amodra@gmail.com>
2865
2866 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2867 do_plt_address_for_global): New functions.
2868 (Output_data_got_powerpc::do_write): Don't segfault when linking
2869 statically.
2870 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2871 add_local_ifunc_entry): Return true on adding entry..
2872 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2873 glink->add_entry call. Remove unused symtab param. Adjust calls.
2874 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2875 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2876 set up symbols here.
2877 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2878 syms here. Do so even when no .iplt. Don't segfault when linking
2879 statically.
2880 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2881 new variants without reloc param.
2882 (Glink_sym_ent::Glink_sym_ent): Likewise.
2883 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2884 reloc when refs will resolve to plt call stub.
2885 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2886 R_PPC_PLTREL24 to resolve locally.
2887 (Target_powerpc::Scan::global): Correct ifunc handling.
2888 (Target_powerpc::Relocate::relocate): Correct local sym glink
2889 lookup. Don't destroy "value" when we have a plt call stub,
2890 and when checking plt call validity.
2891 (Target_powerpc::do_dynsym_value): Simplify.
2892
2893 2012-10-05 Alan Modra <amodra@gmail.com>
2894
2895 * i386.cc (Output_data_plt_i386::address_for_global,
2896 address_for_local): Add plt offset to returned value. Adjust uses.
2897 * sparc.cc (Output_data_plt_sparc::address_for_global,
2898 address_for_local): Likewise.
2899 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2900 address_for_local): Likewise.
2901 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2902 address_for_local): Likewise.
2903 * target.h (Target::plt_address_for_global, plt_address_for_local):
2904 Update comment.
2905 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2906 (Output_data_got::Got_entry::write): Nor here.
2907 * output.h: Comment fix.
2908
2909 2012-10-02 Jiong Wang <jiwang@tilera.com>
2910
2911 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2912 global_offset_table_ value for larget got.
2913 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2914
2915 2012-09-29 Alan Modra <amodra@gmail.com>
2916
2917 * powerpc.cc (Target_powerpc::iplt_): New output section.
2918 (Target_powerpc::iplt_section, make_iplt_section,
2919 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2920 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2921 Target_powerpc::plt_entry_count): Count iplt entries too.
2922 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2923 reloc section in constructor. New params.
2924 (Target_powerpc::make_plt_section): Create reloc section here instead.
2925 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2926 functions.
2927 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2928 (Output_data_glink::add_entry, find_entry): New functions to
2929 deal with local syms.
2930 (Glink_sym_ent): Add support for local syms.
2931 (Output_data_glink::do_write): Handle ifunc plt entries.
2932 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2933 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2934 (Target_powerpc::Relocate::relocate): Likewise.
2935 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2936
2937 2012-09-25 Alan Modra <amodra@gmail.com>
2938
2939 * object.h (Sized_relobj_file::adjust_local_symbol,
2940 do_adjust_local_symbol): New functions.
2941 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2942 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2943 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2944 and irregular opd entry spacing.
2945 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2946 (Global_symbol_visitor_opd): New functor.
2947 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2948 on deleted opd entries.
2949
2950 2012-09-15 Jiong Wang <jiwang@tilera.com>
2951
2952 * tilegx.cc: New file.
2953 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2954 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2955 * configure.tgt: Add entries for tilegx*.
2956 * configure.ac: Likewise.
2957 * Makefile.in: Rebuild.
2958 * configure: Likewise.
2959 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2960 tilegx.
2961
2962 2012-09-13 Alan Modra <amodra@gmail.com>
2963
2964 * target-reloc.h (scan_relocs): Call scan.local for relocs
2965 against symbols in discarded sections. Pass is_discarded
2966 param.
2967 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2968 Add is_discarded param.
2969 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2970 is_discarded to flag opd entry as discarded. Don't emit dyn
2971 relocs on such entries.
2972 (Target_powerpc::Scan::global): Similarly detect and handle
2973 such opd entries.
2974 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2975 opd_ent_. Update all uses.
2976 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2977 (Target_powerpc::relocate_section): Zero out discarded opd
2978 entry relocs.
2979
2980 2012-09-12 Ian Lance Taylor <iant@google.com>
2981
2982 PR gold/14570
2983 * output.cc: Rename Output_data_got template parameter from size
2984 to got_size for all functions. Compile all variants of
2985 Output_data_got.
2986 (Output_data_got::Got_entry::write): Correct use of size for
2987 symbol value. Use local_is_tls rather than casting to
2988 Sized_relobj_file.
2989 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2990 (class Sized_relobj_file): Add do_local_is_tls.
2991 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2992
2993 2012-09-11 Alan Modra <amodra@gmail.com>
2994
2995 PR gold/14566
2996 * layout.cc (Layout::set_segment_offsets): When using
2997 common-page-size alignment, ensure we are on a new max-page-size
2998 page.
2999 * output.cc (Output_segment::set_section_addresses): Use
3000 abi_pagesize, not common_pagesize for relro boundary.
3001 (Output_segment::set_offset): Likewise.
3002
3003 2012-09-11 Alan Modra <amodra@gmail.com>
3004
3005 * output.h (Output_data_got::add_global_tls, add_local_tls,
3006 add_local_tls_pair): New functions.
3007 (Output_data_got::add_local_pair_with_rel): Remove second
3008 reloc param. Expand comment.
3009 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3010 use_plt_or_tls_offset_, similarly for constructor param.
3011 (Output_data_got::Got_entry::write): Add got_index param.
3012 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3013 add_local_tls_pair): New functions.
3014 (Output_data_got::Got_entry::write): Handle tls symbols
3015 with use_plt_or_tls_offset_ set specially.
3016 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3017 (Output_data_got::do_write): Replace iterator with index, pass
3018 index to entry write function.
3019 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3020 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3021 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3022 call.
3023 * i386.cc (Target_i386::Scan::local): Likewise.
3024 * sparc.cc (Target_sparc::Scan::local): Likewise.
3025 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3026 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3027 do_tls_offset_for_global): New functions.
3028 (Target_powerpc::Scan::local): Correct TLS relocations and got
3029 entry values.
3030 (Target_powerpc::Scan::global): Don't emit unnecessary
3031 dynamic relocations on TLS GOT entries.
3032
3033 2012-09-10 Matthias Klose <doko@ubuntu.com>
3034
3035 * config.in: Disable sanity check for kfreebsd.
3036
3037 2012-09-10 Sterling Augustine <saugustine@google.com>
3038
3039 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3040 (Gdb_index::pubtypes_read): New parameter.
3041 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3042 to calls.
3043 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3044 pubtypes_object_.
3045
3046 2012-09-09 Alan Modra <amodra@gmail.com>
3047
3048 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3049 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3050 * gc.h (gc_process_relocs): Call target gc_add_reference.
3051 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3052 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3053 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3054 unnecessary cast.
3055 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3056 to cater for when we don't need code offset. Update use.
3057 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3058 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3059 set_opd_valid): New functions.
3060 (Target_powerpc::do_gc_add_reference): New function.
3061 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3062 stashed refs.
3063 (Target_powerpc::do_gc_mark_symbol): New function.
3064
3065 2012-09-06 Cary Coutant <ccoutant@google.com>
3066
3067 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3068 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3069 (Dwarf_die::skip_attributes): Likewise.
3070 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3071 * testsuite/gdb_index_test.cc (inline_func_1): New function.
3072 (main): Call it.
3073 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3074
3075 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
3076
3077 * testsuite/script_test_3.t: Add .got.plt output section
3078 statement.
3079 * testsuite/script_test_4.t: Likewise.
3080
3081 2012-09-05 Alan Modra <amodra@gmail.com>
3082
3083 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3084 update all uses and lose "enum" when using type.
3085
3086 2012-09-05 Alan Modra <amodra@gmail.com>
3087
3088 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3089 * configure: Regenerate.
3090 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3091 (plugin_final_layout.stdout): Likewise.
3092 (memory_test): Set page sizes to 0x1000.
3093 * testsuite/Makefile.in: Regenerate.
3094 * testsuite/discard_locals_test.sh: Add FIXME comment.
3095 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3096 * testsuite/pr14265.t: Add .got output section statement.
3097 * testsuite/script_test_2.t: Likewise.
3098 * testsuite/script_test_3.t: Likewise.
3099 * testsuite/script_test_4.t: Likewise.
3100 * testsuite/script_test_5.t: Likewise.
3101 * testsuite/script_test_6.t: Likewise.
3102 * testsuite/script_test_7.t: Likewise.
3103 * testsuite/script_test_9.t: Likewise.
3104
3105 2012-09-05 Alan Modra <amodra@gmail.com>
3106
3107 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3108 (Powerpc_relocate_functions::Status): New typedef.
3109 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3110 (Target_powerpc::Scan::local): Handle REL64.
3111 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3112 for REL32 and REL64.
3113 (Target_powerpc::symval_for_branch): New function, extracted from..
3114 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
3115 checks. Report overflow errors.
3116
3117 2012-09-05 Alan Modra <amodra@gmail.com>
3118
3119 * object.h (Sized_relobj_file::emit_relocs): Delete.
3120 (Sized_relobj_file::emit_relocs_reltype): Delete.
3121 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3122 relocate_relocs for --emit-relocs.
3123 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3124 * output.h: Update comment.
3125 (Output_segment::first_section): New function.
3126 (Output_segment::first_section_load_address): Use first_section.
3127 * output.cc (Output_segment::first_section): New function extracted..
3128 (Output_segment::first_section_load_address): ..from here. Delete.
3129 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3130 * target.h (Sized_target::relocate_for_relocatable): Likewise.
3131 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3132 adjust call to target.h function.
3133 * i386.cc (Target_i386): Likewise.
3134 * sparc.cc (Target_sparc): Likewise.
3135 * x86_64.cc (Target_x86_64): Likewise.
3136 * powerpc.cc (Target_powerpc): Likewise.
3137 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
3138 first tls section has section symbol for optimised local dynamic
3139 output relocs.
3140 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3141 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3142 optimised tls code.
3143 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3144 Rename to relocate_relocs. Update error message.
3145
3146 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
3147
3148 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3149 --just-symbols.
3150
3151 2012-08-31 Alan Modra <amodra@gmail.com>
3152
3153 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3154 (Powerpc_relobj::toc_base_offset): New stub function.
3155 (Target_powerpc): Add tp_offset, dtp_offset. Rename
3156 got_mod_index_offset to tlsld_got_offset. Update all refs.
3157 (Target_powerpc::Relocate::enum skip_tls): New.
3158 (Target_powerpc::call_tls_get_addr_): New var.
3159 (Target_powerpc::is_branch_reloc): Move to file scope.
3160 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3161 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3162 New functions.
3163 (Target_powerpc::enum Got_type): Delete old values, add new ones.
3164 (powerpc_info): Correct common_pagesize for ppc64.
3165 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3166 (Powerpc_relocate_functions): Add overflow check enums and functions.
3167 Add non-shift version of rela, rela_ua. Delete all rel public
3168 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
3169 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3170 addr16_ha3, addr14 functions.
3171 (Output_data_got_powerpc::add_constant_pair): New function.
3172 (Output_data_got_powerpc::got_base_offset): Likewise.
3173 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3174 (instruction constants): Sort, add some more.
3175 (Output_data_glink::do_write): Add and use Address typedef. Use
3176 object->toc_base_offset() stub for 64-bit.
3177 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3178 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3179 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3180 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
3181 Always treat .opd relocs as against locally defined symbol.
3182 Correct condition for RELATIVE relocs.
3183 (Target_powerpc::do_finalize_sections): Test for NULL sections.
3184 (Target_powerpc::Relocate::relocate): Use plt call stub as value
3185 for 32-bit syms with a plt entry. Correct ppc64 toc base
3186 calculations. Handle TLS relocs, and more. Add overflow
3187 checking and adjust for Powerpc_relocate_functions changes.
3188 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3189 Reinstate --emit-relocs code with FIXME.
3190
3191 2012-08-30 Alan Modra <amodra@gmail.com>
3192
3193 * layout.cc (Layout::set_segment_offsets): Set p_align to
3194 abi_pagesize, not common_pagesize.
3195 (Layout::relaxation_loop_body): Similarly use abi_pagesize
3196 to determine whether file header can go in segment.
3197
3198 2012-08-30 Alan Modra <amodra@gmail.com>
3199
3200 * output.h (Output_reloc::Output_reloc <output section>): Add
3201 is_relative param. Adjust calls.
3202 (Output_reloc::add_output_section_relative): New functions.
3203 * output.cc (Output_reloc::Output_reloc <output section>): Handle
3204 is_relative.
3205 (Output_reloc::symbol_value): Handle SECTION_CODE.
3206
3207 2012-08-24 Sriraman Tallam <tmsriram@google.com>
3208
3209 * gold.cc (queue_middle_tasks): Call layout again when unique
3210 segments for sections is desired.
3211 * layout.cc (Layout::Layout): Initialize new members.
3212 (Layout::get_output_section_flags): New function.
3213 (Layout::choose_output_section): Call get_output_section_flags.
3214 (Layout::layout): Make output section for mapping to a unique segment.
3215 (Layout::insert_section_segment_map): New function.
3216 (Layout::attach_allocated_section_to_segment): Make unique segment for
3217 output sections marked so.
3218 (Layout::segment_precedes): Check for unique segments when sorting.
3219 * layout.h (Layout::Unique_segment_info): New struct.
3220 (Layout::Section_segment_map): New typedef.
3221 (Layout::insert_section_segment_map): New function.
3222 (Layout::get_output_section_flags): New function.
3223 (Layout::is_unique_segment_for_sections_specified): New function.
3224 (Layout::set_unique_segment_for_sections_specified): New function.
3225 (Layout::unique_segment_for_sections_specified_): New member.
3226 (Layout::section_segment_map_): New member.
3227 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3228 Rename is_gc_pass_one to is_pass_one.
3229 Rename is_gc_pass_two to is_pass_two.
3230 Rename is_gc_or_icf to is_two_pass.
3231 Check for which pass based on whether symbols data is present.
3232 Make it two pass when unique segments for sections is desired.
3233 * output.cc (Output_section::Output_section): Initialize new
3234 members.
3235 * output.h (Output_section::is_unique_segment): New function.
3236 (Output_section::set_is_unique_segment): New function.
3237 (Output_section::is_unique_segment_): New member.
3238 (Output_section::extra_segment_flags): New function.
3239 (Output_section::set_extra_segment_flags): New function.
3240 (Output_section::extra_segment_flags_): New member.
3241 (Output_section::segment_alignment): New function.
3242 (Output_section::set_segment_alignment): New function.
3243 (Output_section::segment_alignment_): New member.
3244 (Output_segment::Output_segment): Initialize is_unique_segment_.
3245 (Output_segment::is_unique_segment): New function.
3246 (Output_segment::set_is_unique_segment): New function.
3247 (Output_segment::is_unique_segment_): New member.
3248 * plugin.cc (allow_unique_segment_for_sections): New function.
3249 (unique_segment_for_sections): New function.
3250 (Plugin::load): Add new functions to transfer vector.
3251 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3252 * Makefile.in: Regenerate.
3253 * testsuite/plugin_final_layout.sh: Check if unique segment
3254 functionality works.
3255 * testsuite/plugin_section_order.c (onload): Check if new interfaces
3256 are available.
3257 (allow_unique_segment_for_sections): New global.
3258 (unique_segment_for_sections): New global.
3259 (claim_file_hook): Call allow_unique_segment_for_sections.
3260 (all_symbols_read_hook): Call unique_segment_for_sections.
3261
3262 2012-08-22 Cary Coutant <ccoutant@google.com>
3263
3264 * layout.cc (Layout::include_section): Don't assert on GROUP
3265 sections with --emit-relocs.
3266
3267 2012-08-21 Cary Coutant <ccoutant@google.com>
3268
3269 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3270 if --export-dynamic-symbol names an undef symbol.
3271
3272 2012-08-18 Alan Modra <amodra@gmail.com>
3273
3274 * powerpc.cc: Formatting and white space.
3275 (Powerpc_relobj): Rename got2_section_ to special_.
3276 Add opd_ent_shndx_ and opd_ent_off_ vectors.
3277 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3278 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3279 (Target_powerpc): Add Address typedef and invalid_address. Use
3280 throughout.
3281 (Target_powerpc::is_branch_reloc): New function.
3282 (Powerpc_relocate_functions): Add Address typedef, use throughout.
3283 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3284 for dst_mask, value and addend.
3285 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3286 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3287 (Output_data_glink::do_write): Correct toc base. Don't try to use
3288 uint16_t for 24-bit offset. Use get_output_section_offset and
3289 check return.
3290 (Target_powerpc::Scan::local): Handle more relocs.
3291 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3292 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3293 Plug in toc restoring insn after plt calls. Translate branches
3294 to function descriptor symbols to corresponding entry point.
3295 (Target_powerpc::relocate_for_relocatable): Check return from
3296 get_output_section_offset.
3297 * symtab.h: Comment typo.
3298
3299 2012-08-14 Ian Lance Taylor <iant@google.com>
3300
3301 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3302 unsupported_relocal_local to call unsupported_reloc_global.
3303
3304 2012-08-14 Nick Clifton <nickc@redhat.com>
3305
3306 PR ld/14265
3307 * script-sections.cc (Sections_element::output_section_name): Add
3308 keep return parameter.
3309 (Output_section_element::match_name): Add keep return parameter.
3310 Return the value of the keep_ member.
3311 * script-sections.h (class Output_section): Update
3312 output_section_name prototype.
3313 * layout.cc (Layout::keep_input_section): New public member
3314 function.
3315 (Layout::choose_output_section): Pass keep parameter to
3316 output_section_name.
3317 * layout.h (class Layout): Add keep_input_section.
3318 * object.cc (Sized_relobj_file::do_layout): Check for kept input
3319 sections.
3320 * testsuite/Makefile.am: Add a test.
3321 * testsuite/Makefile.in: Regenerate.
3322 * testsuite/pr14265.c: Source file for the test.
3323 * testsuite/pr14265.t: Linker script for the test.
3324 * testsuite/pr14265.sh: Shell script for the test.
3325
3326 2012-08-14 Alan Modra <amodra@gmail.com>
3327
3328 * target.h (Target::output_section_name): New function.
3329 (Target::do_output_section_name): New function.
3330 * layout.cc (Layout::choose_output_section): Call the above.
3331 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3332
3333 2012-08-14 Alan Modra <amodra@gmail.com>
3334
3335 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3336 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3337 for replace_constant call.
3338 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3339 (Output_data_glink::do_print_to_mapfile): New function.
3340 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3341 (Target_powerpc::Relocate::relocate): Likewise.
3342
3343 2012-08-14 Alan Modra <amodra@gmail.com>
3344
3345 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3346 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3347 (Output_data_glink::add_entry,find_entry): Remove shndx param.
3348 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
3349 all references to shndx_. Handle special case for R_PPC_PLTREL24
3350 here.
3351 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3352 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3353 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3354 here.
3355 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3356 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3357
3358 2012-08-12 Alan Modra <amodra@gmail.com>
3359
3360 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
3361 (glink insn constants): Use uint32_t.
3362 (Output_data_glink::add_entry): Use insert, not [] operator.
3363
3364 2012-08-11 Alan Modra <amodra@gmail.com>
3365
3366 * object.h (Sized_relobj_file::find_shdr): New function.
3367 (Sized_relobj_file::find_special_sections): New function.
3368 * object.cc (Sized_relobj_file::find_shdr): New function.
3369 (Sized_relobj_file::find_eh_frame): Use find_shdr.
3370 (Sized_relobj_file::find_special_sections): New function, split out..
3371 (Sized_relobj_file::do_read_symbols): ..from here.
3372 * output.h (Output_data_got::replace_constant): New function.
3373 (Output_data_got::num_entries): New function.
3374 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3375 (Output_data_got::got_offset): Protected rather than private.
3376 (Output_data_got::replace_got_entry): New function.
3377 * output.cc (Output_data_got::replace_got_entry): New function.
3378 * powerpc.cc (class Powerpc_relobj): New.
3379 (class Powerpc_relocate_functions): Delete all psymval variants or
3380 convert to value,addend type. Delete pcrela, pcrela_unaligned.
3381 Implement _ha functions using corresponding _hi function.
3382 (Powerpc_relobj::find_special_sections): New function.
3383 (Target_powerpc::do_make_elf_object): New function.
3384 (class Output_data_got_powerpc): New.
3385 (class Output_data_glink): New.
3386 (class Powerpc_scan_relocatable_reloc): New.
3387 Many more changes througout file.
3388
3389 2012-08-09 Nick Clifton <nickc@redhat.com>
3390
3391 * po/vi.po: Updated Vietnamese translation.
3392
3393 2012-08-07 Ian Lance Taylor <iant@google.com>
3394
3395 * layout.cc (Layout::add_target_dynamic_tags): If
3396 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3397 plt_rel.
3398
3399 2012-07-30 Nick Clifton <nickc@redhat.com>
3400
3401 * po/gold.pot: Updated template.
3402 * po/es.po: Updated Spanish translation.
3403
3404 2012-07-18 Cary Coutant <ccoutant@google.com>
3405
3406 PR gold/14344
3407 * configure.ac: Add check for -gpubnames support.
3408 * configure: Regenerate.
3409 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3410 support; force -gno-pubnames.
3411 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3412 support.
3413 (gdb_index_test_4): New test.
3414 * testsuite/Makefile.in: Regenerate.
3415 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3416 * testsuite/gdb_index_test_2.sh: Likewise.
3417 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3418 * testsuite/gdb_index_test_4.sh: New script.
3419 * testsuite/gdb_index_test_comm.sh: New script with common code;
3420 don't look for space after colon.
3421
3422 2012-07-16 Sriraman Tallam <tmsriram@google.com>
3423
3424 * gold.cc (queue_middle_tasks): Update function order only after
3425 deferred objects due to plugins are processed.
3426
3427 2012-07-11 Ian Lance Taylor <iant@google.com>
3428
3429 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3430 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3431 (Target_arm::scan_reloc_for_stub): Likewise.
3432 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3433 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3434 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3435 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3436 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3437
3438 2012-07-10 Dodji Seketeli <dodji@redhat.com>
3439 Ian Lance Taylor <iant@google.com>
3440
3441 PR gold/14309
3442 * configure.ac: Test whether std::tr1::hash<off_t> works.
3443 * gold.h: Add a specialization for std::tr1::hash<off_t> if
3444 needed.
3445 * output.h (class Output_fill): Add virtual destructor.
3446 * configure, config.in: Rebuild.
3447
3448 2012-06-22 Roland McGrath <mcgrathr@google.com>
3449
3450 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3451
3452 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
3453
3454 * plugin.cc (Plugin::load): Handle position independent executables.
3455
3456 2012-06-06 Cary Coutant <ccoutant@google.com>
3457
3458 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3459 add .debug_macro.
3460 (lines_only_debug_sections): Likewise.
3461 (gdb_fast_lookup_sections): New static array.
3462 (is_gdb_debug_section): Rename formal parameter.
3463 (is_lines_only_debug_section): Likewise.
3464 (is_gdb_fast_lookup_section): New function.
3465 (Layout::include_section): Check for ".zdebug_" prefix; pass
3466 section name suffix to is_gdb_debug_section, et al.; check for
3467 fast-lookup sections when building .gdb_index.
3468 * options.h (--strip-debug-gdb): Update GDB version number.
3469
3470 2012-06-06 Cary Coutant <ccoutant@google.com>
3471
3472 * configure.ac: Add check for fallocate.
3473 * configure: Regenerate.
3474 * config.in: Regenerate.
3475
3476 * options.h (class General_options): Add --mmap-output-file and
3477 --posix-fallocate options.
3478 * output.cc: (posix_fallocate): Remove; replace with...
3479 (gold_fallocate): New function.
3480 (Output_file::map_no_anonymous): Call gold_fallocate.
3481 (Output_file::map): Check --mmap-output-file option.
3482
3483 2012-06-05 Jing Yu <jingyu@google.com>
3484
3485 * gold.h (textdomain): Add do {} to empty while(0).
3486 (bindtextdomain): Likewise.
3487
3488 2012-06-04 Cary Coutant <ccoutant@google.com>
3489
3490 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3491 has_dynsym_index.
3492
3493 2012-05-25 Sriraman Tallam <tmsriram@google.com>
3494
3495 * symtab.cc (Symbol_table::define_special_symbol):
3496 Initialize *poldsym to prevent uninitialized variable errors.
3497
3498 2012-05-23 Cary Coutant <ccoutant@google.com>
3499
3500 * layout.cc (Layout::section_name_mapping): Add rules to handle
3501 exact match on .data.rel.ro.local or .data.rel.ro.
3502 (Layout::output_section_name): Check for exact matches.
3503
3504 2012-05-23 Cary Coutant <ccoutant@google.com>
3505
3506 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3507 more carefully.
3508
3509 2012-05-22 Cary Coutant <ccoutant@google.com>
3510
3511 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3512 object before exporting symbol.
3513
3514 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
3515
3516 * testsuite/tls_test.cc: Include "config.h" first.
3517 * testsuite/tls_test_c.c: Likewise.
3518
3519 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
3520 Nick Clifton <nickc@redhat.com>
3521
3522 PR 14072
3523 * configure.in: Add check that sysdep.h has been included before
3524 any system header files.
3525 * configure: Regenerate.
3526 * config.in: Regenerate.
3527
3528 2012-05-14 Cary Coutant <ccoutant@google.com>
3529
3530 * layout.cc (Layout::make_output_section): Mark .tdata section
3531 as RELRO.
3532 * testsuite/relro_test.cc: Add a TLS variable.
3533
3534 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
3535
3536 PR gold/14091
3537 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3538 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3539 R_X86_64_64.
3540
3541 2012-05-08 Cary Coutant <ccoutant@google.com>
3542
3543 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3544 (lines_only_debug_sections): Likewise.
3545
3546 2012-05-02 Roland McGrath <mcgrathr@google.com>
3547
3548 * nacl.cc: New file.
3549 * nacl.h: New file.
3550 * Makefile.am (CCFILES, HFILES): Add them.
3551 * Makefile.in: Regenerate.
3552 * i386.cc (Output_data_plt_i386_nacl): New class.
3553 (Output_data_plt_i386_nacl_exec): New class.
3554 (Output_data_plt_i386_nacl_dyn): New class.
3555 (Target_i386_nacl): New class.
3556 (Target_selector_i386_nacl): New class.
3557 (target_selector_i386): Use it instead of Target_selector_i386.
3558 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3559 (Target_x86_64_nacl): New class.
3560 (Target_selector_x86_64_nacl): New class.
3561 (target_selector_x86_64, target_selector_x32): Use it instead of
3562 Target_selector_x86_64.
3563 * arm.cc (Output_data_plt_arm_nacl): New class.
3564 (Target_arm_nacl): New class.
3565 (Target_selector_arm_nacl): New class.
3566 (target_selector_arm, target_selector_armbe): Use it instead of
3567 Target_selector_arm.
3568
3569 * target-select.cc (select_target): Take new Input_file* and off_t
3570 arguments, pass them on to recognize method of selector.
3571 * object.cc (make_elf_sized_object): Update caller.
3572 * parameters.cc (parameters_force_valid_target): Likewise.
3573 * incremental.cc (make_sized_incremental_binary): Likewise.
3574 * target-select.h: Update decl.
3575 (Target_selector::recognize): Take new Input_file* argument,
3576 pass it on to do_recognize.
3577 (Target_selector::do_recognize): Take new Input_file* argument.
3578 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3579 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3580 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3581 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3582
3583 * target.h (Target::Target_info): New members isolate_execinstr
3584 and rosegment_gap.
3585 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3586 * arm.cc (Target_arm::arm_info): Update initializer.
3587 * i386.cc (Target_i386::i386_info): Likewise.
3588 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3589 * sparc.cc (Target_sparc::sparc_info): Likewise.
3590 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3591 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3592 * layout.cc (Layout::attach_allocated_section_to_segment):
3593 Take new const Target* argument. If target->isolate_execinstr(), act
3594 like --rosegment.
3595 (Layout::find_first_load_seg): Take new const Target* argument;
3596 if target->isolate_execinstr(), reject PF_X segments.
3597 (Layout::relaxation_loop_body): Update caller.
3598 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3599 reset file offset to zero when we hit LOAD_SEG, and then do a second
3600 loop over the segments before LOAD_SEG to reassign offsets after
3601 addresses have been determined. Handle target->rosegment_gap().
3602 (Layout::attach_section_to_segment): Take new const Target* argument;
3603 pass it to attach_allocated_section_to_segment.
3604 (Layout::make_output_section): Update caller.
3605 (Layout::attach_sections_to_segments): Take new const Target* argument;
3606 pass it to attach_section_to_segment.
3607 * gold.cc (queue_middle_tasks): Update caller.
3608 * layout.h (Layout): Update method decls with new arguments.
3609
3610 * arm.cc (Target_arm::Target_arm): Take optional argument for the
3611 Target_info pointer to use.
3612 (Target_arm::do_make_data_plt): New virtual method.
3613 (Target_arm::make_data_plt): New method that calls it.
3614 (Target_arm::make_plt_entry): Use it.
3615 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3616 for the section alignment.
3617 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3618 method.
3619 (Output_data_plt_arm::first_plt_entry_offset): Call it.
3620 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3621 method.
3622 (Output_data_plt_arm::get_plt_entry_size): Call it.
3623 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3624 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3625 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3626 method.
3627 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3628 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3629 method instead of sizeof(plt_entry).
3630 (Output_data_plt_arm::add_entry): Likewise.
3631 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3632 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3633 than static method.
3634 (Target_arm::plt_entry_size): Likewise.
3635 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3636 Move to ...
3637 (Output_data_plt_arm_standard): ... here, new class.
3638 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3639 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3640 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3641
3642 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3643 Take additional argument for the PLT entry size.
3644 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3645 Use get_plt_entry_size method rather than plt_entry_size variable.
3646 (Output_data_plt_x86_64::reserve_slot): Likewise.
3647 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3648 (Output_data_plt_x86_64::add_entry): Likewise.
3649 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3650 (Output_data_plt_x86_64::address_for_global): Likewise.
3651 (Output_data_plt_x86_64::address_for_local): Likewise.
3652 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3653 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3654 Make method non-static.
3655 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3656 method.
3657 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3658 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3659 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3660 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3661 virtual method.
3662 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3663 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3664 virtual method.
3665 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3666 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3667 virtual method.
3668 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3669 (Output_data_plt_x86_64::plt_entry_size)
3670 (Output_data_plt_x86_64::first_plt_entry)
3671 (Output_data_plt_x86_64::plt_entry)
3672 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3673 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3674 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3675 (Output_data_plt_x86_64_standard): ... here, new class.
3676 (Target_x86_64::Target_x86_64): Take optional argument for the
3677 Target_info pointer to use.
3678 (Target_x86_64::do_make_data_plt): New virtual method.
3679 (Target_x86_64::make_data_plt): New method to call it.
3680 (Target_x86_64::init_got_plt_for_update): Use that.
3681 Call this->plt_->add_eh_frame method here.
3682 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3683 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3684 rather than static method.
3685 (Target_x86_64::plt_entry_size): Likewise.
3686 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3687 rather than plt_entry_size variable. Move guts of PLT filling to...
3688 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3689 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3690 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3691
3692 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3693 additional argument for the section alignment.
3694 Don't do add_eh_frame_for_plt here.
3695 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3696 non-static. Use get_plt_entry_size method rather than plt_entry_size
3697 variable.
3698 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3699 method.
3700 (Output_data_plt_i386::get_plt_entry_size): Call it.
3701 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3702 (Output_data_plt_i386::add_eh_frame): New method to call it.
3703 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3704 method.
3705 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3706 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3707 method.
3708 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3709 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3710 method instead of plt_entry_size.
3711 (Output_data_plt_i386::plt_entry_size)
3712 (Output_data_plt_i386::plt_eh_frame_fde_size)
3713 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3714 (Output_data_plt_i386_standard): ... here, new class.
3715 (Output_data_plt_i386_exec): New class.
3716 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3717 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3718 (Output_data_plt_i386::exec_plt_entry): Move to ...
3719 (Output_data_plt_i386_exec::plt_entry): ... here.
3720 (Output_data_plt_i386_dyn): New class.
3721 (Output_data_plt_i386::first_plt_entry): Move to ...
3722 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3723 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3724 (Output_data_plt_i386_dyn::plt_entry): ... here.
3725 (Target_i386::Target_i386): Take optional argument for the Target_info
3726 pointer to use.
3727 (Target_i386::do_make_data_plt): New virtual method.
3728 (Target_i386::make_data_plt): New method to call it.
3729 (Target_i386::make_plt_section): Use that.
3730 Call this->plt_->add_eh_frame method here.
3731 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3732 rather than plt_entry_size variable.
3733 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3734 (Output_data_plt_i386::address_for_local): Likewise.
3735 (Output_data_plt_i386::do_write): Likewise.
3736 Move guts of PLT filling to...
3737 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3738 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3739 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3740 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3741
3742 2012-05-01 Cary Coutant <ccoutant@google.com>
3743
3744 * dwarf_reader.cc (Dwarf_die::read_attributes)
3745 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3746 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3747 * reduced_debug_output.cc
3748 (Output_reduced_debug_info_section::get_die_end): Remove
3749 DW_FORM_GNU_ref_index. Add default case.
3750
3751 2012-04-26 Mark Wielaard <mjw@redhat.com>
3752
3753 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3754 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3755 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3756 DW_AT_high_pc as offset from DW_AT_low_pc.
3757
3758 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3759 * testsuite/Makefile.in: Regenerate.
3760 * testsuite/gdb_index_test_3.c: New test source file.
3761 * testsuite/gdb_index_test_3.sh: New test source file.
3762
3763 2012-04-25 Ian Lance Taylor <iant@google.com>
3764
3765 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3766 pointer.
3767 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3768 as a class, not a struct.
3769 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3770 (Target_arm::apply_cortex_a8_workaround): Likewise.
3771 * gc.h: Declare Reloc_types as a struct, not a class.
3772 * object.h: Declare Symbols_data as a struct.
3773 * reloc.h: Declare Read_relocs_data as a struct.
3774 * target.h: Declare Relocate_info as a struct.
3775
3776 2012-04-24 David S. Miller <davem@davemloft.net>
3777
3778 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3779 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3780 and R_SPARC_WPLT30.
3781
3782 2012-04-24 Cary Coutant <ccoutant@google.com>
3783
3784 * incremental-dump.cc (find_input_containing_global): Replace
3785 magic number with symbolic constant.
3786 (dump_incremental_inputs): Update version number.
3787 * incremental.cc (Output_section_incremental_inputs): Update version
3788 number; import symbolic constants from Incremental_inputs_reader.
3789 (Incremental_inputs::create_data_sections): Align relocations
3790 section correctly for 64-bit targets.
3791 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3792 constants; add padding.
3793 (Output_section_incremental_inputs::write_header): Add assert for
3794 header_size.
3795 (Output_section_incremental_inputs::write_input_files): Add assert
3796 for input_entry_size.
3797 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3798 add assert for object_info_size, input_section_entry_size,
3799 global_sym_entry_size.
3800 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3801 for data structure sizes; use them.
3802 (Incremental_input_entry_reader): Import symbolic constants from
3803 Incremental_inputs_reader; use them.
3804
3805 2012-04-23 David S. Miller <davem@davemloft.net>
3806
3807 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3808 and elf_flags_set_.
3809 (Target_sparc::Target_sparc): Initialize new fields.
3810 (Target_sparc::do_make_elf_object): New function.
3811 (Target_sparc::do_adjust_elf_header): New function.
3812
3813 2012-04-23 Cary Coutant <ccoutant@google.com>
3814
3815 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3816 CU range table of gdb index.
3817
3818 2012-04-20 David S. Miller <davem@davemloft.net>
3819
3820 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3821 instead of false.
3822
3823 2012-04-16 David S. Miller <davem@davemloft.net>
3824
3825 * sparc.cc (Target_sparc::got_address): New function.
3826 (Sparc_relocate_functions::gdop_hix22): New function.
3827 (Sparc_relocate_functions::gdop_lox10): New function.
3828 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3829 relocs.
3830 (Target_sparc::Scan::local): Likewise if the global symbol is not
3831 preemptible and is not IFUNC.
3832 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3833 transformations for local and non-preemptible non-IFUNC global
3834 symbols.
3835
3836 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3837 writing out 64-bit part of ranges.
3838
3839 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3840 -fpic and -fpie respectively.
3841 * Makefile.in: Regenerate.
3842
3843 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3844 (Target_sparc::Target_sparc): Initialize new field.
3845 (Target_sparc::do_plt_section_for_global): New function.
3846 (Target_sparc::do_plt_section_for_local): New function.
3847 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3848 (Target_sparc::make_plt_section): New function, broken out of
3849 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3850 (Target_sparc::make_plt_entry): Call make_plt_section.
3851 (Target_sparc::make_local_ifunc_plt_entry): New function.
3852 (Target_sparc::rela_ifunc_section): New function.
3853 (Target_sparc::plt_section): Remove const.
3854 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3855 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3856 and ifunc_count_ fields.
3857 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3858 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3859 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3860 (Output_data_plt_sparc::rela_ifunc): New function.
3861 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3862 (Output_data_plt_sparc::has_ifunc_section): New function.
3863 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3864 (Output_data_plt_sparc::address_for_global): New function.
3865 (Output_data_plt_sparc::address_for_local): New function.
3866 (Output_data_plt_sparc::plt_index_to_offset): New function.
3867 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3868 and entry_count.
3869 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3870 entry_count.
3871 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3872 R_SPARC_JMP_IREL to switch.
3873 (Target_sparc::Scan::check_non_pic): Likewise.
3874 (Target_sparc::Scan::local): Handle IFUNC symbols.
3875 (Target_sparc::Scan::local): Likewise.
3876 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3877 and plt_address_for_local.
3878 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3879 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3880
3881 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3882 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3883 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3884 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3885 global relocs too.
3886 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3887 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3888 calls.
3889 * sparc.cc (Target_sparc::Scan::global): Likewise.
3890 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3891
3892 2012-04-16 Cary Coutant <ccoutant@google.com>
3893
3894 * archive.cc (Library_base::should_include_member): Check for
3895 --export-dynamic-symbol.
3896 * options.h (class General_options): Add --export-dynamic-symbol.
3897 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3898 --export-dynamic-symbol.
3899 (Symbol_table::gc_mark_undef_symbols): Likewise.
3900 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3901
3902 2012-04-12 David S. Miller <davem@davemloft.net>
3903
3904 * sparc.cc (Reloc::wdisp10): New relocation method.
3905 (Reloc::h34): Likewise.
3906 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3907 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3908 R_SPARC_WDISP10.
3909 (Target_sparc::Scan::local): Likewise.
3910 (Target_sparc::Scan::global): Likewise.
3911 (Target_sparc::Relocate::relocate): Likewise.
3912
3913 2012-04-09 Cary Coutant <ccoutant@google.com>
3914
3915 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3916 low_pc == 0.
3917
3918 2012-04-06 Ian Lance Taylor <iant@google.com>
3919
3920 * timer.cc: #include <unistd.h>.
3921
3922 2012-04-06 Roland McGrath <mcgrathr@google.com>
3923
3924 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3925 * config.in: Regenerate.
3926 * configure: Regenerate.
3927
3928 2012-04-05 Nick Clifton <nickc@redhat.com>
3929
3930 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3931 (AM_LC_MESSAGES): Add.
3932 * aclocal.m4: Regenerate.
3933 * config.in: Regenerate.
3934 * configure: Regenerate.
3935
3936 2012-03-21 Cary Coutant <ccoutant@google.com>
3937
3938 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3939 * Makefile.in: Regenerate.
3940 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3941 (Sized_elf_reloc_mapper::symbol_section): New function.
3942 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3943 (make_elf_reloc_mapper): New function.
3944 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3945 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3946 (Dwarf_abbrev_table::do_get_abbrev): New function.
3947 (Dwarf_ranges_table::read_ranges_table): New function.
3948 (Dwarf_ranges_table::read_range_list): New function.
3949 (Dwarf_pubnames_table::read_section): New function.
3950 (Dwarf_pubnames_table::read_header): New function.
3951 (Dwarf_pubnames_table::next_name): New function.
3952 (Dwarf_die::Dwarf_die): New function.
3953 (Dwarf_die::read_attributes): New function.
3954 (Dwarf_die::skip_attributes): New function.
3955 (Dwarf_die::set_name): New function.
3956 (Dwarf_die::set_linkage_name): New function.
3957 (Dwarf_die::attribute): New function.
3958 (Dwarf_die::string_attribute): New function.
3959 (Dwarf_die::int_attribute): New function.
3960 (Dwarf_die::uint_attribute): New function.
3961 (Dwarf_die::ref_attribute): New function.
3962 (Dwarf_die::child_offset): New function.
3963 (Dwarf_die::sibling_offset): New function.
3964 (Dwarf_info_reader::check_buffer): New function.
3965 (Dwarf_info_reader::parse): New function.
3966 (Dwarf_info_reader::do_parse): New function.
3967 (Dwarf_info_reader::do_read_string_table): New function.
3968 (Dwarf_info_reader::lookup_reloc): New function.
3969 (Dwarf_info_reader::get_string): New function.
3970 (Dwarf_info_reader::visit_compilation_unit): New function.
3971 (Dwarf_info_reader::visit_type_unit): New function.
3972 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3973 Sized_elf_reloc_mapper.
3974 (Sized_dwarf_line_info::symbol_section): Remove function.
3975 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3976 (Sized_dwarf_line_info::read_line_mappings): Remove object
3977 parameter, adjust callers.
3978 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3979 * dwarf_reader.h: Include <sys/types.h>.
3980 (class Track_relocs): Remove forward declaration.
3981 (class Elf_reloc_mapper): New class.
3982 (class Sized_elf_reloc_mapper): New class.
3983 (class Dwarf_abbrev_table): New class.
3984 (class Dwarf_range_list): New class.
3985 (class Dwarf_ranges_table): New class.
3986 (class Dwarf_pubnames_table): New class.
3987 (class Dwarf_die): New class.
3988 (class Dwarf_info_reader): New class.
3989 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3990 (Sized_dwarf_line_info::symbol_section): Remove member function.
3991 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3992 base class.
3993 * gdb-index.cc: New source file.
3994 * gdb-index.h: New source file.
3995 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3996 and .debug_types sections, call Layout::add_to_gdb_index.
3997 (Sized_relobj_incr::do_section_name): Implement.
3998 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3999 return type; Implement.
4000 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4001 return type.
4002 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4003 parameter list and return type.
4004 (Sized_incr_dynobj::do_section_contents): Likewise.
4005 * layout.cc: Include gdb-index.h.
4006 (Layout::Layout): Initialize gdb_index_data_.
4007 (Layout::init_fixed_output_section): Check for .gdb_index section.
4008 (Layout::add_to_gdb_index): New function. Instantiate.
4009 * layout.h: Add forward declaration for class Gdb_index.
4010 (Layout::add_to_gdb_index): New member function.
4011 (Layout::gdb_index_data_): New data member.
4012 * main.cc: Include gdb-index.h.
4013 (main): Print statistics for gdb index.
4014 * object.cc (Object::section_contents): Move code into
4015 do_section_contents.
4016 (need_decompressed_section): Check for sections needed when building
4017 gdb index.
4018 (build_compressed_section_map): Likewise.
4019 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4020 gdb index.
4021 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4022 sections; call Layout::add_to_gdb_index.
4023 (Sized_relobj_file::do_decompressed_section_contents): Call
4024 do_section_contents directly.
4025 * object.h (Object::do_section_contents): Adjust parameter list and
4026 return type.
4027 (Object::do_decompressed_section_contents): Call do_section_contents
4028 directly.
4029 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4030 return type.
4031 * options.h (class General_options): Add --gdb-index option.
4032 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4033 list and return type.
4034 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4035 * reloc.h (Track_relocs::checkpoint): New function.
4036 (Track_relocs::reset): New function.
4037
4038 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4039 New test cases.
4040 * testsuite/Makefile.in: Regenerate.
4041 * testsuite/gdb_index_test.cc: New test source file.
4042 * testsuite/gdb_index_test_1.sh: New test source file.
4043 * testsuite/gdb_index_test_2.sh: New test source file.
4044
4045 2012-03-19 Doug Kwan <dougkwan@google.com>
4046
4047 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4048 (Target_arm::do_finalize_sections): Remove code which defines
4049 __exidx_start and __exidx_end. Make symbol table parameter
4050 anonymous as it is not used.
4051 * gold.cc (queue_middle_tasks): Call target hook to define any
4052 target-specific symbols.
4053 * target.h (Target::define_standard_symbols): New method.
4054 (Target::do_define_standard_symbols): Same.
4055 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4056 * testsuite/Makefile.in: Regenerate.
4057 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4058 and __exidx_end.
4059 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4060 relocations are generated for __exidx_start and __exidx_end.
4061
4062 2012-03-16 Doug Kwan <dougkwan@google.com>
4063
4064 * testsuite/Makefile.am: Disable test initpri3b.
4065 * testsuite/Makefile.in: Regenerate.
4066
4067 2012-03-15 Doug Kwan <dougkwan@google.com>
4068
4069 * arm.cc (Target_arm::got_section): Make .got section read-only
4070 if -z now is given.
4071
4072 2012-03-15 Ian Lance Taylor <iant@google.com>
4073
4074 PR gold/13850
4075 * layout.cc (Layout::make_output_section): Correctly mark
4076 SHT_INIT_ARRAY, et. al., as relro.
4077
4078 2012-03-14 Doug Kwan <dougkwan@google.com>
4079
4080 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4081 dynamic relocations for protected symbols in shared objects.
4082
4083 2012-03-13 Ian Lance Taylor <iant@google.com>
4084
4085 * resolve.cc (Symbol_table::resolve): When merging common symbols,
4086 keep the larger alignment.
4087
4088 2012-03-12 Cary Coutant <ccoutant@google.com>
4089
4090 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4091 handling of DW_LNE_define_file.
4092
4093 2012-03-12 Cary Coutant <ccoutant@google.com>
4094
4095 * reduced_debug_output.cc
4096 (Output_reduced_debug_info_section::get_die_end): Add new FORM
4097 codes to switch.
4098
4099 2012-02-29 Cary Coutant <ccoutant@google.com>
4100
4101 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4102
4103 2012-02-29 Cary Coutant <ccoutant@google.com>
4104
4105 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4106 Call Object::decompressed_section_contents.
4107 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4108 New dtor.
4109 (Sized_dwarf_line_info::buffer_start_): New data member.
4110 * merge.cc (Output_merge_data::do_add_input_section): Call
4111 Object::decompressed_section_contents.
4112 (Output_merge_string::do_add_input_section): Likewise.
4113 * object.cc (need_decompressed_section): New function.
4114 (build_compressed_section_map): Decompress sections needed later.
4115 (Sized_relobj_file::do_decompressed_section_contents): New function.
4116 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4117 * object.h (Object::decompressed_section_contents): New function.
4118 (Object::discard_decompressed_sections): New function.
4119 (Object::do_decompressed_section_contents): New function.
4120 (Object::do_discard_decompressed_sections): New function.
4121 (Compressed_section_info): New type.
4122 (Compressed_section_map): Include decompressed section contents.
4123 (Sized_relobj_file::do_decompressed_section_contents): New function.
4124 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4125
4126 2012-02-16 Cary Coutant <ccoutant@google.com>
4127
4128 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4129 * testsuite/Makefile.in: Regenerate.
4130
4131 2012-02-14 Cary Coutant <ccoutant@google.com>
4132
4133 * options.cc (General_options::finalize): Disallow -pie and -static.
4134
4135 2012-02-03 Doug Kwan <dougkwan@google.com>
4136
4137 * arm.cc (Arm_relocate_functions::abs8,
4138 Arm_relocate_functions::abs16): Use
4139 Bits::has_signed_unsigned_overflow32.
4140 (Arm_relocate_functions::thm_abs8): Correct range of
4141 overflow check.
4142 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4143 in assertions.
4144
4145 2012-02-02 Doug Kwan <dougkwan@google.com>
4146
4147 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4148 position independent outputs, not just shared objects.
4149
4150 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
4151
4152 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4153 * configure: Regenerated.
4154
4155 2012-01-27 Ian Lance Taylor <iant@google.com>
4156
4157 * reloc.h (Bits): New class with static functions, copied from
4158 namespace utils in arm.cc.
4159 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
4160 instead.
4161
4162 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4163
4164 * incremental.cc (write_info_blocks): Correct relocation offset.
4165
4166 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4167
4168 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4169 (Relocate::tls_gd_to_le): Likewise.
4170
4171 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4172
4173 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4174
4175 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4176
4177 * configure.ac: Check if -mcmodel=medium works.
4178 * configure: Regenerated.
4179
4180 2012-01-24 Cary Coutant <ccoutant@google.com>
4181
4182 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4183 definition and ...
4184 (read_unsigned_LEB_128_x): ... this new function.
4185 (read_signed_LEB_128): Replaced with inline definition and ...
4186 (read_signed_LEB_128_x): ... this new function.
4187 * int_encoding.h (read_unsigned_LEB_128_x): New function.
4188 (read_unsigned_LEB_128): Add inline definition.
4189 (read_signed_LEB_128_x): New function.
4190 (read_signed_LEB_128): Add inline definition.
4191 * testsuite/Makefile.am (leb128_unittest): New unit test.
4192 * testsuite/Makefile.in: Regenerate.
4193 * testsuite/leb128_unittest.cc: New unit test.
4194
4195 2012-01-23 Ian Lance Taylor <iant@google.com>
4196
4197 PR gold/13617
4198 * i386.cc (Target_i386::do_code_fill): When using a jmp
4199 instruction, pad with nop instructions.
4200 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4201
4202 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
4203
4204 * x86_64.cc (gc_process_relocs): Add typename on types used in
4205 template.
4206 (scan_relocs): Likewise.
4207 (relocate_section): Likewise.
4208 (apply_relocation): Likewise.
4209
4210 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
4211
4212 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4213 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4214 under x32.
4215
4216 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
4217
4218 * x86_64.cc: Initial support for x32.
4219
4220 2012-01-03 Cary Coutant <ccoutant@google.com>
4221
4222 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4223 Use abstract base class for GOT.
4224 * gold/output.h (class Output_data_got_base): New abstract base class.
4225 (class Output_data_got): Derive from new base class, adjust ctors.
4226 (Output_data_got::reserve_slot): Make virtual; rename to
4227 do_reserve_slot; Adjust callers.
4228 * gold/target.h (Sized_target::init_got_plt_for_update): Return
4229 pointer to abstract base class.
4230 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4231
4232 2011-12-18 Ian Lance Taylor <iant@google.com>
4233
4234 * object.h (Relobj::local_symbol_value): New function.
4235 (Relobj::local_plt_offset): New function.
4236 (Relobj::local_has_got_offset): New function.
4237 (Relobj::local_got_offset): New function.
4238 (Relobj::set_local_got_offset): New function.
4239 (Relobj::do_local_symbol_value): New pure virtual function.
4240 (Relobj::do_local_plt_offset): Likewise.
4241 (Relobj::do_local_has_got_offset): Likewise.
4242 (Relobj::do_local_got_offset): Likewise.
4243 (Relobj::do_set_local_got_offset): Likewise.
4244 (Sized_relobj::do_local_has_got_offset): Rename from
4245 local_has_got_offset.
4246 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4247 (Sized_relobj::do_set_local_got_offset): Rename from
4248 set_local_got_offset.
4249 (Sized_relobj_file::do_local_plt_offset): Rename from
4250 local_plt_offset.
4251 (Sized_relobj_file::do_local_symbol_value): New function.
4252 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4253 local_plt_offset.
4254 * output.cc (Output_data_got::Got_entry::write): Change object to
4255 Relobj. Use local_symbol_value.
4256 (Output_data_got::add_global_with_rel): Change rel_dyn to
4257 Output_data_reloc_generic*. Use add_global_generic.
4258 (Output_data_got::add_global_with_rela): Remove. Change all
4259 callers to use add_global_with_rel.
4260 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4261 Output_data_reloc_generic*. Use add_global_generic.
4262 (Output_data_got::add_global_pair_with_rela): Remove. Change all
4263 callers to use add_global_pair_with_rel.
4264 (Output_data_got::add_local): Change object to Relobj*.
4265 (Output_data_got::add_local_plt): Likewise.
4266 (Output_data_got::add_local_with_rel): Change object to Relobj*,
4267 change rel_dyn to Output_data_reloc_generic*. Use
4268 add_local_generic.
4269 (Output_data_got::add_local_with_rela): Remove. Change all
4270 callers to use all_local_with_rel.
4271 (Output_data_got::add_local_pair_with_rel): Change object to
4272 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
4273 add_output_section_generic.
4274 (Output_data_got::add_local_pair_with_rela): Remove. Change all
4275 callers to use add_local_pair_with_rel.
4276 (Output_data_got::reserve_local): Change object to Relobj*.
4277 * output.h: (class Output_data_reloc_generic): Add pure virtual
4278 declarations for add_global_generic, add_local_generic,
4279 add_output_section_generic.
4280 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4281 functions for Output_data_reloc_generic. Update declarations for
4282 changes listed in output.cc.
4283 (class Output_data_got): Change template parameter to got_size.
4284 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
4285 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4286 function.
4287 (Sized_relobj_incr::do_local_plt_offset): New function.
4288 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4289 add_global_generic.
4290
4291 2011-12-17 Cary Coutant <ccoutant@google.com>
4292
4293 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4294 * resolve.cc (Symbol_table::resolve): Likewise.
4295 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4296 arrays.
4297 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4298
4299 2011-12-16 Ian Lance Taylor <iant@google.com>
4300
4301 * output.h (Output_data_reloc_generic::add): Only call
4302 add_dynamic_reloc if this is a dynamic reloc section.
4303
4304 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
4305
4306 PR gold/13505
4307 * target-reloc.h (apply_relocation): Replace <64, false> with
4308 <size, big_endian>.
4309
4310 2011-11-25 Nick Clifton <nickc@redhat.com>
4311
4312 * po/it.po: New Italian translation.
4313
4314 2011-11-17 Sterling Augustine <saugustine@google.com>
4315
4316 * script.cc (script_include_directive): Implement.
4317 (read_script_file): New local variables name and search_path. Update
4318 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4319 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4320 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4321
4322 2011-11-11 Sterling Augustine <saugustine@google.com>
4323
4324 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4325 (file_or_sections_cmd): Likewise.
4326
4327 2011-11-11 Doug Kwan <dougkwan@google.com>
4328
4329 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4330 if --just-symbols is given.
4331
4332 2011-11-10 Doug Kwan <dougkwan@google.com>
4333
4334 PR gold/13362
4335 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4336 when processing data relocs.
4337 * reloc.h (Relocate_functions::rel_unaligned): New method.
4338 (Relocate_functions::pcrel_unaligned): Ditto.
4339 (Relocate_functions::rel32_unaligned): Ditto.
4340 (Relocate_functions::pcrel32_unaligned): Ditto.
4341
4342 2011-11-09 Doug Kwan <dougkwan@google.com>
4343
4344 PR gold/13362
4345 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4346 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4347 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4348 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4349 (Relocate_functions::rel_unaligned): New.
4350 (Relocate_functions::rel32_unaligned): New.
4351 * target-reloc.h (relocate_for_relocatable): Add code to handle
4352 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4353 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4354 arm_unaligned_reloc_r): New targets.
4355 * testsuite/Makefile.in: Regenerate.
4356 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4357 linking.
4358
4359 2011-11-02 Ian Lance Taylor <iant@google.com>
4360
4361 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
4362 NATIVE_LINKER.
4363 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4364 * options.cc (General_options::finalize): Use library search path
4365 from configure script if specified. If not native and no sysroot,
4366 only search TOOLLIBDIR.
4367 * options.h (Search_directory::Search_directory): Change name to
4368 const std::string&.
4369 (General_options::add_to_library_path_with_sysroot): Change arg to
4370 const std::string&.
4371 * configure, Makefile.in, config.in: Rebuild.
4372
4373 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4374
4375 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4376 we are working around the ARM1176 Erratum.
4377 * options.h (General_options::fix_arm1176): Add option.
4378 * testsuite/Makefile.am: Add testcases, and keep current ones
4379 working.
4380 * testsuite/Makefile.in: Regenerate.
4381 * testsuite/arm_fix_1176.s: New file.
4382 * testsuite/arm_fix_1176.sh: Likewise.
4383
4384 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4385
4386 * arm.cc (Target_arm::Target_arm): Remove initialisation of
4387 may_use_blx_.
4388 (Target_arm::may_use_blx): Remove method.
4389 (Target_arm::set_may_use_blx): Likewise.
4390 (Target_arm::may_use_v4t_interworking): New method.
4391 (Target_arm::may_use_v5t_interworking): Likewise.
4392 (Target_arm::may_use_blx_): Remove member variable.
4393 (Arm_relocate_functions::arm_branch_common): Check for v5T
4394 interworking.
4395 (Arm_relocate_functions::thumb_branch_common): Likewise.
4396 (Reloc_stub::stub_type_for_reloc): Likewise.
4397 (Target_arm::do_finalize_sections): Correct interworking checks.
4398 * testsuite/Makefile.am: Add new tests.
4399 * testsuite/Makefile.in: Regenerate.
4400 * testsuite/arm_farcall_arm_arm.s: New test.
4401 * testsuite/arm_farcall_arm_arm.sh: Likewise.
4402 * testsuite/arm_farcall_arm_thumb.s: Likewise.
4403 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4404 * testsuite/arm_farcall_thumb_arm.s: Likewise.
4405 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4406 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4407 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4408
4409 2011-10-31 Cary Coutant <ccoutant@google.com>
4410
4411 PR gold/13023
4412 * expression.cc (Expression::eval_with_dot): Add
4413 is_section_dot_assignment parameter.
4414 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
4415 absolute and assigning to dot within a section.
4416 * script-sections.cc
4417 (Output_section_element_assignment::set_section_addresses): Pass
4418 dot_section to set_if_absolute.
4419 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4420 as is_section_dot_assignment flag to eval_with_dot.
4421 (Output_section_element_dot_assignment::set_section_addresses):
4422 Likewise.
4423 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4424 parameter. Also set value if relative to dot_section; set the
4425 symbol's output_section.
4426 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4427 parameter. Adjust all callers.
4428 (Expression::eval_maybe_dot): Likewise.
4429 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4430 Adjust all callers.
4431 * testsuite/script_test_2.t: Test assignment of an absolute value
4432 to dot within an output section element.
4433
4434 2011-10-31 Cary Coutant <ccoutant@google.com>
4435
4436 * options.h (class General_options): Add --[no-]gnu-unique options.
4437 * symtab.cc (Symbol_table::sized_write_globals): Convert
4438 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4439
4440 2011-10-31 Cary Coutant <ccoutant@google.com>
4441
4442 PR gold/13359
4443 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4444 unnecessary assertion.
4445 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4446
4447 2011-10-31 Sriraman Tallam <tmsriram@google.com>
4448
4449 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4450 gc_mark_symbol.
4451 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4452 gc_mark_symbol.
4453 Change to just keep the section associated with symbol.
4454 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4455 they are externally visible and --export-dynamic is turned on.
4456 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4457
4458 2011-10-19 Ian Lance Taylor <iant@google.com>
4459
4460 PR gold/13163
4461 * script-sections.cc
4462 (Output_section_element_dot_assignment::needs_output_section): New
4463 function.
4464
4465 2011-10-19 Ian Lance Taylor <iant@google.com>
4466
4467 PR gold/13204
4468 * layout.cc (Layout::segment_precedes): Don't assert failure if a
4469 --section-start option was seen.
4470 * options.h (General_options::any_section_start): New function.
4471
4472 2011-10-18 David S. Miller <davem@davemloft.net>
4473
4474 PR binutils/13301
4475 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4476 member to track relocation locations that have moved during TLS
4477 reloc optimizations.
4478 (Target_sparc::Relocate::Relocate): Initialize to NULL.
4479 (Target_sparc::Relocate::relocate): Adjust view down by 4
4480 bytes if it matches reloc_adjust_addr_.
4481 (Target_sparc::Relocate::relocate_tls): Always move the
4482 __tls_get_addr call delay slot instruction forward 4 bytes when
4483 performing relaxation.
4484
4485 2011-10-18 Cary Coutant <ccoutant@google.com>
4486
4487 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4488 (Output_file::map_no_anonymous): Check for non-zero
4489 return code from posix_fallocate.
4490
4491 2011-10-17 Cary Coutant <ccoutant@google.com>
4492
4493 PR gold/13245
4494 * plugin.cc (is_visible_from_outside): Check for symbols
4495 referenced from dynamic objects.
4496 * resolve.cc (Symbol_table::resolve): Don't count references
4497 from dynamic objects as references from real ELF files.
4498 * testsuite/plugin_test_2.sh: Adjust expected result.
4499
4500 2011-10-17 Cary Coutant <ccoutant@google.com>
4501
4502 * gold.cc: Include timer.h.
4503 (queue_middle_tasks): Stamp time.
4504 (queue_final_tasks): Likewise.
4505 * main.cc (main): Store timer in parameters. Print timers
4506 for each pass.
4507 * parameters.cc (Parameters::Parameters): Initialize timer_.
4508 (Parameters::set_timer): New function.
4509 (set_parameters_timer): New function.
4510 * parameters.h (Parameters::set_timer): New function.
4511 (Parameters::timer): New function.
4512 (Parameters::timer_): New data member.
4513 (set_parameters_timer): New function.
4514 * timer.cc (Timer::stamp): New function.
4515 (Timer::get_pass_time): New function.
4516 * timer.h (Timer::stamp): New function.
4517 (Timer::get_pass_time): New function.
4518 (Timer::pass_times_): New data member.
4519
4520 2011-10-17 Cary Coutant <ccoutant@google.com>
4521
4522 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4523 task for members of lib groups.
4524
4525 2011-10-17 Cary Coutant <ccoutant@google.com>
4526
4527 PR gold/13288
4528 * fileread.cc (File_read::find_view): Add assert.
4529 (File_read::make_view): Move bounds check (replace with assert)...
4530 (File_read::find_or_make_view): ... to here.
4531
4532 2011-10-12 Cary Coutant <ccoutant@google.com>
4533
4534 * output.cc (Output_file::open_base_file): Handle case where
4535 ::read returns less than requested size.
4536
4537 2011-10-10 Cary Coutant <ccoutant@google.com>
4538
4539 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4540 Initialize defined_count_.
4541 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4542 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4543 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4544 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4545 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4546 * incremental.h (Sized_relobj_incr::defined_count_): New data
4547 member.
4548 (Sized_incr_dynobj::defined_count_): New data member.
4549 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4550 Return zeroes instead of internal error.
4551
4552 2011-10-10 Cary Coutant <ccoutant@google.com>
4553
4554 PR gold/13249
4555 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4556 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4557 * output.h (class Output_reloc): Add use_plt_offset flag.
4558 (Output_reloc::type_): Adjust size of bit field.
4559 (Output_reloc::use_plt_offset_): New bit field.
4560 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4561 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4562 flag. Adjust all callers.
4563 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4564 creating RELATIVE relocations.
4565
4566 2011-10-10 Nick Clifton <nickc@redhat.com>
4567
4568 * po/es.po: Updated Spanish translation.
4569 * po/fi.po: Updated Finnish translation.
4570
4571 2011-10-03 Diego Novillo <dnovillo@google.com>
4572
4573 * options.cc (parse_uint): Fix dereference of RETVAL.
4574
4575 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4576
4577 * layout.h (section_order_map_): New member.
4578 (get_section_order_map): New member function.
4579 * output.cc (Output_section::add_input_section): Check for patterns
4580 only when --section-ordering-file is specified.
4581 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4582 output_sections have been formed.
4583 * layout.cc (Layout_Layout): Initialize section_order_map_.
4584 * plugin.cc (update_section_order): Store order in order_map. Do not
4585 update the order.
4586 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4587 * testsuite/Makefile.in: Regenerate.
4588 * testsuite/plugin_section_order.c: New file.
4589 * testsuite/plugin_final_layout.cc: New file.
4590 * testsuite/plugin_final_layout.sh: New file.
4591
4592 2011-09-29 Cary Coutant <ccoutant@google.com>
4593
4594 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4595 Check for NULL.
4596 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4597 symbols during incremental update.
4598 (Symbol_table::add_from_dynobj): Likewise.
4599
4600 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4601 Ian Lance Taylor <iant@google.com>
4602
4603 * symtab.cc (Symbol_table::define_special_symbol): Always
4604 canonicalize version string.
4605
4606 2011-09-26 Cary Coutant <ccoutant@google.com>
4607
4608 * gold.cc (queue_initial_tasks): Move option checks ...
4609 * options.cc (General_options::finalize): ... to here. Disable
4610 some options; make others fatal.
4611
4612 2011-09-26 Cary Coutant <ccoutant@google.com>
4613
4614 gcc PR lto/47247
4615 * plugin.cc (get_symbols_v2): New function.
4616 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4617 (is_referenced_from_outside): New function.
4618 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4619 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4620 (get_symbols): Pass version parameter.
4621 (get_symbols_v2): New function.
4622 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4623 parameter.
4624 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4625 (onload): Add LDPT_GET_SYMBOLS_V2.
4626 (all_symbols_read_hook): Use get_symbols_v2; check for
4627 LDPR_PREVAILING_DEF_IRONLY_EXP.
4628 * testsuite/plugin_test_3.sh: Update expected results.
4629
4630 2011-09-23 Simon Baldwin <simonb@google.com>
4631
4632 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4633 configuration options.
4634 * configure: Regenerate.
4635 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4636 * Makefile.in: Regenerate.
4637 * testsuite/Makefile.in: Regenerate.
4638
4639 2011-09-19 Sriraman Tallam <tmsriram@google.com>
4640
4641 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4642
4643 2011-09-19 Cary Coutant <ccoutant@google.com>
4644
4645 * incremental.cc (can_incremental_update): Fix typo in comment.
4646 * incremental.h (can_incremental_update): Likewise.
4647
4648 2011-09-18 Cary Coutant <ccoutant@google.com>
4649
4650 * incremental.cc (can_incremental_update): New function.
4651 * incremental.h (can_incremental_update): New function.
4652 * layout.cc (Layout::init_fixed_output_section): Call it.
4653 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4654 * object.cc (Sized_relobj_file::do_layout): Call
4655 can_incremental_update.
4656
4657 2011-09-13 Cary Coutant <ccoutant@google.com>
4658
4659 * configure.ac: Check for glibc support for gnu_indirect_function
4660 support with static linking, setting automake conditional
4661 IFUNC_STATIC.
4662 * Makefile.in: Regenerate.
4663 * configure: Regenerate.
4664
4665 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4666 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4667 for IFUNC_STATIC.
4668 * testsuite/Makefile.in: Regenerate.
4669
4670 2011-09-13 Cary Coutant <ccoutant@google.com>
4671
4672 * incremental.cc (Sized_relobj_incr::do_layout): Call
4673 report_comdat_group for kept comdat sections.
4674 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4675 * testsuite/Makefile.in: Regenerate.
4676 * testsuite/incr_comdat_test_1.cc: New source file.
4677 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4678 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4679 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4680
4681 2011-09-13 Ian Lance Taylor <iant@google.com>
4682
4683 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4684 variable external_symbols_offset.
4685
4686 2011-09-12 Ian Lance Taylor <iant@google.com>
4687
4688 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4689 triggered if object has no symbols.
4690
4691 2011-09-09 David S. Miller <davem@davemloft.net>
4692
4693 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4694 (Output_fill_debug_line::do_write): Likewise.
4695
4696 2011-08-29 Cary Coutant <ccoutant@google.com>
4697
4698 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4699 casts to match formatting specs.
4700 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4701
4702 2011-08-26 Cary Coutant <ccoutant@google.com>
4703
4704 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4705 remaining hole size when allocating.
4706 (Layout::make_output_section): Set fill methods for debug sections.
4707 * layout.h (Free_list::Free_list_node): Move from private to
4708 public.
4709 (Free_list::set_min_hole_size): New function.
4710 (Free_list::begin, Free_list::end): New functions.
4711 (Free_list::min_hole_): New data member.
4712 * output.cc: Include dwarf.h.
4713 (Output_fill_debug_info::do_minimum_hole_size): New function.
4714 (Output_fill_debug_info::do_write): New function.
4715 (Output_fill_debug_line::do_minimum_hole_size): New function.
4716 (Output_fill_debug_line::do_write): New function.
4717 (Output_section::Output_section): Initialize new data member.
4718 (Output_section::set_final_data_size): Ensure patch space is larger
4719 than minimum hole size.
4720 (Output_section::do_write): Fill holes in debug sections.
4721 * output.h (Output_fill): New class.
4722 (Output_fill_debug_info): New class.
4723 (Output_fill_debug_line): New class.
4724 (Output_section::set_free_space_fill): New function.
4725 (Output_section::free_space_fill_): New data member.
4726 * testsuite/Makefile.am (incremental_test_3): Add
4727 --incremental-patch option.
4728 (incremental_test_4): Likewise.
4729 (incremental_test_5): Likewise.
4730 (incremental_test_6): Likewise.
4731 (incremental_copy_test): Likewise.
4732 (incremental_common_test_1): Likewise.
4733 * testsuite/Makefile.in: Regenerate.
4734
4735 2011-08-26 Nick Clifton <nickc@redhat.com>
4736
4737 * po/es.po: Updated Spanish translation.
4738
4739 2011-08-01 Cary Coutant <ccoutant@google.com>
4740
4741 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4742 * gold/testsuite/Makefile.in: Regenerate.
4743 * gold/testsuite/justsyms_exec.c: New source file.
4744 * gold/testsuite/justsyms_lib.c: New source file.
4745
4746 2011-08-01 Cary Coutant <ccoutant@google.com>
4747
4748 * layout.cc (Layout::set_segment_offsets): Don't realign text
4749 segment if -Ttext was specified.
4750 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4751 file type.
4752 * object.h (Sized_relobj_file::e_type): New function.
4753 (Sized_relobj_file::e_type_): New data member.
4754 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4755 base address for ET_EXEC files.
4756 * target.cc (Target::do_make_elf_object_implementation): Allow
4757 ET_EXEC files with --just-symbols option.
4758
4759 2011-07-28 Cary Coutant <ccoutant@google.com>
4760
4761 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4762 Add thread_number parameter.
4763 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4764 * workqueue-threads.cc
4765 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4766 current thread if its thread number is greater than desired thread
4767 count.
4768 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4769 Add thread_number parameter.
4770 (Workqueue::should_cancel_thread): Likewise.
4771 (Workqueue::find_runnable_or_wait): Pass thread_number to
4772 should_cancel_thread.
4773 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4774 parameter.
4775
4776 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4777
4778 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4779 only after checking if it cannot be forced local.
4780 * symtab.h (is_externally_visible): Check if the symbol is not forced
4781 local.
4782
4783 2011-07-15 Ian Lance Taylor <iant@google.com>
4784
4785 * options.h (class General_options): Add --print-output-format.
4786 Move -EL next to -EB, for better --help output.
4787 * target-select.cc: Include <cstdio>, "options.h", and
4788 "parameters.h".
4789 (Target_selector::do_target_bfd_name): New function.
4790 (print_output_format): New function.
4791 * target-select.h (class Target_selector): Update declarations.
4792 (Target_selector::target_bfd_name): New function.
4793 (print_output_format): Declare.
4794 * main.cc: Include "target-select.h".
4795 (main): Handle --print-output-format.
4796 * gold.cc: Include "target-select.h".
4797 (queue_initial_tasks): Handle --print-output-format when there are
4798 no input files.
4799 * parameters.cc (parameters_force_valid_target): Give a better
4800 error message if -EB/-EL does not match target.
4801 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4802 function.
4803
4804 2011-07-15 Ian Lance Taylor <iant@google.com>
4805
4806 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4807 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4808 (Output_data_plt_i386::do_write): Write address of .dynamic
4809 section to first entry in .got.plt section.
4810 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4811 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4812 Initialize layout_.
4813 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4814 section to first entry in .got.plt section.
4815 * layout.h (Layout::dynamic_section): New function.
4816
4817 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4818
4819 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4820 to claim_file call.
4821 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4822 input_section_position_, and input_section_glob_.
4823 (read_layout_from_file): Call function section_ordering_specified.
4824 * layout.h (is_section_ordering_specified): New function.
4825 (section_ordering_specified): New function.
4826 (section_ordering_specified_): New boolean member.
4827 * main.cc(main): Call load_plugins after layout object is defined.
4828 * output.cc (Output_section::add_input_section): Use
4829 function section_ordering_specified to check if section ordering is
4830 needed.
4831 * output.cc (Output_section::add_relaxed_input_section): Use
4832 function section_ordering_specified to check if section ordering is
4833 needed.
4834 (Output_section::update_section_layout): New function.
4835 (Output_section::sort_attached_input_sections): Check if input section
4836 must be reordered.
4837 * output.h (Output_section::update_section_layout): New function.
4838 * plugin.cc (get_section_count): New function.
4839 (get_section_type): New function.
4840 (get_section_name): New function.
4841 (get_section_contents): New function.
4842 (update_section_order): New function.
4843 (allow_section_ordering): New function.
4844 (Plugin::load): Add the new interfaces to the transfer vector.
4845 (Plugin_manager::load_plugins): New parameter.
4846 (Plugin_manager::all_symbols_read): New parameter.
4847 (Plugin_manager::claim_file): New parameter. Save the elf object for
4848 unclaimed objects.
4849 (Plugin_manager::get_elf_object): New function.
4850 (Plugin_manager::get_view): Change to directly use the bool to check
4851 if get_view is called from claim_file_hook.
4852 * plugin.h (input_objects): New function
4853 (Plugin__manager::load_plugins): New parameter.
4854 (Plugin_manager::claim_file): New parameter.
4855 (Plugin_manager::get_elf_object): New function.
4856 (Plugin_manager::in_claim_file_handler): New function.
4857 (Plugin_manager::in_claim_file_handler_): New member.
4858 (layout): New function.
4859 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4860 handler with an extra parameter. Make the elf object before calling
4861 claim_file handler.
4862 * testsuite/plugin_test.c (get_section_count): New function pointer.
4863 (get_section_type): New function pointer.
4864 (get_section_name): New function pointer.
4865 (get_section_contents): New function pointer.
4866 (update_section_order): New function pointer.
4867 (allow_section_ordering): New function pointer.
4868 (onload): Check if the new interfaces exist.
4869
4870 2011-07-13 Ian Lance Taylor <iant@google.com>
4871
4872 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4873 relro section.
4874 * x86_64.cc (Target_x86_64::got_section): Likewise.
4875 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4876 (relro_now_test_SOURCES): New variable.
4877 (relro_now_test_DEPENDENCIES): New variable.
4878 (relro_now_test_LDFLAGS): New variable.
4879 (relro_now_test_LDADD): New variable.
4880 (relro_now_test.so): New target.
4881 * testsuite/Makefile.in: Rebuild.
4882
4883 2011-07-12 Ian Lance Taylor <iant@google.com>
4884
4885 PR gold/12980
4886 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4887 GLOB_DAT relocation rather than a RELATIVE relocation for a
4888 protected symbol when creating a shared library.
4889 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4890 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4891 * testsuite/protected_main_1.cc (main): Test that protected
4892 function has same address.
4893
4894 2011-07-11 Ian Lance Taylor <iant@google.com>
4895
4896 PR gold/12979
4897 * options.h (class General_options): Add -Bgroup.
4898 * options.cc (General_options::finalize): If -Bgroup is set,
4899 default to --unresolved-symbols=report-all.
4900 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4901 * target-reloc.h (issue_undefined_symbol_error): Handle
4902 --unresolved-symbols=report-all.
4903
4904 2011-07-08 Ian Lance Taylor <iant@google.com>
4905
4906 PR gold/11985
4907 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4908 if linker script discards key sections.
4909 (Layout::create_dynamic_symtab): Likewise.
4910 (Layout::assign_local_dynsym_offsets): Likewise.
4911 (Layout::sized_create_version_sections): Likewise.
4912 (Layout::create_interp): Likewise.
4913 (Layout::finish_dynamic_section): Likewise.
4914 (Layout::set_dynamic_symbol_size): Likewise.
4915
4916 2011-07-08 Ian Lance Taylor <iant@google.com>
4917
4918 PR gold/12386
4919 * options.h (class General_options): Add --unresolved-symbols.
4920 * target-reloc.h (issue_undefined_symbol_error): Check
4921 --unresolved-symbols. Add comments.
4922
4923 2011-07-08 Ian Lance Taylor <iant@google.com>
4924
4925 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4926 expression more complex.
4927
4928 2011-07-08 Ian Lance Taylor <iant@google.com>
4929
4930 PR gold/11317
4931 * target-reloc.h (issue_undefined_symbol_error): New inline
4932 function, broken out of relocate_section.
4933 (relocate_section): Call issue_undefined_symbol_error.
4934 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4935 there is no TLS segment if we are about to issue an undefined
4936 symbol error.
4937 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4938
4939 2011-07-08 Ian Lance Taylor <iant@google.com>
4940
4941 PR gold/12279
4942 * resolve.cc (Symbol_table::should_override): Add fromtype
4943 parameter. Change all callers. Give error when linking together
4944 TLS and non-TLS symbol.
4945 (Symbol_table::should_override_with_special): Add fromtype
4946 parameter. Change all callers.
4947 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4948 there is no TLS segment if we have reported some errors.
4949 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4950
4951 2011-07-08 Ian Lance Taylor <iant@google.com>
4952
4953 PR gold/12372
4954 * target.h (Target::plt_address_for_global): New function.
4955 (Target::plt_address_for_local): New function.
4956 (Target::plt_section_for_global): Remove.
4957 (Target::plt_section_for_local): Remove.
4958 (Target::do_plt_address_for_global): New virtual function.
4959 (Target::do_plt_address_for_local): New virtual function.
4960 (Target::do_plt_section_for_global): Remove.
4961 (Target::do_plt_section_for_local): Remove.
4962 (Target::register_global_plt_entry): Add Symbol_table and Layout
4963 parameters.
4964 * output.cc (Output_data_got::Got_entry::write): Use
4965 plt_address_for_global and plt_address_for_local.
4966 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4967 address of output section.
4968 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4969 got_irelative_, and irelative_count_ fields. Update
4970 declarations.
4971 (Output_data_plt_i386::has_irelative_section): New function.
4972 (Output_data_plt_i386::entry_count): Add irelative_count_.
4973 (Output_data_plt_i386::set_final_data_size): Likewise.
4974 (class Target_i386): Add got_irelative_ and rel_irelative_
4975 fields. Update declarations.
4976 (Target_i386::Target_i386): Initialize new fields.
4977 (Target_i386::do_plt_address_for_global): New function replacing
4978 do_plt_section_for_global.
4979 (Target_i386::do_plt_address_for_local): New function replacing
4980 do_plt_section_for_local.
4981 (Target_i386::got_section): Create got_irelative_.
4982 (Target_i386::rel_irelative_section): New function.
4983 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4984 fields. Don't define __rel_iplt_{start,end}.
4985 (Output_data_plt_i386::add_entry): Add symtab and layout
4986 parameters. Change all callers. Use different PLT and GOT for
4987 IFUNC symbols.
4988 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4989 layout parameters. Change all callers. Use different PLT and
4990 GOT.
4991 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4992 (Output_data_plt_i386::rel_irelative): New function.
4993 (Output_data_plt_i386::address_for_global): New function.
4994 (Output_data_plt_i386::address_for_local): New function.
4995 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4996 IRELATIVE GOT when changing IFUNC GOT entries.
4997 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4998 reloc.
4999 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5000 if we didn't create an IRELATIVE GOT.
5001 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5002 plt_address_for_local.
5003 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5004 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5005 got_irelative_, and irelative_count_ fields. Update
5006 declarations.
5007 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5008 Initialize new fields. Remove symtab parameter. Change all
5009 callers.
5010 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5011 irelative_count_.
5012 (Output_data_plt_x86_64::has_irelative_section): New function.
5013 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5014 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5015 fields. Update declarations.
5016 (Target_x86_64::Target_x86_64): Initialize new fields.
5017 (Target_x86_64::do_plt_address_for_global): New function replacing
5018 do_plt_section_for_global.
5019 (Target_x86_64::do_plt_address_for_local): New function replacing
5020 do_plt_section_for_local.
5021 (Target_x86_64::got_section): Create got_irelative_.
5022 (Target_x86_64::rela_irelative_section): New function.
5023 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5024 all callers. Don't create __rel_iplt_{start,end}.
5025 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5026 parameters. Change all callers. Use different PLT and GOT for
5027 IFUNC symbols.
5028 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5029 layout parameters. Change all callers. Use different PLT and
5030 GOT.
5031 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5032 parameters. Change all callers. Use different PLT and GOT for
5033 IFUNC symbols.
5034 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5035 (Output_data_plt_x86_64::rela_irelative): New function.
5036 (Output_data_plt_x86_64::address_for_global): New function.
5037 (Output_data_plt_x86_64::address_for_local): New function.
5038 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5039 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5040 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5041 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5042 parameters.
5043 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5044 reloc.
5045 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5046 symbols if we didn't create an IRELATIVE GOT.
5047 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5048 plt_address_for_local.
5049 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5050 * testsuite/ifuncvar1.c: New test file.
5051 * testsuite/ifuncvar2.c: New test file.
5052 * testsuite/ifuncvar3.c: New test file.
5053 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5054 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5055 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5056 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5057 * testsuite/Makefile.in: Rebuild.
5058
5059 2011-07-07 Cary Coutant <ccoutant@google.com>
5060
5061 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5062 (two_file_test_1_ndebug.o): Likewise.
5063 (two_file_test_1b_ndebug.o): Likewise.
5064 (two_file_test_2_ndebug.o): Likewise.
5065 (two_file_test_main_ndebug.o): Likewise.
5066 (incremental_test_2): Link with no-debug versions.
5067
5068 2011-07-06 Cary Coutant <ccoutant@google.com>
5069
5070 * gold/incremental.cc
5071 (Output_section_incremental_inputs::write_info_blocks): Check for
5072 hidden and internal symbols.
5073
5074 2011-07-06 Cary Coutant <ccoutant@google.com>
5075
5076 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5077 Check disposition for startup file.
5078 (Incremental_inputs::report_command_line): Ignore
5079 --incremental-startup-unchanged option.
5080 * options.cc (General_options::parse_incremental_startup_unchanged):
5081 New function.
5082 (General_options::General_options): Initialize new data member.
5083 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5084 (General_options): Add --incremental-startup-unchanged option.
5085 (General_options::incremental_startup_disposition): New function.
5086 (General_options::incremental_startup_disposition_): New data member.
5087
5088 2011-07-06 Cary Coutant <ccoutant@google.com>
5089
5090 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5091 input file index to Script_info ctor.
5092 (Sized_incremental_binary::do_file_has_changed): Find the
5093 command-line argument for files named in scripts.
5094 * incremental.h (Script_info::Script_info): New ctor
5095 with input file index.
5096 (Script_info::input_file_index): New function.
5097 (Script_info::input_file_index_): New data member.
5098 (Incremental_binary::get_library): Add const.
5099 (Incremental_binary::get_script_info): Add const.
5100 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5101 * testsuite/Makefile.am (incremental_test_5): New test case.
5102 (incremental_test_6): New test case.
5103 * testsuite/Makefile.in: Regenerate.
5104
5105 2011-07-06 Cary Coutant <ccoutant@google.com>
5106
5107 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5108 debug output when command lines differ.
5109
5110 2011-07-06 Cary Coutant <ccoutant@google.com>
5111
5112 * incremental.cc (Incremental_inputs::report_command_line): Ignore
5113 --incremental-patch option.
5114 * layout.cc (Free_list::allocate): Extend allocation beyond original
5115 end if enabled.
5116 (Layout::make_output_section): Mark sections that should get
5117 patch space.
5118 * options.cc (parse_percent): New function.
5119 * options.h (parse_percent): New function.
5120 (DEFINE_percent): New macro.
5121 (General_options): Add --incremental-patch option.
5122 * output.cc (Output_section::Output_section): Initialize new data
5123 members.
5124 (Output_section::add_input_section): Print section name when out
5125 of patch space.
5126 (Output_section::add_output_section_data): Likewise.
5127 (Output_section::set_final_data_size): Add patch space when
5128 doing --incremental-full.
5129 (Output_section::do_reset_address_and_file_offset): Remove patch
5130 space.
5131 (Output_segment::set_section_list_addresses): Print debug output
5132 only if --incremental-update.
5133 * output.h (Output_section::set_is_patch_space_allowed): New function.
5134 (Output_section::is_patch_space_allowed_): New data member.
5135 (Output_section::patch_space_): New data member.
5136 * parameters.cc (Parameters::incremental_full): New function.
5137 * parameters.h (Parameters::incremental_full): New function
5138 * testsuite/Makefile.am (incremental_test_2): Add test for
5139 --incremental-patch option.
5140 * testsuite/Makefile.in: Regenerate.
5141 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5142 (t18): Remove function body.
5143
5144 2011-07-05 Doug Kwan <dougkwan@google.com>
5145
5146 PR gold/12771
5147 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5148 Arm_Address type for relocation result.
5149 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
5150 overflow check.
5151 (Arm_relocate_functions::abs32): Use unaligned access.
5152 (Arm_relocate_functions::rel32): Ditto.
5153 (Arm_relocate_functions::prel31): Ditto.
5154 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5155 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5156 static data relocations.
5157 * testsuite/Makefile.in: Regnerate.
5158 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5159
5160 2011-07-05 Ian Lance Taylor <iant@google.com>
5161
5162 PR gold/12392
5163 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5164 symbols if necessary.
5165 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5166
5167 2011-07-05 Ian Lance Taylor <iant@google.com>
5168
5169 PR gold/12952
5170 * resolve.cc (Symbol::override_base_with_special): Simply override
5171 version with special symbol version, ignoring previous version.
5172
5173 2011-07-05 Ian Lance Taylor <iant@google.com>
5174
5175 * object.cc (Sized_relobj_file::include_section_group): Add
5176 information to comment about signature location.
5177
5178 2011-07-02 Ian Lance Taylor <iant@google.com>
5179
5180 PR gold/12957
5181 * options.h (class General_options): Add -f and -F.
5182 * options.cc (General_options::finalize): Fatal error if -f/-F
5183 are used without -shared.
5184 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5185
5186 2011-07-02 Ian Lance Taylor <iant@google.com>
5187
5188 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5189
5190 2011-07-01 Ian Lance Taylor <iant@google.com>
5191
5192 PR gold/12525
5193 PR gold/12952
5194 * resolve.cc (Symbol::override_base_with_special): Don't override
5195 the version if the overriding symbol has a different name.
5196 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
5197 all callers. If we give an error about an undefined version,
5198 define the base version if necessary.
5199 * dynobj.h (class Versions): Update declaration.
5200 * testsuite/weak_alias_test_5.cc: New file.
5201 * testsuite/weak_alias_test.script: New file.
5202 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5203 and versioned_alias have the right value, and call t2.
5204 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5205 weak_alias_test_5.so.
5206 (weak_alias_test_LDADD): Likewise.
5207 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5208 * testsuite/Makefile.in: Rebuild.
5209
5210 2011-07-01 Ian Lance Taylor <iant@google.com>
5211
5212 PR gold/12525
5213 * options.h (class General_options): Support -z notext.
5214 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5215 -Wl,-z,notext.
5216 (two_file_shared_nonpic.so): Likewise.
5217 (two_file_shared_mixed.so): Likewise.
5218 (two_file_shared_mixed_1.so): Likewise.
5219 (weak_undef_lib_nonpic.so): Likewise.
5220 (alt/weak_undef_lib_nonpic.so): Likewise.
5221 (tls_test_shared_nonpic.so): Likewise.
5222 * testsuite/Makefile.in: Rebuild.
5223
5224 2011-07-01 Ian Lance Taylor <iant@google.com>
5225
5226 PR gold/12525
5227 * configure.ac: Test whether static linking works, setting
5228 the automake conditional HAVE_STATIC.
5229 * testsuite/Makefile.am: Disable tests using -static if
5230 HAVE_STATIC is not true.
5231 * configure, testsuite/Makefile.in: Rebuild.
5232
5233 2011-07-01 Ian Lance Taylor <iant@google.com>
5234
5235 PR gold/12525
5236 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5237 Assert if we see DW_EH_PE_indirect.
5238 * target.h (Target::ehframe_datarel_base): New function.
5239 (Target::do_ehframe_datarel_base): New target function.
5240 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5241 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5242 function.
5243
5244 2011-07-01 Ian Lance Taylor <iant@google.com>
5245
5246 PR gold/12571
5247 * options.h (class General_options): Add
5248 --ld-generated-unwind-info.
5249 * ehframe.cc (Fde::write): Add address parameter. Change all
5250 callers. If associated with PLT, fill in address and size.
5251 (Cie::set_output_offset): Only add merge mapping if there is an
5252 object.
5253 (Cie::write): Add address parameter. Change all callers.
5254 (Eh_frame::add_ehframe_for_plt): New function.
5255 * ehframe.h (class Fde): Update declarations. Move shndx_ and
5256 input_offset_ fields into union u_, with new plt field.
5257 (Fde::Fde): Adjust for new union field.
5258 (Fde::Fde) [Output_data version]: New constructor.
5259 (Fde::add_mapping): Only add merge mapping if there is an object.
5260 (class Cie): Update declarations.
5261 (class Eh_frame): Declare add_ehframe_for_plt.
5262 * layout.cc (Layout::layout_eh_frame): Break out code into
5263 make_eh_frame_section, and call it.
5264 (Layout::make_eh_frame_section): New function.
5265 (Layout::add_eh_frame_for_plt): New function.
5266 * layout.h (class Layout): Update declarations.
5267 * merge.cc (Merge_map::add_mapping): Add assertion.
5268 * i386.cc: Include "dwarf.h".
5269 (class Output_data_plt_i386): Make first_plt_entry,
5270 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
5271 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5272 and plt_eh_frame_fde.
5273 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5274 boundary. Call add_eh_frame_for_plt if appropriate.
5275 * x86_64.cc: Include "dwarf.h".
5276 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
5277 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
5278 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5279 and plt_eh_frame_fde.
5280 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5281 appropriate.
5282
5283 2011-06-29 Ian Lance Taylor <iant@google.com>
5284
5285 PR gold/12629
5286 * object.cc (Sized_relobj_file::layout_section): Change shdr
5287 parameter to be const.
5288 (Sized_relobj_file::layout_eh_frame_section): New function, broken
5289 out of do_layout.
5290 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5291 appropriate. Call layout_eh_frame_section.
5292 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5293 sections.
5294 * object.h (class Sized_relobj_file): Update declarations.
5295
5296 2011-06-29 Ian Lance Taylor <iant@google.com>
5297
5298 PR gold/12652
5299 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5300 modifier.
5301 (Lex::gather_token): Accept trailing M/m/K/k for integers.
5302
5303 2011-06-29 Ian Lance Taylor <iant@google.com>
5304
5305 PR gold/12675
5306 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5307 SHT_X86_64_UNWIND.
5308 * layout.cc (Layout::layout_eh_frame): Likewise.
5309
5310 2011-06-29 Ian Lance Taylor <iant@google.com>
5311
5312 PR gold/12695
5313 * layout.cc (Layout::symtab_section_shndx): New function.
5314 * layout.h (class Layout): Declare symtab_section_shndx.
5315 * output.cc (Output_section::write_header): Call it.
5316
5317 2011-06-29 Ian Lance Taylor <iant@google.com>
5318
5319 PR gold/12818
5320 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5321 symbols which are not used in a relocation.
5322
5323 2011-06-28 Ian Lance Taylor <iant@google.com>
5324
5325 PR gold/12898
5326 * layout.cc (Layout::segment_precedes): Don't crash if a linker
5327 script create indistinguishable segments.
5328 (Layout::set_segment_offsets): Use stable_sort when sorting
5329 segments. Pass this to Compare_segments constructor.
5330 * layout.h (class Layout): Make segment_precedes non-static.
5331 (class Compare_segments): Change from struct to class. Add
5332 layout_ field. Add constructor.
5333 * script-sections.cc
5334 (Script_sections::attach_sections_using_phdrs_clause): Rename
5335 local orphan to is_orphan. Don't report failure to put empty
5336 section in segment. On attachment failure, report name of
5337 section, and attach to first PT_LOAD segment.
5338
5339 2011-06-28 Ian Lance Taylor <iant@google.com>
5340
5341 PR gold/12934
5342 * target-select.cc (Target_selector::Target_selector): Add
5343 emulation parameter. Change all callers.
5344 (select_target_by_bfd_name): Rename from select_target_by_name.
5345 Change all callers.
5346 (select_target_by_emulation): New function.
5347 (supported_emulation_names): New function.
5348 * target-select.h (class Target_selector): Add emulation_ field.
5349 Update declarations.
5350 (Target_selector::recognize_by_bfd_name): Rename from
5351 recognize_by_name. Change all callers.
5352 (Target_selector::supported_bfd_names): Rename from
5353 supported_names. Change all callers.
5354 (Target_selector::recognize_by_emulation): New function.
5355 (Target_selector::supported_emulations): New function.
5356 (Target_selector::emulation): New function.
5357 (Target_selector::do_recognize_by_bfd_name): Rename from
5358 do_recognize_by_name. Change all callers.
5359 (Target_selector::do_supported_bfd_names): Rename from
5360 do_supported_names. Change all callers.
5361 (Target_selector::do_recognize_by_emulation): New function.
5362 (Target_selector::do_supported_emulations): New function.
5363 (select_target_by_bfd_name): Change name in declaration.
5364 (select_target_by_emulation): Declare.
5365 (supported_emulation_names): Declare.
5366 * parameters.cc (parameters_force_valid_target): Try to find
5367 target based on emulation from -m option.
5368 * options.h (class General_options): Change doc string for -m.
5369 * options.cc (help): Print emulations.
5370 (General_options::parse_V): Likewise.
5371 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5372 Add emulation parameter. Change all callers.
5373
5374 2011-06-28 Ian Lance Taylor <iant@google.com>
5375
5376 * target.h (class Target): Add osabi_ field.
5377 (Target::osabi): New function.
5378 (Target::set_osabi): New function.
5379 (Target::Target): Initialize osabi_.
5380 (Target::do_adjust_elf_header): Make pure virtual.
5381 (Sized_target::do_adjust_elf_header): Declare.
5382 * target.cc (Sized_target::do_adjust_elf_header): New function.
5383 (class Sized_target): Instantiate all versions.
5384 * freebsd.h (class Target_freebsd): Remove.
5385 (Target_selector_freebsd::do_recognize): Call set_osabi on
5386 Target.
5387 (Target_selector_freebsd::do_recognize_by_name): Likewise.
5388 (Target_selector_freebsd::set_osabi): Remove.
5389 * i386.cc (class Target_i386): Inherit from Sized_target rather
5390 than Target_freebsd.
5391 * x86_64.cc (class Target_x86_64): Likewise.
5392
5393 2011-06-28 Ian Lance Taylor <iant@google.com>
5394
5395 * target.h (Target::can_check_for_function_pointers): Rewrite.
5396 Make non-virtual.
5397 (Target::can_icf_inline_merge_sections): Likewise.
5398 (Target::section_may_have_icf_unsafe_poineters): Likewise.
5399 (Target::Target_info): Add can_icf_inline_merge_sections field.
5400 (Target::do_can_check_for_function_pointers): New virtual
5401 function.
5402 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5403 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5404 from can_check_for_function_pointers, move in file.
5405 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5406 section_may_have_icf_unsafe_poineters, move in file.
5407 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5408 * i386.cc (Target_i386::do_can_check_for_function_pointers):
5409 Rename from can_check_for_function_pointers, move in file.
5410 (Target_i386::can_icf_inline_merge_sections): Remove.
5411 (Target_i386::i386_info): Initialize
5412 can_icf_inline_merge_sections.
5413 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5414 Initialize can_icf_inline_merge_sections.
5415 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5416 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5417 Rename from can_check_for_function_pointers, move in file.
5418 (Target_x86_64::can_icf_inline_merge_sections): Remove.
5419 (Target_x86_64::x86_64_info): Initialize
5420 can_icf_inline_merge_sections.
5421 * testsuite/testfile.cc (Target_test::test_target_info):
5422 Likewise.
5423 * icf.cc (get_section_contents): Correct formatting.
5424
5425 2011-06-27 Ian Lance Taylor <iant@google.com>
5426
5427 * symtab.cc (Symbol::versioned_name): New function.
5428 (Symbol_table::add_to_final_symtab): Use versioned_name when
5429 appropriate.
5430 (Symbol_table::sized_write_symbol): Likewise.
5431 * symtab.h (class Symbol): Declare versioned_name.
5432 * stringpool.h (class Stringpool_template): Add variant of add
5433 which takes a std::basic_string.
5434 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5435 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5436 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5437 (ver_test_12.o): New target.
5438 * testsuite/Makefile.in: Rebuild.
5439
5440 2011-06-27 Doug Kwan <dougkwan@google.com>
5441
5442 * arm.cc (Arm_relocate_functions::thm_jump8,
5443 Arm_relocate_functions::thm_jump11): Use a wider signed
5444 type to compute offset.
5445 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5446 arm_thm_jump8.
5447 * testsuite/Makefile.in: Regenerate.
5448 * testsuite/arm_branch_in_range.sh: Check test results of
5449 arm_thm_jump11 and arm_thm_jump8.
5450 * testsuite/arm_thm_jump11.s: New test source file.
5451 * testsuite/arm_thm_jump11.t: New linker script.
5452 * testsuite/arm_thm_jump8.s: New test source file.
5453 * testsuite/arm_thm_jump8.t: New linker script.
5454
5455 2011-06-24 Ian Lance Taylor <iant@google.com>
5456
5457 * layout.cc: Include "object.h".
5458 (ctors_sections_in_init_array): New static variable.
5459 (Layout::is_ctors_in_init_array): New function.
5460 (Layout::layout): Add entry to ctors_sections_in_init_array if
5461 appropriate.
5462 * layout.h (class Layout): Declare is_ctors_in_init_array.
5463 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5464 is_ctors_reverse_view is set.
5465 (Sized_relobj_file::write_sections): Add layout parameter. Change
5466 all callers. Set is_ctors_reverse_view field of View_size.
5467 (Sized_relobj_file::reverse_words): New function.
5468 * object.h (Sized_relobj_file::View_size): Add
5469 is_ctors_reverse_view field.
5470 (class Sized_relobj_file): Update declarations.
5471 * testsuite/initpri3.c: New test.
5472 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5473 initpri3b.
5474 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5475 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5476 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5477 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5478 * testsuite/Makefile.in: Rebuild.
5479
5480 2011-06-24 Cary Coutant <ccoutant@google.com>
5481
5482 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5483 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5484 (debug_msg_cdebug.err): New targets.
5485 * testsuite/Makefile.in: Regenerate.
5486 * testsuite/debug_msg.sh: Check output of link with compressed debug.
5487 Fix checks for link with shared library.
5488
5489 2011-06-24 Doug Kwan <dougkwan@google.com>
5490
5491 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5492 skip empty text sections.
5493 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5494
5495 2011-06-22 Ian Lance Taylor <iant@google.com>
5496
5497 PR gold/12910
5498 * options.h (class General_options): Add --ctors-in-init-array.
5499 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5500 friends as SHT_PROGBITS for merging sections.
5501 (Layout::layout): Remove special handling of .init_array and
5502 friends. Don't sort if doing relocatable link. Sort for .ctors
5503 and .dtors if ctors_in_init_array.
5504 (Layout::make_output_section): Force correct section types for
5505 .init_array and friends. Don't sort if doing relocatable link,
5506 Don't sort .ctors and .dtors if ctors_in_init_array.
5507 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5508 (Layout::output_section_name): Add relobj parameter. Change all
5509 callers. Handle .ctors. and .dtors. in code rather than table.
5510 Handle .ctors and .dtors if ctors_in_init_array.
5511 (Layout::match_file_name): New function, moved from output.cc.
5512 * layout.h (class Layout): Update declarations.
5513 * output.cc: Include "layout.h".
5514 (Input_section_sort_entry::get_priority): New function.
5515 (Input_section_sort_entry::match_file_name): Just call
5516 Layout::match_file_name.
5517 (Output_section::Input_section_sort_init_fini_compare::operator()):
5518 Handle .ctors and .dtors. Sort by explicit priority rather than
5519 by name.
5520 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5521 * testsuite/initpri2.c: New test.
5522 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5523 (check_PROGRAMS): Add initpri2.
5524 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5525 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5526 * configure, testsuite/Makefile.in: Rebuild.
5527
5528 2011-06-19 Ian Lance Taylor <iant@google.com>
5529
5530 PR gold/12880
5531 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5532 .interp section to a PT_INTERP segment even if we have seen a
5533 --dynamic-linker option. Don't do it if we have seen a PHDRS
5534 clause in a linker script.
5535 (Layout::finalize): Don't create a .interp section if we've
5536 already create a PT_INTERP segment.
5537 (Layout::create_interp): Always call choose_output_section (revert
5538 patch of 2011-06-17). Don't create PT_INTERP segment.
5539 * script-sections.cc
5540 (Script_sections::create_note_and_tls_segments): Add a .interp
5541 section to a PT_INTERP segment even if we have seen a
5542 --dynamic-linker option.
5543
5544 2011-06-18 Ian Lance Taylor <iant@google.com>
5545
5546 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5547 merely because a non-PT_LOAD segment has a dynamic reloc.
5548
5549 2011-06-18 Ian Lance Taylor <iant@google.com>
5550
5551 * layout.cc (Layout::finish_dynamic_section): Don't create
5552 DT_FLAGS entry if not needed.
5553
5554 2011-06-18 Ian Lance Taylor <iant@google.com>
5555
5556 PR gold/12745
5557 * layout.cc (Layout::layout_eh_frame): Correct handling of
5558 writable .eh_frame section.
5559
5560 2011-06-17 Ian Lance Taylor <iant@google.com>
5561
5562 PR gold/12893
5563 * resolve.cc (Symbol_table::resolve): Don't give an error if a
5564 symbol is redefined with the exact same object and value.
5565
5566 2011-06-17 Ian Lance Taylor <iant@google.com>
5567
5568 PR gold/12880
5569 * layout.h (class Layout): Add interp_segment_ field.
5570 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5571 (Layout::attach_allocated_section_to_segment): If making shared
5572 library, put .interp section in PT_INTERP segment.
5573 (Layout::finalize): Also call create_interp if -dynamic-linker
5574 option was used.
5575 (Layout::create_interp): Assert that there is no PT_INTERP
5576 segment. If not using a SECTIONS clause, use make_output_section.
5577 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5578 * script-sections.cc
5579 (Script_sections::create_note_and_tls_segments): If making shared
5580 library, put .interp section in PT_INTERP segment.
5581
5582 2011-06-17 Ian Lance Taylor <iant@google.com>
5583
5584 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5585 when making a shared library.
5586
5587 2011-06-17 Ian Lance Taylor <iant@google.com>
5588
5589 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5590 parameter. Change all callers. Don't issue warning about PC32
5591 against locally defined symbol.
5592
5593 2011-06-16 Ian Lance Taylor <iant@google.com>
5594
5595 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5596 occurs in same object.
5597
5598 2011-06-14 Alan Modra <amodra@gmail.com>
5599
5600 * po/POTFILES.in: Regenerate.
5601
5602 2011-06-09 Ian Lance Taylor <iant@google.com>
5603
5604 * script-sections.cc
5605 (Orphan_output_section::set_section_addresses): For a relocatable
5606 link set address to 0.
5607
5608 2011-06-09 Cary Coutant <ccoutant@google.com>
5609
5610 PR gold/12804
5611 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5612 used with --compress-debug-sections.
5613 * gold/object.cc (Sized_relobj_file::do_layout): Report
5614 uncompressed size of compressed input sections.
5615
5616 2011-06-08 Cary Coutant <ccoutant@google.com>
5617
5618 PR gold/12804
5619 * testsuite/two_file_test_2_v1.cc: Change initialization of
5620 v2 to keep it in .data.
5621
5622 2011-06-07 Cary Coutant <ccoutant@google.com>
5623
5624 * common.cc (Symbol_table::do_allocate_commons_list): Call
5625 gold_fallback.
5626 * errors.cc (Errors::fatal): Adjust call to gold_exit.
5627 (Errors::fallback): New function.
5628 (gold_fallback): New function.
5629 * errors.h (Errors::fallback): New function.
5630 * gold.cc (gold_exit): Change status parameter to enum; adjust
5631 all callers.
5632 (queue_initial_tasks): Call gold_fallback.
5633 * gold.h: Include cstdlib.
5634 (Exit_status): New enum type.
5635 (gold_exit): Change status parameter to enum.
5636 (gold_fallback): New function.
5637 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5638 (Layout::create_symtab_sections): Likewise.
5639 (Layout::create_shdrs): Likewise.
5640 * main.cc (main): Adjust call to gold_exit.
5641 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5642 (Output_data_got::add_got_entry_pair): Likewise.
5643 (Output_section::add_input_section): Likewise.
5644 (Output_section::add_output_section_data): Likewise.
5645 (Output_segment::set_section_list_addresses): Likewise.
5646 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5647
5648 2011-06-07 Cary Coutant <ccoutant@google.com>
5649
5650 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5651 for incremental links.
5652 * output.cc (Output_segment::set_section_list_addresses): Remove
5653 FIXME and test for TLS or BSS.
5654
5655 2011-06-07 Cary Coutant <ccoutant@google.com>
5656
5657 * testsuite/Makefile.am: Add incremental_copy_test,
5658 incremental_common_test_1.
5659 * testsuite/Makefile.in: Regenerate.
5660 * testsuite/common_test_1_v1.c: New source file.
5661 * testsuite/common_test_1_v2.c: New source file.
5662 * testsuite/copy_test_v1.cc: New source file.
5663
5664 2011-06-07 Cary Coutant <ccoutant@google.com>
5665
5666 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5667 update, allocate common from bss section's free list.
5668 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5669 linker-defined symbols.
5670 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5671 Skip GOT and PLT entries that are no longer referenced.
5672 (Output_section_incremental_inputs::write_info_blocks): Mark
5673 linker-defined symbols.
5674 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5675 * output.cc (Output_section::allocate): New function.
5676 * output.h (Output_section::allocate): New function.
5677 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5678 linker-defined symbols.
5679 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5680 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5681 (Symbol::init_base_output_data): Likewise.
5682 (Symbol::init_base_output_segment): Likewise.
5683 (Symbol::init_base_constant): Likewise.
5684 (Sized_symbol::init_output_data): Likewise.
5685 (Sized_symbol::init_output_segment): Likewise.
5686 (Sized_symbol::init_constant): Likewise.
5687 (Symbol_table::do_define_in_output_data): Likewise.
5688 (Symbol_table::do_define_in_output_segment): Likewise.
5689 (Symbol_table::do_define_as_constant): Likewise.
5690 * symtab.h (Symbol::is_predefined): New function.
5691 (Symbol::init_base_output_data): Add is_predefined parameter.
5692 (Symbol::init_base_output_segment): Likewise.
5693 (Symbol::init_base_constant): Likewise.
5694 (Symbol::is_predefined_): New data member.
5695 (Sized_symbol::init_output_data): Add is_predefined parameter.
5696 (Sized_symbol::init_output_segment): Likewise.
5697 (Sized_symbol::init_constant): Likewise.
5698 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5699
5700 2011-06-07 Cary Coutant <ccoutant@google.com>
5701
5702 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5703 instead of emit_copy_reloc.
5704 (Copy_relocs::emit_copy_reloc): Refactor.
5705 (Copy_relocs::make_copy_reloc): New function.
5706 (Copy_relocs::add_copy_reloc): Remove.
5707 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5708 section.
5709 (Copy_relocs::make_copy_reloc): New function.
5710 (Copy_relocs::add_copy_reloc): Remove.
5711 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5712 unchanged input files.
5713 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5714 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5715 Reserve BSS space for COPY relocations.
5716 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5717 (Output_section_incremental_inputs::write_info_blocks): Record
5718 whether a symbol is copied from a shared object.
5719 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5720 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5721 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5722 (Incremental_input_entry_reader::get_output_symbol_index): Add
5723 is_copy parameter.
5724 (Incremental_binary::emit_copy_relocs): New function.
5725 (Incremental_binary::do_emit_copy_relocs): New function.
5726 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5727 new data member.
5728 (Sized_incremental_binary::add_copy_reloc): New function.
5729 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5730 (Sized_incremental_binary::Copy_reloc): New struct.
5731 (Sized_incremental_binary::Copy_relocs): New typedef.
5732 (Sized_incremental_binary::copy_relocs_): New data member.
5733 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5734 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5735 * target.h (Sized_target::emit_copy_reloc): New function.
5736 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5737
5738 2011-06-02 Cary Coutant <ccoutant@google.com>
5739
5740 PR gold/12163
5741 * gold/archive.cc (Archive::Archive): Initialize new data member.
5742 (Archive::include_all_members): Return if archive has already been
5743 included.
5744 * gold/archive.h (Archive::include_all_members_): New data member.
5745
5746 2011-06-02 Nick Clifton <nickc@redhat.com>
5747
5748 * dynobj.h: Fix spelling mistake in comment.
5749 * output.cc: Likewise.
5750
5751 2011-05-31 Doug Kwan <dougkwan@google.com>
5752 Asier Llano
5753
5754 PR gold/12826
5755 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5756 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5757 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5758 redundant arm_exidx_test.so.
5759 * testsuite/Makefile.in: Regenerate.
5760 (check_SCRIPTS): Add pr12826.sh
5761 (check_DATA): Add pr12826.stdout
5762 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5763 * testsuite/pr12826.sh: New file.
5764 * testsuite/pr12826_1.s: Ditto.
5765 * testsuite/pr12826_1.s: Ditto.
5766
5767 2011-05-30 Ian Lance Taylor <iant@google.com>
5768
5769 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5770 sections.
5771
5772 2011-05-29 Ian Lance Taylor <iant@google.com>
5773
5774 PR gold/12804
5775 * testsuite/Makefile.am: Use different file name for two_file_test
5776 temporary file for each incremental test.
5777 * testsuite/Makefile.in: Rebuild.
5778
5779 2011-05-29 Ian Lance Taylor <iant@google.com>
5780
5781 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5782 binary input file is empty.
5783
5784 2011-05-27 Ian Lance Taylor <iant@google.com>
5785
5786 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5787 (ver_test_9.so): Likewise.
5788 * testsuite/Makefile.in: Rebuild.
5789
5790 2011-05-26 Cary Coutant <ccoutant@google.com>
5791
5792 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5793 * incremental.cc (Incremental_inputs::report_input_section): Fix
5794 comment, indentation.
5795 (Incremental_inputs::report_comdat_group): New function.
5796 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5797 of data for incremental input file entry.
5798 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5799 group count, COMDAT group signatures.
5800 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5801 an unchanged input file.
5802 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5803 Initialize new data member.
5804 (Incremental_object_entry::add_comdat_group): New function.
5805 (Incremental_object_entry::get_comdat_group_count): New function.
5806 (Incremental_object_entry::get_comdat_signature_key): New function.
5807 (Incremental_object_entry::groups_): New data member.
5808 (Incremental_inputs::report_comdat_group): New function.
5809 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5810 data for incremental input file entry.
5811 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5812 (Incremental_input_entry_reader::get_input_section): Adjust size of
5813 data for incremental input file entry.
5814 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5815 (Incremental_input_entry_reader::get_comdat_group_signature): New
5816 function.
5817 * object.cc (Sized_relobj::include_section_group): Report kept
5818 COMDAT groups for incremental links.
5819
5820 2011-05-24 David Meyer <pdox@google.com>
5821
5822 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5823 with name parameter. Add found_name parameter.
5824 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5825 * dirsearch.h (class Dirsearch): Update declaration.
5826
5827 2011-05-24 Ian Lance Taylor <iant@google.com>
5828
5829 * archive.cc (Library_base::should_include_member): Pull in object
5830 from archive if it defines the entry symbol.
5831 * parameters.cc (Parameters::entry): New function.
5832 * parameters.h (class Parameters): Declare entry.
5833 * output.h (class Output_file_header): Remove entry_ field.
5834 * output.cc (Output_file_header::Output_file_header): Remove entry
5835 parameter. Change all callers.
5836 (Output_file_header::entry): Use parameters->entry.
5837 * gold.cc (queue_middle_tasks): Likewise.
5838 * plugin.cc (Plugin_hook::run): Likewise.
5839
5840 2011-05-24 Cary Coutant <ccoutant@google.com>
5841
5842 * gold.cc (queue_initial_tasks): Pass incremental base filename
5843 to Output_file::open_base_file; don't print error message.
5844 * incremental-dump.cc (main): Adjust call to
5845 Output_file::open_for_modification.
5846 * incremental-dump.cc (main): Likewise.
5847 * incremental.cc (Incremental_inputs::report_command_line):
5848 Ignore --incremental-base option when comparing command lines.
5849 Ignore parameter when given as separate argument.
5850 * options.h (class General_options): Add --incremental-base.
5851 * output.cc (Output_file::Output_file):
5852 (Output_file::open_base_file): Add base_name and writable parameters;
5853 read base file into new file; print error message here.
5854 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5855 callers.
5856 * output.h (Output_file::open_for_modification): Rename to...
5857 (Output_file::open_base_file): ...this; add base_name and
5858 writable parameters; adjust all callers.
5859 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5860 callers.
5861 * testsuite/Makefile.am (incremental_test_4): Test
5862 --incremental-base.
5863 * testsuite/Makefile.in: Regenerate.
5864
5865 2011-05-24 Cary Coutant <ccoutant@google.com>
5866
5867 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5868 incremental_test_4.
5869 * testsuite/Makefile.in: Regenerate.
5870 * testsuite/two_file_test_1_v1.cc: New test source file.
5871 * testsuite/two_file_test_1b_v1.cc: New test source file.
5872 * testsuite/two_file_test_2_v1.cc: New test source file.
5873
5874 2011-05-24 Cary Coutant <ccoutant@google.com>
5875
5876 * dynobj.h (Dynobj::do_dynobj): New function.
5877 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5878 flag and soname for shared objects.
5879 * incremental.cc (Incremental_inputs::report_object): Make
5880 either Incremental_object_entry or Incremental_dynobj_entry; add
5881 soname to string table.
5882 (Incremental_inputs::report_input_section): Add assertion.
5883 (Output_section_incremental_inputs::set_final_data_size): Adjust
5884 type of input file entry for shared libraries; adjust size of
5885 shared library info entry.
5886 (Output_section_incremental_inputs::write_input_files): Write
5887 as_needed flag for shared libraries.
5888 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5889 of input file entry for shared libraries; write soname.
5890 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5891 soname from incremental info.
5892 * incremental.h (enum Incremental_input_flags): Add
5893 INCREMENTAL_INPUT_AS_NEEDED.
5894 (Incremental_input_entry::Incremental_input_entry): Initialize new
5895 data member.
5896 (Incremental_input_entry::set_as_needed): New function.
5897 (Incremental_input_entry::as_needed): New function.
5898 (Incremental_input_entry::do_dynobj_entry): New function.
5899 (Incremental_input_entry::as_needed_): New data member.
5900 (Incremental_object_entry::Incremental_object_entry): Don't check
5901 for shared library.
5902 (Incremental_object_entry::do_type): Likewise.
5903 (class Incremental_dynobj_entry): New class.
5904 (Incremental_input_entry_reader::as_needed): New function.
5905 (Incremental_input_entry_reader::get_soname): New function.
5906 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5907 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5908 size of shared library info entry.
5909 * layout.cc (Layout::finish_dynamic_section): Don't test for
5910 incremental link when adding DT_NEEDED entries.
5911 * object.h (Object::Object): Initialize new data member.
5912 (Object::dynobj): New function.
5913 (Object::set_as_needed): New function.
5914 (Object::as_needed): New function.
5915 (Object::do_dynobj): New function.
5916 (Object::as_needed_): New data member.
5917
5918 2011-05-24 Cary Coutant <ccoutant@google.com>
5919
5920 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5921 info; adjust display of GOT entries.
5922 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5923 vector of input objects; remove file_status_.
5924 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5925 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5926 got_plt reader; call target hooks to reserve GOT entries.
5927 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5928 of input file info header and GOT info entry.
5929 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5930 relocation info.
5931 (Got_plt_view_info::got_descriptor): Remove.
5932 (Got_plt_view_info::sym_index): New data member.
5933 (Got_plt_view_info::input_index): New data member.
5934 (Local_got_offset_visitor::visit): Write input file index.
5935 (Global_got_offset_visitor::visit): Write 0 for input file index.
5936 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5937 with sym_index and input_index.
5938 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5939 incremental info GOT entry; replace got_descriptor with input_index.
5940 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5941 map from input file index to object.
5942 (Sized_relobj_incr::do_layout): Replace direct data member reference
5943 with accessor function.
5944 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5945 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5946 Adjust size of input file info header.
5947 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5948 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5949 (Incremental_input_entry_reader::get_input_section): Adjust size of
5950 input file info header.
5951 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5952 of incremental info GOT entry.
5953 (Incremental_got_plt_reader::get_got_desc): Remove.
5954 (Incremental_got_plt_reader::get_got_symndx): New function.
5955 (Incremental_got_plt_reader::get_got_input_index): New function.
5956 (Sized_incremental_binary::Sized_incremental_binary): Remove
5957 file_status_; add input_objects_.
5958 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5959 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5960 (Sized_incremental_binary::file_is_unchanged): Remove.
5961 (Sized_incremental_binary::set_input_object): New function.
5962 (Sized_incremental_binary::input_object): New function.
5963 (Sized_incremental_binary::file_status_): Remove.
5964 (Sized_incremental_binary::input_objects_): New data member.
5965 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5966 references.
5967 (Sized_relobj_incr::invalid_address): Move to base class.
5968 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5969 class.
5970 (Sized_relobj_incr::do_output_section_offset): Likewise.
5971 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5972 (Sized_relobj_incr::section_offsets_): Likewise.
5973 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5974 function.
5975 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5976 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5977 with accessor function.
5978 (Sized_relobj_file::do_layout): Likewise.
5979 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5980 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5981 (Sized_relobj_file::compute_final_local_value): Replace refs to
5982 section_offsets_ with accessor function.
5983 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5984 * object.h (Relobj::Relobj): Initialize new data members.
5985 (Relobj::add_dyn_reloc): New function.
5986 (Relobj::first_dyn_reloc): New function.
5987 (Relobj::dyn_reloc_count): New function.
5988 (Relobj::first_dyn_reloc_): New data member.
5989 (Relobj::dyn_reloc_count_): New data member.
5990 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5991 references.
5992 (Sized_relobj::Address): New typedef.
5993 (Sized_relobj::invalid_address): Move here from child class.
5994 (Sized_relobj::Sized_relobj): Initialize new data members.
5995 (Sized_relobj::sized_relobj): New function.
5996 (Sized_relobj::is_output_section_offset_invalid): Move here from
5997 child class.
5998 (Sized_relobj::get_output_section_offset): Likewise.
5999 (Sized_relobj::local_has_got_offset): Likewise.
6000 (Sized_relobj::local_got_offset): Likewise.
6001 (Sized_relobj::set_local_got_offset): Likewise.
6002 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6003 (Sized_relobj::clear_got_offsets): New function.
6004 (Sized_relobj::section_offsets): Move here from child class.
6005 (Sized_relobj::do_output_section_offset): Likewise.
6006 (Sized_relobj::do_set_section_offset): Likewise.
6007 (Sized_relobj::Local_got_offsets): Likewise.
6008 (Sized_relobj::local_got_offsets_): Likewise.
6009 (Sized_relobj::section_offsets_): Likewise.
6010 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6011 references.
6012 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6013 class.
6014 (Sized_relobj_file::sized_relobj): New function
6015 (Sized_relobj_file::local_has_got_offset): Move to base class.
6016 (Sized_relobj_file::local_got_offset): Likewise.
6017 (Sized_relobj_file::set_local_got_offset): Likewise.
6018 (Sized_relobj_file::get_output_section_offset): Likewise.
6019 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6020 (Sized_relobj_file::do_output_section_offset): Likewise.
6021 (Sized_relobj_file::do_set_section_offset): Likewise.
6022 (Sized_relobj_file::Local_got_offsets): Likewise.
6023 (Sized_relobj_file::local_got_offsets_): Likewise.
6024 (Sized_relobj_file::section_offsets_): Likewise.
6025 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6026 (all constructors).
6027 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6028 (Output_reloc::get_symbol_index): Likewise.
6029 (Output_reloc::local_section_offset): Likewise.
6030 (Output_reloc::get_address): Likewise.
6031 (Output_reloc::symbol_value): Likewise.
6032 (Output_data_got::reserve_slot): Move to class definition.
6033 (Output_data_got::reserve_local): New function.
6034 (Output_data_got::reserve_slot_for_global): Remove.
6035 (Output_data_got::reserve_global): New function.
6036 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6037 (all constructors, two instantiations).
6038 (Output_reloc::get_relobj): New function (two instantiations).
6039 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6040 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6041 (Output_data_reloc::add_global): Adjust type of relobj.
6042 (Output_data_reloc::add_global_relative): Likewise.
6043 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6044 (Output_data_reloc::add_local): Likewise.
6045 (Output_data_reloc::add_local_relative): Likewise.
6046 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6047 (Output_data_reloc::add_local_section): Likewise.
6048 (Output_data_reloc::add_output_section): Likewise.
6049 (Output_data_reloc::add_absolute): Likewise.
6050 (Output_data_reloc::add_target_specific): Likewise.
6051 (Output_data_got::reserve_slot): Move definition here.
6052 (Output_data_got::reserve_local): New function.
6053 (Output_data_got::reserve_global): New function.
6054 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6055 section_offsets_ with accessor function.
6056 (Sized_relobj_file::write_sections): Likewise.
6057 (Sized_relobj_file::do_relocate_sections): Likewise.
6058 * target.h (Sized_target::reserve_local_got_entry): New function.
6059 (Sized_target::reserve_global_got_entry): New function.
6060 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6061 (Target_x86_64::reserve_global_got_entry): New function.
6062 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6063
6064 2011-05-23 Cary Coutant <ccoutant@google.com>
6065
6066 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6067 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6068 bit when checking got_type.
6069 * incremental.cc (Sized_incremental_binary::setup_readers):
6070 Store symbol table and string table locations; initialize bit vector
6071 of file status flags.
6072 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6073 unchanged files.
6074 (Sized_incremental_binary::do_process_got_plt): New function.
6075 (Sized_incremental_binary::get_symtab_view): Use stored locations.
6076 (Output_section_incremental_inputs::set_final_data_size): Record
6077 file index for each input file.
6078 (Output_section_incremental_inputs::write_got_plt): Store file index
6079 instead of input entry offset for each GOT entry.
6080 * incremental.h
6081 (Incremental_input_entry::Incremental_input_entry): Initialize new
6082 data member.
6083 (Incremental_input_entry::set_offset): Store file index.
6084 (Incremental_input_entry::get_file_index): New function.
6085 (Incremental_input_entry::file_index_): New data member.
6086 (Incremental_binary::process_got_plt): New function.
6087 (Incremental_binary::do_process_got_plt): New function.
6088 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6089 data members.
6090 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6091 (Sized_incremental_binary::set_file_is_unchanged): New function.
6092 (Sized_incremental_binary::file_is_unchanged): New function.
6093 (Sized_incremental_binary::do_process_got_plt): New function.
6094 (Sized_incremental_binary::file_status_): New data member.
6095 (Sized_incremental_binary::main_symtab_loc_): New data member.
6096 (Sized_incremental_binary::main_strtab_loc_): New data member.
6097 * output.cc (Output_data_got::Got_entry::write): Add case
6098 RESERVED_CODE.
6099 (Output_data_got::add_global): Call add_got_entry.
6100 (Output_data_got::add_global_plt): Likewise.
6101 (Output_data_got::add_global_with_rel): Likewise.
6102 (Output_data_got::add_global_with_rela): Likewise.
6103 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6104 (Output_data_got::add_global_pair_with_rela): Likewise.
6105 (Output_data_got::add_local): Call add_got_entry.
6106 (Output_data_got::add_local_plt): Likewise.
6107 (Output_data_got::add_local_with_rel): Likewise.
6108 (Output_data_got::add_local_with_rela): Likewise.
6109 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6110 (Output_data_got::add_local_pair_with_rela): Likewise.
6111 (Output_data_got::reserve_slot): New function.
6112 (Output_data_got::reserve_slot_for_global): New function.
6113 (Output_data_got::add_got_entry): New function.
6114 (Output_data_got::add_got_entry_pair): New function.
6115 (Output_section::add_output_section_data): Edit FIXME.
6116 * output.h
6117 (Output_section_data_build::Output_section_data_build): New
6118 constructor with size parameter.
6119 (Output_data_space::Output_data_space): Likewise.
6120 (Output_data_got::Output_data_got): Initialize new data member; new
6121 constructor with size parameter.
6122 (Output_data_got::add_constant): Call add_got_entry.
6123 (Output_data_got::reserve_slot): New function.
6124 (Output_data_got::reserve_slot_for_global): New function.
6125 (class Output_data_got::Got_entry): Add RESERVED_CODE.
6126 (Output_data_got::add_got_entry): New function.
6127 (Output_data_got::add_got_entry_pair): New function.
6128 (Output_data_got::free_list_): New data member.
6129 * target.h (Sized_target::init_got_plt_for_update): New function.
6130 (Sized_target::register_global_plt_entry): New function.
6131 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6132 Initialize new data member; call init; add constructor with PLT count.
6133 (Output_data_plt_x86_64::init): New function.
6134 (Output_data_plt_x86_64::add_relocation): New function.
6135 (Output_data_plt_x86_64::reserve_slot): New function.
6136 (Output_data_plt_x86_64::free_list_): New data member.
6137 (Target_x86_64::init_got_plt_for_update): New function.
6138 (Target_x86_64::register_global_plt_entry): New function.
6139 (Output_data_plt_x86_64::add_entry): Allocate from free list for
6140 incremental updates.
6141 (Output_data_plt_x86_64::add_relocation): New function.
6142 * testsuite/object_unittest.cc (Object_test): Set default options.
6143
6144 2011-05-16 Ian Lance Taylor <iant@google.com>
6145
6146 * options.h (class General_options): Make -i a synonym for -r.
6147
6148 2011-05-16 Ian Lance Taylor <iant@google.com>
6149
6150 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6151
6152 2011-05-10 Cary Coutant <ccoutant@google.com>
6153
6154 * object.cc (Sized_relobj::do_count_local_symbols): Check for
6155 strip_all (-s).
6156
6157 2011-05-06 Ian Lance Taylor <iant@google.com>
6158
6159 * layout.cc (Layout::layout): If the output section flags change,
6160 update the ordering.
6161
6162 2011-04-25 Cary Coutant <ccoutant@google.com>
6163
6164 * incremental-dump.cc (dump_incremental_inputs): Print local
6165 symbol info for each input file.
6166 * incremental.cc
6167 (Output_section_incremental_inputs::set_final_data_size): Add local
6168 symbol info to input file entries in incremental info.
6169 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6170 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6171 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6172 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6173 implementation.
6174 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6175 (Sized_incr_relobj::do_relocate): Write the local symbols.
6176 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6177 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6178 Adjust size of input file header.
6179 (Incremental_inputs_reader::get_local_symbol_offset): New function.
6180 (Incremental_inputs_reader::get_local_symbol_count): New function.
6181 (Incremental_inputs_reader::get_input_section): Adjust size of input
6182 file header.
6183 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6184 (Sized_incr_relobj::This): New typedef.
6185 (Sized_incr_relobj::sym_size): New const data member.
6186 (Sized_incr_relobj::Local_symbol): New struct.
6187 (Sized_incr_relobj::do_output_local_symbol_count): New function.
6188 (Sized_incr_relobj::do_local_symbol_offset): New function.
6189 (Sized_incr_relobj::local_symbol_count_): New data member.
6190 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6191 (Sized_incr_relobj::local_symbol_index_): New data member.
6192 (Sized_incr_relobj::local_symbol_offset_): New data member.
6193 (Sized_incr_relobj::local_dynsym_offset_): New data member.
6194 (Sized_incr_relobj::local_symbols_): New data member.
6195 * object.h (Relobj::output_local_symbol_count): New function.
6196 (Relobj::local_symbol_offset): New function.
6197 (Relobj::do_output_local_symbol_count): New function.
6198 (Relobj::do_local_symbol_offset): New function.
6199 (Sized_relobj::do_output_local_symbol_count): New function.
6200 (Sized_relobj::do_local_symbol_offset): New function.
6201
6202 2011-04-22 Vladimir Simonov <sv@sw.ru>
6203
6204 * descriptors.cc (set_close_on_exec): New function.
6205 (Descriptors::open): Use set_close_on_exec.
6206 * output.cc (S_ISLNK): Define if not defined.
6207
6208 2011-04-22 Cary Coutant <ccoutant@google.com>
6209
6210 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6211 global symbol map.
6212 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6213 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6214 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6215 relocations.
6216 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6217 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6218 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6219 * incremental.h
6220 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6221 function.
6222 (Incremental_binary::apply_incremental_relocs): New function.
6223 (Incremental_binary::do_apply_incremental_relocs): New function.
6224 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6225 data member.
6226 (Sized_incremental_binary::add_global_symbol): New function.
6227 (Sized_incremental_binary::global_symbol): New function.
6228 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6229 (Sized_incremental_binary::symbol_map_): New data member.
6230 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6231 * target.h (Sized_target::apply_relocation): New function.
6232 * target-reloc.h (apply_relocation): New function.
6233 * x86_64.cc (Target_x86_64::apply_relocation): New function.
6234
6235 2011-04-22 Doug Kwan <dougkwan@google.com>
6236
6237 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6238 flag of a SHT_ARM_EXIDX section.
6239 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6240 * testsuite/Makefile.in: Regenerate.
6241 * testsuite/arm_exidx_test.s: New file.
6242 * testsuite/arm_exidx_test.sh: Same.
6243
6244 2011-04-20 Cary Coutant <ccoutant@google.com>
6245
6246 PR gold/12689
6247 * archive.h (Incremental_archive_entry::Archive_member):
6248 Initialize arg_serial_ (second constructor).
6249
6250 2011-04-17 Ian Lance Taylor <iant@google.com>
6251
6252 * object.cc (Relocate_info::location): Simplify location string.
6253 * errors.cc (Errors::error_at_location): Don't print program
6254 name.
6255 (Errors::warning_at_location): Likewise.
6256 (Errors::undefined_symbol): Likewise.
6257 * testsuite/debug_msg.sh: Update accordingly.
6258
6259 2011-04-14 Cary Coutant <ccoutant@google.com>
6260
6261 * gold/layout.cc (Layout::symtab_section_offset): New function.
6262 * gold/layout.h (Layout::symtab_section_offset): New function.
6263 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6264
6265 2011-04-12 Ian Lance Taylor <iant@google.com>
6266
6267 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
6268 with MREMAP_MAYMOVE.
6269 * output.h (class Output_file): Add map_is_allocated_ field.
6270 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
6271 not available, provide stubs. If mremap is not available, #define
6272 it to gold_mremap.
6273 (MREMAP_MAYMOVE): Define if not defined.
6274 (Output_file::Output_file): Initialize map_is_allocated_.
6275 (Output_file::resize): Check map_is_allocated_.
6276 (Output_file::map_anonymous): If mmap fails, use malloc.
6277 (Output_file::unmap): Don't do anything for an anonymous map.
6278 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
6279 is not available, provide stubs.
6280 (File_read::View::~View): Use free rather than delete[].
6281 (File_read::make_view): Use malloc rather than new[]. If mmap
6282 fails, use malloc.
6283 (File_read::find_or_make_view): Use malloc rather than new[].
6284 * gold.h: Remove HAVE_REMAP code.
6285 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
6286 exists. Rename mremap to gold_mremap. If mmap is not available
6287 don't do anything.
6288 * configure, config.in: Rebuild.
6289
6290 2011-04-11 Ian Lance Taylor <iant@google.com>
6291
6292 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6293 initialize local variable v.
6294
6295 2011-04-11 Cary Coutant <ccoutant@google.com>
6296
6297 * archive.cc (Archive::include_member): Adjust call to
6298 report_object.
6299 (Add_archive_symbols::run): Track argument serial numbers.
6300 (Lib_group::include_member): Likewise.
6301 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6302 * archive.h (Incremental_archive_entry::Archive_member):
6303 Initialize arg_serial_.
6304 (Archive_member::arg_serial_): New data member.
6305 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6306 (Sized_dynobj::do_add_symbols): Track symbols when doing an
6307 incremental link.
6308 (Sized_dynobj::do_for_all_local_got_entries): New function.
6309 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6310 function.
6311 * fileread.cc (get_mtime): New function.
6312 * fileread.h (get_mtime): New function.
6313 * gold.cc (queue_initial_tasks): Check for incremental update.
6314 (process_incremental_input): New function.
6315 (queue_middle_tasks): Don't force valid target for incremental
6316 update.
6317 * incremental-dump.cc (find_input_containing_global): Adjust
6318 size of symbol info entry.
6319 (dump_incremental_inputs): Dump argument serial number and
6320 in_system_directory flag; bias shndx by 1; print symbol names
6321 when dumping per-file symbol lists; use new symbol info readers.
6322 * incremental.cc
6323 (Output_section_incremental_inputs:update_data_size): New function.
6324 (Sized_incremental_binary::setup_readers): Setup input readers
6325 for each input file; build maps for files added from libraries
6326 and scripts.
6327 (Sized_incremental_binary::check_input_args): New function.
6328 (Sized_incremental_binary::do_check_inputs): Build map of argument
6329 serial numbers to input arguments.
6330 (Sized_incremental_binary::do_file_has_changed): Rename
6331 do_file_is_unchanged to this; compare file modification times.
6332 (Sized_incremental_binary::do_init_layout): New function.
6333 (Sized_incremental_binary::do_reserve_layout): New function.
6334 (Sized_incremental_binary::do_get_input_reader): Remove.
6335 (Sized_incremental_binary::get_symtab_view): New function.
6336 (Incremental_checker::can_incrementally_link_output_file): Remove.
6337 (Incremental_inputs::report_command_line): Exclude --debug options.
6338 (Incremental_inputs::report_archive_begin): Add parameter; track
6339 argument serial numbers; don't put input file entry for archive
6340 before archive members.
6341 (Incremental_inputs::report_archive_end): Put input file entry
6342 for archive after archive members.
6343 (Incremental_inputs::report_object): Add parameter; track argument
6344 serial numbers and in_system_directory flag.
6345 (Incremental_inputs::report_script): Add parameter; track argument
6346 serial numbers.
6347 (Output_section_incremental_inputs::set_final_data_size): Adjust
6348 size of symbol info entry; check for forwarding symbols.
6349 (Output_section_incremental_inputs::write_input_files): Write
6350 in_system_directory flag and argument serial number.
6351 (Output_section_incremental_inputs::write_info_blocks): Map section
6352 indices between incremental info and original input file; store
6353 input section index for each symbol.
6354 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6355 change operator() to visit().
6356 (class Global_got_offset_visitor): Likewise.
6357 (class Global_symbol_visitor_got_plt):
6358 (Output_section_incremental_inputs::write_got_plt): Use new visitor
6359 classes.
6360 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6361 (Sized_incr_relobj::do_read_symbols): New function.
6362 (Sized_incr_relobj::do_layout): New function.
6363 (Sized_incr_relobj::do_layout_deferred_sections): New function.
6364 (Sized_incr_relobj::do_add_symbols): New function.
6365 (Sized_incr_relobj::do_should_include_member): New function.
6366 (Sized_incr_relobj::do_for_all_global_symbols): New function.
6367 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6368 (Sized_incr_relobj::do_section_size): New function.
6369 (Sized_incr_relobj::do_section_name): New function.
6370 (Sized_incr_relobj::do_section_contents): New function.
6371 (Sized_incr_relobj::do_section_flags): New function.
6372 (Sized_incr_relobj::do_section_entsize): New function.
6373 (Sized_incr_relobj::do_section_address): New function.
6374 (Sized_incr_relobj::do_section_type): New function.
6375 (Sized_incr_relobj::do_section_link): New function.
6376 (Sized_incr_relobj::do_section_info): New function.
6377 (Sized_incr_relobj::do_section_addralign): New function.
6378 (Sized_incr_relobj::do_initialize_xindex): New function.
6379 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6380 (Sized_incr_relobj::do_read_relocs): New function.
6381 (Sized_incr_relobj::do_gc_process_relocs): New function.
6382 (Sized_incr_relobj::do_scan_relocs): New function.
6383 (Sized_incr_relobj::do_count_local_symbols): New function.
6384 (Sized_incr_relobj::do_finalize_local_symbols): New function.
6385 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6386 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6387 (Sized_incr_relobj::do_relocate): New function.
6388 (Sized_incr_relobj::do_set_section_offset): New function.
6389 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6390 (Sized_incr_dynobj::do_read_symbols): New function.
6391 (Sized_incr_dynobj::do_layout): New function.
6392 (Sized_incr_dynobj::do_add_symbols): New function.
6393 (Sized_incr_dynobj::do_should_include_member): New function.
6394 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6395 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6396 (Sized_incr_dynobj::do_section_size): New function.
6397 (Sized_incr_dynobj::do_section_name): New function.
6398 (Sized_incr_dynobj::do_section_contents): New function.
6399 (Sized_incr_dynobj::do_section_flags): New function.
6400 (Sized_incr_dynobj::do_section_entsize): New function.
6401 (Sized_incr_dynobj::do_section_address): New function.
6402 (Sized_incr_dynobj::do_section_type): New function.
6403 (Sized_incr_dynobj::do_section_link): New function.
6404 (Sized_incr_dynobj::do_section_info): New function.
6405 (Sized_incr_dynobj::do_section_addralign): New function.
6406 (Sized_incr_dynobj::do_initialize_xindex): New function.
6407 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6408 (make_sized_incremental_object): New function.
6409 (Incremental_library::copy_unused_symbols): New function.
6410 (Incremental_library::do_for_all_unused_symbols): New function.
6411 * incremental.h (enum Incremental_input_flags): New type.
6412 (class Incremental_checker): Remove.
6413 (Incremental_input_entry::Incremental_input_entry): Add argument
6414 serial number.
6415 (Incremental_input_entry::arg_serial): New function.
6416 (Incremental_input_entry::set_is_in_system_directory): New function.
6417 (Incremental_input_entry::is_in_system_directory): New function.
6418 (Incremental_input_entry::arg_serial_): New data member.
6419 (Incremental_input_entry::is_in_system_directory_): New data member.
6420 (class Script_info): Move here from script.h.
6421 (Script_info::Script_info): Add filename parameter.
6422 (Script_info::filename): New function.
6423 (Script_info::filename_): New data member.
6424 (Incremental_script_entry::Incremental_script_entry): Add argument
6425 serial number.
6426 (Incremental_object_entry::Incremental_object_entry): Likewise.
6427 (Incremental_object_entry::add_input_section): Build list of input
6428 sections with map to original shndx.
6429 (Incremental_object_entry::get_input_section_index): New function.
6430 (Incremental_object_entry::shndx_): New data member.
6431 (Incremental_object_entry::name_key_): Rename; adjust all refs.
6432 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6433 (Incremental_archive_entry::Incremental_archive_entry): Add argument
6434 serial number.
6435 (Incremental_inputs::report_archive_begin): Likewise.
6436 (Incremental_inputs::report_object): Likewise.
6437 (Incremental_inputs::report_script): Likewise.
6438 (class Incremental_global_symbol_reader): New class.
6439 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6440 and store flags and input file type.
6441 (Incremental_input_entry_reader::arg_serial): New function.
6442 (Incremental_input_entry_reader::type): Extract type from flags.
6443 (Incremental_input_entry_reader::is_in_system_directory): New function.
6444 (Incremental_input_entry_reader::get_input_section_count): Call
6445 accessor function for type.
6446 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6447 function for type; adjust size of global symbol entry.
6448 (Incremental_input_entry_reader::get_global_symbol_count): Call
6449 accessor function for type.
6450 (Incremental_input_entry_reader::get_object_count): Likewise.
6451 (Incremental_input_entry_reader::get_object_offset): Likewise.
6452 (Incremental_input_entry_reader::get_member_count): Likewise.
6453 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6454 (Incremental_input_entry_reader::get_member_offset): Likewise.
6455 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6456 (Incremental_input_entry_reader::Global_symbol_info): Remove.
6457 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6458 (Incremental_input_entry_reader::get_global_symbol_reader): New
6459 function.
6460 (Incremental_input_entry_reader::get_output_symbol_index): New
6461 function.
6462 (Incremental_input_entry_reader::type_): Remove.
6463 (Incremental_input_entry_reader::flags_): New data member.
6464 (Incremental_inputs_reader::input_file_offset): New function.
6465 (Incremental_inputs_reader::input_file_index): New function.
6466 (Incremental_inputs_reader::input_file): Call input_file_offset.
6467 (Incremental_inputs_reader::input_file_at_offset): New function.
6468 (Incremental_relocs_reader::get_r_type): Reformat.
6469 (Incremental_relocs_reader::get_r_shndx): Reformat.
6470 (Incremental_relocs_reader::get_r_offset): Reformat.
6471 (Incremental_relocs_reader::data): New function.
6472 (Incremental_binary::Incremental_binary): Initialize new data members.
6473 (Incremental_binary::check_inputs): Add cmdline parameter.
6474 (Incremental_binary::file_is_unchanged): Remove.
6475 (Input_reader::arg_serial): New function.
6476 (Input_reader::get_unused_symbol_count): New function.
6477 (Input_reader::get_unused_symbol): New function.
6478 (Input_reader::do_arg_serial): New function.
6479 (Input_reader::do_get_unused_symbol_count): New function.
6480 (Input_reader::do_get_unused_symbol): New function.
6481 (Incremental_binary::input_file_count): New function.
6482 (Incremental_binary::get_input_reader): Change signature to use
6483 index instead of filename.
6484 (Incremental_binary::file_has_changed): New function.
6485 (Incremental_binary::get_input_argument): New function.
6486 (Incremental_binary::get_library): New function.
6487 (Incremental_binary::get_script_info): New function.
6488 (Incremental_binary::init_layout): New function.
6489 (Incremental_binary::reserve_layout): New function.
6490 (Incremental_binary::output_file): New function.
6491 (Incremental_binary::do_check_inputs): New function.
6492 (Incremental_binary::do_file_is_unchanged): Remove.
6493 (Incremental_binary::do_file_has_changed): New function.
6494 (Incremental_binary::do_init_layout): New function.
6495 (Incremental_binary::do_reserve_layout): New function.
6496 (Incremental_binary::do_input_file_count): New function.
6497 (Incremental_binary::do_get_input_reader): Change signature.
6498 (Incremental_binary::input_args_map_): New data member.
6499 (Incremental_binary::library_map_): New data member.
6500 (Incremental_binary::script_map_): New data member.
6501 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6502 new data members.
6503 (Sized_incremental_binary::output_section): New function.
6504 (Sized_incremental_binary::inputs_reader): Add const.
6505 (Sized_incremental_binary::symtab_reader): Add const.
6506 (Sized_incremental_binary::relocs_reader): Add const.
6507 (Sized_incremental_binary::got_plt_reader): Add const.
6508 (Sized_incremental_binary::get_symtab_view): New function.
6509 (Sized_incremental_binary::Inputs_reader): New typedef.
6510 (Sized_incremental_binary::Input_entry_reader): New typedef.
6511 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6512 (Sized_incremental_binary::do_file_is_unchanged): Remove.
6513 (Sized_incremental_binary::do_file_has_changed): New function.
6514 (Sized_incremental_binary::do_init_layout): New function.
6515 (Sized_incremental_binary::do_reserve_layout): New function.
6516 (Sized_input_reader::Inputs_reader): Remove.
6517 (Sized_input_reader::Input_entry_reader): Remove.
6518 (Sized_input_reader::do_arg_serial): New function.
6519 (Sized_input_reader::do_get_unused_symbol_count): New function.
6520 (Sized_input_reader::do_get_unused_symbol): New function.
6521 (Sized_incremental_binary::do_input_file_count): New function.
6522 (Sized_incremental_binary::do_get_input_reader): Change signature;
6523 use index instead of filename.
6524 (Sized_incremental_binary::section_map_): New data member.
6525 (Sized_incremental_binary::input_entry_readers_): New data member.
6526 (class Sized_incr_relobj): New class.
6527 (class Sized_incr_dynobj): New class.
6528 (make_sized_incremental_object): New function.
6529 (class Incremental_library): New class.
6530 * layout.cc (Free_list::num_lists): New static data member.
6531 (Free_list::num_nodes): New static data member.
6532 (Free_list::num_removes): New static data member.
6533 (Free_list::num_remove_visits): New static data member.
6534 (Free_list::num_allocates): New static data member.
6535 (Free_list::num_allocate_visits): New static data member.
6536 (Free_list::init): New function.
6537 (Free_list::remove): New function.
6538 (Free_list::allocate): New function.
6539 (Free_list::dump): New function.
6540 (Free_list::print_stats): New function.
6541 (Layout_task_runner::run): Resize output file for incremental updates.
6542 (Layout::Layout): Initialize new data members.
6543 (Layout::set_incremental_base): New function.
6544 (Layout::init_fixed_output_section): New function.
6545 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6546 incremental updates.
6547 (Layout::create_gold_note): Do not create gold note section for
6548 incremental updates.
6549 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6550 for incremental updates.
6551 (Layout::set_section_offsets): For incremental updates, allocate space
6552 from free list.
6553 (Layout::create_symtab_sections): Layout with offsets relative to
6554 start of section; for incremental updates, allocate space from free
6555 list.
6556 (Layout::create_shdrs): For incremental updates, allocate space from
6557 free list.
6558 (Layout::finish_dynamic_section): For incremental updates, do not
6559 check --as-needed (fixed in subsequent patch).
6560 * layout.h (class Free_list): New class.
6561 (Layout::set_incremental_base): New function.
6562 (Layout::incremental_base): New function.
6563 (Layout::init_fixed_output_section): New function.
6564 (Layout::allocate): New function.
6565 (Layout::incremental_base_): New data member.
6566 (Layout::free_list_): New data member.
6567 * main.cc (main): Print Free_list statistics.
6568 * object.cc (Relobj::finalize_incremental_relocs): Add
6569 clear_counts parameter; clear counts only when clear_counts is set.
6570 (Sized_relobj::Sized_relobj): Initialize new base class.
6571 (Sized_relobj::do_layout): Don't report special sections.
6572 (Sized_relobj::do_for_all_local_got_entries): New function.
6573 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6574 symtab_off to all symbol table offsets.
6575 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6576 * object.h (class Got_offset_list): Move to top of file.
6577 (Object::Object): Allow case where input_file == NULL.
6578 (Object::~Object): Likewise.
6579 (Object::input_file): Assert that input_file != NULL.
6580 (Object::lock): Allow case where input_file == NULL.
6581 (Object::unlock): Likewise.
6582 (Object::is_locked): Likewise.
6583 (Object::token): Likewise.
6584 (Object::release): Likewise.
6585 (Object::is_incremental): New function.
6586 (Object::get_mtime): New function.
6587 (Object::for_all_local_got_entries): New function.
6588 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6589 (Object::set_is_in_system_directory): New function.
6590 (Object::is_in_system_directory): New function.
6591 (Object::do_is_incremental): New function.
6592 (Object::do_get_mtime): New function.
6593 (Object::do_for_all_local_got_entries): New function.
6594 (Object::is_in_system_directory_): New data member.
6595 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6596 (class Sized_relobj_base): New class.
6597 (class Sized_relobj): Derive from Sized_relobj_base.
6598 (class Sized_relobj::Symbols): Redeclare from base class.
6599 (class Sized_relobj::local_got_offset_list): Remove.
6600 (class Sized_relobj::Output_sections): Redeclare from base class.
6601 (class Sized_relobj::do_for_all_local_got_entries): New function.
6602 (class Sized_relobj::write_local_symbols): Add offset parameter.
6603 (class Sized_relobj::local_symbol_offset_): Update comment.
6604 (class Sized_relobj::local_dynsym_offset_): Update comment.
6605 * options.cc (Input_arguments::add_file): Remove const.
6606 * options.h (Input_file_argument::Input_file_argument):
6607 Initialize arg_serial_ (all constructors).
6608 (Input_file_argument::set_arg_serial): New function.
6609 (Input_file_argument::arg_serial): New function.
6610 (Input_file_argument::arg_serial_): New data member.
6611 (Input_arguments::Input_arguments): Initialize file_count_.
6612 (Input_arguments::add_file): Remove const.
6613 (Input_arguments::number_of_input_files): New function.
6614 (Input_arguments::file_count_): New data member.
6615 (Command_line::number_of_input_files): Call
6616 Input_arguments::number_of_input_files.
6617 * output.cc (Output_segment_headers::Output_segment_headers):
6618 Set current size.
6619 (Output_section::Input_section::current_data_size): New function.
6620 (Output_section::Output_section): Initialize new data members.
6621 (Output_section::add_input_section): Don't do merge sections for
6622 an incremental link; allocate space from free list for an
6623 incremental update.
6624 (Output_section::add_output_section_data): Allocate space from
6625 free list for an incremental update.
6626 (Output_section::update_data_size): New function.
6627 (Output_section::set_fixed_layout): New function.
6628 (Output_section::reserve): New function.
6629 (Output_segment::set_section_addresses): Remove const.
6630 (Output_segment::set_section_list_addresses): Remove const; allocate
6631 space from free list for an incremental update.
6632 (Output_segment::set_offset): Adjust size of RELRO segment for an
6633 incremental update.
6634 * output.h (Output_data::current_data_size): Move here from
6635 child classes.
6636 (Output_data::pre_finalize_data_size): New function.
6637 (Output_data::update_data_size): New function.
6638 (Output_section_headers::update_data_size): new function.
6639 (Output_section_data_build::current_data_size): Move to Output_data.
6640 (Output_data_strtab::update_data_size): New function.
6641 (Output_section::current_data_size): Move to Output_data.
6642 (Output_section::set_fixed_layout): New function.
6643 (Output_section::has_fixed_layout): New function.
6644 (Output_section::reserve): New function.
6645 (Output_section::update_data_size): New function.
6646 (Output_section::has_fixed_layout_): New data member.
6647 (Output_section::free_list_): New data member.
6648 (Output_segment::set_section_addresses): Remove const.
6649 (Output_segment::set_section_list_addresses): Remove const.
6650 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6651 New function.
6652 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6653 New function.
6654 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6655 parameter when calling Add_symbols constructor; store argument
6656 serial number for members of a lib group.
6657 (Add_symbols::locks): Allow case where token == NULL.
6658 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6659 (Read_member::~Read_member): New function.
6660 (Read_member::is_runnable): New function.
6661 (Read_member::locks): New function.
6662 (Read_member::run): New function.
6663 (Check_script::~Check_script): New function.
6664 (Check_script::is_runnable): New function.
6665 (Check_script::locks): New function.
6666 (Check_script::run): New function.
6667 (Check_library::~Check_library): New function.
6668 (Check_library::is_runnable): New function.
6669 (Check_library::locks): New function.
6670 (Check_library::run): New function.
6671 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6672 (Add_symbols::library_): New data member.
6673 (class Read_member): New class.
6674 (class Check_script): New class.
6675 (class Check_library): New class.
6676 * reloc.cc (Read_relocs::is_runnable): Allow case where
6677 token == NULL.
6678 (Read_relocs::locks): Likewise.
6679 (Scan_relocs::locks): Likewise.
6680 (Relocate_task::locks): Likewise.
6681 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6682 to clear counters.
6683 (Sized_relobj::incremental_relocs_scan): Fix comment.
6684 (Sized_relobj::do_relocate): Pass output file offset to
6685 write_local_symbols.
6686 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6687 from class declaration.
6688 * script.cc (read_input_script): Allocate Script_info; pass
6689 argument serial number to report_script.
6690 * script.h (class Script_info): Move to incremental.h.
6691 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6692 * symtab.h (Symbol_table::add_from_incrobj): New function.
6693 (Symbol_table::set_file_offset): New function.
6694
6695 2011-04-05 Cary Coutant <ccoutant@google.com>
6696
6697 * incremental-dump.cc (dump_incremental_inputs): Change signature
6698 to take a Sized_incremental_binary; change caller. Use readers
6699 in Sized_incremental_binary.
6700 * incremental.cc
6701 (Sized_incremental_binary::find_incremental_inputs_sections):
6702 Rename do_find_incremental_inputs_sections to this.
6703 (Sized_incremental_binary::setup_readers): New function.
6704 (Sized_incremental_binary::do_check_inputs): Check
6705 has_incremental_info_ flag; move setup code to setup_readers;
6706 use input readers.
6707 (Sized_incremental_binary::do_file_is_unchanged): New function.
6708 (Sized_incremental_binary::do_get_input_reader): New function.
6709 * incremental.h (class Incremental_binary): Move to end of file.
6710 (Incremental_binary::file_is_unchanged): New function.
6711 (Incremental_binary::do_file_is_unchanged): New function.
6712 (Incremental_binary::Input_reader): New class.
6713 (Incremental_binary::get_input_reader): New function.
6714 (class Sized_incremental_binary): Move to end of file.
6715 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6716 input section reader classes.
6717 (Sized_incremental_binary::has_incremental_info): New function.
6718 (Sized_incremental_binary::inputs_reader): New function.
6719 (Sized_incremental_binary::symtab_reader): New function.
6720 (Sized_incremental_binary::relocs_reader): New function.
6721 (Sized_incremental_binary::got_plt_reader): New function.
6722 (Sized_incremental_binary::do_file_is_unchanged): New function.
6723 (Sized_incremental_binary::Sized_input_reader): New class.
6724 (Sized_incremental_binary::get_input_reader): New function.
6725 (Sized_incremental_binary::find_incremental_inputs_sections):
6726 Rename do_find_incremental_inputs_sections to this.
6727 (Sized_incremental_binary::setup_readers): New function.
6728 (Sized_incremental_binary::has_incremental_info_): New data member.
6729 (Sized_incremental_binary::inputs_reader_): New data member.
6730 (Sized_incremental_binary::symtab_reader_): New data member.
6731 (Sized_incremental_binary::relocs_reader_): New data member.
6732 (Sized_incremental_binary::got_plt_reader_): New data member.
6733 (Sized_incremental_binary::current_input_file_): New data member.
6734
6735 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6736
6737 PR gold/12640
6738 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6739 violation.
6740
6741 2011-03-30 Cary Coutant <ccoutant@google.com>
6742
6743 * archive.cc (Archive::include_member): Adjust call to report_object.
6744 (Add_archive_symbols::run): Add script_info to call to
6745 report_archive_begin.
6746 (Lib_group::include_member): Adjust call to report_object.
6747 (Add_lib_group_symbols::run): Adjust call to report_object.
6748 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6749 blocks. Add object count for script input files.
6750 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6751 script_info parameter; change all callers.
6752 (Incremental_inputs::report_object): Add script_info parameter;
6753 change all callers.
6754 (Incremental_inputs::report_script): Store backpointer to
6755 incremental info entry.
6756 (Output_section_incremental_inputs::set_final_data_size): Record
6757 additional information for scripts.
6758 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6759 * incremental.h (Incremental_script_entry::add_object): New function.
6760 (Incremental_script_entry::get_object_count): New function.
6761 (Incremental_script_entry::get_object): New function.
6762 (Incremental_script_entry::objects_): New data member; adjust
6763 constructor.
6764 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6765 (Incremental_inputs::report_object): Add script_info parameter.
6766 (Incremental_inputs_reader::get_object_count): New function.
6767 (Incremental_inputs_reader::get_object_offset): New function.
6768 * options.cc (Input_arguments::add_file): Return reference to
6769 new input argument.
6770 * options.h (Input_argument::set_script_info): New function.
6771 (Input_argument::script_info): New function.
6772 (Input_argument::script_info_): New data member; adjust all
6773 constructors.
6774 (Input_file_group::add_file): Return reference to new input argument.
6775 (Input_file_lib::add_file): Likewise.
6776 (Input_arguments::add_file): Likewise.
6777 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6778 * script.cc (Parser_closure::Parser_closure): Add script_info
6779 parameter; adjust all callers.
6780 (Parser_closure::script_info): New function.
6781 (Parser_closure::script_info_): New data member.
6782 (read_input_script): Report scripts earlier to incremental info.
6783 (script_add_file): Set script_info in Input_argument.
6784 (script_add_library): Likewise.
6785 * script.h (Script_options::Script_info): Rewrite class.
6786
6787 2011-03-29 Cary Coutant <ccoutant@google.com>
6788
6789 * archive.cc (Library_base::should_include_member): Move
6790 method here from class Archive.
6791 (Archive::Archive): Initialize base class.
6792 (Archive::should_include_member): Move to base class.
6793 (Archive::do_for_all_unused_symbols): New function.
6794 (Add_archive_symbols::run): Remove redundant access to
6795 incremental_inputs.
6796 (Lib_group::Lib_group): Initialize base class.
6797 (Lib_group::do_filename): New function.
6798 (Lib_group::include_member): Pass pointer to Lib_group to
6799 report_object.
6800 (Lib_group::do_for_all_unused_symbols): New function.
6801 (Add_lib_group_symbols::run): Report archive information for
6802 incremental links.
6803 * archive.h (class Library_base): New base class.
6804 (class Archive): Derive from Library_base.
6805 (Archive::filename): Move to base class.
6806 (Archive::set_incremental_info): Likewise.
6807 (Archive::incremental_info): Likewise.
6808 (Archive::Should_include): Likewise.
6809 (Archive::should_include_member): Likewise.
6810 (Archive::Armap_entry): Remove.
6811 (Archive::Unused_symbol_iterator): Remove.
6812 (Archive::unused_symbols_begin): Remove.
6813 (Archive::unused_symbols_end): Remove.
6814 (Archive::do_filename): New function.
6815 (Archive::do_get_mtime): New function.
6816 (Archive::do_for_all_unused_symbols): New function.
6817 (Archive::task_): Move to base class.
6818 (Archive::incremental_info_): Likewise.
6819 (class Lib_group): Derive from Library_base.
6820 (Lib_group::do_filename): New function.
6821 (Lib_group::do_get_mtime): New function.
6822 (Lib_group::do_for_all_unused_symbols): New function.
6823 (Lib_group::task_): Move to base class.
6824 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6825 function.
6826 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6827 function.
6828 * incremental.cc (Incremental_inputs::report_archive_begin):
6829 Use Library_base; call library's get_mtime; add incremental inputs
6830 entry before members.
6831 (class Unused_symbol_visitor): New class.
6832 (Incremental_inputs::report_archive_end): Use Library_base; use
6833 visitor class to record unused symbols; don't add incremental inputs
6834 entry after members.
6835 (Incremental_inputs::report_object): Use Library_base.
6836 * incremental.h
6837 (Incremental_archive_entry::Incremental_archive_entry): Remove
6838 unused Archive parameter.
6839 (Incremental_inputs::report_archive_begin): Use Library_base.
6840 (Incremental_inputs::report_archive_end): Likewise.
6841 (Incremental_inputs::report_object): Likewise.
6842 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6843 function.
6844 * object.h (Object::for_all_global_symbols): New function.
6845 (Object::do_for_all_global_symbols): New function.
6846 (Sized_relobj::do_for_all_global_symbols): New function.
6847 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6848 function.
6849 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6850 function.
6851
6852 2011-03-27 Ian Lance Taylor <iant@google.com>
6853
6854 * archive.cc (Archive::interpret_header): Return -1 if something
6855 goes wrong. Change callers accordingly.
6856
6857 2011-03-25 Cary Coutant <ccoutant@google.com>
6858
6859 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6860 * testsuite/Makefile.in: Regenerate.
6861
6862 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6863
6864 * plugin.cc (get_view): New.
6865 (Plugin::load): Pass get_view to the plugin.
6866 (Plugin_manager::get_view): New.
6867
6868 2011-03-21 Ian Lance Taylor <iant@google.com>
6869
6870 * testsuite/final_layout.sh: Rewrite to not use dc.
6871 * testsuite/relro_test.sh: Fail if dc is not present.
6872
6873 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6874
6875 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6876 Change == to -eq.
6877 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6878 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6879 Change == to -eq.
6880 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6881 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6882
6883 2011-03-14 Ian Lance Taylor <iant@google.com>
6884
6885 * script-sections.cc (Sort_output_sections::script_compare):
6886 Rename from is_before, change return type.
6887 (Sort_output_sections::operator()): Adjust accordingly.
6888
6889 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6890
6891 PR gold/12572
6892 * testsuite/odr_violation2.cc: Add comment to make all error line
6893 numbers double digits.
6894 * testsuite/debug_msg.sh: Adjust expected errors.
6895
6896 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6897
6898 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6899 but mark earlier ones as non-canonical
6900 (offset_to_iterator): Update search target and example
6901 (do_addr2line): Return extra lines in a vector*
6902 (format_file_lineno): Extract from do_addr2line
6903 (one_addr2line): Add vector* out-param
6904 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6905 when a lineno entry appeared last for its instruction
6906 (Dwarf_line_info): Add vector* out-param
6907 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6908 * symtab.cc (Odr_violation_compare): Include the lineno in the
6909 comparison again.
6910 (linenos_from_loc): New. Combine the canonical line for an
6911 address with its other lines.
6912 (True_if_intersect): New. Helper functor to make
6913 std::set_intersection a query.
6914 (detect_odr_violations): Compare sets of lines instead of just
6915 one line for each function. This became less deterministic, but
6916 has fewer false positives.
6917 * symtab.h: Declarations.
6918 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6919 mix an optimized and non-optimized object in the same binary
6920 (odr_violation2.so): Same.
6921 * testsuite/Makefile.in: Regenerate from Makefile.am.
6922 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6923 * testsuite/debug_msg.sh: Update line numbers and add
6924 assertions.
6925 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6926 non-optimized context.
6927 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6928 isn't inlined, and use OdrDerived in an optimized context.
6929 * testsuite/odr_header1.h: Defines OdrDerived, where
6930 optimization will change the
6931 first-instruction-in-the-destructor's file and line number.
6932 * testsuite/odr_header2.h: Defines OdrBase.
6933
6934 2011-03-09 Ian Lance Taylor <iant@google.com>
6935
6936 * fileread.cc (File_read::clear_views): Don't delete the whole
6937 file view.
6938
6939 2011-03-08 Ian Lance Taylor <iant@google.com>
6940
6941 PR gold/12525
6942 * fileread.cc: #include <climits>.
6943 (GOLD_IOV_MAX): Define.
6944 (File_read::read_multiple): Limit number of entries by iov_max.
6945 * fileread.h (class File_read): Always set max_readv_entries to
6946 128.
6947
6948 2011-03-07 Ian Lance Taylor <iant@google.com>
6949
6950 PR gold/12525
6951 * options.h (class General_options): Add -dy and -dn.
6952
6953 2011-03-02 Cary Coutant <ccoutant@google.com>
6954
6955 * testsuite/script_test_9.t: Add TLS segment.
6956
6957 2011-03-02 Simon Baldwin <simonb@google.com>
6958
6959 * configure.ac: Add check for gnu_indirect_function support in
6960 the toolchain building binutils.
6961 * configure: Rebuild.
6962
6963 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6964
6965 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6966 plugin only symbols.
6967 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6968 in plugin files as not needed in the symbol table.
6969
6970 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6971
6972 * output.cc (Output_section::add_input_section): Delay fill
6973 generation for section ordering.
6974
6975 2011-02-09 Ian Lance Taylor <iant@google.com>
6976
6977 PR gold/12316
6978 * object.h (class Sized_relobj): Remove clear_local_symbols.
6979 * reloc.cc (Sized_relobj::do_relocate): Don't call
6980 clear_local_symbols.
6981
6982 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6983
6984 * plugin.cc (is_visible_from_outside): Return true for symbols
6985 in the -u option.
6986
6987 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6988
6989 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6990 filename.
6991
6992 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6993
6994 * icf.h (is_section_foldable_candidate): Change type of parameter
6995 to std::string.
6996 * icf.cc (Icf::find_identical_sections): Change type of local variable
6997 section_name to be std::string.
6998 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6999
7000 2011-01-25 Ian Lance Taylor <iant@google.com>
7001
7002 * script.cc (script_add_extern): Rewrite to use
7003 add_symbol_reference.
7004
7005 2011-01-25 Doug Kwan <dougkwan@google.com>
7006
7007 * icf.cc (get_section_contents): Always lock section's object.
7008
7009 2011-01-24 Ian Lance Taylor <iant@google.com>
7010
7011 * options.h (class General_options): Accept
7012 --no-detect-odr-violations.
7013
7014 2011-01-24 Ian Lance Taylor <iant@google.com>
7015
7016 * version.cc (version_string): Bump to 1.11.
7017
7018 2011-01-24 Ian Lance Taylor <iant@google.com>
7019
7020 * plugin.cc (class Plugin_rescan): Define new class.
7021 (Plugin_manager::claim_file): Set any_claimed_.
7022 (Plugin_manager::save_archive): New function.
7023 (Plugin_manager::save_input_group): New function.
7024 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7025 necessary.
7026 (Plugin_manager::new_undefined_symbol): New function.
7027 (Plugin_manager::rescan): New function.
7028 (Plugin_manager::rescannable_defines): New function.
7029 (Plugin_manager::add_input_file): Set any_added_.
7030 * plugin.h (class Plugin_manager): define new fields rescannable_,
7031 undefined_symbols_, any_claimed_, and any_added_. Declare
7032 Plugin_rescan as friend. Declare new functions.
7033 (Plugin_manager::Rescannable): Define type.
7034 (Plugin_manager::Rescannable_list): Define type.
7035 (Plugin_manager::Undefined_symbol_list): Define type.
7036 (Plugin_manager::Plugin_manager): Initialize new fields.
7037 * archive.cc (Archive::defines_symbol): New function.
7038 (Add_archive_symbols::run): Pass archive to plugins if any.
7039 * archive.h (class Archive): Declare defines_symbol.
7040 * readsyms.cc (Input_group::~Input_group): New function.
7041 (Finish_group::run): Pass input_group to plugins if any.
7042 * readsyms.h (class Input_group): Declare destructor.
7043 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7044 any.
7045
7046 2011-01-10 Ian Lance Taylor <iant@google.com>
7047
7048 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7049 section as relro.
7050 (Layout::set_segment_offsets): Reset increase_relro before calling
7051 set_section_addresses a second time.
7052
7053 2011-01-04 Cary Coutant <ccoutant@google.com>
7054
7055 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7056 sections before NOBITS sections.
7057
7058 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
7059
7060 * version.cc (print_version): Update copyright to 2011.
7061
7062 2010-12-23 Cary Coutant <ccoutant@google.com>
7063
7064 * output.h (Output_data_reloc::add_output_section): Pass OD instead
7065 of OS to this->add. Add OD parameter to second form of the function.
7066
7067 2010-12-20 Ian Lance Taylor <iant@google.com>
7068
7069 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7070 second of two consecutive entries with same offset.
7071
7072 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7073
7074 * testsuite/Makefile.am (ifuncmain2static_LDADD)
7075 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7076 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7077 to avoid unneeded links against $(LDADD).
7078 * testsuite/Makefile.in: Regenerate.
7079
7080 2010-12-15 Ian Lance Taylor <iant@google.com>
7081
7082 PR gold/12324
7083 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7084 for R_X86_64_32 and R_X86_64_PC32.
7085 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7086 ver_matching_def_pic.o.
7087 (ver_matching_def_pic.o): New target.
7088
7089 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7090
7091 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7092 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7093 Move definition before File_read::View member definitions.
7094 (File_read::View::~View): Initialize and hold lock before
7095 updating current_mapped_bytes.
7096
7097 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7098
7099 * dwarf_reader.cc: Remove outdated comment.
7100 * gold-threads.cc: Fix typo in error message.
7101 * archive.cc: Fix typos in comments.
7102 * archive.h: Likewise.
7103 * arm-reloc-property.cc: Likewise.
7104 * arm-reloc-property.h: Likewise.
7105 * arm-reloc.def: Likewise.
7106 * arm.cc: Likewise.
7107 * attributes.h: Likewise.
7108 * cref.cc: Likewise.
7109 * ehframe.cc: Likewise.
7110 * fileread.h: Likewise.
7111 * gold.h: Likewise.
7112 * i386.cc: Likewise.
7113 * icf.cc: Likewise.
7114 * incremental.h: Likewise.
7115 * int_encoding.cc: Likewise.
7116 * layout.h: Likewise.
7117 * main.cc: Likewise.
7118 * merge.h: Likewise.
7119 * object.cc: Likewise.
7120 * object.h: Likewise.
7121 * options.cc: Likewise.
7122 * readsyms.cc: Likewise.
7123 * reduced_debug_output.cc: Likewise.
7124 * reloc.cc: Likewise.
7125 * script-sections.cc: Likewise.
7126 * sparc.cc: Likewise.
7127 * symtab.h: Likewise.
7128 * target-reloc.h: Likewise.
7129 * target.cc: Likewise.
7130 * target.h: Likewise.
7131 * timer.cc: Likewise.
7132 * timer.h: Likewise.
7133 * x86_64.cc: Likewise.
7134
7135 2010-12-09 Cary Coutant <ccoutant@google.com>
7136
7137 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7138 stack.
7139 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7140 parameter; change all callers.
7141 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7142 * options.h (warn_execstack): New option.
7143
7144 2010-12-07 Doug Kwan <dougkwan@google.com>
7145
7146 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7147 like function call relocations.
7148
7149 2010-12-07 Ian Lance Taylor <iant@google.com>
7150
7151 * archive.cc (Archive::get_elf_object_for_member): Permit
7152 punconfigured to be NULL.
7153 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7154 (Archive::include_member): Pass NULL to get_elf_object_for_member
7155 if we searched for the archive and this is the first included
7156 object.
7157
7158 2010-12-01 Ian Lance Taylor <iant@google.com>
7159
7160 * dwarf_reader.h (class Sized_dwarf_line_info): Add
7161 track_relocs_type_ field.
7162 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7163 Set track_relocs_type_.
7164 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7165 contents when using RELA relocs.
7166 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7167 reloc_map_.
7168 * reloc.cc (Track_relocs::next_addend): New function.
7169 * reloc.h (class Track_relocs): Declare next_addend.
7170
7171 2010-12-01 Ian Lance Taylor <iant@google.com>
7172
7173 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7174 virtual destructor.
7175
7176 2010-12-01 Ian Lance Taylor <iant@google.com>
7177
7178 * README: Update compilers known to work and fail.
7179
7180 2010-11-23 Matthias Klose <doko@ubuntu.com>
7181
7182 * configure.in: For --enable-gold, handle value `default' instead of
7183 `both*'. Always install ld as ld.bfd, install as ld if gold is
7184 not the default.
7185 * configure: Regenerate.
7186
7187 2010-11-18 Doug Kwan <dougkwan@google.com>
7188
7189 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7190 and right_alignment to be zero. Store result alignment only if it is
7191 greater than existing alignment.
7192
7193 2010-11-16 Cary Coutant <ccoutant@google.com>
7194
7195 PR gold/12220
7196 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7197 Check for ".zdebug_line".
7198
7199 2010-11-16 Doug Kwan <dougkwan@google.com>
7200 Cary Coutant <ccoutant@google.com>
7201
7202 * output.h (Output_segment::set_section_addresses): Pass increase_relro
7203 by reference; adjust all callers.
7204 * output.cc (Output_segment::set_section_addresses): Adjust references
7205 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7206 list is empty.
7207 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7208 end at page boundary.
7209
7210 2010-11-16 Cary Coutant <ccoutant@google.com>
7211
7212 PR gold/12220
7213 * layout.cc (Layout::choose_output_section): Transform names of
7214 compressed sections even when using a script with a SECTIONS clause.
7215 (Layout::output_section_name): Remove code to transform
7216 compressed debug section names.
7217 * output.cc (Output_section::add_input_section): Use uncompressed
7218 section size when tracking input sections.
7219
7220 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
7221
7222 * symtab.h (Symbol::NON_PIC_REF): Remove.
7223 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7224 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
7225 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7226 (Symbol::use_plt_offset): Take a flags argument and pass it
7227 directly to needs_dynamic_reloc. Restrict check for undefined
7228 weak symbols to function calls.
7229 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7230 (Target_arm::Scan::global): Use it.
7231 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7232 (Target_arm::Relocate::relocate): Likewise.
7233 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7234 parameter with an r_type parameter. Use get_reference_flags
7235 to get the flags.
7236 (Target_arm::Relocate::relocate): Update accordingly.
7237 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7238 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7239 (Target_i386::Scan::global): Likewise.
7240 (Target_i386::Relocate::relocate): Likewise.
7241 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7242 parameter with an r_type parameter. Use get_reference_flags
7243 to get the flags.
7244 (Target_i386::Relocate::relocate): Update accordingly.
7245 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7246 (Target_powerpc::Scan::global): Use it.
7247 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7248 (Target_powerpc::Relocate::relocate): Likewise.
7249 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7250 (Target_sparc::Scan::global): Use it.
7251 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7252 (Target_sparc::Relocate::relocate): Likewise.
7253 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7254 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7255 (Target_x86_64::Scan::global): Likewise.
7256 (Target_x86_64::Relocate::relocate): Likewise.
7257
7258 2010-11-08 Doug Kwan <dougkwan@google.com>
7259 Cary Coutant <ccoutant@google.com>
7260
7261 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7262 (Arm_exidx_merge_section::section_contents_): New data member.
7263 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7264 (Arm_input_section::~Arm_input_section): De-allocate memory.
7265 (Arm_input_section::original_contents_): New data member.
7266 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7267 in parameters instead of calling Object::section_contents without
7268 locking.
7269 (Arm_output_section::group_section): New parameter TASK. Pass it
7270 to callees that need locking objects.
7271 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
7272 to lock EXIDX input sections. Fix a formatting issue. Call
7273 Arm_exidx_merged_section::build_contents to create merged section
7274 contents.
7275 (Arm_output_section::create_stub_group): New parameter TASK. Use it
7276 to lock object of stub table owner.
7277 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7278 TEXT_SIZE to initialize data member TEXT_SIZE_.
7279 (Arm_exidx_input_section::addralign): Fix typo in comment.
7280 (Arm_exidx_input_section::text_size): New method.
7281 (Target_arm::do_relax): New parameter TASK. Pass it to callees
7282 that require locking objects. Lock objects before scanning for stubs
7283 and updating local symbols.
7284 (Arm_input_section<big_endian>::init): Copy contents of original
7285 input section.
7286 (Arm_input_section<big_endian>::do_write): Use saved contents of
7287 original input section instead of calling Object::section_contents
7288 without locking.
7289 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7290 size without calling Object::section_size().
7291 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7292 for size. Allocate a buffer for merged EXIDX entries.
7293 (Arm_exidx_merged_section::build_contents): New method.
7294 (Arm_exidx_merged_section::do_write): Move merge section contents
7295 building code to Arm_exidx_merged_section::build_contetns. Write
7296 out contetns in buffer instead of building it on the fly.
7297 (Arm_relobj::make_exidx_input_section): Also pass text section size
7298 to Arm_exidx_input_section constructor.
7299 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
7300 (Arm_dynobj::do_read_symbols): Fix memory leak.
7301 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7302 * target.h: (class Task): Add forward declaration.
7303 (Target::relax): Add new parameter TASK and pass it to
7304 Target::do_relax().
7305 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
7306
7307 2010-11-05 Cary Coutant <ccoutant@google.com>
7308
7309 PR gold/10708
7310 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7311 object when reading from the file.
7312 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7313 second layout pass.
7314 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7315 when reading section contents.
7316 (get_section_contents): Likewise.
7317 (icf::find_identical_sections): Likewise.
7318 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7319 object when reading from the file.
7320 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7321 the object when doing deferred section layout.
7322
7323 2010-11-03 Nick Clifton <nickc@redhat.com>
7324
7325 PR gold/12001
7326 * script.h (class Symbol_assignment: name): New member. Returns
7327 the name of the symbol.
7328 * scrfipt.cc (Script_options::is_pending_assignment): New member.
7329 Returns true if the given symbol name is on the list of
7330 assignments wating to be processed.
7331 * archive.cc (should_incldue_member): If the symbol is undefined,
7332 check to see if it is on the list of symbols pending assignment.
7333
7334 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
7335
7336 * script-sections.cc (Script_sections::find_memory_region): Check
7337 for a NULL output section pointer.
7338
7339 2010-10-29 Doug Kwan <dougkwan@google.com>
7340
7341 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7342 Output_section::add_relaxed_input_section.
7343 * output.cc (Output_section::add_relaxed_input_section): Add new
7344 arguments LAYOUT and NAME. Set section order index.
7345 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7346 Copy section order index.
7347 * output.h (Output_section::add_relaxed_input_section): Add new
7348 arguments LAYOUT and NAME.
7349
7350 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7351
7352 * testsuite/Makefile.am: Move gcctestdir/ld rule to
7353 NATIVE_OR_CROSS_LINKER.
7354 * testsuite/Makefile.in: Regenerate.
7355
7356 2010-10-20 Doug Kwan <dougkwan@google.com>
7357
7358 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7359 without SHF_LINK_ORDER flags.
7360 * layout.cc (Layout::choose_output_section): Do not filter
7361 SHF_LINK_ORDER flag in a relocatable link.
7362
7363 2010-10-17 Cary Coutant <ccoutant@google.com>
7364
7365 * output.h (Output_segment::set_section_addresses): Change function
7366 signature. Update all callers.
7367 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7368 sections.
7369 (Output_segment::set_section_addresses): Align after last TLS
7370 section. Add padding before last relro section instead of after.
7371
7372 2010-10-17 Doug Kwan <dougkwan@google.com>
7373
7374 * gold/arm.cc (Target_arm::got_section): Use correct order and set
7375 GOT output section to be writable.
7376
7377 2010-10-14 Cary Coutant <ccoutant@google.com>
7378
7379 * debug.h (DEBUG_INCREMENTAL): New flag.
7380 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7381 * gold.cc (queue_initial_tasks): Check parameters for incremental link
7382 mode.
7383 * incremental.cc (report_command_line): Ignore all forms of
7384 --incremental.
7385 * layout.cc (Layout::Layout): Check parameters for incremental link
7386 mode.
7387 * options.cc (General_options::parse_incremental): New function.
7388 (General_options::parse_no_incremental): New function.
7389 (General_options::parse_incremental_full): New function.
7390 (General_options::parse_incremental_update): New function.
7391 (General_options::incremental_mode_): New data member.
7392 (General_options::finalize): Check incremental_mode_.
7393 * options.h (General_options): Update help text for --incremental.
7394 Add --no-incremental, --incremental-full, --incremental-update.
7395 (General_options::Incremental_mode): New enum type.
7396 (General_options::incremental_mode): New function.
7397 (General_options::incremental_mode_): New data member.
7398 * parameters.cc (Parameters::incremental_mode_): New data member.
7399 (Parameters::set_options): Set incremental_mode_.
7400 (Parameters::set_incremental_full): New function.
7401 (Parameters::incremental): New function.
7402 (Parameters::incremental_update): New function.
7403 (set_parameters_incremental_full): New function.
7404 * parameters.h (Parameters::set_incremental_full): New function.
7405 (Parameters::incremental): New function.
7406 (Parameters::incremental_update): New function.
7407 (Parameters::incremental_mode_): New data member.
7408 (set_parameters_incremental_full): New function.
7409 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7410 incremental link mode.
7411 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7412 (Sized_relobj::do_relocate_sections): Likewise.
7413 * testsuite/Makefile.am (incremental_test): Use --incremental-full
7414 option.
7415 * testsuite/Makefile.in: Regenerate.
7416 * testsuite/incremental_test.sh: Filter all forms of --incremental.
7417
7418 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7419
7420 * script-sections.h (class Script_sections): Make
7421 Sections_elements typedef public.
7422 * script-sections.cc (class Sort_output_sections): Add elements_
7423 field. Add constructor which sets it; change all callers.
7424 (Sort_output_sections::is_before): New function.
7425 (Sort_output_sections::operator()): Call is_before.
7426 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7427 conditional.
7428 * testsuite/script_test_10.sh: New test. Test script section
7429 order.
7430 * testsuite/script_test_10.t: Likewise.
7431 * testsuite/script_test_10.s: Likewise.
7432 * testsuite/Makefile.am: Wrap the cross linker tests and the
7433 common tests into NATIVE_OR_CROSS_LINKER.
7434 (check_SCRIPTS): Add script_test_10.sh.
7435 (check_DATA): Add script_test_10.stdout.
7436 (script_test_10.o, script_test_10): New targets.
7437 (script_test_10.stdout): New target.
7438 * configure, testsuite/Makefile.in: Regenerate.
7439
7440 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7441
7442 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7443 error for the deprecated relocations.
7444 (Target_arm::Scan::global): Likewise.
7445 (Target_arm::Relocate::relocate): Likewise.
7446
7447 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
7448
7449 * fileread.cc (Input_file::find_file): Initialize *found_name
7450 and *namep when using the fallback search for case 4.
7451
7452 2010-10-11 Cary Coutant <ccoutant@google.com>
7453
7454 * options.h (class General_options): Redefine -z lazy as an alias for
7455 the negation of -z now.
7456
7457 2010-10-11 Ian Lance Taylor <iant@google.com>
7458
7459 * resolve.cc (symbol_to_bits): Report the value of the unsupported
7460 binding.
7461
7462 2010-10-06 Nick Clifton <nickc@redhat.com>
7463
7464 * script-sections.cc(class Memory_region): Remove
7465 current_lma_offset_ field. Rename current_vma_offset_ to
7466 current_offset_. Add last_section_ field.
7467 (Memory_region::get_current_vma_address): Rename to
7468 get_current_address.
7469 (Memory_region::get_current_lma_address): Delete.
7470 (Memory_region::increment_vma_offset): Rename to
7471 increment_offset.
7472 (Memory_region::increment_lma_offset): Delete.
7473 (Memory_region::attributes_compatible): New method. Returns
7474 true if the provided section is compatible with the region.
7475 (Memory_region::get_last_section): New method. Returns the last
7476 section to use the region.
7477 (Memory_region::set_last_section): New method. Stores the last
7478 section to use the region.
7479 (Script_sections::block_in_region): New method. Returns true if
7480 a block of memory is contained within a region.
7481 (Script_sections::find_memory_region): New method. Locates a
7482 memory region to be used to set a VMA or LMA address.
7483 (Output_section_definition::set_section_addresses): Add code to
7484 check for addresses set by memory regions.
7485 (Output_segment::set_section_addresses): Remove memory region
7486 walking code.
7487 (Script_sections::create_segment): Add a warning if a header
7488 segment is created outside of any region.
7489 * script-sections.h (class Script_sections): Add prototypes for
7490 find_memory_region and block_in_region methods.
7491 * testsuite/memory_test.s: Use .long instead of .word.
7492 * testsuite/memory_test.t: Add some more output sections.
7493 * testsuite/memory_test.sh: Update expected output.
7494
7495 2010-10-02 Doug Kwan <dougkwan@google.com>
7496
7497 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7498 defintion to symtab.h
7499 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7500 declaration to defintion.
7501
7502 2010-10-01 Nick Clifton <nickc@redhat.com>
7503
7504 * expression.cc (eval): Replace dummy argument with NULL.
7505 (eval_maybe_dot): Check for a NULL result section pointer.
7506 (Symbol_expression::value): Likewise.
7507 (Dot_expression::value): Likewise.
7508 (BINARY_EXPRESSION): Likewise.
7509 (Max_expression::value): Likewise.
7510 (Min_expression::value): Likewise.
7511 (Absolute_expression::value): Likewise.
7512 (Addr_expression::value_from_output_section): Likewise.
7513 (Loaddddr_expression::value_from_output_section): Likewise.
7514 (Segment_start_expression::value): Likewise.
7515 * script-sections.cc
7516 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7517 argument with NULL.
7518 (Sections_elememt_dot_assignment::set_section_addresses):
7519 Likewise.
7520 (Output_data_expression::do_write_to_buffer): Likewise.
7521 (Output_section_definition::finalize_symbols): Likewise.
7522 (Output_section_definition::set_section_addresses): Likewise.
7523
7524 2010-09-30 Doug Kwan <dougkwan@google.com>
7525
7526 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7527
7528 2010-09-28 Sriraman Tallam <tmsriram@google.com>
7529
7530 * target.h (Target::can_icf_inline_merge_sections): New virtual
7531 function.
7532 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7533 virtual function.
7534 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7535 virtual function.
7536 * icf.cc (get_section_contents): Inline merge sections only when
7537 target allows it.
7538
7539 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7540
7541 * configure: Regenerate.
7542
7543 2010-09-17 Ian Lance Taylor <iant@google.com>
7544
7545 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7546 * testsuite/Makefile.am (memory_test.o): New target.
7547 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7548 memory_test.t.
7549 * testsuite/Makefile.in: Rebuild.
7550
7551 2010-09-17 Doug Kwan <dougkwan@google.com>
7552
7553 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7554 defintion if relocation uses GOT entries of the symbol.
7555 * testsuite/icf_safe_test.sh: Fix test.
7556 * testsuite/icf_safe_so_test.sh: Fix test.
7557
7558 2010-09-16 Cary Coutant <ccoutant@google.com>
7559
7560 * script_sections.cc (class Memory_region): Remove "NULL" from
7561 vector initializations.
7562
7563 2010-09-15 Cary Coutant <ccoutant@google.com>
7564
7565 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7566 Resolve forwarding symbols.
7567
7568 2010-09-15 Doug Kwan <dougkwan@google.com>
7569
7570 * gold/testsuite/script_test_3.t: Add ARM special sections.
7571 * gold/testsuite/script_test_4.t: Same.
7572 * gold/testsuite/script_test_5.t: Same.
7573 * gold/testsuite/script_test_6.t: Same.
7574 * gold/testsuite/script_test_7.t: Same.
7575 * gold/testsuite/script_test_7.t: Same.
7576 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7577
7578 2010-09-14 Cary Coutant <ccoutant@google.com>
7579
7580 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7581 (Target_x86_64::Relocate::relocate_tls): Replace check for
7582 saw_tls_block_reloc_ with test for executable section.
7583
7584 2010-09-12 Cary Coutant <ccoutant@google.com>
7585
7586 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7587 position-independent executables to shared libraries need dynamic
7588 relocations.
7589 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7590 position-independent executables.
7591 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7592 * testsuite/Makefile.in: Regenerate.
7593
7594 2010-09-10 Nick Clifton <nickc@redhat.com>
7595
7596 PR gold/11997
7597 * testsuite/memory_test.t: Discard any sections that are not
7598 needed.
7599
7600 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7601
7602 PR gold/11996
7603 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7604 "This::" to work around a bug in gcc 4.2.
7605
7606 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7607
7608 2010-09-09 Rafael Espindola <espindola@google.com>
7609
7610 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7611 sections with different PF_X flags in the same segment.
7612 (Layout::find_first_load_seg): Search all segments to find the first
7613 one.
7614 * options.h (rosegment): New.
7615
7616 2010-09-08 Rafael Espindola <espindola@google.com>
7617
7618 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7619
7620 2010-09-08 Doug Kwan <dougkwan@google.com>
7621
7622 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7623 (Arm_relobj::do_relocate_sections): Add new parameter for output
7624 file to match the parent.
7625 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7626 of local symbols instead of input values. Update code to track
7627 changes in gold::relocate_section.
7628 * object.cc (Sized_relobj::compute_final_local_value): New methods.
7629 (Sized_relobj::compute_final_local_value_internal): New methods.
7630 (Sized_relobj::do_finalize_local_symbols): Move code from loop
7631 body into private version of Sized_relobj::compute_final_local_value.
7632 Call the inline method.
7633 * object.h (Symbol_value::Symbol_value): Define destructor. Free
7634 merged symbol value if there is one.
7635 (Symbol_value::has_output_value): New method defintiion.
7636 (Sized_relobj::Compute_final_local_value_status): New enum type.
7637 (Sized_relobj::compute_final_local_value): New methods.
7638 (Sized_relobj::compute_final_local_value_internal): New methods.
7639 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7640 and arm_cortex_a8.sh.
7641 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7642 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7643 New tests.
7644 * Makefile.in: Regenerate.
7645 * testsuite/arm_bl_out_of_range.s: Update test.
7646 * testsuite/thumb_bl_out_of_range.s: Ditto.
7647 * testsuite/thumb_blx_out_of_range.s: Ditto.
7648 * testsuite/arm_branch_out_of_range.sh: New file.
7649 * testsuite/arm_cortex_a8.sh: Ditto.
7650 * testsuite/arm_cortex_a8_b.s: Ditto.
7651 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7652 * testsuite/arm_cortex_a8_b_local.s: Ditto.
7653 * testsuite/arm_cortex_a8_bl.s: Ditto.
7654 * testsuite/arm_cortex_a8_blx.s: Ditto.
7655 * testsuite/arm_cortex_a8_local.s: Ditto.
7656 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7657 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7658
7659 2010-09-08 Rafael Espindola <espindola@google.com>
7660
7661 * Makefile.am (memory_test.stdout): Run readelf with -W.
7662 * Makefile.in: Regenerate.
7663 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7664 64 bit output.
7665
7666 2010-09-08 Rafael Espindola <espindola@google.com>
7667
7668 * script-sections.cc (Script_sections::add_memory_region): Convert
7669 field precision to int.
7670 * script.cc (script_set_section_region, script_set_section_region):
7671 Convert field precision to int.
7672
7673 2010-09-08 Rafael Espindola <espindola@google.com>
7674
7675 * arm.cc (do_finalize_sections): Create the __exidx_start and
7676 __exdix_end symbols even when the section is missing.
7677
7678 2010-09-08 Nick Clifton <nickc@redhat.com>
7679
7680 * README: Remove claim that MEMORY is not supported.
7681 * expression.cc (script_exp_function_origin)
7682 (script_exp_function_length): Move from here to ...
7683 * script.cc: ... here.
7684 (script_set_section_region, script_add_memory)
7685 (script_parse_memory_attr, script_include_directive): New
7686 functions.
7687 * script-sections.cc
7688 (class Memory_region): New class.
7689 (class Output_section_definition): Add set_memory_region,
7690 set_section_vma, set_section_lma and get_section_name methods.
7691 (class Script_Sections): Add add_memory_region,
7692 find_memory_region, find_memory_region_origin,
7693 find_memory_region_length and set_memory_region methods.
7694 Have set_section_addresses method walk the list of set memory
7695 regions.
7696 Extend the print methos to display memory regions.
7697 * script-sections.h: Add prototypes for new methods.
7698 Add enum for MEMORY region attributes.
7699 * yyscript.y: Add support for parsing MEMORY regions.
7700 * script-c.h: Add prototypes for new functions.
7701 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7702 * testsuite/Makefile.in: Regenerate.
7703 * testsuite/memory_test.sh: New script.
7704 * testsuite/memory_test.s: New assembler source file.
7705 * testsuite/memory_test.t: New linker script.
7706
7707 2010-08-27 Doug Kwan <dougkwan@google.com>
7708
7709 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7710 reference override an existing dynamic weak reference.
7711 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7712 * testsuite/Makefile.in: Regenerate.
7713 * testsuite/dyn_weak_ref.sh: New file.
7714 * testsuite/dyn_weak_ref_1.c: Ditto.
7715 * testsuite/dyn_weak_ref_2.c: Ditto.
7716
7717 2010-08-27 Ian Lance Taylor <iant@google.com>
7718
7719 * incremental.h (class Incremental_input_entry): Add virtual
7720 destructor.
7721
7722 2010-08-27 Ian Lance Taylor <iant@google.com>
7723
7724 * testsuite/start_lib_test_3.c: Mark t3 as used.
7725
7726 2010-08-27 Nick Clifton <nickc@redhat.com>
7727
7728 * options.cc (version_script): Fix small typo in previous
7729 whitespace tidyup.
7730
7731 2010-08-25 Nick Clifton <nickc@redhat.com>
7732
7733 * archive.cc: Formatting fixes: Remove whitespace between
7734 typename and following asterisk. Remove whitespace between
7735 function name and opening parenthesis.
7736 * archive.h: Likewise.
7737 * arm.cc: Likewise.
7738 * attributes.cc: Likewise.
7739 * attributes.h: Likewise.
7740 * common.cc: Likewise.
7741 * copy-relocs.cc: Likewise.
7742 * dirsearch.h: Likewise.
7743 * dynobj.cc: Likewise.
7744 * ehframe.cc: Likewise.
7745 * ehframe.h: Likewise.
7746 * expression.cc: Likewise.
7747 * fileread.cc: Likewise.
7748 * fileread.h: Likewise.
7749 * gc.h: Likewise.
7750 * gold-threads.cc: Likewise.
7751 * gold.cc: Likewise.
7752 * i386.cc: Likewise.
7753 * icf.h: Likewise.
7754 * incremental-dump.cc: Likewise.
7755 * incremental.cc: Likewise.
7756 * layout.cc: Likewise.
7757 * layout.h: Likewise.
7758 * main.cc: Likewise.
7759 * merge.cc: Likewise.
7760 * merge.h: Likewise.
7761 * object.cc: Likewise.
7762 * object.h: Likewise.
7763 * options.cc: Likewise.
7764 * options.h: Likewise.
7765 * output.cc: Likewise.
7766 * output.h: Likewise.
7767 * plugin.cc: Likewise.
7768 * plugin.h: Likewise.
7769 * powerpc.cc: Likewise.
7770 * reloc.cc: Likewise.
7771 * script-c.h: Likewise.
7772 * script-sections.cc: Likewise.
7773 * script.cc: Likewise.
7774 * stringpool.cc: Likewise.
7775 * symtab.cc: Likewise.
7776 * symtab.h: Likewise.
7777 * target.cc: Likewise.
7778 * timer.cc: Likewise.
7779 * timer.h: Likewise.
7780 * version.cc: Likewise.
7781 * x86_64.cc: Likewise.
7782
7783 2010-08-24 Nick Clifton <nickc@redhat.com>
7784
7785 PR 11899
7786 * layout.cc (segment_precedes): Sort segments by their physical
7787 addresses, if they have been set.
7788
7789 2010-08-23 Cary Coutant <ccoutant@google.com>
7790
7791 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7792 symbols data.
7793 (Lib_group::include_member): Unlock object after deleting its
7794 symbols data.
7795 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7796 the bug fixed here.
7797
7798 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7799 Cary Coutant <ccoutant@google.com>
7800
7801 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7802 constructor, and set_blocker.
7803 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7804 readsyms_blocker_.
7805 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7806 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7807 * testsuite/Makefile.am (start_lib_test): New test case.
7808 * testsuite/Makefile.in: Regenerate.
7809 * testsuite/start_lib_test_main.c: New file.
7810 * testsuite/start_lib_test_1.c: New file.
7811 * testsuite/start_lib_test_2.c: New file.
7812 * testsuite/start_lib_test_3.c: New file.
7813
7814 2010-08-19 Ian Lance Taylor <iant@google.com>
7815
7816 * Makefile.in: Rebuild with automake 1.11.1.
7817 * aclocal.m4: Likewise.
7818 * testsuite/Makefile.in: Likewise.
7819
7820 2010-08-19 Ian Lance Taylor <iant@google.com>
7821
7822 PR 10893
7823 * i386.cc (class Output_data_plt_i386): Update declarations.
7824 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7825 local_ifuncs_ fields.
7826 (Target_i386::do_plt_section_for_global): New function.
7827 (Target_i386::do_plt_section_for_local): New function.
7828 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7829 parameter; change all callers. Initialize global_ifuncs_ and
7830 local_ifuncs_. If doing a static link define __rel_iplt_start and
7831 __rel_iplt_end.
7832 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7833 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7834 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7835 symbols.
7836 (Target_i386::make_plt_section): New function, broken out of
7837 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7838 (Target_i386::make_plt_entry): Call make_plt_section.
7839 (Target_i386::make_local_ifunc_plt_entry): New function.
7840 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7841 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7842 R_386_IRELATIVE to switch.
7843 (Target_i386::Scan::global): Likewise.
7844 (Target_i386::Relocate::relocate): Likewise.
7845 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7846 switch.
7847 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7848 (Target_x86_64::do_plt_section_for_global): New function.
7849 (Target_x86_64::do_plt_section_for_local): New function.
7850 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7851 parameter; change all callers. If doing a static link define
7852 __rela_iplt_start and __rela_iplt_end.
7853 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7854 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7855 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7856 to point to .plt.
7857 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7858 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7859 switch.
7860 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7861 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7862 R_X86_64_IRELATIVE to switch.
7863 (Target_x86_64::Scan::global): Likewise.
7864 (Target_x86_64::Relocate::relocate): Likewise.
7865 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7866 switch.
7867 * target.h (class Target): Add plt_section_for_global and
7868 plt_section_for_local functions. Add do_plt_section_for_global
7869 and do_plt_section_for_local virtual functions.
7870 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7871 clarifying comments.
7872 (Symbol::use_plt_offset): Handle IFUNC symbol.
7873 * object.cc (Sized_relobj::Sized_relobj): Initialize
7874 local_plt_offsets_.
7875 (Sized_relobj::local_has_plt_offset): New function.
7876 (Sized_relobj::local_plt_offset): New function.
7877 (Sized_relobj::set_local_plt_offset): New function.
7878 (Sized_relobj::do_count): Handle IFUNC symbol.
7879 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7880 a bit away from input_shndx_ field. Add set_is_func_symbol and
7881 is_ifunc_symbol functions.
7882 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7883 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7884 local_plt_offsets_ field.
7885 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7886 * output.h (class Output_section_data): Add non-const
7887 output_section function.
7888 (class Output_data_got): Update declarations.
7889 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7890 Add use_plt_offset parameter to global and local constructors.
7891 Change all callers. Change local_sym_index_ field to 31 bits.
7892 Change GSYM_CODE and CONSTANT_CODE accordingly.
7893 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7894 doing a static link don't set sh_link field.
7895 (Output_data_got::Got_entry::write): Use PLT offset if
7896 appropriate.
7897 (Output_data_got::add_global_plt): New function.
7898 (Output_data_got::add_local_plt): New function.
7899 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7900 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7901 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7902 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7903 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7904 IFUNC conditional.
7905 * testsuite/ifunc-sel.h: New file.
7906 * testsuite/ifuncmain1.c: New file.
7907 * testsuite/ifuncmain1vis.c: New file.
7908 * testsuite/ifuncmod1.c: New file.
7909 * testsuite/ifuncdep2.c: New file.
7910 * testsuite/ifuncmain2.c: New file.
7911 * testsuite/ifuncmain3.c: New file.
7912 * testsuite/ifuncmod3.c: New file.
7913 * testsuite/ifuncmain4.c: New file.
7914 * testsuite/ifuncmain5.c: New file.
7915 * testsuite/ifuncmod5.c: New file.
7916 * testsuite/ifuncmain6pie.c: New file.
7917 * testsuite/ifuncmod6.c: New file.
7918 * testsuite/ifuncmain7.c: New file.
7919 * configure, testsuite/Makefile.in: Rebuild.
7920
7921 2010-08-18 Ian Lance Taylor <iant@google.com>
7922
7923 * incremental.cc
7924 (Output_section_incremental_inputs::write_input_files): Add cast
7925 to avoid signed/unsigned comparison warning.
7926 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7927
7928 2010-08-12 Cary Coutant <ccoutant@google.com>
7929
7930 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7931
7932 2010-08-13 Ian Lance Taylor <iant@google.com>
7933
7934 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7935
7936 2010-08-12 Cary Coutant <ccoutant@google.com>
7937 Doug Kwan <dougkwan@google.com>
7938
7939 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7940 defintion overrides non-weak undef, remember that the original undef
7941 is not weak.
7942 * symtab.cc (Symbol_table::sized_write_global): For undef without
7943 an original weak binding, set binding to global in output.
7944 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7945 * testsuite/Makefile.in: Regenerate.
7946 * testsuite/strong_ref_weak_def.sh: New file.
7947 * testsuite/strong_ref_weak_def_1.c: Ditto.
7948 * testsuite/strong_ref_weak_def_2.c: Ditto.
7949
7950 2010-08-12 Cary Coutant <ccoutant@google.com>
7951
7952 * testsuite/incremental_test.sh: Rewrite.
7953 * testsuite/incremental_test_1.c: Rewrite.
7954 * testsuite/incremental_test_2.c: Rewrite.
7955
7956 2010-08-12 Cary Coutant <ccoutant@google.com>
7957
7958 * arm.cc (Target_arm::got_size): Add const.
7959 (Target_arm::got_entry_count): New function.
7960 (Target_arm::plt_entry_count): New function.
7961 (Target_arm::first_plt_entry_offset): New function.
7962 (Target_arm::plt_entry_size): New function.
7963 (Output_data_plt_arm::entry_count): New function.
7964 (Output_data_plt_arm::first_plt_entry_offset): New function.
7965 (Output_data_plt_arm::get_plt_entry_size): New function.
7966 * i386.cc (Target_i386::got_size): Add const.
7967 (Target_i386::got_entry_count): New function.
7968 (Target_i386::plt_entry_count): New function.
7969 (Target_i386::first_plt_entry_offset): New function.
7970 (Target_i386::plt_entry_size): New function.
7971 (Output_data_plt_i386::entry_count): New function.
7972 (Output_data_plt_i386::first_plt_entry_offset): New function.
7973 (Output_data_plt_i386::get_plt_entry_size): New function.
7974 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7975 find_incremental_inputs_sections. Dump incremental_got_plt section.
7976 * incremental.cc: Include target.h.
7977 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7978 parameter. Adjust all callers. Find incremental_got_plt section.
7979 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7980 section.
7981 (Output_section_incremental_inputs::set_final_data_size): Calculate
7982 size of incremental_got_plt section.
7983 (Output_section_incremental_inputs::do_write): Write the
7984 incremental_got_plt section.
7985 (Got_plt_view_info): New struct.
7986 (Local_got_offset_visitor): New class.
7987 (Global_got_offset_visitor): New class.
7988 (Global_symbol_visitor_got_plt): New class.
7989 (Output_section_incremental_inputs::write_got_plt): New function.
7990 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7991 Add parameter. Adjust all callers.
7992 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7993 (Incremental_inputs::got_plt_section): New function.
7994 (Incremental_inputs::got_plt_section_): New data member.
7995 (Incremental_got_plt_reader): New class.
7996 * layout.cc (Layout::create_incremental_info_sections): Add the
7997 incremental_got_plt section.
7998 * object.h (Got_offset_list::get_list): New function.
7999 (Got offset_list::for_all_got_offsets): New function.
8000 (Sized_relobj::local_got_offset_list): New function.
8001 * powerpc.cc (Target_powerpc::got_size): Add const.
8002 (Target_powerpc::got_entry_count): New function.
8003 (Target_powerpc::plt_entry_count): New function.
8004 (Target_powerpc::first_plt_entry_offset): New function.
8005 (Target_powerpc::plt_entry_size): New function.
8006 (Output_data_plt_powerpc::entry_count): New function.
8007 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8008 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8009 * sparc.cc (Target_sparc::got_size): Add const.
8010 (Target_sparc::got_entry_count): New function.
8011 (Target_sparc::plt_entry_count): New function.
8012 (Target_sparc::first_plt_entry_offset): New function.
8013 (Target_sparc::plt_entry_size): New function.
8014 (Output_data_plt_sparc::entry_count): New function.
8015 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8016 (Output_data_plt_sparc::get_plt_entry_size): New function.
8017 * symtab.h (Symbol::got_offset_list): New function.
8018 (Symbol_table::for_all_symbols): New function.
8019 * target.h (Sized_target::got_entry_count): New function.
8020 (Sized_target::plt_entry_count): New function.
8021 (Sized_target::plt_entry_size): New function.
8022 * x86_64.cc (Target_x86_64::got_size): Add const.
8023 (Target_x86_64::got_entry_count): New function.
8024 (Target_x86_64::plt_entry_count): New function.
8025 (Target_x86_64::first_plt_entry_offset): New function.
8026 (Target_x86_64::plt_entry_size): New function.
8027 (Output_data_plt_x86_64::entry_count): New function.
8028 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8029 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8030
8031 2010-08-12 Cary Coutant <ccoutant@google.com>
8032
8033 * archive.cc: Include incremental.h.
8034 (Archive::Archive): Initialize incremental_info_.
8035 (Archive::include_member): Record archive members in incremental info.
8036 (Add_archive_symbols::run): Record begin and end of an archive in
8037 incremental info.
8038 (Lib_group::include_member): Record objects in incremental info.
8039 * archive.h (Incremental_archive_entry): Forward declaration.
8040 (Archive::set_incremental_info): New member function.
8041 (Archive::incremental_info): New member function.
8042 (Archive::Unused_symbol_iterator): New class.
8043 (Archive::unused_symbols_begin): New member function.
8044 (Archive::unused_symbols_end): New member function.
8045 (Archive::incremental_info_): New data member.
8046 * incremental-dump.cc (find_input_containing_global): New function.
8047 (dump_incremental_inputs): Dump new incremental info sections.
8048 * incremental.cc: Include symtab.h.
8049 (Output_section_incremental_inputs): New class.
8050 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8051 new incremental info sections.
8052 (Sized_incremental_binary::do_check_inputs): Likewise.
8053 (Incremental_inputs::report_archive): Remove.
8054 (Incremental_inputs::report_archive_begin): New function.
8055 (Incremental_inputs::report_archive_end): New function.
8056 (Incremental_inputs::report_object): New function.
8057 (Incremental_inputs::finalize_inputs): Remove.
8058 (Incremental_inputs::report_input_section): New function.
8059 (Incremental_inputs::report_script): Rewrite.
8060 (Incremental_inputs::finalize): Do nothing but finalize string table.
8061 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8062 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8063 (Incremental_inputs::create_data_sections): New function.
8064 (Incremental_inputs::relocs_entsize): New function.
8065 (Output_section_incremental_inputs::set_final_data_size): New function.
8066 (Output_section_incremental_inputs::do_write): New function.
8067 (Output_section_incremental_inputs::write_header): New function.
8068 (Output_section_incremental_inputs::write_input_files): New function.
8069 (Output_section_incremental_inputs::write_info_blocks): New function.
8070 (Output_section_incremental_inputs::write_symtab): New function.
8071 * incremental.h (Incremental_script_entry): Forward declaration.
8072 (Incremental_object_entry): Forward declaration.
8073 (Incremental_archive_entry): Forward declaration.
8074 (Incremental_inputs): Forward declaration.
8075 (Incremental_inputs_header_data): Remove.
8076 (Incremental_inputs_header): Remove.
8077 (Incremental_inputs_header_write): Remove.
8078 (Incremental_inputs_entry_data): Remove.
8079 (Incremental_inputs_entry): Remove.
8080 (Incremental_inputs_entry_write): Remove.
8081 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8082 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8083 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8084 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8085 Likewise.
8086 (Incremental_input_entry): New class.
8087 (Incremental_script_entry): New class.
8088 (Incremental_object_entry): New class.
8089 (Incremental_archive_entry): New class.
8090 (Incremental_inputs::Incremental_inputs): Initialize new data members.
8091 (Incremental_inputs::report_inputs): Remove.
8092 (Incremental_inputs::report_archive): Remove.
8093 (Incremental_inputs::report_archive_begin): New function.
8094 (Incremental_inputs::report_archive_end): New function.
8095 (Incremental_inputs::report_object): Change prototype.
8096 (Incremental_inputs::report_input_section): New function.
8097 (Incremental_inputs::report_script): Change prototype.
8098 (Incremental_inputs::get_reloc_count): New function.
8099 (Incremental_inputs::set_reloc_count): New function.
8100 (Incremental_inputs::create_data_sections): New function.
8101 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8102 (Incremental_inputs::inputs_section): New function.
8103 (Incremental_inputs::symtab_section): New function.
8104 (Incremental_inputs::relocs_section): New function.
8105 (Incremental_inputs::get_stringpool): Add const.
8106 (Incremental_inputs::command_line): Add const.
8107 (Incremental_inputs::inputs): Remove.
8108 (Incremental_inputs::command_line_key): New function.
8109 (Incremental_inputs::input_file_count): New function.
8110 (Incremental_inputs::input_files): New function.
8111 (Incremental_inputs::relocs_entsize): New function.
8112 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8113 (Incremental_inputs::finalize_inputs): Remove.
8114 (Incremental_inputs::Input_info): Remove.
8115 (Incremental_inputs::lock_): Remove.
8116 (Incremental_inputs::inputs_): Change type.
8117 (Incremental_inputs::inputs_map_): Remove.
8118 (Incremental_inputs::current_object_entry_): New data member.
8119 (Incremental_inputs::inputs_section_): New data member.
8120 (Incremental_inputs::symtab_section_): New data member.
8121 (Incremental_inputs::relocs_section_): New data member.
8122 (Incremental_inputs::reloc_count_): New data member.
8123 (Incremental_inputs_reader): New class.
8124 (Incremental_symtab_reader): New class.
8125 (Incremental_relocs_reader): New class.
8126 * layout.cc (Layout::finalize): Move finalization of incremental info
8127 and creation of incremental info sections to follow finalization of
8128 symbol table. Set offsets for postprocessing sections.
8129 (Layout::create_incremental_info_sections): Call
8130 Incremental_inputs::create_data_sections. Add incremental symtab
8131 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
8132 sections to layout after input sections.
8133 * layout.h (struct Timespec): Forward declaration.
8134 (Layout::incremental_inputs): Add const.
8135 (Layout::create_incremental_info_sections): Add parameter.
8136 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8137 * object.cc: Include incremental.h.
8138 (Relobj::finalize_incremental_relocs): New function.
8139 (Sized_relobj::do_layout): Record input sections in incremental info.
8140 * object.h (Object::output_section): New function.
8141 (Object::output_section_offset): Moved from Relobj.
8142 (Object::get_incremental_reloc_base): New function.
8143 (Object::get_incremental_reloc_count): New function.
8144 (Object::do_output_section): New function.
8145 (Object::do_output_section_offset): Moved from Relobj.
8146 (Object::do_get_incremental_reloc_base): New function.
8147 (Object::do_get_incremental_reloc_count): New function.
8148 (Object::Object): Initialize new data members.
8149 (Relobj::output_section): Renamed do_output_section and moved to
8150 protected.
8151 (Relobj::output_section_offset): Moved to Object.
8152 (Relobj::do_get_incremental_reloc_base): New function.
8153 (Relobj::do_get_incremental_reloc_count): New function.
8154 (Relobj::allocate_incremental_reloc_counts): New function.
8155 (Relobj::count_incremental_reloc): New function.
8156 (Relobj::finalize_incremental_relocs): New function.
8157 (Relobj::next_incremental_reloc_index): New function.
8158 (Relobj::reloc_counts_): New data member.
8159 (Relobj::reloc_bases_): New data member.
8160 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
8161 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
8162 (Sized_relobj::incremental_relocs_scan): New function.
8163 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8164 (Sized_relobj::incremental_relocs_write): New function.
8165 (Sized_relobj::incremental_relocs_write_reltype): New function.
8166 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8167 incremental link.
8168 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8169 archives and object files elsewhere.
8170 (Add_symbols::run): Report object files here.
8171 (Finish_group::run): Report end of archive at end of group.
8172 * reloc.cc: Include layout.h, incremental.h.
8173 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8174 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8175 (Sized_relobj::incremental_relocs_scan): New function.
8176 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8177 (Sized_relobj::do_relocate_sections): Write incremental relocations.
8178 (Sized_relobj::incremental_relocs_write): New function.
8179 (Sized_relobj::incremental_relocs_write_reltype): New function.
8180 * script.cc (read_input_script): Rewrite test for incremental link.
8181 Change call to Incremental_inputs::report_script.
8182 * symtab.h (Symbol_table::first_global_index): New function.
8183 (Symbol_table::output_count): New function.
8184
8185 2010-08-12 Doug Kwan <dougkwan@google.com>
8186
8187 * arm.cc (Target_arm::merge_object_attributes): Check command line
8188 options --no-wchar-size-warning and --no-enum-size-warning.
8189 * options.h (General_options): Add ld-compatible options
8190 --no-enum-size-warning and --no-wchar-size-warning.
8191
8192 2010-08-04 Ian Lance Taylor <iant@google.com>
8193
8194 * x86_64.cc (Target_x86_64::Scan::local): Use
8195 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8196 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8197 (Target_x86_64::Scan::global): Likewise.
8198 (Target_x86_64::Relocate::relocate): Likewise.
8199 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8200 Likewise.
8201
8202 2010-08-03 Cary Coutant <ccoutant@google.com>
8203
8204 * merge.cc (Output_merge_string::do_add_input_section): Count strings
8205 to reserve space in merged_strings vector. Keep total input size
8206 for stats.
8207 (Output_merge_string::do_print_merge_stats): Print total input size.
8208 * merge.h (Output_merge_string): Add input_size_ field.
8209 * stringpool.cc (Stringpool_template::string_length): Move
8210 implementations out of Stringpool_template class and place in
8211 stringpool.h.
8212 * stringpool.h (string_length): Move out of Stringpool_template.
8213
8214 2010-08-03 Ian Lance Taylor <iant@google.com>
8215
8216 PR 11712
8217 * layout.cc (relaxation_loop_body): If address of load segment is
8218 set, adjust address to include headers if possible.
8219
8220 2010-08-03 Ian Lance Taylor <iant@google.com>
8221
8222 * version.cc (version_string): Bump to 1.10.
8223
8224 2010-08-03 Ian Lance Taylor <iant@google.com>
8225
8226 PR 11805
8227 * layout.h (enum Output_section_order): Define.
8228 (class Layout): Update declarations.
8229 * layout.cc (Layout::get_output_section): Add order parameter.
8230 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8231 is_first_non_relro parameters. Change all callers.
8232 (Layout::choose_output_section): Likewise.
8233 (Layout::add_output_section_data): Likewise.
8234 (Layout::make_output_section): Likewise. Set order.
8235 (Layout::default_section_order): New function.
8236 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8237 * output.cc (Output_section::Output_section): Initialize order_.
8238 Don't initialize deleted fields.
8239 (Output_segment::Output_segment): Don't initialize deleted
8240 fields.
8241 (Output_segment::add_output_section_to_load): New function
8242 replacing add_output_section. Change all callers to call this or
8243 add_output_section_to_nonload.
8244 (Output_segment::add_output_section_to_nonload): New function.
8245 (Output_segment::remove_output_section): Rewrite.
8246 (Output_segment::add_initial_output_data): Likewise.
8247 (Output_segment::has_any_data_sections): Likewise.
8248 (Output_segment::is_first_section_relro): Likewise.
8249 (Output_segment::maximum_alignment): Likewise.
8250 (Output_segment::has_dynamic_reloc): New function replacing
8251 dynamic_reloc_count. Change all callers.
8252 (Output_segment::has_dynamic_reloc_list): New function replacing
8253 dynamic_reloc_count_list. Change all callers.
8254 (Output_segment::set_section_addresses): Rewrite.
8255 (Output_segment::set_offset): Rewrite.
8256 (Output_segment::find_first_and_last_list): Remove.
8257 (Output_segment::set_tls_offsets): Rewrite.
8258 (Output_segment::first_section_load_address): Likewise.
8259 (Output_segment::output_section_count): Likewise.
8260 (Output_segment::section_with_lowest_load_address): Likewise.
8261 (Output_segment::write_section_headers): Likewise.
8262 (Output_segment::print_sections_to_map): Likewise.
8263 * output.h (class Output_data): Remove dynamic_reloc_count_
8264 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
8265 (Output_data::add_dynamic_reloc): Rewrite.
8266 (Output_data::has_dynamic_reloc): New function.
8267 (Output_data::dynamic_reloc_count): Remove.
8268 (class Output_section): Add order_ field. Remvoe is_relro_local_,
8269 is_last_relro_, is_first_non_relro_, is_interp_,
8270 is_dynamic_linker_section_ fields. Add order and set_order
8271 functions. Remove is_relro_local, set_is_relro_local,
8272 is_last_relro, set_is_last_relro, is_first_non_relro,
8273 set_is_first_non_relro functions, is_interp, set_is_interp,
8274 is_dynamic_linker_section, and set_is_dynamic_linker_section
8275 functions.
8276 (class Output_segment): Change Output_data_list from std::list to
8277 std:;vector. Add output_lists_ field. Remove output_data_ and
8278 output_bss_ fields. Update declarations.
8279
8280 2010-08-02 Ian Lance Taylor <iant@google.com>
8281
8282 * arm.cc (Target_arm::gc_process_relocs): Use typename.
8283 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8284 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8285
8286 2010-08-02 Ian Lance Taylor <iant@google.com>
8287
8288 PR 11855
8289 * script.cc (Script_options::Script_options): Initialize
8290 symbol_definitions_ and symbol_references_.
8291 (Script_options::add_symbol_assignment): Update
8292 symbol_definitions_ and symbol_references_.
8293 (Script_options::add_symbol_reference): New function.
8294 (script_symbol): New function.
8295 * script.h (class Script_options): Add symbol_definitions_ and
8296 symbol_references_ fields.
8297 (Script_options::referenced_const_iterator): New type.
8298 (Script_options::referenced_begin): New function.
8299 (Script_options::referenced_end): New function.
8300 (Script_options::is_referenced): New function.
8301 (Script_options::any_unreferenced): New function.
8302 * script-c.h (script_symbol): Declare.
8303 * yyscript.y (exp): Call script_symbol.
8304 * symtab.cc: Include "script.h".
8305 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8306 Change all callers. Check symbols referenced by scripts.
8307 (Symbol_table::add_undefined_symbols_from_command_line): Add
8308 layout parameter. Change all callers.
8309 (Symbol_table::do_add_undefined_symbols_from_command_line):
8310 Likewise. Break out loop body. Check symbols referenced by
8311 scripts.
8312 (Symbol_table::add_undefined_symbol_from_command_line): New
8313 function broken out of
8314 do_add_undefined_symbols_from_command_line.
8315 * symtab.h (class Symbol_table): Update declarations.
8316 * archive.cc: Include "layout.h".
8317 (Archive::should_include_member): Add layout parameter. Change
8318 all callers. Check for symbol mentioned in expression.
8319 * archive.h (class Archive): Update declaration.
8320 * object.cc (Sized_relobj::do_should_include_member): Add layout
8321 parameter.
8322 * object.h (Object::should_include_member): Add layout parameter.
8323 Change all callers.
8324 (Object::do_should_include_member): Add layout parameter.
8325 (class Sized_relobj): Update declaration.
8326 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8327 parameter.
8328 * dynobj.h (class Sized_dynobj): Update declaration.
8329 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8330 layout parameter.
8331 * plugin.h (class Sized_pluginobj): Update declaration.
8332
8333 2010-08-02 Ian Lance Taylor <iant@google.com>
8334
8335 PR 11866
8336 * output.cc (Output_segment::set_offset): Search for the first and
8337 last sections rather than assuming that the list is in order.
8338 (Output_segment::find_first_and_last_list): New function.
8339 * output.h (class Output_segment): Update declarations.
8340 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8341 (relro_strip_test_SOURCES): New variable.
8342 (relro_strip_test_DEPENDENCIES): New variable.
8343 (relro_strip_test_LDFLAGS): New variable.
8344 (relro_strip_test_LDADD): New variable.
8345 (relro_strip_test.so): New target.
8346
8347 2010-08-02 Ian Lance Taylor <iant@google.com>
8348
8349 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8350 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8351 (Target_i386::got_tlsdesc_section): New function.
8352 (Target_i386::got_section): Create space for GOT entries for
8353 TLSDESC relocations.
8354 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8355 R_386_TLS_GOTDESC.
8356 (Target_i386::Scan::global): Likewise.
8357 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8358 using TLSDESC GOT.
8359 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8360 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8361 (Target_x86_64::got_tlsdesc_section): New function.
8362 (Target_x86_64::got_section): Create space for GOT entries for
8363 TLSDESC relocations.
8364 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8365 R_386_TLS_GOTDESC.
8366 (Target_x86_64::Scan::global): Likewise.
8367 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8368 using TLSDESC GOT.
8369
8370 2010-08-02 Ian Lance Taylor <iant@google.com>
8371
8372 * testsuite/final_layout.sh: Use dc to convert from hex to
8373 decimal.
8374
8375 2010-07-29 Sriraman Tallam <tmsriram@google.com>
8376
8377 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8378 paramter to the call to gold::gc_process_relocs.
8379 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8380 paramter to the call to gold::gc_process_relocs.
8381 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8382 parameter to the call to gold::gc_process_relocs.
8383 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8384 template parameter to the call to gold::gc_process_relocs.
8385 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8386 paramter to the call to gold::gc_process_relocs.
8387 * gc.h (get_embedded_addend_size): New function.
8388 (gc_process_relocs): Save the size of the reloc for use by ICF.
8389 * icf.cc (get_section_contents): Get the addend from the text section
8390 for SHT_REL relocation sections.
8391 * icf.h (Icf::Reloc_addend_size_info): New typedef.
8392 (Icf::Reloc_info): Add new member reloc_addend_size_info.
8393 * int_encoding.h (read_from_pointer): New overloaded function.
8394 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8395 * testsuite/icf_sht_rel_addend_test.sh: New file.
8396 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8397 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8398
8399 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8400
8401 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8402 * Makefile.in: Regenerate.
8403 * testsuite/Makefile.in: Regenerate.
8404
8405 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
8406
8407 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8408 * gold/testsuite/debug_msg.cc: Likewise.
8409 * gold/testsuite/odr_violation1.cc
8410 * gold/testsuite/odr_violation2.cc
8411
8412 2010-07-21 Cary Coutant <ccoutant@google.com>
8413
8414 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8415 string, and length fields.
8416 (Output_merge_string::Merged_strings_list): New type.
8417 (Output_merge_string::Merged_strings_lists): New typedef.
8418 (Output_merge_string): Replace merged_strings_ with
8419 merged_strings_lists_.
8420 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8421 Merged_strings_list per input object and section. Don't store pointer
8422 to the string. Don't store length with each merged string entry.
8423 (Output_merge_string::finalize_merged_data): Loop over list of merged
8424 strings lists. Recompute length of each merged string.
8425
8426 2010-07-15 Cary Coutant <ccoutant@google.com>
8427
8428 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8429 here.
8430
8431 2010-07-14 Ian Lance Taylor <iant@google.com>
8432
8433 * descriptors.cc (Descriptors::open): Report correct name in error
8434 message.
8435
8436 2010-07-13 Doug Kwan <dougkwan@google.com>
8437
8438 * arm.cc (Arm_input_section::Arm_input_section): For a
8439 SHT_ARM_EXIDX section, always keeps the input sections.
8440 (Arm_input_section::set_exidx_section_link): New method.
8441 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8442 has_errors_ to false.
8443 (Arm_exidx_input_section::has_errors,
8444 Arm_exidx_input_section::set_has_errors): New methods.
8445 (Arm_exidx_input_section::has_errors_): New data member.
8446 (Arm_relobj::get_exidx_shndx_list): New method.
8447 (Arm_output_section::append_text_sections_to_list): Do not skip
8448 section without SHF_EXECINSTR.
8449 (Arm_output_section::fix_exidx_coverage): Skip input sections with
8450 errors.
8451 (Arm_relobj::make_exidx_input_section): Add new parameter for text
8452 section header. Make error messages more verbose. Check for
8453 a non-executable section linked to an EXIDX section.
8454 (Arm_relobj::do_read_symbols): Remove error checking, which has been
8455 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
8456 check that there is no deferred EXIDX section if we exit early.
8457 Instead of not making an EXIDX section in case of an error, make one
8458 and set the has_errors flag of it.
8459 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8460 in a relocatable link.
8461 (Target_arm::do_relax): Look for the EXIDX output section instead of
8462 assuming that it is called .ARM.exidx.
8463 (Target_arm::fix_exidx_coverage): Add a new parameter for input
8464 section list. Do not check for SHF_EXECINSTR section flags but
8465 skip any input section with errors.
8466 * output.cc (Output_section::Output_section): Initialize
8467 always_keeps_input_sections_ to false.
8468 (Output_section::add_input_section): Check for
8469 always_keeps_input_sections_.
8470 * output.h (Output_section::always_keeps_input_sections,
8471 Output_section::set_always_keeps_input_sections): New methods.
8472 (Output_section::always_keeps_input_sections): New data member.
8473
8474 2010-07-13 Rafael Espindola <espindola@google.com>
8475
8476 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8477 * fileread.h (Input_file): Add try_extra_search_path and find_file.
8478
8479 2010-07-13 Philip Herron <herron.philip@googlemail.com>
8480 Ian Lance Taylor <iant@google.com>
8481
8482 * output.h (Output_section_lookup_maps::add_merge_section):
8483 Correct check of whether value was inserted.
8484 (Output_section_lookup_maps::add_merge_input_section): Likewise.
8485 (Output_section_lookup_maps::add_relaxed_input_section):
8486 Likewise.
8487 * arm.cc (Target_arm::got_section): Remove used local os.
8488 * i386.cc (Target_i386::got_section): Likewise.
8489 * x86_64.cc (Target_x86_64::got_section): Likewise.
8490 * sparc.cc (Target_sparc::got_section): Likewise.
8491 (Target_sparc::relocate): Remove unused local have_got_offset.
8492 * powerpc.cc (Target_powerpc::relocate): Likewise.
8493
8494 2010-07-13 Ian Lance Taylor <iant@google.com>
8495
8496 * compressed_output.cc (zlib_decompress): Fix signature in
8497 !HAVE_ZLIB_H case.
8498
8499 * archive.cc (Archive::include_member): Unlock an external member
8500 of a thin archive. Don't bother to delete an object we know is
8501 NULL.
8502
8503 2010-07-12 Cary Coutant <ccoutant@google.com>
8504
8505 * compressed_output.cc (zlib_decompress): New function.
8506 (get_uncompressed_size): New function.
8507 (decompress_input_section): New function.
8508 * compressed_output.h (get_uncompressed_size): New function.
8509 (decompress_input_section): New function.
8510 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8511 Handle compressed debug sections.
8512 * layout.cc (is_compressed_debug_section): New function.
8513 (Layout::output_section_name): Map compressed section names to
8514 canonical names.
8515 * layout.h (is_compressed_debug_section): New function.
8516 (is_debug_info_section): Recognize compressed debug sections.
8517 * merge.cc: Include compressed_output.h.
8518 (Output_merge_data::do_add_input_section): Handle compressed
8519 debug sections.
8520 (Output_merge_string::do_add_input_section): Handle compressed
8521 debug sections.
8522 * object.cc: Include compressed_output.h.
8523 (Sized_relobj::Sized_relobj): Initialize new data members.
8524 (build_compressed_section_map): New function.
8525 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8526 * object.h (Object::section_is_compressed): New method.
8527 (Object::do_section_is_compressed): New method.
8528 (Sized_relobj::Compressed_section_map): New type.
8529 (Sized_relobj::do_section_is_compressed): New method.
8530 (Sized_relobj::compressed_sections_): New data member.
8531 * output.cc (Output_section::add_input_section): Handle compressed
8532 debug sections.
8533 * reloc.cc: Include compressed_output.h.
8534 (Sized_relobj::write_sections): Handle compressed debug sections.
8535
8536 2010-07-08 Cary Coutant <ccoutant@google.com>
8537
8538 * resolve.cc (Symbol_table::resolve): Remember whether undef was
8539 weak when resolving to a dynamic def.
8540 (Symbol_table::should_override): Add adjust_dyndef flag; set it
8541 for weak undef/dynamic def cases. Adjust callers.
8542 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8543 undef_binding_weak_.
8544 (Symbol_table::sized_write_globals): Adjust symbol binding.
8545 (Symbol_table::sized_write_symbol): Add binding parameter.
8546 * symtab.h (Symbol::set_undef_binding): New method.
8547 (Symbol::is_undef_binding_weak): New method.
8548 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8549 (Symbol_table::should_override): Add new parameter.
8550 (Symbol_table::sized_write_symbol): Add new parameter.
8551
8552 * testsuite/weak_undef_file1.cc: Add new test case.
8553 * testsuite/weak_undef_file2.cc: Fix header comment.
8554 * testsuite/weak_undef_test.cc: Add new test case.
8555
8556 2010-06-29 Doug Kwan <dougkwan@google.com>
8557
8558 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8559 Initialize USE_SYMBOL_.
8560 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8561 definition.
8562 (Arm_reloc_property::uses_symbol_): New data member declaration.
8563 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8564 uses symbol value and symbol is undefined but not weakly undefined.
8565
8566 2010-06-28 Rafael Espindola <espindola@google.com>
8567
8568 * plugin.cc (Plugin::load): Use dlerror.
8569
8570 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8571
8572 * symtab.cc (detect_odr_violations): When reporting an ODR
8573 violation, report an object where the symbol is defined.
8574
8575 2010-06-25 Doug Kwan <dougkwan@google.com>
8576
8577 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8578 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8579 definition.
8580 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8581 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8582 target hook to detect function points.
8583 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8584 * icf.h (Icf::check_section_for_function_pointers): Change type of
8585 parameter SECTION_NAME to const reference to std::string. Use
8586 target hook to determine if section may have unsafe pointers.
8587 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8588 method definition.
8589
8590 2010-06-21 Rafael Espindola <espindola@google.com>
8591
8592 * fileread.cc (Input_file::find_fie): New
8593 (Input_file::open): Use Input_file::find_fie.
8594 * fileread.h (Input_file::find_fie): New
8595 * plugin.cc (set_extra_library_path): New.
8596 (Plugin::load): Add set_extra_library_path to the transfer vector.
8597 (Plugin_manager::set_extra_library_path): New.
8598 (Plugin_manager::add_input_file): Use the extra search path if set.
8599 (set_extra_library_path(): New.
8600 * plugin.h (Plugin_manager): Add set_extra_library_path and
8601 extra_search_path_.
8602
8603 2010-06-19 Cary Coutant <ccoutant@google.com>
8604
8605 * layout.cc (gdb_sections): Add .debug_types.
8606 (lines_only_debug_sections): Likewise.
8607
8608 2010-06-18 Rafael Espindola <espindola@google.com>
8609
8610 * plugin.cc (add_input_file,add_input_library)
8611 (Plugin_manager::add_input_file): Make filename arguments const.
8612 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8613 const.
8614
8615 2010-06-16 Doug Kwan <dougkwan@google.com>
8616
8617 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8618 .ARM.attributes section if we have not merged any input
8619 attributes sections.
8620
8621 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8622
8623 * arm.cc: Allow combining objects with no EABI version
8624 information.
8625
8626 2010-06-15 Rafael Espindola <espindola@google.com>
8627
8628 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8629
8630 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8631
8632 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8633 (struct iovec): Correct !HAVE_READV definition.
8634
8635 2010-06-10 Cary Coutant <ccoutant@google.com>
8636
8637 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8638 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8639 reloc sections.
8640 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8641
8642 PR 11683
8643 * symtab.h (Symbol::is_placeholder): New member function.
8644 * target-reloc.h (relocate_section): Check for placeholder symbols.
8645
8646 * testsuite/Makefile.am (plugin_test_8): New test.
8647 (plugin_test_9): New test.
8648 * testsuite/Makefile.in: Regenerate.
8649
8650 2010-06-09 Nick Clifton <nickc@redhat.com>
8651
8652 * yyscript.y (input_list_element): Allow strings prefixed with
8653 the '-' character. Treat these as libraries.
8654 * script.cc (script_add_library): New function. Adds a library
8655 specified by "-l<name>" found in an input script.
8656 * script-c.h: Add prototype for script_add_library.
8657
8658 2010-06-07 Doug Kwan <dougkwan@google.com>
8659
8660 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8661 Restrict stub-group size to be within long conditional branch
8662 range when working around cortex-A8 erratum.
8663
8664 2010-06-07 Damien Diederen <dd@crosstwine.com>
8665
8666 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8667 #ifdef typo.
8668
8669 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8670
8671 PR gold/11658
8672 * output.cc
8673 (Output_section::Input_section_sort_entry::compare_section_ordering):
8674 Change to return non-zero correctly.
8675 (Output_section::Input_section_sort_section_order_index_compare
8676 ::operator()): Change to fix ambiguity in comparisons.
8677
8678 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8679
8680 * gold.h (is_wildcard_string): New function.
8681 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8682 (Layout::layout_eh_frame): Ditto.
8683 (Layout::find_section_order_index): New method.
8684 (Layout::read_layout_from_file): New method.
8685 * layout.h (Layout::find_section_order_index): New method.
8686 (Layout::read_layout_from_file): New method.
8687 (Layout::input_section_position_): New private member.
8688 (Layout::input_section_glob_): New private member.
8689 * main.cc (main): Call read_layout_from_file here.
8690 * options.h (--section-ordering-file): New option.
8691 * output.cc (Output_section::input_section_order_specified_): New
8692 member.
8693 (Output_section::Output_section): Initialize new member.
8694 (Output_section::add_input_section): Add new parameter.
8695 Keep input sections when --section-ordering-file is used.
8696 (Output_section::set_final_data_size): Sort input sections when
8697 section ordering file is specified.
8698 (Output_section::Input_section_sort_entry): Add new parameter.
8699 Check sorting type.
8700 (Output_section::Input_section_sort_entry::compare_section_ordering):
8701 New method.
8702 (Output_section::Input_section_sort_compare::operator()): Change to
8703 consider section_order_index.
8704 (Output_section::Input_section_sort_init_fini_compare::operator()):
8705 Change to consider section_order_index.
8706 (Output_section::Input_section_sort_section_order_index_compare
8707 ::operator()): New method.
8708 (Output_section::sort_attached_input_sections): Change to sort
8709 according to section order when specified.
8710 (Output_section::add_input_section<32, true>): Add new parameter.
8711 (Output_section::add_input_section<64, true>): Add new parameter.
8712 (Output_section::add_input_section<32, false>): Add new parameter.
8713 (Output_section::add_input_section<64, false>): Add new parameter.
8714 * output.h (Output_section::add_input_section): Add new parameter.
8715 (Output_section::input_section_order_specified): New
8716 method.
8717 (Output_section::set_input_section_order_specified): New method.
8718 (Input_section::Input_section): Initialize section_order_index_.
8719 (Input_section::section_order_index): New method.
8720 (Input_section::set_section_order_index): New method.
8721 (Input_section::section_order_index_): New member.
8722 (Input_section::Input_section_sort_section_order_index_compare): New
8723 struct.
8724 (Output_section::input_section_order_specified_): New member.
8725 * script-sections.cc (is_wildcard_string): Delete and move modified
8726 method to gold.h.
8727 (Output_section_element_input::Output_section_element_input): Modify
8728 call to is_wildcard_string.
8729 (Output_section_element_input::Input_section_pattern
8730 ::Input_section_pattern): Ditto.
8731 (Output_section_element_input::Output_section_element_input): Ditto.
8732 * testsuite/Makefile.am (final_layout): New test case.
8733 * testsuite/Makefile.in: Regenerate.
8734 * testsuite/final_layout.cc: New file.
8735 * testsuite/final_layout.sh: New file.
8736
8737 2010-06-01 Rafael Espindola <espindola@google.com>
8738
8739 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8740
8741 2010-06-01 Rafael Espindola <espindola@google.com>
8742
8743 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8744 visibility of symbols.
8745
8746 2010-05-27 Doug Kwan <dougkwan@google.com>
8747
8748 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8749 from start of output section instead of address for a local symbol
8750 in a merged or relaxed section when doing a relocatable link.
8751
8752 2010-05-26 Rafael Espindola <espindola@google.com>
8753
8754 PR 11604
8755 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8756 adding sections the garbage collector removed.
8757 * gold/testsuite/Makefile.am: Add test.
8758 * gold/testsuite/Makefile.in: Regenerate.
8759 * gold/testsuite/plugin_test_7.sh: New.
8760 * gold/testsuite/plugin_test_7_1.c: New.
8761 * gold/testsuite/plugin_test_7_2.c: New.
8762
8763 2010-05-26 Rafael Espindola <espindola@google.com>
8764
8765 * script-sections.cc (Output_section_definition::set_section_addresses):
8766 Check for --section-start.
8767
8768 2010-05-26 Doug Kwan <dougkwan@google.com>
8769
8770 * arm.cc (Arm_scan_relocatable_relocs): New class.
8771 (Target_arm::relocate_special_relocatable): New method.
8772 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8773 (Arm_relocate_functions::thumb_branch_common): Same.
8774 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8775 instead of Default_scan_relocatable_relocs.
8776 * target-reloc.h (relocate_for_relocatable): Let target handle
8777 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8778 * target.h (Sized_target::relocate_special_relocatable): New method.
8779
8780 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8781
8782 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8783
8784 2010-05-23 Doug Kwan <dougkwan@google.com>
8785
8786 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8787 instead of a cast.
8788 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8789 with a direct branch, not a conditional branch, to a stub.
8790 * merge.cc (Output_merge_base::record_input_section): New method
8791 defintion.
8792 (Output_merge_data::do_add_input_section): Record input section if
8793 keeps-input-sections flag is set.
8794 (Output_merge_string::do_add_input_section): Ditto.
8795 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8796 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8797 INPUT_SECTIONS_.
8798 (Output_merge_base::keeps_input_sections,
8799 Output_merge_base::set_keeps_input_sections,
8800 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8801 method definitions.
8802 (Output_merge_base::Input_sections): New type declaration.
8803 (Output_merge_base::input_sections_begin,
8804 Output_merge_base::input_sections_end,
8805 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8806 (Output_merge_base::bool keeps_input_sections_,
8807 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8808 Output_merge_base::input_sections_): New data members.
8809 (Output_merge_data::do_set_keeps_input_sections): New method
8810 defintion.
8811 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8812 * output.cc (Output_section::Input_section::relobj): Move method
8813 defintion from class declaration to here and handle merge sections.
8814 (Output_section::Input_section::shndx): Ditto.
8815 (Output_section::Output_section): Remove initializations of removed
8816 data members and initialize new data member LOOKUP_MAPS_.
8817 (Output_section::add_input_section): Set keeps-input-sections flag
8818 for a newly created merge output section as appropriate. Adjust code
8819 to use Output_section_lookup_maps class.
8820 (Output_section::add_relaxed_input_section): Adjst code for lookup
8821 maps code refactoring.
8822 (Output_section::add_merge_input_section): Add a new parameter
8823 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8824 class. If adding input section to a newly created merge output
8825 section fails, remove the new merge section.
8826 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8827 Adjust code for use of the Output_section_lookup_maps class.
8828 (Output_section::find_merge_section): Ditto.
8829 (Output_section::build_lookup_maps): New method defintion.
8830 (Output_section::find_relaxed_input_section): Adjust code to use
8831 Output_section_lookup_maps class.
8832 (Output_section::get_input_sections): Export merge sections. Adjust
8833 code to use Output_section_lookup_maps class.
8834 (Output_section:::add_script_input_section): Adjust code to use
8835 Output_section_lookup_maps class. Update lookup maps for merge
8836 sections also.
8837 (Output_section::discard_states): Use Output_section_lookup_maps.
8838 (Output_section::restore_states): Same.
8839 * output.h (Merge_section_properties): Move class defintion out of
8840 Output_section.
8841 (Output_section_lookup_maps): New class.
8842 (Output_section::Input_section::is_merge_section): New method
8843 defintion.
8844 (Output_section::Input_section::relobj): Move defintion out of class
8845 defintion. Declare method only.
8846 (Output_section::Input_section::shndx): Ditto.
8847 (Output_section::Input_section::output_merge_base): New method defintion.
8848 (Output_section::Input_section::u2_.pomb): New union field.
8849 (Output_section::Merge_section_by_properties_map,
8850 Output_section::Output_section_data_by_input_section_map,
8851 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8852 Remove types.
8853 (Output_section::add_merge_input_section): Add new parameter
8854 KEEPS_INPUT_SECTIONS.
8855 (Output_section::build_lookup_maps): New method declaration.
8856 (Output_section::merge_section_map_,
8857 Output_section::merge_section_by_properties_map_,
8858 Output_section::relaxed_input_section_map_,
8859 Output_section::is_relaxed_input_section_map_valid_): Remove data
8860 members.
8861 (Output_section::lookup_maps_): New data member.
8862
8863 2010-05-21 Doug Kwan <dougkwan@google.com>
8864
8865 PR gold/11619
8866 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8867 avoid a compilation error.
8868
8869 2010-05-19 Rafael Espindola <espindola@google.com>
8870
8871 * script-sections.cc (Output_section_definition::allocate_to_segment):
8872 Update the phdrs_list even when the output section is NULL.
8873 * testsuite/Makefile.am: Add test.
8874 * testsuite/Makefile.in: Regenerate.
8875 * testsuite/script_test_9.cc: New.
8876 * testsuite/script_test_9.sh: New.
8877 * testsuite/script_test_9.t: New.
8878
8879 2010-05-19 Doug Kwan <dougkwan@google.com>
8880
8881 * arm.cc (Arm_input_section::original_size): New method.
8882 (Arm_input_section::do_addralign): Add a cast.
8883 (Arm_input_section::do_output_offset): Remove static cast.
8884 (Arm_input_section::original_addralign,
8885 Arm_input_section::original_size_): Change type to uint32_t.
8886 (Arm_input_section::init): Add safe casts for section alignment
8887 and size.
8888 (Arm_input_section::set_final_data_size): Do not set address and
8889 offset of stub table.
8890 (Arm_output_section::fix_exidx_coverage): Change use of of
8891 Output_section::Simple_input_section to that of
8892 Output_section::Input_section.
8893 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8894 except for the first pass.
8895 * output.cc (Output_section::get_input_sections): Change type of
8896 input_sections to std::list<Input_section>.
8897 (Output_section::add_script_input_section): Rename from
8898 Output_section::add_simple_input_section. Change type of SIS
8899 parameter from Simple_input_section to Input_section.
8900 * output.h (Output_section::Simple_input_section): Remove class.
8901 (Output_section::Input_section): Change class visibility to public.
8902 (Output_section::Input_section::addralign): Use stored alignments
8903 for special input sections if set.
8904 (Output_section::Input_section::set_addralign): New method.
8905 (Output_section::get_input_sections): Change parameter type from
8906 list of Simple_input_section to list of Input_section.
8907 (Output_section::add_script_input_section): Rename from
8908 Output_section::add_simple_input_section. Change first parameter's
8909 type from Simple_input_section to Input_section and remove the
8910 second and third parameters.
8911 * script-sections.cc (Input_section::Input_section_list): Change
8912 type to list of Output_section::Input_section/
8913 (Input_section_info::Input_section_info): Change parameter type of
8914 INPUT_SECTION to Output_section::Input_section.
8915 (Input_section_info::input_section): Change return type.
8916 (Input_section_info::input_section_): Change type to
8917 Output_section::Input_section.
8918 (Output_section_element_input::set_section_addresses): Adjust code
8919 to use Output_section::Input_section instead of
8920 Output_section::Simple_input_section. Adjust code for renaming
8921 of Output_section::add_simple_input_section.
8922 (Orphan_output_section::set_section_addresses): Ditto.
8923
8924 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8925
8926 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8927 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8928
8929 2010-05-18 Rafael Espindola <espindola@google.com>
8930
8931 * options.cc (General_options::finalize): Handle -nostdlib.
8932 * options.h (nostdlib): New option.
8933 * script.cc (script_add_search_dir): Handle -nostdlib.
8934
8935 2010-05-12 Doug Kwan <dougkwan@google.com>
8936
8937 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8938 attributes section only if there no attributes section after merging.
8939 (Target_arm::merge_object_attributes): Move value of
8940 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8941 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8942 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8943 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8944 and arm_attr_merge_7.stdout.
8945 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8946 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8947 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8948 arm_attr_merge_7b.o): New rules.
8949 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8950 arm_attr_merge_7
8951 * testsuite/Makefile.in: Regenerate.
8952 * testsuite/arm_attr_merge.sh: New file.
8953 * testsuite/arm_attr_merge_[67][ab].s: Same.
8954
8955 2010-05-05 Nick Clifton <nickc@redhat.com>
8956
8957 * po/es.po: Updated Spanish translation.
8958
8959 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8960
8961 * Makefile.am (install-exec-local): Properly install gold as
8962 default cross linker.
8963 * Makefile.in: Regenerated.
8964
8965 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8966 Nick Clifton <nickc@redhat.com>
8967
8968 * configure.ac (install_as_default): Define and set to false
8969 unless --enable-gold or --enable-gold=both/gold has been
8970 specified.
8971 * configure: Regenerate.
8972
8973 * Makefile.am (install-exec-local): Install the executable as
8974 'ld.gold'. If install_as_default is true then also install it as
8975 'ld'.
8976 * Makefile.in: Regenerated.
8977
8978 2010-04-24 Ian Lance Taylor <iant@google.com>
8979
8980 * layout.cc (Layout::layout_reloc): In relocatable link don't
8981 combine reloc sections for grouped sections.
8982
8983 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8984
8985 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8986 sections that are not ordinary to icf.
8987 * icf.cc (get_section_contents): Handle relocation pointing to section
8988 with no object or shndx information.
8989 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8990 * testsuite/Makefile.in: Regenerate.
8991 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8992 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8993
8994 2010-04-22 Ian Lance Taylor <iant@google.com>
8995
8996 * expression.cc (Expression::Expression_eval_info): Add
8997 result_alignment_pointer field.
8998 (Expression::eval_with_dot): Add result_alignment_pointer
8999 parameter. Change all callers.
9000 (Expression::eval_maybe_dot): Likewise.
9001 (class Binary_expression): Add alignment_pointer parameter to
9002 left_value and right_value. Change all callers.
9003 (BINARY_EXPRESSION): Set result alignment.
9004 (class Trinary_expression): Add alignment_pointer parameter to
9005 arg2_value and arg3_value. Change all callers.
9006 (Trinary_cond::value): Set result alignment.
9007 (Max_expression::value, Min_expression::value): Likewise.
9008 (Align_expression::value): Likewise.
9009 * script-sections.cc (class Sections_element): Add dot_alignment
9010 parameter to set_section_addresses virtual function. Update
9011 instantiations.
9012 (class Output_section_element): Likewise.
9013 (Script_sections::create_segments): Add dot_alignment parameter.
9014 Change all callers.
9015 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9016 (Script_sections::set_phdrs_clause_addresses): Likewise.
9017 * script-sections.h: Update declarations.
9018 * script.h: Update declarations.
9019 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9020 min_p_align.
9021 * testsuite/script_test_3.t: Set large alignment.
9022 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9023 segment has expected alignment.
9024
9025 2010-04-22 Nick Clifton <nickc@redhat.com>
9026
9027 * po/gold.pot: Updated by the Translation project.
9028 * po/vi.po: Updated Vietnamese translation.
9029
9030 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9031
9032 * testsuite/Makefile.am (check_PROGRAMS): Add
9033 icf_virtual_function_folding_test.
9034 * testsuite/Makefile.in: Regenerated.
9035
9036 2010-04-15 Andrew Haley <aph@redhat.com>
9037
9038 * options.h (merge_exidx_entries): New option.
9039 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9040 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9041 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9042 (Target_arm::merge_exidx_entries): New function.
9043 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9044 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9045 to Arm_exidx_fixup constructor.
9046 Add new arg, merge_exidx_entries.
9047 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9048 Arm_output_section::fix_exidx_coverage.
9049
9050 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9051
9052 * icf.cc (get_section_contents): Check for preemptible functions.
9053 Ignore addend when appropriate.
9054 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9055 section folded.
9056 (add_from_relobj): Check for section folded.
9057 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9058 * symtab.h (should_add_dynsym_entry): Add new parameter.
9059 * target-reloc.h (scan_relocs): Check for section folded.
9060 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9061 Check reloc types for function pointers in shared objects.
9062 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9063 case.
9064 (icf_preemptible_functions_test): New test case.
9065 (icf_string_merge_test): New test case.
9066 * testsuite.Makefile.in: Regenerate.
9067 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9068 bar_glob. Refactor code.
9069 * testsuite/icf_preemptible_functions_test.cc: New file.
9070 * testsuite/icf_preemptible_functions_test.sh: New file.
9071 * testsuite/icf_string_merge_test.cc: New file.
9072 * testsuite/icf_string_merge_test.sh: New file.
9073 * testsuite/icf_virtual_function_folding_test.cc: New file.
9074 * testsuite/icf_virtual_function_folding_test.sh: New file.
9075
9076 2010-04-14 Doug Kwan <dougkwan@google.com>
9077
9078 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9079 for local symbol recounting if we remove a section due to ICF.
9080 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9081 there are no regular objects in input.
9082
9083 2010-04-13 Doug Kwan <dougkwan@google.com>
9084
9085 * arm.cc (Arm_input_section::set_final_data_size): Compute
9086 accurate final data size instead of using current data size.
9087
9088 2010-04-09 Doug Kwan <dougkwan@google.com>
9089
9090 * layout.cc (Layout::choose_output_section): Handle script section
9091 types.
9092 (Layout::make_output_section_for_script): Add section type parameter.
9093 Handle script section types.
9094 * layout.h (Layout::make_output_section_for_script): Add section
9095 type parameter.
9096 * output.cc (Output_section::Output_section): Initialize data member
9097 is_noload_.
9098 (Output_section::do_reset_address_and_file_offset): Do not set address
9099 to 0 if section is a NOLOAD section.
9100 * output.h (Output_section::is_noload): New method.
9101 (Output_section::set_is_noload): Ditto.
9102 (Output_section::is_noload_): New data member.
9103 * script-c.h (Script_section_type): New enum type.
9104 (struct Parser_output_section_header): Add new file section_type.
9105 * script-sections.cc (Sections_element::output_section_name): Add
9106 parameter for returning script section type.
9107 (Output_section_definition::output_section_name): Ditto.
9108 (Output_section_definition::section_type)P; New method.
9109 (Output_section_definiton::script_section_type_name): Ditto.
9110 (Output_section_definition::script_section_type_): New data member.
9111 (Output_section_definition::Output_section_definition): Initialize
9112 data member Output_section_definition::script_section_type_.
9113 (Output_section_definition::create_sections): Pass script section type
9114 to Layout::make_output_section_for_script.
9115 (Output_section_definition::output_section_name): Return script
9116 section type to caller.
9117 (Output_section_definition::set_section_address): Do not advance
9118 dot value and load address if section type is NOLOAD. Set address
9119 of NOLOAD sections regardless of section flags.
9120 (Output_section_definition::print): Print section type if it is
9121 not SCRIPT_SECTION_TYPE_NONE.
9122 (Output_section_definition::section_type): New method.
9123 (Output_section_definition::script_section_type_name): Ditto.
9124 (Script_sections::output_section_name): Add new parameter
9125 PSECTION_TYPE for returning script section type. Pass it to
9126 section elements. Handle discard sections.
9127 (Sort_output_sections::operator()): Handle NOLOAD sections.
9128 * script-sections.h (Script_sections::Section_type): New enum type.
9129 (Script_sections::output_section_name): Add a new parameter for
9130 returning script section type.
9131 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9132 INFO and NOLOAD.
9133 * yyscript.y (union): Add new field SECTION_TYPE.
9134 (COPY, DSECT, INFO, NOLOAD): New tokens.
9135 (opt_address_and_section_type): Change type to output_section_header.
9136 (section_type): New non-terminal
9137 (section_header): Handle section type.
9138 (opt_address_and_section_type): Return section type value.
9139
9140 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
9141
9142 * testsuite/plugin_common_test_1.c (foo): Add prototype.
9143 * testsuite/plugin_common_test_2.c (foo): Likewise.
9144
9145 2010-04-08 Doug Kwan <dougkwan@google.com>
9146
9147 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9148 Output_merge_data.
9149 * output.cc (Output_section::add_merge_input_section): Simplify
9150 code and return status of Output_merge_base::add_input_section.
9151 Update merge section map only if Output_merge_base::add_input_section
9152 returns true.
9153
9154 2010-04-07 Doug Kwan <dougkwan@google.com>
9155
9156 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9157 if section is marked as containing instructions but has no mapping
9158 symbols.
9159 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9160 correct section index.
9161 (Arm_relobj::find_linked_text_section): Ditto.
9162
9163 2010-04-07 Cary Coutant <ccoutant@google.com>
9164
9165 * archive.cc (include_member): Destroy Read_symbols_data object before
9166 releasing file.
9167 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9168 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9169 (Read_symbols_data::~Read_symbols_data) New destructor.
9170 (Section_relocs::Section_relocs) New constructor.
9171 (Section_relocs::~Section_relocs) New destructor.
9172 (Read_relocs_data::Read_relocs_data) New constructor.
9173 (Read_relocs_data::~Read_relocs_data) New destructor.
9174 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9175 pointers to NULL after deleting.
9176
9177 2010-04-07 Doug Kwan <dougkwan@google.com>
9178
9179 * arm.cc: Replace "endianity" with "endianness" in comments.
9180 (Arm_exidx_cantunwind): Ditto.
9181 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9182 (Arm_relobj::merge_flags_and_attributes): New method.
9183 (Arm_relobj::merge_flags_and_attributes_): New data member.
9184 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9185 (Arm_relobj::scan_sections_for_stubs): Ditto.
9186 (Arm_relobj::do_read_symbols): Check to see if we really want to
9187 merge processor-specific flags and attributes. Exit early if
9188 an object is empty except for section names and the undefined symbol.
9189 (Target_arm::do_finalize_sections): Move check for ELF format to
9190 Arm_relobj::do_read_symbols. Merge processor specific flags and
9191 attributes from a regular object only when we have determined that
9192 it is aapropriate. Do not create an .ARM.attributes section in
9193 output if there is no regular input object.
9194 (Target_arm::merge_processor_specific_flags): Check
9195 --warn-mismatch before printing any error.
9196 (Target_arm::merge_object_attributes): Ditto.
9197 * gold.cc (queue_middle_tasks): Handle the case in which there is
9198 no regular object in input.
9199 * options.cc (General_options::parse_EB): New method.
9200 (General_options::parse_EL): Same.
9201 (General_options::General_options): Initialize endianness_.
9202 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9203 New options.
9204 (General_options::Endianness): New enum.
9205 (General_options::endianness): New method.
9206 (General_options::endianness_): New data member.
9207 * parameters.cc (Parameters::set_options): Check target endianness.
9208 (Parameters::set_target_once): Ditto.
9209 (Parameters::check_target_endianness): New method.
9210 (parameters_force_valid_target): If either -EL or -EB is specified,
9211 use it to define endianness of default target.
9212 * parameters.h (Parameters::check_target_endianness): New method
9213 declaration.
9214 * target.h (class Target): Change "endianity" to "endianness"
9215 in comments.
9216
9217 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9218
9219 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9220 * configure: Regenerate.
9221 * Makefile.in: Regenerate.
9222 * testsuite/Makefile.in: Regenerate.
9223
9224 2010-04-06 Cary Coutant <ccoutant@google.com>
9225
9226 gcc PR lto/42757
9227 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9228 prevailing definitions of common symbols.
9229 * testsuite/plugin_test_6.sh: New test case.
9230 * testsuite/plugin_common_test_1.c: New test case.
9231 * testsuite/plugin_common_test_2.c: New test case.
9232 * testsuite/Makefile.am (plugin_test_6): New test case.
9233 * testsuite/Makefile.in: Regenerate.
9234
9235 2010-04-06 Nick Clifton <nickc@redhat.com>
9236
9237 * po/vi.po: New Vietnamese translation.
9238
9239 2010-03-30 Doug Kwan <dougkwan@google.com>
9240
9241 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9242
9243 2010-03-25 Doug Kwan <dougkwan@google.com>
9244
9245 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9246 to avoid a conversion warning on a 32-bit host.
9247
9248 2010-03-24 Ian Lance Taylor <iant@google.com>
9249
9250 * testsuite/script_test_3.t: Add a TLS segment.
9251 * testsuite/Makefile.am (check_PROGRAMS): Add
9252 tls_phdrs_script_test.
9253 (tls_phdrs_script_test_SOURCES): Define.
9254 (tls_phdrs_script_test_DEPENDENCIES): Define.
9255 (tls_phdrs_script_test_LDFLAGS): Define.
9256 (tls_phdrs_script_test_LDADD): Define.
9257 * testsuite/Makefile.in: Rebuild.
9258
9259 2010-03-23 Cary Coutant <ccoutant@google.com>
9260
9261 * fileread.cc (find_or_make_view): Fix comment.
9262
9263 2010-03-23 Ian Lance Taylor <iant@google.com>
9264
9265 * script-sections.cc (class Orphan_section_placement): Define
9266 PLACE_TLS and PLACE_TLS_BSS.
9267 (Orphan_section_placement::Orphan_section_placement): Initialize
9268 new places.
9269 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9270 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9271 (tls_script_test_SOURCES): Define.
9272 (tls_script_test_DEPENDENCIES): Define.
9273 (tls_script_test_LDFLAGS): Define.
9274 (tls_script_test_LDADD): Define.
9275 * testsuite/Makefile.in: Rebuild.
9276
9277 2010-03-22 Doug Kwan <dougkwan@google.com>
9278
9279 * arm.cc (Arm_relocate_functions::abs8,
9280 Arm_relocate_functions::abs16): Use correct check for overflow
9281 specified in the ARM ELF specs.
9282 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
9283 target of a BLX instruction specially.
9284 (Reloc_stub::stub_type_for_reloc): Ditto.
9285 (Relocate::relocate): Use symbolic names instead of numeric relocation
9286 codes to report error.
9287 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9288 workaround.
9289 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9290 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9291 thumb2_blx_out_of_range.stdout
9292 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9293 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9294 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9295 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9296 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9297 thumb2_blx_in_range, thumb2_blx_in_range.o,
9298 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9299 thumb2_blx_out_of_range.o): New rules.
9300 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9301 thumb2_blx_in_range and thumb2_blx_out_of_range.
9302 * testsuite/Makefile.in: Regenerate.
9303 * arm_branch_in_range.sh: Add tests for THUMB BLX.
9304 * testsuite/thumb_blx_in_range.s: New file.
9305 * testsuite/thumb_blx_out_of_range.s: New file.
9306
9307 2010-03-22 Rafael Espindola <espindola@google.com>
9308
9309 * archive.cc (Should_include): Move to archive.h.
9310 (should_include_member): Make it a member of Archive.
9311 (Lib_group): New.
9312 (Add_lib_group_symbols): New.
9313 * archive.h: Include options.h.
9314 (Archive_member): Moved from Archive.
9315 (Should_include): Moved from archive.cc.
9316 (Lib_group): New.
9317 (Add_lib_group_symbols): New.
9318 * dynobj.cc (do_should_include_member): New.
9319 * dynobj.h (do_should_include_member): New.
9320 * gold.cc (queue_initial_tasks): Update call to queue.
9321 * main.cc (main): Print lib group stats.
9322 * object.cc (do_should_include_member): New.
9323 * object.h: Include archive.h.
9324 (Object::should_include_member): New.
9325 (Object::do_should_include_member): New.
9326 (Sized_relobj::do_should_include_member): New.
9327 * options.cc (General_options::parse_start_lib): New.
9328 (General_options::parse_end_lib): New.
9329 (Input_arguments::add_file): Handle lib groups.
9330 (Input_arguments::start_group): Check we are not in a lib.
9331 (Input_arguments::start_lib): New.
9332 (Input_arguments::end_lib): New.
9333 * options.h (General_options): Add start_lib and end_lib.
9334 (Input_argument::lib_): New.
9335 (Input_argument::lib): New.
9336 (Input_argument::is_lib): New.
9337 (Input_file_lib): New.
9338 (Input_arguments::in_lib_): New.
9339 (Input_arguments::in_lib): New.
9340 (Input_arguments::start_lib): New.
9341 (Input_arguments::end_lib_): New.
9342 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9343 in unused members as preempted.
9344 (Sized_pluginobj::do_should_include_member): New.
9345 * plugin.h (Sized_pluginobj::do_should_include_member): New.
9346 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9347 return the blocker.
9348 (Read_symbols::do_whole_lib_group): New.
9349 (Read_symbols::do_lib_group): New.
9350 (Read_symbols::do_read_symbols): Handle lib groups.
9351 (Read_symbols::get_name): Handle lib groups.
9352 * readsyms.h (Read_symbols): Add an archive member pointer.
9353 (Read_symbols::do_whole_lib_group): New.
9354 (Read_symbols::do_lib_group): New.
9355 (Read_symbols::member_): New.
9356 * script.cc (read_input_script): Update call to queue_soon.
9357
9358 2010-03-19 Doug Kwan <dougkwan@google.com>
9359
9360 * arm.cc (Stub_table::Stub_table): Initialize new data members
9361 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9362 (Stub_table::add_reloc_stub): Assign stub offset and update
9363 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9364 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9365 New data members.
9366 (Stub_table::update_data_size_and_addralign): Use
9367 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9368 instead of going over all reloc stubs.
9369 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9370 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9371 Stringpool_template::offset_ to size of Stringpool_char.
9372 (Stringpool_template::new_key_offset): Remove code to initialize
9373 Stringpool_template::offset_.
9374 * stringpool.h (Stringpool_template::set_no_zero_null): Set
9375 Stringpool_template::offset_ to zero.
9376
9377 2010-03-15 Doug Kwan <dougkwan@google.com>
9378
9379 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9380 offset_.
9381 (Stringpool_template::new_key_offset): New method.
9382 (Stringpool_template::add_string): Assign offsets when adding new
9383 strings.
9384 (Stringpool_template::set_string_offsets): Do not set string offsets
9385 when not optimizing.
9386 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9387 member size_.
9388 (Chunked_vector::clear): Clear size_.
9389 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9390 (Chunked_vector::size): Return size_.
9391 (Chunked_vector::push_back): Use size_ to find insert position.
9392 (Chunked_vector::size_): New data member.
9393 (Stringpool_template::set_no_zero_null): Assert string set is empty.
9394 (Stringpool_template::new_key_offset): New method declaration.
9395 (Stringpool_template::offset_): New data member.
9396
9397 2010-03-15 Rafael Espindola <espindola@google.com>
9398
9399 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9400 Add_symbols' constructor.
9401 * readsyms.h (Add_symbols): Remove the input_group member.
9402
9403 2010-03-10 Ian Lance Taylor <iant@google.com>
9404
9405 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9406 target to ask whether a reference to a symbol requires a stack
9407 split.
9408 * target.h (Target::is_call_to_non_split): New function.
9409 (Target::do_is_call_to_non_split): Declare virtual function.
9410 * target.cc: Include "symtab.h".
9411 (Target::do_is_call_to_non_split): New function.
9412 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9413
9414 2010-03-10 Cary Coutant <ccoutant@google.com>
9415
9416 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9417 (File_read::open[1]): Remove initial mapping of whole_file_view_.
9418 (File_read::open[2]): Add whole_file_view_ to list of views.
9419 (File_read::make_view): Remove test of whole_file_view_.
9420 (File_read::find_or_make_view): Create whole_file_view_ if
9421 necessary.
9422 (File_read::clear_views): Replace bool parameter with enum;
9423 adjust all callers. Don't delete views with permanent data;
9424 do delete cached views and views from archives if
9425 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
9426 if clearing the corresponding view.
9427 * fileread.h (File_read::Clear_views_mode): New enum.
9428 (File_read::View::is_permanent_view): New method.
9429 (File_read::clear_views): Replace bool parameter
9430 with enum; adjust all callers.
9431 * options.h (General_options): Change keep_files_mapped option;
9432 add map_whole_files.
9433 * readsyms.cc (Add_symbols::run): Delete sd_ object before
9434 releasing the file.
9435 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9436 the file.
9437
9438 2010-03-10 David S. Miller <davem@davemloft.net>
9439
9440 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9441
9442 2010-03-09 Sriraman Tallam <tmsriram@google.com>
9443
9444 * icf.cc (get_section_contents): Add '@' marker after processing the
9445 merge reloc.
9446
9447 2010-03-08 Doug Kwan <dougkwan@google.com>
9448
9449 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9450 due to a conversion warning.
9451 (Arm_relobj::update_output_local_symbol_count): Check for local
9452 symbol with unset output index.
9453
9454 2010-03-05 Ian Lance Taylor <iant@google.com>
9455
9456 * options.h (class General_options): Add --spare-dynamic-tags.
9457 * output.cc (Output_data_dynamic::set_final_data_size): Implement
9458 --spare-dynamic-tags.
9459
9460 2010-03-05 Ian Lance Taylor <iant@google.com>
9461
9462 * incremental.cc: Include "libiberty.h".
9463
9464 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
9465
9466 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9467 function, is_info_ member.
9468 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9469 (Versions::Versions): Update caller.
9470 (Versions::define_base_version): Likewise.
9471 (Versions::add_def): Likewise.
9472
9473 2010-03-03 Sriraman Tallam <tmsriram@google.com>
9474
9475 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9476 (Scan::possible_function_pointer_reloc): New function.
9477 (Scan::local_reloc_may_be_function_pointer): Change to call
9478 possible_function_pointer_reloc.
9479 (Scan::global_reloc_may_be_function_pointer): Ditto.
9480 * icf.h (Icf::check_section_for_function_pointers): Change to reject
9481 relocations in ".data.rel.ro._ZTV" section.
9482 * testsuite/icf_safe_so_test.sh: Change to pass i386.
9483 * testsuite/icf_safe_so_test.cc: Ditto.
9484 * testsuite/icf_safe_test.cc: Ditto.
9485 * testsuite/icf_safe_test.sh: Ditto.
9486
9487 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9488 Ian Lance Taylor <iant@google.com>
9489
9490 * target-reloc.h (relocate_section): Check the symbol table index
9491 for -1U before setting the local symbol index.
9492 (scan_relocatable_relocs): If copying the relocation, record that
9493 the local symbol is required.
9494 * object.h (Symbol_value::is_output_symtab_index_set): New
9495 function.
9496 (Symbol_value::may_be_discarded_from_output_symtab): New
9497 function.
9498 (Symbol_value::has_output_symtab_entry): New function.
9499 (Symbol_value::needs_output_symtab_entry): Remove.
9500 (Symbol_value::output_symtab_index): Make sure the symbol index is
9501 set.
9502 (Symbol_value::set_output_symtab_index): Make sure the symbol
9503 index is not set. Make sure the new index is valid.
9504 (Symbol_value::set_must_have_output_symtab_entry): New function.
9505 (Symbol_value::has_output_dynsym_entry): New function.
9506 (Symbol_value::set_output_dynsym_index): Make sure the new index
9507 is valid.
9508 (Sized_relobj::set_must_have_output_symtab_entry): New function.
9509 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9510 local symbol if permitted.
9511 (Sized_relobj::do_finalize_local_symbols): Call
9512 is_output_symtab_index_set rather than needs_output_symtab_entry.
9513 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9514 rather than needs_output_symtab_entry. Call
9515 has_output_dynsym_entry rather than needs_output_dynsym_entry.
9516 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9517 is_output_symtab_index_set rather than needs_output_symtab_entry.
9518 * testsuite/discard_locals_relocatable_test.c: New file.
9519 * testsuite/discard_locals_test.sh: Test -r.
9520 * testsuite/Makefile.am (check_DATA): Add
9521 discard_locals_relocatable_test1.syms,
9522 discard_local_relocatable_test2.syms.
9523 (MOSTLYCLEANFILES): Likewise. Also add
9524 discard_locals_relocatable_test1.lout and
9525 discard_locals_relocatable_test2.out.
9526 (discard_locals_relocatable_test1.syms): New target.
9527 (discard_locals_relocatable_test.o): New target.
9528 (discard_locals_relocatable_test1.out): New target.
9529 (discard_locals_relocatable_test2.syms): New target.
9530 (discard_locals_relocatable_test2.out): New target.
9531 (various): Add missing ../ld-new dependencies.
9532 * testsuite/Makefile.in: Rebuild.
9533
9534 2010-03-03 Nick Clifton <nickc@redhat.com>
9535
9536 * po/fi.po: New Finnish translation.
9537
9538 2010-03-01 Doug Kwan <dougkwan@google.com>
9539
9540 * layout.cc (Layout::Layout): Force section types of .init_array*,
9541 .preinit_array* and .fini_array* sections.
9542 * output.cc (Output_section::Input_section_sort_entry::has_priority):
9543 Fix check of return value of std::string::find.().
9544 (Output_section::Input_section_sort_compare::operator()): Remove
9545 comment about .init_array.
9546 (Output_section::Input_section_sort_init_fini_compare::operator()):
9547 New method.
9548 (Output_section::sort_attached_input_sections): Handle .init_array
9549 and .fini_array specially.
9550 * output.h (Output_section::Inut_section_sort_compare): Update
9551 comment.
9552 (Output_section::Input_section_sort_init_fini_compare): New struct.
9553
9554 2010-02-26 Doug Kwan <dougkwan@google.com>
9555
9556 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9557 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9558 * testsuite/debug_msg.sh: Avoid matching source line number for
9559 use of global variable undef_int.
9560
9561 2010-02-26 Doug Kwan <dougkwan@google.com>
9562
9563 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9564 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9565 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9566 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9567 * options.cc (General_options::General_options): Initialize member
9568 fix_v4bx_.
9569 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9570 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9571 and rm_no_fix_v4bx.stdout
9572 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9573 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9574 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9575 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9576 and arm_no_fix_v4bx.
9577 * Makefile.in: Regenerate.
9578 * testsuite/arm_fix_v4bx.s: New file.
9579 * testsuite/arm_fix_v4bx.sh: Ditto.
9580
9581 2010-02-24 Doug Kwan <dougkwan@google.com>
9582
9583 * arm.cc (Target_arm::got_section): Make the .got section the first
9584 non RELRO section in the data segment.
9585 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9586 suffixes of section names.
9587
9588 2010-02-24 Doug Kwan <dougkwan@google.com>
9589
9590 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9591 flags and attributes merging if an input file is a binary file.
9592 * fileread.cc (Input_file::open): Record format of original file.
9593 * fileread.h (Input_file::Format): New enum type.
9594 (Input_file::Input_file): Initialize data member format_.
9595 (Input_file::format): New method definition.
9596 (Input_file::format_):: New data member.
9597
9598 2010-02-24 Doug Kwan <dougkwan@google.com>
9599
9600 * arm.cc (Arm_output_data_got): New class.
9601 (ARM_TCB_SIZE): New constant
9602 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9603 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9604 If user uses a script with a SECTIONS clause, issue only a warning
9605 for a misplaced EXIDX input section. Otherwise, issue an error.
9606 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9607 garbage collection.
9608 (Target_arm::got_mode_index_entry): Handle static linking.
9609 (Target_arm::Scan::local): Ditto.
9610 (Target_arm::Scan::global): Ditto.
9611 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
9612 all incorrectly implemented relocations.
9613 (Target_arm::fix_exidx_coverage): Pass layout to
9614 Arm_output_section::fix_exidx_coverage.
9615 * layout.cc (Layout::section_name_mapping): Remove trailing dots
9616 from ".ARM.exidx." and ".ARM.extab.".
9617
9618 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9619
9620 * arm.cc (Target_arm::do_finalize_sections): Create attribute
9621 section if it does not already exist.
9622 * attributes.cc (Attributes_section_data::Attributes_section_data):
9623 Don't crash if size is zero.
9624
9625 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9626 Ian Lance Taylor <iant@google.com>
9627
9628 * gold.cc (queue_middle_tasks): If no input files were opened,
9629 exit.
9630 * workqueue.h (Task_function::Task_function): Assert that there is
9631 a blocker.
9632
9633 2010-02-22 Doug Kwan <dougkwan@google.com>
9634
9635 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9636 * icf.cc (get_section_contents): Cast snprintf arguments to long long
9637 types to avoid warnings due to different uint64_t implementations
9638 on different hosts.
9639
9640 2010-02-21 Doug Kwan <dougkwan@google.com>
9641
9642 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9643 handling of the maximum backward branch offset.
9644 (Arm_relocate_functions::thumb_branch_common): Ditto.
9645 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9646 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9647 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9648 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9649 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9650 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9651 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9652 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9653 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9654 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9655 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9656 thumb2_bl_out_of_range.o): New rules.
9657 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9658 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9659 thumb2_bl_out_of_range
9660 * testsuite/Makefile.in: Regenerate.
9661 * testsuite/arm_bl_in_range.s: New file.
9662 * testsuite/arm_bl_out_of_range.s: Ditto.
9663 * testsuite/arm_branch_in_range.sh: Ditto.
9664 * testsuite/arm_branch_range.t: Ditto.
9665 * testsuite/thumb2_branch_range.t: Ditto.
9666 * testsuite/thumb_bl_in_range.s: Ditto.
9667 * testsuite/thumb_bl_out_of_range.s: Ditto.
9668 * testsuite/thumb_branch_range.t: Ditto.
9669
9670 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9671
9672 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9673 Add reloc offset information.
9674 * icf.cc (get_section_contents): Change iterators to point to the new
9675 vectors. Add reloc offset information to the contents.
9676 * icf.h (Icf::Sections_reachable_info): New typedef.
9677 (Icf::Sections_reachable_list): New typedef.
9678 (Icf::Offset_info): New typedef.
9679 (Icf::Reloc_info): New struct typedef.
9680 (Icf::Reloc_info_list): New typedef.
9681 (Icf::symbol_reloc_list): Delete method.
9682 (Icf::addend_reloc_list): Delete method.
9683 (Icf::section_reloc_list): Delete method.
9684 (Icf::reloc_info_list): New method.
9685 (Icf::reloc_info_list_): New member.
9686
9687 2010-02-19 Doug Kwan <dougkwan@google.com>
9688
9689 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9690 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9691 * arm.cc (Arm_relocation_functions): New forward declaration.
9692 (Target_arm::Target_arm): Initialize new data members
9693 got_mod_index_offset_ and tls_base_symbol_defined_.
9694 (Target_arm::Relocate::relocate_tls): New method.
9695 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9696 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9697 New methods.
9698 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9699 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9700 (Target_arm::got_mod_index_offset_,
9701 Target_arm::tls_base_symbol_defined_): New data members.
9702 (Target_arm::Scan::local, Target::Scan::global,
9703 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9704 relocations.
9705
9706 2010-02-18 Doug Kwan <dougkwan@google.com>
9707
9708 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9709 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9710 text section as a parameter becuase some broken tools may not set
9711 the link in section header.
9712 (Target_arm::has_got_section): New method.
9713 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9714 without any mapping symbol as data only. Remove warning.
9715 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9716 link in its section header, try to discover the link by inspecting the
9717 REL31 relocation at the beginning of the section.
9718 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9719 in error message.
9720 (Target_arm::Scan::global): Treat any reference to the symbol
9721 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9722
9723 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9724
9725 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9726 (Scan::global_reloc_may_be_function_pointer): New function.
9727 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9728 (Scan::global_reloc_may_be_function_pointer): New function.
9729 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9730 (Scan::global_reloc_may_be_function_pointer): New function.
9731 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9732 (Scan::global_reloc_may_be_function_pointer): New function.
9733 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9734 (Scan::global_reloc_may_be_function_pointer): New function.
9735 (Scan::possible_function_pointer_reloc): New function.
9736 (Target_x86_64::can_check_for_function_pointers): New function.
9737 * gc.h (gc_process_relocs): Scan relocation types to determine if
9738 function pointers were taken for targets that support it.
9739 * icf.cc (Icf::find_identical_sections): Include functions for
9740 folding in safe ICF whose pointer is not taken.
9741 * icf.h (Secn_fptr_taken_set): New typedef.
9742 (fptr_section_id_): New member.
9743 (section_has_function_pointers): New function.
9744 (set_section_has_function_pointers): New function.
9745 (check_section_for_function_pointers): New function.
9746 * options.h: Fix comment for safe ICF option.
9747 * target.h (can_check_for_function_pointers): New function.
9748 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9749 Modify icf_safe_test for X86-64.
9750 * testsuite/Makefile.in: Regenerate.
9751 * testsuite/icf_safe_so_test.cc: New file.
9752 * testsuite/icf_safe_so_test.sh: New file.
9753 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9754 (main): Change to take pointer to function kept_func_3.
9755 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9756 folding is done correctly for X86-64.
9757
9758 2010-02-12 David S. Miller <davem@davemloft.net>
9759
9760 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9761 is_symbolless parameter.
9762 (Output_reloc<SHT_REL>::is_symbolless): New.
9763 (Output_reloc<SHT_REL>::is_symbolless_): New.
9764 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9765 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9766 (Output_reloc<SHT_RELA>::is_symbolless): New.
9767 (Output_data_reloc::add_global): Handle is_symbolless.
9768 (Output_data_reloc::add_global_relative): Likewise.
9769 (Output_data_reloc::add_local): Likewise.
9770 (Output_data_reloc::add_local_relative): Likewise.
9771 (Output_data_reloc::add_symbolless_global_addend): New.
9772 (Output_data_reloc::add_symbolless_local_addend): New.
9773 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9774 is_symbolless.
9775 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9776 instead of ->is_relative_
9777 (Output_reloc::write): Likewise.
9778 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9779 (Output_reloc::write_rel): Simplify.
9780
9781 * sparc.cc (Target_sparc::Scan::local): Use
9782 ->add_symbolless_local_addend as needed.
9783 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9784 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9785 based upon relocation offset.
9786
9787 2010-02-11 Doug Kwan <dougkwan@google.com>
9788
9789 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9790 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9791 beginning of function.
9792 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9793 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9794 parameter is_32bit in calls to should_apply_static_reloc.
9795 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9796 (check_DATA): Add arm_abs_global.stdout.
9797 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9798 arm_abs_global.stdout): New rules.
9799 (MOSTLLYCLEANFILES): Add arm_abs_global
9800 * Makefile.in: Regenerate.
9801 * testsuite/arm_abs_global.s: New file.
9802 * testsuite/arm_abs_global.sh: Ditto.
9803 * testsuite/arm_abs_lib.s: Ditto.
9804
9805 2010-02-11 Ian Lance Taylor <iant@google.com>
9806
9807 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9808 Read_relocs task.
9809 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9810 Allocate_commons_task first.
9811 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9812 task, rather than symtab_lock_.
9813 (Gc_process_relocs::~Gc_process_relocs): New function.
9814 (Gc_process_relocs::is_runnable): Check this_blocker_.
9815 (Gc_process_relocs::locks): Use next_blocker_ rather than
9816 blocker_.
9817 (Scan_relocs::~Scan_relocs): New function.
9818 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9819 symtab_lock_.
9820 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9821 next_blocker_.
9822 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9823 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9824 constructor accordingly.
9825 (class Gc_process_relocs): Likewise.
9826 (class Scan_relocs): Likewise.
9827 * common.h (class Allocate_commons_task): Remove symtab_lock_
9828 field, and corresponding constructor parameter.
9829 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9830 symtab_lock_.
9831 (Allocate_commons_task::locks): Likewise.
9832
9833 2010-02-11 Ian Lance Taylor <iant@google.com>
9834
9835 * gold-threads.h (class Once): Define.
9836 (class Initialize_lock): Rewrite as child of Once.
9837 * gold-threads.cc (class Once_initialize): Define.
9838 (once_pointer_control): New static variable.
9839 (once_pointer, once_arg): New static variables.
9840 (c_run_once): New static function.
9841 (Once::Once, Once::run_once, Once::internal_run): New functions.
9842 (class Initialize_lock_once): Remove.
9843 (initialize_lock_control): Remove.
9844 (initialize_lock_pointer): Remove.
9845 (initialize_lock_once): Remove.
9846 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9847 (Initialize_lock::initialize): Rewrite.
9848 (Initialize_lock::do_run_once): New function.
9849 * archive.cc (Archive::interpret_header): Only clear name if it is
9850 not already empty.
9851 * fileread.cc: Include "gold-threads.h"
9852 (file_counts_lock): New static variable.
9853 (file_counts_initialize_lock): Likewise.
9854 (File_read::release): Only increment counts when using --stats.
9855 Use a lock around the increment.
9856 * parameters.cc (class Set_parameters_target_once): Define.
9857 (set_parameters_target_once): New static variable.
9858 (Parameters::Parameters): Move here from parameters.h.
9859 (Parameters::set_target): Rewrite.
9860 (Parameters::set_target_once): New function.
9861 (Parameters::clear_target): Move here and rewrite.
9862 * parameters.h (class Parameters): Update declarations. Add
9863 set_parameters_target_once_ field.
9864 (Parameters::Parameters): Move to parameters.cc.
9865 (Parameters::clear_target): Likewise.
9866 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9867 task.
9868 (Start_group::~Start_group): New function.
9869 (Start_group::is_runnable): New function.
9870 (Start_group::locks, Start_group::run): New functions.
9871 (Finish_group::run): Change saw_undefined to size_t.
9872 * readsyms.h (class Start_group): Define.
9873 (class Finish_group): Change saw_undefined_ field to size_t.
9874 (Finish_group::Finish_group): Remove saw_undefined and
9875 this_blocker parameters. Change all callers.
9876 (Finish_group::set_saw_undefined): New function.
9877 (Finish_group::set_blocker): New function.
9878 * symtab.h (class Symbol_table): Change saw_undefined to return
9879 size_t. Change saw_undefined_ field to size_t.
9880 * target-select.cc (Set_target_once::do_run_once): New function.
9881 (Target_selector::Target_selector): Initialize set_target_once_
9882 field. Don't initialize lock_ and initialize_lock_ fields.
9883 (Target_selector::instantiate_target): Rewrite.
9884 (Target_selector::set_target): New function.
9885 * target-select.h (class Set_target_once): Define.
9886 (class Target_selector): Update declarations. Make
9887 Set_target_once a friend. Remove lock_ and initialize_lock_
9888 fields. Add set_target_once_ field.
9889
9890 2010-02-10 Ian Lance Taylor <iant@google.com>
9891
9892 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9893 queueing any tasks.
9894 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9895 (queue_middle_tasks): Add all blockers before queueing any tasks.
9896 (queue_final_tasks): Likewise.
9897 * token.h (Task_token::add_blockers): New function.
9898 * object.h (Input_objects::number_of_relobjs): New function.
9899
9900 2010-02-10 Ian Lance Taylor <iant@google.com>
9901
9902 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9903 shared, not if not position independent.
9904 * x86_64.cc (Relocate::relocate_tls): Likewise.
9905 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9906 (tls_pie_pic_test): New target.
9907 * testsuite/Makefile.in: Rebuild.
9908
9909 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9910 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9911 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9912 * testsuite/Makefile.in: Rebuild.
9913
9914 2010-02-09 David S. Miller <davem@davemloft.net>
9915
9916 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9917 R_SPARC_RELATIVE using ->add_local_relative().
9918 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9919
9920 * output.h (Output_data_dynamic::add_section_size): New method
9921 that takes two Output_data objects.
9922 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9923 entry param. Handle it in initializers.
9924 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9925 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9926 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9927 arg.
9928 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9929 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9930 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9931 for dynrel_includes_plt.
9932 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9933 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9934 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9935 before .rela.plt
9936 (Target_sparc::do_finalize_sections): Update to pass true for
9937 dynrel_includes_plt.
9938 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9939 output before .rela.plt
9940 (Target_powerpc::do_finalize_sections): Update to pass true for
9941 dynrel_includes_plt when 32-bit.
9942
9943 2010-02-08 Doug Kwan <dougkwan@google.com>
9944
9945 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9946 method.
9947 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9948 Arm_relobj::scan_section_for_cortex_a8_stubs,
9949 Arm_relobj::do_relocation_section): Instead of calling
9950 Output_section::output_address, use faster
9951 Arm_relobj::simple_input_section_output_address.
9952
9953 2010-02-08 David S. Miller <davem@davemloft.net>
9954
9955 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9956 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9957 relocation helper function.
9958
9959 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9960 just like R_SPARC_GOT{10,13,22}.
9961 (Target_sparc::Scan::local): Likewise.
9962 (Target_sparc::Relocate:relocate): Likewise.
9963
9964 2010-02-06 Ian Lance Taylor <iant@google.com>
9965
9966 * configure.ac: Rewrite targetobjs duplicate removal code to use
9967 only shell constructs.
9968 * configure: Rebuild.
9969
9970 2010-02-05 Doug Kwan <dougkwan@google.com>
9971
9972 PR 11247
9973 * arm.cc (Arm_relobj::section_is_scannable): New method.
9974 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9975 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9976
9977 2010-02-04 Doug Kwan <dougkwan@google.com>
9978
9979 PR 11247
9980 * arm-reloc-property.cc (cstdio): Include.
9981 * configure.ac (targetobjs): Remove duplicates.
9982 * configure: Regenerate.
9983 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9984 big and little endian version for a given address size.
9985
9986 2010-02-03 Doug Kwan <dougkwan@google.com>
9987
9988 * arm-reloc-property.cc
9989 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9990 definition.
9991 * arm-reloc-property.h
9992 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9993 New method definition.
9994 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9995 declaration.
9996 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9997 overflow to N.
9998 (GOT_PREL): Change implemented to Y.
9999 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10000 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10001 (Arm_relocate_functions::movw_abs_nc): Remove method.
10002 (Arm_relocate_functions::movt_abs): Ditto.
10003 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10004 (Arm_relocate_functions::thm_movt_abs): Ditto.
10005 (Arm_relocate_functions::movw_rel_nc): Ditto.
10006 (Arm_relocate_functions::movw_rel): Ditto.
10007 (Arm_relocate_functions::movt_rel): Ditto.
10008 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10009 (Arm_relocate_functions:thm_movw_rel): Ditto.
10010 (Arm_relocate_functions:thm_movt_rel): Ditto.
10011 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10012 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10013 New method definitions.
10014 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10015 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10016 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10017 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10018 (Target_arm::Relocate::relocate): Check for non-static or
10019 unimplemented relocation code and exit early. Change calls to
10020 Target_arm::reloc_uses_thumb_bit and
10021 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10022 instead. Refactor code to handle similar relocations to increase
10023 code sharing. Remove check for unsupported relocation code in switch
10024 statement.
10025 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10026 relocation property table to find out size. Change error message to
10027 print out the name of a relocation code instead of the numeric value.
10028 (Target_arm::scan_reloc_for_stub): Use relocation property table
10029 instead of calling Target_arm::reloc_uses_thumb_bit().
10030
10031 2010-02-02 Doug Kwan <dougkwan@google.com>
10032
10033 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10034 types of relaxed input section.
10035
10036 2010-02-02 Doug Kwan <dougkwan@google.com>
10037
10038 * Makefile.am (HFILES): Add arm-reloc-property.h.
10039 (DEFFILES): New.
10040 (TARGETSOURCES): Add arm-reloc-property.cc
10041 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10042 (libgold_a_SOURCES): $(DEFFILES)
10043 * Makefile.in: Regenerate.
10044 * arm-reloc-property.cc: New file.
10045 * arm-reloc-property.h: New file.
10046 * arm-reloc.def: New file.
10047 * arm.cc: Update comments.
10048 (arm-reloc-property.h): New included header.
10049 (arm_reloc_property_table): New global variable.
10050 (Target_arm::do_select_as_default_target): New method definition.
10051 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10052 arm-reloc-property to targ_extra_obj.
10053 * parameters.cc (set_parameters_target): Call
10054 Target::select_as_default_target().
10055 * target.h (Target::select_as_default_target): New method definition.
10056 (Target::do_select_as_default_target): Same.
10057
10058 2010-02-01 Doug Kwan <dougkwan@google.com>
10059
10060 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10061 first_output_text_section_.
10062 (Arm_exidx_fixup::first_output_text_section): New method definition.
10063 (Arm_exidx_fixup::first_output_text_section_): New data member.
10064 (Arm_exidx_fixup::process_exidx_section): Record the first text
10065 output section seen.
10066 (Arm_output_section::fix_exidx_coverage): Set correct linked section
10067 and entsize in output section header.
10068
10069 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10070
10071 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10072 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10073 (Arm_relocate_functions::thm_alu11): New Method.
10074 (Arm_relocate_functions::thm_pc8): New Method.
10075 (Arm_relocate_functions::thm_pc12): New Method.
10076 (Target_arm::Scan::local): Handle the relocations.
10077 (Target_arm::Scan::global): Likewise.
10078 (Target_arm::Relocate::relocate): Likewise.
10079 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10080
10081 2010-01-29 Doug Kwan <dougkwan@google.com>
10082
10083 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10084 of relocation types as ld.
10085
10086 2010-01-29 Doug Kwan <dougkwan@google.com>
10087
10088 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10089 to public.
10090 (Arm_relocate_functions::thumb_branch_common): Ditto.
10091 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10092 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10093 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10094 Arm_relocate_functions::jump24): Remove.
10095 (Target_arm::Relocate::relocate): Adjust code to call
10096 Arm_relocation_functions::arm_branch_common and
10097 Arm_relocation_functions::thumb_branch_common instead of their removed
10098 wrappers. Merge switch-cases together to reduce source code size.
10099
10100 2010-01-29 Doug Kwan <dougkwan@google.com>
10101
10102 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10103 output_local_symbol_count_needs_update_.
10104 (Arm_relobj::output_local_symbol_count_needs_update,
10105 Arm_relobj::set_output_local_symbol_count_needs_update,
10106 Arm_relobj::update_output_local_symbol_count): New methods.
10107 (Arm_relobj::output_local_symbol_count_needs_update_): New data
10108 member.
10109 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10110 of pointed function as in a R_ARM_PREL31 relocation.
10111 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10112 for output local symbol count updating.
10113 (Target_arm::do_relax): Update output local symbol counts in objects
10114 if necessary.
10115 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10116
10117 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10118
10119 * arm.cc: Added support for the ARM relocations:
10120 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10121 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10122 (Arm_relocate_functions::movw_rel_nc): Renamed (was
10123 movw_prel_nc).
10124 (Arm_relocate_functions::movw_rel): New method.
10125 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10126 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10127 thm_movw_prel_nc).
10128 (Arm_relocate_functions::thm_movw_rel): New method.
10129 (Arm_relocate_functions::thm_movt_rel): Renamed (was
10130 thm_movt_prel).
10131 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10132 relocations.
10133 (Target_arm::Scan::global): Likewise.
10134 (Target_arm::Relocate::relocate): Likewise.
10135 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10136 Likewise.
10137
10138 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10139
10140 * arm.cc: Added support for ARM group relocations.
10141 (Target_arm::reloc_needs_sym_origin): New method.
10142 (Arm_relocate_functions::calc_grp_kn): New method.
10143 (Arm_relocate_functions::calc_grp_residual): New method.
10144 (Arm_relocate_functions::calc_grp_gn): New method.
10145 (Arm_relocate_functions::arm_grp_alu): New Method.
10146 (Arm_relocate_functions::arm_grp_ldr): New Method.
10147 (Arm_relocate_functions::arm_grp_ldrs): New Method.
10148 (Arm_relocate_functions::arm_grp_ldc): New Method.
10149 (Target_arm::Scan::local): Handle the ARM group relocations.
10150 (Target_arm::Scan::global): Likewise.
10151 (Target_arm::Relocate::relocate): Likewise.
10152 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10153 Likewise.
10154
10155 2010-01-26 Doug Kwan <dougkwan@google.com>
10156
10157 * arm.cc (set): Include.
10158 (class Arm_exidx_fixup): Change type of last_input_section_ to const
10159 pointer type.
10160 (Arm_output_section::Text_section_list): New type.
10161 (Arm_output_section::append_text_sections_to_list): New method.
10162 (Arm_output_section::fix_exidx_coverage): Ditto.
10163 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10164 (Arm_relobj::convert_input_section_to_relaxed_section): Use
10165 Relobj::set_section_offset() instead of
10166 Sized_relobj::invalidate_section_offset().
10167 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10168 parameter for section headers. Ignore relocation sections for
10169 unallocated sections and EXIDX sections.
10170 (Target_arm::fix_exidx_coverage): New method.
10171 (Target_arm::output_section_address_less_than): New type.
10172 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10173 linked text section instead of the EXIDX section.
10174 (Arm_output_section::create_stub_group): Add an assertion to check
10175 that this is not an EXIDX output section.
10176 (Arm_output_section::append_text_sections_to_list): New method.
10177 (Arm_output_section::fix_exidx_coverage): Ditto.
10178 (Arm_relobj::scan_sections_for_stubs): Adjust call to
10179 Arm_relobj::section_needs_reloc_stub_scanning.
10180 (Target_arm::do_relax): Fix EXIDX output section coverage in the
10181 first pass.
10182 (Target_arm::fix_exidx_coverage): New method.
10183 * object.h (Relobj::set_output_section): New method.
10184 (Sized_relobj::invalidate_section_offset): Remove method.
10185 (Sized_relobj::do_invalidate_section_offset): Remove method.
10186 (Sized_relobj::do_set_section_offset): Handle offset value -1.
10187
10188 2010-01-25 Doug Kwan <dougkwan@google.com>
10189
10190 * arm.cc (Arm_exidx_merged_section::do_output_offset):
10191 Fix warning due to signed and unsigned comparison on a 32-bit host.
10192
10193 2010-01-22 Doug Kwan <dougkwan@google.com>
10194
10195 * arm.cc (Target_arm::do_relax): Record an output section for section
10196 offset adjustment it contains any stub table that has changed.
10197 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10198 offsets in an output section if necessary.
10199 * output.cc (Output_section::Output_section): Initialize
10200 section_offsets_need_adjustments_.
10201 (Output_section::add_input_section_for_script): Renamed to
10202 Output_section::add_simple_input_section.
10203 (Output_section::save_states): Add a comment.
10204 (Output_section::discard_states): New method defintion.
10205 (Output_section::adjust_section_offsets): Same.
10206 * output.h (Output_section::add_input_section_for_script): Renamed to
10207 Output_section::add_simple_input_section.
10208 (Output_section::discard_states): New method declaration.
10209 (Output_section::adjust_section_offsets): Same.
10210 (Output_section::section_offsets_need_adjustment,
10211 Output_section::set_section_offsets_need_adjustment): New method
10212 definitions.
10213 (Output_section::section_offsets_need_adjustment_): New data member.
10214 * script-sections.cc
10215 (Output_section_element_input::set_section_address): Adjust code for
10216 renaming of Output_section::add_input_section_for_script.
10217 (Orphan_output_section::set_section_address): Same.
10218
10219 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10220
10221 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10222 Fix_v4bx enum values .
10223 * gold/options.h (General_options): New option definitions.
10224 (General_options::fix_v4bx): New method.
10225 (General_options::Fix_v4bx): New enum.
10226 * gold/options.cc (General_options::parse_fix_v4bx): New method.
10227 (General_options::parse_fix_v4bx_interworking): New method.
10228
10229 2010-01-22 Doug Kwan <dougkwan@google.com>
10230
10231 * arm.cc (Arm_exidx_fixup): New class.
10232
10233 2010-01-21 Doug Kwan <dougkwan@google.com>
10234
10235 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10236 classes.
10237 (Arm_exidx_section_offset_map): New type.
10238
10239 2010-01-21 Doug Kwan <dougkwan@google.com>
10240
10241 * arm.cc (Arm_exidx_input_section): New class.
10242 (Arm_relobj::exidx_input_section_by_link,
10243 Arm_relobj::exidx_input_section_by_shndx,
10244 Arm_relobj::make_exidx_input_section): New methods.
10245 (read_arm_attributes_section): Remove.
10246 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10247 information about them.
10248 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10249 to here.
10250
10251 2010-01-20 Doug Kwan <dougkwan@google.com>
10252
10253 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10254 Input_section_specifier to Section_id.
10255 (Target_arm::new_arm_input_section: Adjust code for change of key
10256 type.
10257 (Target_arm::find_arm_input_section): Ditto.
10258 * gc.h (object.h): Include for Section_id nand Section_id_hash.
10259 (Section_id): Remove.
10260 (Garbage_collection::Section_id_hash): Remove.
10261 * icf.h (object.h): Include for Section_id nand Section_id_hash.
10262 (Section_id): Remove.
10263 (Icf::Section_id_hash): Remove.
10264 * object.h (Section_id, Const_section_id, Section_id_hash,
10265 Const_section_id_hash): New type definitions.
10266 * output.cc (Output_section::add_relaxed_input_section): Change to
10267 use Const_section_id instead of Input_section_specifier as key type.
10268 (Output_section::add_merge_input_section): Ditto.
10269 (Output_section::build_relaxation_map): Change to use Section_id
10270 instead of Input_section_specifier as key type.
10271 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10272 Ditto.
10273 (Output_section::convert_input_sections_to_relaxed_sections): Change
10274 to use Const_section_id instead of Input_section_specifier as key type.
10275 (Output_section::find_merge_section): Ditto.
10276 (Output_section::find_relaxed_input_section): Ditto.
10277 * output.h (Input_section_specifier): Remove class.
10278 (Output_section::Output_section_data_by_input_section_map): Change
10279 key type to Const_section_id.
10280 (Output_section::Output_relaxed_input_section_by_input_section_map):
10281 Ditto.
10282 (Output_section::Relaxation_map): Change key type to Section_id.
10283
10284 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10285
10286 * gold/arm.cc: Added support for R_ARM_V4BX relocation
10287 (class Arm_v4bx_stub): New class.
10288 (DEF_STUBS): Updated definition to support v4_veneer_bx.
10289 (Stub_factory::make_arm_v4bx_stub): New method.
10290 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10291 (Stub_table::empty): Handle v4bx stubs.
10292 (Stub_table::add_arm_v4bx_stub): New method.
10293 (Stub_table::find_arm_v4bx_stub): New method.
10294 (Arm_relocate_functions::v4bx): New method.
10295 (Target_arm::fix_v4bx): New method.
10296 (Target_arm::Target_arm): Handle R_ARM_V4BX.
10297 (Stub_table::relocate_stubs): Likewise.
10298 (Stub_table::do_write): Likewise.
10299 (Stub_table::update_data_size_and_addralign): Likewise.
10300 (Stub_table::finalize_stubs): Likewise.
10301 (Target_arm::Scan::local): Likewise.
10302 (Target_arm::Scan::global): Likewise.
10303 (Target_arm::do_finalize_sections): Likewise.
10304 (Target_arm::Relocate::relocate): Likewise.
10305 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10306 Likewise.
10307 (Target_arm::scan_reloc_for_stub): Likewise.
10308 (Target_arm::scan_reloc_section_for_stubs): Likewise.
10309
10310 2010-01-19 Ian Lance Taylor <iant@google.com>
10311
10312 * output.cc (Output_section_headers::do_sized_write): Write large
10313 segment count to sh_info field.
10314 (Output_file_header::do_sized_write): For large segment count,
10315 write PN_XNUM to e_phnum field.
10316
10317 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10318
10319 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10320 (Arm_relocate_functions::thm_jump8): New function.
10321 (Arm_relocate_functions::thm_jump11): New function.
10322 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10323 R_ARM_THM_JUMP11.
10324 (Target_arm::Scan::global): Likewise.
10325 (Target_arm::Relocate::relocate): Likewise.
10326 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10327 Likewise.
10328
10329 2010-01-14 Doug Kwan <dougkwan@google.com>
10330
10331 * arm.cc (map, utility): Include headers.
10332 (Target_arm::apply_cortex_a8_workaround): New method.
10333 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10334 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10335 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10336 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10337 the --[no-]fix-cortex-a8 command line options.
10338 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10339 (Target_arm::relocate_stub): Use addend in instruction template.
10340 * options.h (DEFINE_bool): Set the user-set flag.
10341 (General_options): Add --[no-]-fix-cortex options.
10342 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10343 : Update fast look-up map after conversion.
10344
10345 2010-01-14 Sriraman Tallam <tmsriram@google.com>
10346
10347 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10348 in the first pass of do_layout.
10349
10350 2010-01-13 Doug Kwan <dougkwan@google.com>
10351
10352 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10353 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10354 apparent compiler problem of not folding static constant integral
10355 data members of elfcpp::Elf_sizes<32>.
10356
10357 2010-01-13 Doug Kwan <dougkwan@google.com>
10358
10359 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10360 Arm_relobj::section_needs_cortex_a8_stub_scanning,
10361 Arm_relobj::scan_section_for_cortex_a8_erratum,
10362 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10363 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10364 sections to scan for relocation stubs into a new method
10365 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
10366 relocation and Cortex-A8 stub scanning.
10367 (Target_arm::do_relax): Force stubs to be after stubbed sections
10368 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
10369 the beginning of a new relaxation pass. Update a comment.
10370 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10371
10372 2010-01-12 Ian Lance Taylor <iant@google.com>
10373
10374 * target-reloc.h (visibility_error): New inline function.
10375 (relocate_section): Call visibility_error.
10376 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10377 (MOSTLYCLEANFILES): Likewise.
10378 (protected_4_pic.o, protected_3.err): New targets.
10379 * testsuite/protected_4.cc: New file.
10380
10381 2010-01-12 Doug Kwan <dougkwan@google.com>
10382
10383 * arm.cc (Cortex_a8_reloc): New class.
10384 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10385 and cortex_a8_relocs_info_.
10386 (Target_arm::fix_cortex_a8): New method definition.
10387 (Target_arm::Cortex_a8_relocs_info): New type.
10388 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10389 New data member declarations.
10390 (Target_arm::scan_reloc_for_stub): Record information about
10391 relocations for THUMB branches that might be exempted from the
10392 Cortex-A8 workaround.
10393 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10394 at the beginning of a relaxation pass.
10395
10396 2010-01-12 Doug Kwan <dougkwan@google.com>
10397
10398 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10399 (Arm_relobj::Mapping_symbol_position,
10400 Arm_reloj::Mapping_symbol_position_less,
10401 Arm_relobj::Mapping_symbols_info): New types.
10402 (Target_arm::is_mapping_symbol_name): New method definition.
10403 (Arm_relobj::do_count_local_symbols): Save information about mapping
10404 symbols.
10405
10406 2010-01-11 Doug Kwan <dougkwan@google.com>
10407
10408 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10409 Arm_relocate_functions::thumb32_branch_upper,
10410 Arm_relocate_functions::thumb32_branch_lower,
10411 Arm_relocate_functions::thumb32_cond_branch_offset,
10412 Arm_relocate_functions::thumb32_cond_branch_upper,
10413 Arm_relocate_functions::thumb32_cond_branch_lower,
10414 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10415 branch offset encoding.
10416 (Arm_relocate_functions::thumb_branch_common): Use new branch
10417 offset encoding methods to avoid code duplication.
10418 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10419 (Stub_addend_reader::operator()): Use new branch encoding method
10420 to avoid code duplication.
10421
10422 2010-01-11 Doug Kwan <dougkwan@google.com>
10423
10424 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10425 (Target_arm::do_finalize_sections): Define special EXIDX section
10426 symbols only if referenced.
10427 * gc.h (Garbage_collection::add_reference): New method.
10428 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10429 code duplication.
10430
10431 2010-01-11 Ian Lance Taylor <iant@google.com>
10432
10433 * script.cc (Version_script_info::build_expression_list_lookup):
10434 Change complaing about duplicate wildcard match from error to
10435 warning.
10436
10437 * script.cc (class Lazy_demangler): Recreate--revert part of patch
10438 of 2009-12-30.
10439 (Version_script_info::Version_script_info): Initialize globs_,
10440 default_version_, default_is_global_, and exact_. Don't
10441 initialize globals_ or locals_.
10442 (Version_script_info::build_lookup_tables): Build local symbols
10443 first.
10444 (Version_script_info::unquote): New function.
10445 (Version_script_info::add_exact_match): New function.
10446 (Version_script_info::build_expression_list_lookup): Remove lookup
10447 parameter. Add is_global parameter. Change all callers. Handle
10448 wildcard pattern specially. Unquote pattern. Call
10449 add_exact_match.
10450 (Version_script_info::get_name_to_match): New function.
10451 (Version_script_info::get_symbol_version): New function.
10452 (Version_script_info::get_symbol_version_helper): Remove.
10453 (Version_script_info::check_unmatched_names): Call unquote.
10454 * script.h (class Version_script_info): Change get_symbol_version
10455 to be non-inline and add is_global parameter; change all callers.
10456 Rewrite symbol_is_local. Update declarations. Define struct
10457 Version_tree_match, Exact, Globs. Don't define struct Lookup.
10458 Remove globals_ and locals_ members. Add exact_, globs_,
10459 default_version_, is_global_.
10460 (Version_script_info::Glob): Remove pattern, add expression and
10461 is_global. Update constructor. Change all callers.
10462 * dynobj.cc (Versions::finalize): Mark the version symbol as the
10463 default version.
10464 (Versions::symbol_section_contents): If a symbol is undefined, or
10465 defined in a dynamic object, set the version index to
10466 VER_NDX_LOCAL.
10467 * symtab.cc (Symbol_table::add_from_relobj): Don't call
10468 symbol_is_local.
10469 (Symbol_table::add_from_pluginobj): Likewise.
10470 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10471
10472 2010-01-11 Doug Kwan <dougkwan@google.com>
10473
10474 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10475 (incremental_dump_LDADD): Add linking option for libintl.
10476 * Makefile.in: Regenerate.
10477
10478 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
10479
10480 PR gold/11144
10481 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10482 instead of -Ds.
10483 * testsuite/Makefile.in: Regenerated.
10484
10485 2010-01-10 Doug Kwan <dougkwan@google.com>
10486
10487 * options.h (DEFINE_var): Use parentheses around argument varname__
10488 in macro body to avoid any unintended subsequent substitutions.
10489
10490 2010-01-10 Ian Lance Taylor <iant@google.com>
10491
10492 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10493 candidates before doing symbol resolution.
10494
10495 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10496 ODR candidates if only one is weak.
10497
10498 2010-01-08 Ian Lance Taylor <iant@google.com>
10499
10500 * script.cc (Version_script_info::build_expression_list_lookup):
10501 Don't warn about ambiguous version, just record the ambiguity.
10502 (Version_script_info::get_symbol_version_helper): Give error if
10503 version is ambiguous.
10504
10505 2010-01-08 Doug Kwan <dougkwan@google.com>
10506
10507 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10508 prev_data_size_ and prev_addralign_. Remove initializer for
10509 deleted data member has_been_changed_.
10510 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10511 to determine if the table is empty.
10512 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10513 Remove.
10514 (Stub_table::add_reloc_stub): Define method in class definition
10515 instead of just declaring it there.
10516 (Stub_table::add_cortex_a8_stub): New method definition.
10517 (Stub_table::update_data_size_and_addralign): Ditto.
10518 (Stub_table::finalize_stubs): Ditto.
10519 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10520 (Stub_table::do_addralign_): Return address alignment in the
10521 (Stub_table::do_reset_address_and_file_offset): Define method in
10522 class definition instead of declaring it there. Set current data
10523 size to be the data size of the previous pass.
10524 (Stub_table::set_final_data_size): Use current data size as the
10525 final data size.
10526 (Stub_table::relocate_stub): Change parameter type of stub from
10527 Reloc_stub pointer to Stub pointer.
10528 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10529 (Stub_table::Cortex_a8_stub_list): New typedef.
10530 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10531 Stub_table::prev_addralign_): New data member.
10532 (Arm_relobj::Arm_relobj): Initialize data member
10533 section_has_cortex_a8_workaround_.
10534 (Arm_relobj::section_has_cortex_a8_workaround,
10535 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10536 definitions.
10537 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10538 declarations.
10539 (Target_arm::relocate_stub): Change parameter type of stub from
10540 Reloc_stub pointer to Stub pointer.
10541 (Insn_template::size, Insn_template::alignment): Handle
10542 THUMB16_SPECIAL_TYPE.
10543 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10544 Stub_table::update_data_size_and_addralign,
10545 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10546 definitions.
10547 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10548 (Stub_table::do_write): Ditto.
10549 (Target_arm::do_relax): Adjust code for changes in Stub_table.
10550
10551 2010-01-08 Ian Lance Taylor <iant@google.com>
10552
10553 PR 11108
10554 * symtab.h (class Symbol): Remove fields is_target_special_ and
10555 has_plt_offset_. Add field is_defined_in_discarded_section_.
10556 (Symbol::is_defined_in_discarded_section): New function.
10557 (Symbol::set_is_defined_in_discarded_section): New function.
10558 (Symbol::has_plt_offset): Rewrite.
10559 (Symbol::set_plt_offset): Verify that new offset is not -1U.
10560 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10561 Don't initialize is_target_special_ or has_plt_offset_.
10562 Initialize is_defined_in_discarded_section_.
10563 (Symbol_table::add_from_relobj): If appropriate, set
10564 is_defined_in_discarded_section.
10565 * resolve.cc (Symbol::override_base_with_special): Don't test
10566 is_target_special_. Change has_plt_offset_ to has_plt_offset().
10567 * target-reloc.h (relocate_section): Do special handling for
10568 symbols defined in discarded sections for global symbols as well
10569 as local symbols.
10570
10571 2010-01-08 Ian Lance Taylor <iant@google.com>
10572
10573 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10574 the SHT_SYMTAB case.
10575
10576 2010-01-08 Ian Lance Taylor <iant@google.com>
10577
10578 * object.cc (Sized_relobj::do_layout): Don't get confused if
10579 layout_eh_frame returns NULL.
10580
10581 2010-01-08 Ian Lance Taylor <iant@google.com>
10582
10583 PR 11084
10584 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10585 dynamic symbol table, use the normal symbol table.
10586 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10587 symbol table.
10588
10589 2010-01-08 Ian Lance Taylor <iant@google.com>
10590
10591 PR 11072
10592 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10593 sections.
10594
10595 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10596
10597 * version.cc (print_version): Change to "Copyright 2010".
10598
10599 2010-01-08 Ian Lance Taylor <iant@google.com>
10600
10601 PR 10287
10602 PR 11063
10603 * i386.cc (class Target_i386): Change return type of plt_section
10604 to be non-const.
10605 (class Output_data_plt_i386): Add tls_desc_rel_ field.
10606 (Output_data_plt_i386::Output_data_plt_i386): Initialize
10607 tls_desc_rel_ field.
10608 (Output_data_plt_i386::rel_tls_desc): New function.
10609 (Target_i386::rel_tls_desc_section): New function.
10610 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10611 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10612 R_386_TLS_DESC reloc in rel_tls_desc_section.
10613 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10614 Define struct Tlsdesc_info.
10615 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10616 (Target_x86_64::do_reloc_symbol_index): New function.
10617 (Target_x86_64::add_tlsdesc_info): New function.
10618 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10619 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10620 tlsdesc_rel_ field.
10621 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
10622 all callers.
10623 (Output_data_plt_x86_64::rela_tlsdesc): New function.
10624 (Target_x86_64::rela_tlsdesc_section): New function.
10625 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10626 handling.
10627 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10628 (Target_x86_64::do_reloc_addend): New function.
10629 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10630 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10631 declarations. Define TARGET_CODE. Add arg field to u1_ union.
10632 (Output_reloc::type): New function.
10633 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10634 (Output_reloc::is_target_specific): New function.
10635 (Output_reloc::target_arg): New function.
10636 (class Output_reloc) [SHT_RELA]: Add four new constructors for
10637 absolute relocs and target specific relocs.
10638 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10639 add_target_specific.
10640 (class Output_data_reloc) [SHT_RELA]: Likewise.
10641 * output.cc (Output_reloc::Output_reloc): Add four new versions
10642 for absolute relocs and target specific relocs.
10643 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10644 (Output_reloc::get_symbol_index): Likewise.
10645 (Output_reloc::local_section_offset): Check that local_sym_index_
10646 is not TARGET_CODE or 0.
10647 (Output_reloc::symbol_value): Likewise.
10648 (Output_reloc::write) [SHT_RELA]: Call target for target specific
10649 reloc.
10650 * target.h (class Target): Add reloc_symbol_index and reloc_addend
10651 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
10652 functions.
10653 * layout.cc (add_target_dynamic_tags): Use output section for
10654 DT_PLTRELSZ and DT_JMPREL.
10655
10656 2010-01-07 Ian Lance Taylor <iant@google.com>
10657
10658 PR 11061
10659 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10660 function.
10661 (class Output_data_reloc_generic): Define.
10662 (class Output_data_reloc_base): Change base class to
10663 Output_data_reloc_generic. Change add() method to call
10664 bump_relative_reloc_count for a relative reloc. Remove
10665 sort_relocs_ field.
10666 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10667 to sort_relocs().
10668 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10669 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10670 appropriate.
10671 * layout.h (class Layout): Update declaration.
10672
10673 2010-01-07 Ian Lance Taylor <iant@google.com>
10674
10675 * output.h (class Output_data): Add const version of
10676 output_section and do_output_section.
10677 (class Output_section_data): Add const version of
10678 do_output_section.
10679 (class Output_section): Likewise.
10680 * layout.cc (Layout::add_target_dynamic_tags): New function.
10681 * layout.h (class Layout): Update declarations.
10682 * arm.cc (Target_arm::do_finalize_sections): Use
10683 add_target_dynamic_tags.
10684 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10685 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10686 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10687 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10688
10689 2010-01-07 Ian Lance Taylor <iant@google.com>
10690
10691 PR 11042
10692 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10693 object as needed.
10694
10695 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10696 Ian Lance Taylor <iant@google.com>
10697
10698 PR 11019
10699 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10700 Xindex::read_symtab_xindex.
10701
10702 2010-01-07 Doug Kwan <dougkwan@google.com>
10703
10704 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10705 (Insn_template::thumb16_bcond_insn): New method declaration.
10706 (Insn_template): Fix spelling.
10707 (Stub::thumb16_special): New method declaration.
10708 (Stub::do_write): Define virtual method which was previously pure
10709 virtual.
10710 (Stub::do_thumb16_special): New method declaration.
10711 (Stub::do_fixed_endian_write): New template member.
10712 (Reloc_stub::do_write): Remove.
10713 (Reloc_stub::do_fixed_endian_write): Remove.
10714 (Cortex_a8_stub): New class definition.
10715 (Stub_factory::make_cortex_a8_stub): New method definition.
10716 (Stub_factory::Stub_factory): Add missing static storage class
10717 qualifier for elf32_arm_stub_a8_veneer_blx.
10718
10719 2010-01-07 Ian Lance Taylor <iant@google.com>
10720
10721 PR 10980
10722 * options.h (class General_options): Add --warn-unresolved-symbols
10723 and --error-unresolved-symbols.
10724 * errors.cc (Errors::undefined_symbol): Implement
10725 --warn-unresolved-symbols.
10726
10727 * options.h (class General_options): Add -z text and -z textoff.
10728 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10729
10730 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10731
10732 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10733 (Garbage_collection::cident_sections): New function.
10734 (Garbage_collection::add_cident_section): New function.
10735 (Garbage_collection::cident_sections_): New member.
10736 (gc_process_relocs): Add references to sections whose names are C
10737 identifiers.
10738 * gold.h (cident_section_start_prefix): New constant.
10739 (cident_section_stop_prefix): New constant.
10740 (is_cident): New function.
10741 * layout.cc (Layout::define_section_symbols): Replace string constants
10742 with the newly defined constants.
10743 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10744 C identifiers.
10745 * testsuite/Makefile.am: Add gc_orphan_section_test.
10746 * testsuite/Makefile.in: Regenerate.
10747 * testsuite/gc_orphan_section_test.cc: New file.
10748 * testsuite/gc_orphan_section_test.sh: New file.
10749
10750 2010-01-06 Ian Lance Taylor <iant@google.com>
10751
10752 PR 10980
10753 * options.h (class General_options): Add --warn-shared-textrel.
10754 * layout.cc (Layout::finish_dynamic_section): Implement
10755 --warn-shared-textrel.
10756
10757 PR 10980
10758 * options.h (class General_options): Add --warn-multiple-gp.
10759
10760 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10761
10762 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10763 $(THREADSLIB) and $(LIBDL).
10764 * Makefile.in: Rebuild.
10765
10766 2010-01-06 Ian Lance Taylor <iant@google.com>
10767
10768 PR 10980
10769 * options.cc (General_options::parse_section_start): New function.
10770 (General_options::section_start): New function.
10771 (General_options::General_options): Initialize all members.
10772 * options.h: Include <map>
10773 (class General_options): Add --section-start. Add section_starts_
10774 member.
10775 * layout.cc (Layout::attach_allocated_section_to_segment): If
10776 --section-start was used, set the address of the segment. Remove
10777 local sort_sections.
10778 (Layout::relaxation_loop_body): If the address of the load segment
10779 has been set by --section-start, don't use it.
10780 * output.h (Output_segment::update_flags_for_output_section): New
10781 function.
10782 * output.cc (Output_segment::add_output_section): Call
10783 update_flags_for_output_section.
10784
10785 2010-01-05 Ian Lance Taylor <iant@google.com>
10786
10787 PR 10980
10788 * options.h (class General_options): Add --undefined-version.
10789 * script.cc (struct Version_expression): Add was_matched_by_symbol
10790 field.
10791 (Version_script_info::matched_symbol): New function.
10792 (Version_script_info::get_symbol_version_helper): Call
10793 matched_symbol.
10794 (Version_script_info::check_unmatched_names): New function.
10795 * script.h (class Version_script_info): Update declarations.
10796 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10797
10798 * options.h (class General_options): Use DEFINE_bool_alias for
10799 allow_multiple_definition.
10800 * resolve.cc (Symbol_table::should_override): Don't test
10801 allow_multiple_definition.
10802
10803 PR 10980
10804 * options.h (class General_options): Add --cref.
10805 * main.cc (main): Print cref table if --cref. Don't close mapfile
10806 until after printing cref table.
10807 * cref.cc: Include "symtab.h".
10808 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10809 (Cref_table_compare::operator()): New function.
10810 (Cref_inputs::gather_cref): New function.
10811 (filecol): New static const.
10812 (Cref_inputs::print_cref): New function.
10813 (Cref::print_cref): New function.
10814 * cref.h: Include <cstdio>.
10815 (class Cref): Update declarations.
10816 * mapfile.h (Mapfile::file): New function.
10817 * object.h (class Object): Define Symbols. Declare virtual
10818 do_get_global_symbols.
10819 (Object::get_global_symbols): New function.
10820 * object.cc (Input_objects::add_object): Pass object to cref_ if
10821 --cref.
10822 (Input_objects::archive_start): Likewise.
10823 (Input_objects::archive_stop): Likewise.
10824 (Input_objects::print_cref): New function.
10825 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10826 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10827 --cref.
10828 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10829 function.
10830 * plugin.h (class Sized_pluginobj): Update declarations.
10831
10832 2010-01-05 Ian Lance Taylor <iant@google.com>
10833
10834 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10835 to is_default_version. Rename insdef to insdefault.
10836 (Symbol_table::add_from_relobj): Rename def to is_default_version
10837 and local to is_forced_local.
10838 (Symbol_table::add_from_pluginobj): Likewise.
10839 (Symbol_table::add_from_dynobj): Likewise.
10840 (Symbol_table::define_special_symbol): Rename insdef to
10841 insdefault.
10842
10843 2010-01-04 Ian Lance Taylor <iant@google.com>
10844
10845 PR 10980
10846 * options.h (class General_options): Add
10847 --allow-multiple-definition and -z muldefs.
10848 * resolve.cc (Symbol_table::should_override): Don't warn about a
10849 multiple symbol definition if --allow-multiple-definition or -z
10850 muldefs.
10851
10852 PR 10980
10853 * options.h (class General_options): Add --add-needed and
10854 --copy-dt-needed-entries. Tweak --as-needed help entry.
10855 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10856 error if --copy-dt-needed-entries aka --add-needed is used and
10857 would cause a change in behaviour.
10858
10859 PR 10980
10860 * options.h (class General_options): Add -G as a short version of
10861 --shared. Add no-op options -assert, -g, and -i.
10862
10863 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10864
10865 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10866 check for .text or .gnu.linkonce.t sections.
10867 * icf.cc (Icf::find_identical_sections): Ditto.
10868 Change the detection for mangled function name within the section
10869 name.
10870 * icf.h (is_section_foldable_candidate): New function.
10871
10872 2009-12-30 Ian Lance Taylor <iant@google.com>
10873
10874 PR 10980
10875 * options.h (class General_options): Permit two dashes with
10876 --retain-symbols-file.
10877
10878 2009-12-30 Ian Lance Taylor <iant@google.com>
10879
10880 PR 10979
10881 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10882 don't put the file header and segment headers in the text
10883 segment.
10884
10885 PR 10979
10886 * common.cc (Sort_commons::operator()): Stabilize sort when both
10887 entries are NULL.
10888 (Symbol_table::do_allocate_commons_list): When allocating common
10889 symbols, skip a symbol which is no longer common.
10890 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10891 an object before checking its type.
10892 * testsuite/common_test_2.c: New file.
10893 * testsuite/common_test_3.c: New file.
10894 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10895 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10896 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10897 (common_test_2_pic.o, common_test_2.so): New targets.
10898 (common_test_3_pic.o, common_test_3.so): New targets.
10899 * testsuite/Makefile.in: Rebuild.
10900
10901 PR 10979
10902 * script.cc (read_input_script): If we see a new SECTIONS clause,
10903 and we have added an input section, give an error.
10904 * layout.h (class Layout): Add have_added_input_section function.
10905 Add have_added_input_section_ field.
10906 * layout.cc (Layout::Layout): Initialize
10907 have_added_input_section_.
10908 (Layout::layout): Set have_added_input_section_.
10909 (Layout::layout_eh_frame): Likewise.
10910
10911 2009-12-30 Ian Lance Taylor <iant@google.com>
10912
10913 PR 10931
10914 * options.h (class General_options): Add --sort-common option.
10915 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10916 * common.cc (Sort_common): Add sort_order parameter to
10917 constructor. Add sort_order_ field.
10918 (Sort_commons::operator): Check sort_order_.
10919 (Symbol_table::allocate_commons): Determine the sort order.
10920 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10921 Change all callers.
10922 (Symbol_table::do_allocate_commons_list): Likewise.
10923
10924 2009-12-30 Ian Lance Taylor <iant@google.com>
10925
10926 PR 10916
10927 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10928 symbols from this object, don't change the visibility of an
10929 undefined symbol.
10930 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10931
10932 2009-12-30 Ian Lance Taylor <iant@google.com>
10933
10934 PR 10861
10935 * script.h (class Version_script_info): Define Language enum.
10936 Update declarations. Define Glob, Exact, and Lookup types. Add
10937 new fields globals_, locals_, and is_finalized_.
10938 * script.cc: Various formatting fixes.
10939 (class Parser_closure): Change language_stack_ from a vector of
10940 std::string to one of Version_script_info::Language. Adjust all
10941 uses accordingly.
10942 (class Lazy_demangler): Remove.
10943 (struct Version_expression): Change language from std::string to
10944 Version_script_info::Language.
10945 (Version_script_info::Version_script_info): New function.
10946 (Version_script_info::~Version_script_info): Don't call clear.
10947 (Version_script_info::finalize): New function.
10948 (Version_script_info::build_lookup_tables): New function.
10949 (Version_script_info::build_expression_list_lookup): New
10950 function.
10951 (Version_script_info::get_symbol_version_helper): Rewrite to use
10952 lookup tables.
10953 (Version_script_info::print_expression_list): Adjust to use
10954 Version_script_info::Language.
10955 (script_push_lex_into_version_mode): Check that the version script
10956 has not been finalized.
10957 (version_script_push_lang): Change language string to
10958 Version_script_info::Language.
10959 * options.cc (Command_line::version_script): New function.
10960 * options.h (class General_options): Add finalize_dynamic_list
10961 function. Change version_script from declaration to definition.
10962 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10963 * testsuite/version_script.map: Remove duplicate def of foo.
10964 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10965 version_script.map.
10966 * testsuite/Makefile.in: Rebuild.
10967
10968 2009-12-30 Ian Lance Taylor <iant@google.com>
10969
10970 PR 10843
10971 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10972 if the input symbol index is 0, make the output symbol index 0.
10973
10974 2009-12-30 Ian Lance Taylor <iant@google.com>
10975
10976 PR 10670
10977 * options.h (class General_options): Add -x/--discard-all.
10978 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10979 --discard-all. If the local symbol needs a dynamic entry, check
10980 that before handling --discard-locals.
10981
10982 2009-12-30 Ian Lance Taylor <iant@google.com>
10983
10984 PR 10450
10985 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10986 flags to PF_R.
10987 (Output_segment::add_output_section): Don't change the flags if
10988 the type is PT_TLS.
10989
10990 PR 10450
10991 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10992 GNU hash table if they need a dynamic value. Otherwise, don't add
10993 them if they are defined in a dynamic object or are forced local.
10994
10995 2009-12-29 Ian Lance Taylor <iant@google.com>
10996
10997 PR 10450
10998 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10999 .gnu.hash table for a 32-bit target.
11000
11001 PR 10450
11002 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11003 regular and a dynamic object only needs a dynamic symbol table
11004 entry if it is externally visible.
11005
11006 PR 10450
11007 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11008 constructor. Add global_offset_table_ field.
11009 (Target_i386::got_section): Set global_offset_table_.
11010 (Target_i386::do_finalize_sections): Set global_offset_table_
11011 size.
11012 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11013 in constructor. Add global_offset_table_ field.
11014 (Target_x86_64::got_section): Set global_offset_table_.
11015 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11016 size.
11017
11018 * layout.cc (Layout::Layout): Initialize increase_relro_.
11019 (Layout::get_output_section): Add is_relro, is_last_relro, and
11020 is_first_non_relro parameters. Change all callers.
11021 (Layout::choose_output_section): Likewise.
11022 (Layout::add_output_section_data): Likewise.
11023 (Layout::make_output_section): Likewise.
11024 (Layout::set_segment_offsets): Clear increase_relro when using a
11025 linker script.
11026 * layout.h (class Layout): Add increase_relro method. Add
11027 increase_relro_ field. Update declarations.
11028 * output.cc (Output_section::Output_section): Initialize
11029 is_last_relro_ and is_first_non_relro_.
11030 (Output_segment::add_output_section): Group relro sections is
11031 do_sort is true. Handle is_last_relro and is_first_non_relro.
11032 (Output_segment::maximum_alignment): Remove relro handling.
11033 (Output_segment::set_section_addresses): Add increase_relro
11034 parameter. Change all callers. Add initial alignment to align
11035 relro sections on separate page. Remove old relro handling.
11036 (Output_segment::set_section_list_addresses): Remove in_relro
11037 parameter. Change all callers.
11038 (Output_segment::set_offset): Add increase parameter. Change all
11039 callers. Remove old relro handling.
11040 * output.h (class Output_section): Add new methods: is_last_relro,
11041 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11042 Add is_last_relro_ and is_first_non_relro_ fields.
11043 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11044 Create separate .got.plt section. Call increase_relro.
11045 * x86_64.cc (Target_x86_64::got_section): Likewise.
11046 * testsuite/relro_script_test.t: Add .got.plt.
11047
11048 PR 10450
11049 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11050 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11051 (Layout::finalize): Call set_dynamic_symbol_size.
11052 (Layout::set_dynamic_symbol_size): New function.
11053 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11054 set_dynamic_symbol_size.
11055
11056 PR 10450
11057 * output.h (class Output_section): Add is_entsize_zero_ field.
11058 * output.cc (Output_section::Output_section): Initialize
11059 is_entsize_zero_.
11060 (Output_section::set_entsize): If two different entsizes are
11061 requested, force it to zero.
11062 (Output_section::add_input_section): Set flags for .debug_str
11063 before updating section flags. Set entsize.
11064 (Output_section::update_flags_for_input_section): Set SHF_MERGE
11065 and SHF_STRING if all input sections have those flags.
11066
11067 2009-12-29 Rafael Espindola <espindola@google.com>
11068
11069 * main.cc (main): Fix the sys time reporting.
11070 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11071 reporting.
11072
11073 2009-12-29 Sriraman Tallam <tmsriram@google.com>
11074
11075 * options.cc (General_options::parse_version): Allow -v to exit
11076 without an error if there is nothing to link.
11077
11078 2009-12-29 Ian Lance Taylor <iant@google.com>
11079
11080 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11081 using a version of gcc before 4.1.
11082 * configure: Rebuild.
11083
11084 2009-12-28 Chris Demetriou <cgd@google.com>
11085
11086 * attributes.cc (Output_attributes_section_data::do_write): Use
11087 std::vector::front rather than std::vector::data.
11088
11089 2009-12-28 Ian Lance Taylor <iant@google.com>
11090
11091 * symtab.h (class Symbol_table): Add enum Defined.
11092 * resolve.cc (Symbol_table::should_override): Add defined
11093 parameter. Change all callers. Test whether object is NULL
11094 before calling a method on it.
11095 (Symbol_table::report_resolve_problem): Add defined parameter.
11096 Change all callers.
11097 (Symbol_table::should_override_with_special): Likewise.
11098 * symtab.cc (Symbol_table::define_in_output_data): Add defined
11099 parameter. Change all callers.
11100 (Symbol_table::do_define_in_output_data): Likewise.
11101 (Symbol_table::define_in_output_segment): Likewise.
11102 (Symbol_table::do_define_in_output_segment): Likewise.
11103 (Symbol_table::define_as_constant): Likewise.
11104 (Symbol_table::do_define_as_constant): Likewise.
11105 * script.h (class Symbol_assignment): Add is_defsym parameter to
11106 constructor; change all callers.
11107 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11108 parameter. Change all callers. Add is_defsym_ field.
11109 (class Parser_closure): Add parsing_defsym parameter to
11110 constructor; change all callers. Add parsing_defsym accessor
11111 function. Add parsing_defsym_ field.
11112
11113 2009-12-28 Ian Lance Taylor <iant@google.com>
11114
11115 * gold.cc (queue_middle_tasks): Fix formatting.
11116 * object.cc (Relobj::is_section_name_included): Likewise.
11117
11118 2009-12-23 Ian Lance Taylor <iant@google.com>
11119
11120 * i386.cc (Target_i386::do_calls_non_split): Recognize
11121 -fsplit-stack prologue for a function with a static chain.
11122 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11123 -fsplit-stack prologue when using %r11.
11124
11125 2009-12-21 Sriraman Tallam <tmsriram@google.com>
11126
11127 * options.cc (General_options::parse_version): Make -v continue and do
11128 the link like GNU ld does.
11129
11130 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
11131
11132 * Makefile.am (CCFILES): Add timer.cc.
11133 (HFILES): Add timer.h.
11134 * configure.ac: Check for sysconf and times.
11135 * main.cc: include timer.h.
11136 (main): Use Timer instead of get_run_time.
11137 * timer.cc: New.
11138 * timer.h: New.
11139 * workqueue.cc: include timer.h.
11140 (Workqueue::find_and_run_task):
11141 Report user, sys and wall time.
11142 * Makefile.in: Regenerate.
11143 * config.in: Regenerate.
11144 * configure: Regenerate.
11145
11146 2009-12-16 Doug Kwan <dougkwan@google.com>
11147
11148 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11149 sections.
11150 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11151 relaxed input sections.
11152 * output.cc (Output_section::find_relaxed_input_section): Change
11153 return type to Output_relaxed_input_section pointer. Adjust code
11154 for new type of relaxed_input_section_map_.
11155 * output.h (Output_section::find_relaxed_input_section): Change
11156 return type to Output_relaxed_input_section pointer.
11157 (Output_section::Output_relaxed_input_section_by_input_section_map):
11158 New type.
11159 (Output_section::relaxed_input_section_map_): Change type to
11160 Output_section::Output_relaxed_input_section_by_input_section_map.
11161 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11162 input section.
11163
11164 2009-12-15 Ian Lance Taylor <iant@google.com>
11165
11166 * layout.cc (Layout::create_shstrtab): Only write out after input
11167 sections if we are compressing debug sections.
11168
11169 2009-12-15 Ian Lance Taylor <iant@google.com>
11170
11171 * archive.cc (Archive::add_symbols): Only look up a symbol without
11172 a version if there is, in fact, a version.
11173
11174 2009-12-14 Ian Lance Taylor <iant@google.com>
11175
11176 Revert -Wshadow changes, all changes from:
11177 2009-12-11 Doug Kwan <dougkwan@google.com>
11178 2009-12-11 Nick Clifton <nickc@redhat.com>
11179 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11180
11181 2009-12-11 Doug Kwan <dougkwan@google.com>
11182
11183 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11184 due to -Wshadow.
11185 * attributes.cc (Object_attribute::size): Ditto.
11186 (Attributes_section_data::size): Ditto.
11187 (Attributes_section_data::Attributes_section_data): Ditto.
11188 (Output_attributes_section_data::do_write): Ditto.
11189 * attributes.h (Object_attribute::set_type): Ditto.
11190 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11191
11192 2009-12-11 Nick Clifton <nickc@redhat.com>
11193
11194 * archive.cc: Fix shadowed variable warnings.
11195 * arm.cc: Likewise.
11196 * compressed_output.cc: Likewise.
11197 * compressed_output.h: Likewise.
11198 * configure: Likewise.
11199 * dwarf_reader.cc: Likewise.
11200 * dynobj.cc: Likewise.
11201 * dynobj.h: Likewise.
11202 * ehframe.cc: Likewise.
11203 * ehframe.h: Likewise.
11204 * errors.cc: Likewise.
11205 * expression.cc: Likewise.
11206 * fileread.cc: Likewise.
11207 * fileread.h: Likewise.
11208 * freebsd.h: Likewise.
11209 * i386.cc: Likewise.
11210 * icf.cc: Likewise.
11211 * incremental.h: Likewise.
11212 * layout.cc: Likewise.
11213 * layout.h: Likewise.
11214 * mapfile.cc: Likewise.
11215 * merge.cc: Likewise.
11216 * merge.h: Likewise.
11217 * object.cc: Likewise.
11218 * object.h: Likewise.
11219 * options.h: Likewise.
11220 * output.cc: Likewise.
11221 * output.h: Likewise.
11222 * parameters.cc: Likewise.
11223 * plugin.cc: Likewise.
11224 * powerpc.cc: Likewise.
11225 * reduced_debug_output.cc: Likewise.
11226 * reduced_debug_output.h: Likewise.
11227 * reloc.cc: Likewise.
11228 * reloc.h: Likewise.
11229 * resolve.cc: Likewise.
11230 * script-sections.cc: Likewise.
11231 * script.cc: Likewise.
11232 * script.h: Likewise.
11233 * sparc.cc: Likewise.
11234 * symtab.cc: Likewise.
11235 * symtab.h: Likewise.
11236 * target-select.cc: Likewise.
11237 * target-select.h: Likewise.
11238 * token.h: Likewise.
11239 * workqueue.cc: Likewise.
11240 * workqueue.h: Likewise.
11241 * x86_64.cc: Likewise.
11242
11243 2009-12-10 Doug Kwan <dougkwan@google.com>
11244
11245 * arm.cc (attributes.h): New include.
11246 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11247 (Arm_relobj::~Arm_relobj): Delete object pointed by
11248 attributes_section_data_.
11249 (Arm_relobj::attributes_section_data): New method definition.
11250 (Arm_relobj::attributes_section_data_): New data member declaration.
11251 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11252 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11253 attributes_section_data_.
11254 (Arm_dynobj::attributes_section_data): New method definition.
11255 (Arm_dynobj::attributes_section_data_): New data member declaration.
11256 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
11257 initialization value of may_use_blx_ to false.
11258 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11259 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11260 object attributes to compute results instead of hard-coding.
11261 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11262 Target_arm::get_secondary_compatible_arch,
11263 Target_arm::set_secondary_compatible_arch
11264 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11265 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11266 New method declarations.
11267 (Target_arm::get_aeabi_object_attribute): New method definition.
11268 (Target_arm::attributes_section_data_): New data member declaration.
11269 (read_arm_attributes_section): New template definition.
11270 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11271 (Arm_dynobj::do_read_symbols): Ditto.
11272 (Target_arm::do_finalize_sections): Merge attributes sections from
11273 input. Check for BLX use after attributes section merging.
11274 Fix __exidx_start and __exidx_end visibility. Create an
11275 .ARM.attributes section if necessary.
11276 (Target_arm::get_secondary_compatible_arch,
11277 Target_arm::set_secondary_compatible_arch,
11278 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11279 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11280 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11281 New method definitions.
11282
11283 2009-12-09 Ian Lance Taylor <iant@google.com>
11284
11285 * plugin.cc (Plugin::load): Don't cast from void* to a function
11286 pointer.
11287
11288 2009-12-09 Ian Lance Taylor <iant@google.com>
11289
11290 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11291 information fields.
11292
11293 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
11294
11295 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11296 Replace two_file_shared_1.so with two_file_shared_2.so.
11297 * testsuite/Makefile.in: Regenerated.
11298
11299 2009-12-08 Doug Kwan <dougkwan@google.com>
11300
11301 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11302 (HFILES): Add attributes.h and int_encoding.h.
11303 * Makefile.in: Regenerate.
11304 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11305 function definitions to int_encoding.cc
11306 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11307 prototypes to int_encoding.h
11308 * reduced_debug_output.cc (int_encoding.h): New include.
11309 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11310 function definitions to int_encoding.cc
11311 (insert_into_vector, read_from_pointer): Move template definitions to
11312 int_encoding.h
11313 * attributes.cc: New file.
11314 * attributes.h: New file.
11315 * int_encoding.cc: New file.
11316 * int_encoding.h: New file.
11317
11318 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
11319
11320 PR gold/11055
11321 * incremental-dump.cc (dump_incremental_inputs): New.
11322 (main): Use dump_incremental_inputs.
11323
11324 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
11325
11326 PR gold/10893
11327 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11328 checking elfcpp::STT_FUNC.
11329 (Target_i386::Relocate::relocate): Likewise.
11330 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11331
11332 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11333 symbols from shared libraries into normal FUNC symbols.
11334
11335 * symtab.h (Symbol): Add is_func and use it.
11336
11337 2009-12-05 Doug Kwan <dougkwan@google.com>
11338
11339 * arm.cc (Target_arm::arm_info): Initialize new fields
11340 attributes_section and attributes_vendor.
11341 * i386.cc (Target_i386::i386_info): Same.
11342 * object.cc (Sized_relobj::do_layout): Skip attribute section.
11343 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11344 fields attributes_section and attributes_vendor.
11345 * sparc.cc (Target_sparc::sparc_info): Same.
11346 * target.h (Target::attributes_section, Target::attributes_vendor,
11347 Target::is_attributes_section, Target::attribute_arg_type,
11348 Target::attributes_order): New method definitions.
11349 (Target::Target_info::attributes_section,
11350 Target::Target_info::attributes_vendor): New fields.
11351 (Target::do_attribute_arg_type, Target::do_attributes_order): New
11352 virtual method definitions.
11353 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11354 attributes_section and attributes_vendor.
11355 * testsuite/testfile.cc (Target_test::test_target_info): Same.
11356
11357 2009-12-05 Doug Kwan <dougkwan@google.com>
11358
11359 * arm.cc: Update comments about interworking and stub generation.
11360 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11361 considered as non-PIC.
11362 (Arm_relocate_functions::base_abs): Fix formatting.
11363 (Arm_relocate_functions::got_prel): Fix comment. Change interface
11364 of function to use GOT entry address instead of offset.
11365 (Target_arm::Scan::global): Issue an error if a symbol would need a
11366 PLT does not get one because it is untyped. Remove code to create
11367 dynamic symbols for relative branches.
11368 (Target_arm::Relocate::relocate: Use 0 instead of false since function
11369 takes unsigned integer instead of boolean.
11370
11371 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
11372
11373 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11374 (two_file_test_LDADD): Likewise.
11375 (common_test_1_LDADD): Likewise.
11376 (exception_test_LDADD) Likewise.
11377 (weak_test_LDADD): Likewise.
11378 (many_sections_test_LDADD): Likewise.
11379 (initpri1_LDADD): Likewise.
11380 (script_test_1_LDADD): Likewise.
11381 (script_test_2_LDADD): Likewise.
11382 (justsyms_LDADD): Likewise.
11383 (binary_test_LDADD): Likewise.
11384 (large_LDADD): Likewise.
11385 * testsuite/Makefile.in: Regenerated.
11386
11387 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
11388
11389 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11390 (Symbol_table::override_with_special): Likewise.
11391 (Symbol_table::add_from_object): Likewise.
11392
11393 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11394
11395 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11396 Don't set the data_offset twice.
11397
11398 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11399
11400 * testsuite/Makefile.in: Regenerate.
11401
11402 2009-12-03 Doug Kwan <dougkwan@google.com>
11403
11404 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11405 (Target_arm::do_finalize_sections): Add parameter for symbol table
11406 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
11407 * i386.cc (Target_i386::do_finalize_sections): Add an additional
11408 parameter for symbol table pointer.
11409 * layout.cc (Layout::finalize): Call Target::finalize_sections with
11410 an additional parameter for a pointer to symbol table.
11411 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11412 parameter for a symbol table pointer.
11413 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11414 * target.h (Target::finalize_sections, Target::do_finalize_sections):
11415 Ditto.
11416 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11417 parameter for a symbol table pointer.
11418
11419 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
11420
11421 * incremental.cc (Incremental_inputs_header)
11422 (Incremental_inputs_header_write, Incremental_inputs_entry)
11423 (Incremental_inputs_entry_write): Move ...
11424 * incremental.h (Incremental_inputs_header)
11425 (Incremental_inputs_header_write, Incremental_inputs_entry)
11426 (Incremental_inputs_entry_write): here.
11427
11428 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11429
11430 * incremental.cc (make_sized_incremental_binary): Set the target.
11431 Error if it is incompatible.
11432 * output.h (Output_file): Add filename method.
11433
11434 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11435
11436 * incremental.cc (Incremental_inputs_entry): Remove unused argument
11437 from the get_* methods.
11438
11439 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11440
11441 * incremental-dump.cc (main): Check that the offeset of a script is 0.
11442 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11443 Write 0 for the data_offset of scripts.
11444
11445 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11446
11447 * testsuite/Makefile.am: Add the incremental_test.sh test.
11448 * testsuite/incremental_test.sh: New.
11449 * testsuite/incremental_test_1.c: New.
11450 * testsuite/incremental_test_2.c: New.
11451
11452 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
11453
11454 * incremental-dump.cc (main): Fix typos.
11455
11456 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
11457
11458 PR gold/11025
11459 * incremental-dump.cc (main): Use llu to print 64 bit values.
11460
11461 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
11462 H.J. Lu <hongjiu.lu@intel.com>
11463
11464 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11465 $(LIBDL).
11466 (incremental_dump_LDADD): Likewise.
11467 * Makefile.in: Regenerated.
11468
11469 2009-11-25 Doug Kwan <dougkwan@google.com>
11470
11471 Revert:
11472
11473 2009-11-25 Doug Kwan <dougkwan@google.com>
11474
11475 * arm.cc (Target_arm::Target_arm): Move method definition
11476 outside of class definition. Add code to handle
11477 --target1-rel, --target1-abs and --target2= options.
11478 (Target_arm::get_reloc_reloc_type): Change method to be
11479 non-static and const.
11480 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11481 New data member declaration.
11482 (Target_arm::Scan::local, Target_arm::Scan::global,
11483 Target_arm::Relocate::relocate,
11484 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11485 Adjust call to Target_arm::get_real_reloc_type.
11486 (Target_arm::get_real_reloc_type): Use command line options
11487 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11488 * options.h (--target1-rel, --target1-abs, --target2): New
11489 ARM-only options.
11490
11491 2009-11-25 Doug Kwan <dougkwan@google.com>
11492
11493 * arm.cc (Target_arm::Target_arm): Move method definition outside of
11494 class definition. Add code to handle --target1-rel, --target1-abs
11495 and --target2= options.
11496 (Target_arm::get_reloc_reloc_type): Change method to be non-static
11497 and const.
11498 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11499 member declaration.
11500 (Target_arm::Scan::local, Target_arm::Scan::global,
11501 Target_arm::Relocate::relocate,
11502 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11503 call to Target_arm::get_real_reloc_type.
11504 (Target_arm::get_real_reloc_type): Use command line options to
11505 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11506 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11507 options.
11508
11509 2009-11-25 Doug Kwan <dougkwan@google.com>
11510
11511 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11512 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11513 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11514 formatting.
11515 (Arm_relocate_functions::thm_call): Replace body with a call to
11516 Arm_relocate_functions::thumb_branch_common.
11517 (Arm_relocate_functions::thm_jump24,
11518 Arm_relocate_functions::thm_xpc22): New method definitions.
11519 (Arm_relocate_functions::thumb_branch_common): New method definition.
11520 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11521 operator.
11522 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11523 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11524
11525 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11526
11527 * Makefile.am: Build incremental-dump
11528 * Makefile.in: Regenerate.
11529 * incremental-dump.cc: New.
11530 * incremental.cc (Incremental_inputs_header_data,
11531 Incremental_inputs_entry_data): Move to incremental.h
11532 * incremental.h: (Incremental_inputs_header_data,
11533 Incremental_inputs_entry_data): Move from incremental.cc
11534
11535 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11536
11537 * incremental.cc (Incremental_inputs_header,
11538 Incremental_inputs_header_write, Incremental_inputs_entry,
11539 Incremental_inputs_entry_write): Add a typedef with the data type.
11540
11541 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11542
11543 * incremental.cc (Incremental_inputs_header,
11544 Incremental_inputs_header_write, Incremental_inputs_entry,
11545 Incremental_inputs_entry_write): Update comment about which
11546 type has the filed descriptions.
11547
11548 2009-11-15 Doug Kwan <dougkwan@google.com>
11549
11550 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11551 (Arm_relocate_functions::arm_branch_common): Change method defintion
11552 in class definition to a method declaration and update list of formal
11553 parameters.
11554 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11555 Arm_relocation_functions::jump24): Adjust call to
11556 Arm_relocate_functions::arm_branch_common. Update list of formal
11557 parameters.
11558 (Arm_relocate_functions::xpc25): New method definition.
11559 (Arm_relocate_functions::arm_branch_common): Move method defintion
11560 out from class definition. Use stubs for mode-switching and extending
11561 branch ranges.
11562 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11563 specially. Change code to enable use of stubs in ARM branches.
11564
11565 2009-11-10 Doug Kwan <dougkwan@google.com>
11566
11567 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11568 in method declaration.
11569 (Target_arm::relocate_stub): New method declaration.
11570 (Target_arm::default_target): Change to return a pointer instead of
11571 a const reference.
11572 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11573 Target_arm::default_target.
11574 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11575 method definition.
11576 (Target_arm::relocate_section): Adjust view.
11577 (Target_arm::relocate_stub): New method definition.
11578
11579 2009-11-10 Doug Kwan <dougkwan@google.com>
11580
11581 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11582 a format warning.
11583 * incremental.cc (open_incremental_binary): Initialized local
11584 variables to avoid warnings.
11585 * object.cc (make_elf_object): Ditto.
11586 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11587 a format warning.
11588
11589 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11590
11591 PR gold/10930
11592 * testsuite/plugin_test.c: Include "config.h".
11593
11594 2009-11-09 Doug Kwan <dougkwan@google.com>
11595
11596 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11597 (arm_symbol_value): Remove.
11598 (Arm_relocate_functions::arm_branch_common,
11599 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11600 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11601 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11602 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11603 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11604 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11605 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11606 Arm_relocate_functions::thm_mobw_abs_nc,
11607 Arm_relocate_functions::thm_mov_abs,
11608 Arm_relocate_functions::movw_prel_nc,
11609 Arm_relocate_functions::thm_movt_abs,
11610 Arm_relocate_functions::movt_prel,
11611 Arm_relocate_functions::thm_movw_prel_nc,
11612 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11613 (Target_arm::Relocate::relocate): Only decompose address into two
11614 parts if relocation type uses the thumb-bit and pass the actual
11615 bit instead of a flag indicating that the thumb-bit is used. Adjust
11616 calls to methods in Arm_relocate_functions for this change.
11617
11618 2009-11-08 Ian Lance Taylor <iant@google.com>
11619
11620 PR 10925
11621 * reloc.cc: Instantiate
11622 Sized_relobj::initialize_input_to_output_maps and
11623 Sized_relobj:free_input_to_output_maps.
11624
11625 2009-11-06 Ian Lance Taylor <iant@google.com>
11626
11627 PR 10876
11628 * defstd.cc (in_segment): Set only_if_ref true for "end".
11629
11630 2009-11-06 Doug Kwan <dougkwan@google.com>
11631
11632 * arm.cc (class Reloc_stub): Correct a comment.
11633 (Target_arm::Target_arm): Initialize arm_input_section_map_.
11634 (Target_arm::scan_section_for_stubs): New method declaration.
11635 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11636 Change methods from private to protected.
11637 (Target_arm::do_may_relax): New method definition.
11638 (Target_arm::do_relax, Target_arm::group_sections,
11639 Target_arm::scan_reloc_for_stub,
11640 Target_arm::scan_reloc_section_for_stubs): New method declarations.
11641 (Target_arm::arm_input_section_map_): New data member declaration.
11642 (Target_arm::scan_reloc_for_stub,
11643 Target_arm::scan_reloc_section_for_stubs,
11644 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11645 Target_arm::do_relax): New method definitions.
11646
11647 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
11648
11649 * configure.ac: Check for (struct stat)::st_mtim
11650 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11651 * config.in: Regenerate.
11652 * configure: Regenerate.
11653
11654 2009-11-05 Ian Lance Taylor <iant@google.com>
11655
11656 PR 10910
11657 * output.cc (Output_segment::add_output_section): Add missing
11658 return statement.
11659
11660 2009-11-04 Ian Lance Taylor <iant@google.com>
11661
11662 PR 10880
11663 * object.h (class Object): Add is_needed and set_is_needed
11664 methods. Add is_needed_ field. Make bool fields into bitfields.
11665 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11666 defined in a dynamic object and referenced by a regular object,
11667 set is_needed for the dynamic object.
11668 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11669 if the file is marked with as_needed and it is not needed.
11670
11671 2009-11-04 Ian Lance Taylor <iant@google.com>
11672
11673 PR 10887
11674 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11675 tags if data is discarded by linker script.
11676 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11677 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11678 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11679 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11680
11681 2009-11-04 Ian Lance Taylor <iant@google.com>
11682
11683 * layout.cc (Layout::get_output_section): Add is_interp and
11684 is_dynamic_linker_section parameters. Change all callers.
11685 (Layout::choose_output_section): Likewise.
11686 (Layout::make_output_section): Likewise.
11687 (Layout::add_output_section_data): Add is_dynamic_linker_section
11688 parameter. Change all callers.
11689 * layout.h (class Layout): Update declarations.
11690 * output.h (class Output_section): Add is_interp, set_is_interp,
11691 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11692 Add is_interp_, is_dynamic_linker_section_ fields. Change
11693 generate_code_fills_at_write_ to a bitfield.
11694 * output.cc (Output_section::Output_sections): Initialize new
11695 fields.
11696 (Output_segment::add_output_section): Add do_sort parameter.
11697 Change all callers.
11698
11699 2009-11-03 Ian Lance Taylor <iant@google.com>
11700
11701 PR 10860
11702 * options.h (class General_options): Add --warn-common.
11703 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11704 merging two common symbols.
11705 (Symbol_table::should_override): Handle --warn-common when merging
11706 a common symbol with a defined symbol. Use report_resolve_problem
11707 for multiple definitions.
11708 (Symbol_table::report_resolve_problem): New function.
11709 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11710
11711 2009-11-03 Doug Kwan <dougkwan@google.com>
11712
11713 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11714 stub_factory_.
11715 (Target_arm::stub_factory): New method definition.
11716 (Target_arm::new_arm_input_section,
11717 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11718 Target_arm::reloc_uses_thumb_bit): New method declarations.
11719 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11720 New type definitions.
11721 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11722 member declarations.
11723 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11724 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11725 New method definitions.
11726
11727 2009-11-03 Ian Lance Taylor <iant@google.com>
11728
11729 * options.h (class General_options): Add --warn_constructors.
11730
11731 2009-11-03 Ian Lance Taylor <iant@google.com>
11732
11733 PR 10893
11734 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11735 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11736
11737 2009-11-03 Ian Lance Taylor <iant@google.com>
11738
11739 PR 10895
11740 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11741 --msgid-bugs-address.
11742 (install-pdf): New target.
11743 (install-data_yes): Look up one directory to find mkinstalldirs.
11744
11745 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11746
11747 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11748 tree.
11749
11750 2009-10-30 Doug Kwan <dougkwan@google.com>
11751
11752 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11753
11754 2009-10-30 Doug Kwan <dougkwan@google.com>
11755
11756 * arm.cc (Stub_addend_reader): New struct template definition
11757 and partial specializations.
11758 (Stub_addend_reader::operator()): New method definition for a
11759 partially specialized template.
11760
11761 2009-10-30 Doug Kwan <dougkwan@google.com>
11762
11763 * arm.cc (Arm_relobj::processor_specific_flags): New method
11764 definition.
11765 (Arm_relobj::do_read_symbols): New method declaration.
11766 (Arm_relobj::processor_specific_flags_): New data member declaration.
11767 (Arm_dynobj): New class definition.
11768 (Target_arm::do_finalize_sections): Add input_objects parameter.
11769 (Target_arm::do_adjust_elf_header): New method declaration.
11770 (Target_arm::are_eabi_versions_compatible,
11771 (Target_arm::merge_processor_specific_flags): New method declaration.
11772 (Target_arm::do_make_elf_object): New overloaded method definitions
11773 and declaration.
11774 (Arm_relobj::do_read_symbols): New method definition.
11775 (Arm_dynobj::do_read_symbols): Ditto.
11776 (Target_arm::do_finalize_sections): Add input_objects parameters.
11777 Merge processor-specific flags from all input objects.
11778 (Target_arm::are_eabi_versions_compatible,
11779 Target_arm::merge_processor_specific_flags,
11780 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11781 New method definitions.
11782 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11783 Input_objects pointer type parameter.
11784 * layout.cc (Layout::finalize): Pass input objects to target's.
11785 finalize_sections function.
11786 * output.cc (Output_file_header::do_sized_write): Set ELF file
11787 header's processor-specific flags.
11788 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11789 Input_objects pointer type parameter.
11790 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11791 * target.h (Input_objects): New forward class declaration.
11792 (Target::processor_specific_flags,
11793 Target::are_processor_specific_flags_sect): New method definitions.
11794 (Target::finalize_sections): Add input_objects parameter.
11795 (Target::Target): Initialize processor_specific_flags_ and
11796 are_processor_specific_flags_set_.
11797 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11798 parameter.
11799 (Target::set_processor_specific_flags): New method definition.
11800 (Target::processor_specific_flags_,
11801 Target::are_processor_specific_flags_set_): New data member
11802 declarations.
11803 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11804 Input_objects pointer type parameter.
11805
11806 2009-10-30 Doug Kwan <dougkwan@google.com>
11807
11808 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11809
11810 2009-10-28 Ian Lance Taylor <iant@google.com>
11811
11812 * object.h (class Relobj): Drop options parameter from
11813 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11814 do_scan_relocs, do_relocate. Change all callers.
11815 (class Sized_relobj): Drop options parameters from
11816 do_gc_process_relocs, do_scan_relocs, do_relocate,
11817 do_relocate_sections, relocate_sections, emit_relocs_scan,
11818 emit_relocs_scan_reltype. Change all callers.
11819 (struct Relocate_info): Remove options field and all references to
11820 it.
11821 * reloc.h (class Read_relocs): Remove options constructor
11822 parameter and options_ field. Change all callers.
11823 (class Gc_process_relocs, class Scan_relocs): Likewise.
11824 (class Relocate_task): Likewise.
11825 * target-reloc.h (scan_relocs): Remove options parameter. Change
11826 all callers.
11827 (scan_relocatable_relocs): Likewise.
11828 * target.h (class Sized_target): Remove options parameter from
11829 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11830 all callers.
11831 * gc.h (gc_process_relocs): Remove options parameter. Change all
11832 callers.
11833 * arm.cc: Update functions to remove options parameters.
11834 * i386.cc: Likewise.
11835 * powerpc.cc: Likewise.
11836 * sparc.cc: Likewise.
11837 * x86_64.cc: Likewise.
11838 * testsuite/testfile.cc: Likewise.
11839
11840 2009-10-28 Doug Kwan <dougkwan@google.com>
11841
11842 * arm.cc (Arm_relobj): New class definition.
11843 (Arm_relobj::scan_sections_for_stubs,
11844 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11845 New method definitions.
11846
11847 2009-10-28 Cary Coutant <ccoutant@google.com>
11848
11849 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11850 (Plugin::cleanup_done_): New member.
11851 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11852 (Plugin_manager::cleanup_done_): Remove.
11853 (Plugin_manager::add_input_file): Edit error message.
11854 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11855 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11856
11857 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11858
11859 * fileread.cc: (File_read::View::~View): Use the new
11860 data_ownership_ filed.
11861 (File_read::~File_read): Dispose the new whole_file_view_.
11862 (File_read::open): Mmap the whole file if needed.
11863 (File_read::open): Use whole_file_view_ instead of contents_.
11864 (File_read::find_view): Use whole_file_view_ if applicable.
11865 (File_read::do_read): Use whole_file_view_ instead of contents_.
11866 (File_read::make_view): Use whole_file_view_ instead of contents_,
11867 update File_read::View::View call.
11868 (File_read::find_or_make_view): Update File_read::View::View
11869 call.
11870 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11871 remove contents_
11872 (File_read::View::Data_ownership): New enum.
11873 (File_read::View::View): Replace bool mapped_ with Data_ownership
11874 argument.
11875 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11876 (File_read::View::data_ownership_): New field.
11877 (File_read::contents_): Remove (replaced by whole_file_view_).
11878 (File_read::whole_file_view_): New field.
11879 * options.h (class General_options): Add --keep-files-mapped.
11880
11881 2009-10-27 Cary Coutant <ccoutant@google.com>
11882
11883 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11884 * testsuite/Makefile.am (plugin_test_5): New test case.
11885 * testsuite/Makefile.in: Regenerate.
11886
11887 2009-10-25 Doug Kwan <dougkwan@google.com>
11888
11889 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11890 from private to protected to allow access by child class.
11891 (Sized_relobj::do_relocate_sections): New method declaration.
11892 (Sized_relobj::relocate_sections): Virtualize.
11893 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11894 Sized_relobj::relocate_sections. Instantiate template explicitly
11895 for different target sizes and endianity.
11896
11897 2009-10-24 Doug Kwan <dougkwan@google.com>
11898
11899 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11900 (Arm_input_section::as_arm_input_section): New method.
11901 (Arm_output_section): New class definition.
11902 (Arm_output_section::create_stub_group,
11903 Arm_output_section::group_sections): New method definitions.
11904
11905 2009-10-22 Doug Kwan <dougkwan@google.com>
11906
11907 * arm.cc (Arm_input_section): New class definition.
11908 (Arm_input_section::init, Arm_input_section:do_write,
11909 Arm_input_section::set_final_data_size,
11910 Arm_input_section::do_reset_address_and_file_offset): New method
11911 definitions.
11912
11913 2009-10-21 Doug Kwan <dougkwan@google.com>
11914
11915 * arm.cc (Stub_table, Arm_input_section): New forward class
11916 declarations.
11917 (Stub_table): New class defintion.
11918 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11919 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11920 New method definition.
11921
11922 2009-10-21 Doug Kwan <dougkwan@google.com>
11923
11924 * arm.cc: Update copyright comments.
11925 (Target_arm): New forward class template declaration.
11926 (Arm_address): New type.
11927 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11928 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11929 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11930 constants.
11931 (Insn_template): Same.
11932 (DEF_STUBS): New macro.
11933 (Stub_type): New enum type.
11934 (Stub_template): New class definition.
11935 (Stub): Same.
11936 (Reloc_stub): Same.
11937 (Stub_factory): Same.
11938 (Target_arm::Target_arm): Initialize may_use_blx_ and
11939 should_force_pic_veneer_.
11940 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11941 Target_arm::should_force_pic_veneer,
11942 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11943 Target_arm::using_thumb_only, Target_arm:;default_target): New
11944 method defintions.
11945 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11946 New data member declarations.
11947 (Insn_template::size, Insn_template::alignment): New method defintions.
11948 (Stub_template::Stub_template): New method definition.
11949 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11950 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11951 (Stub_factory::Stub_factory): New method definition.
11952 * gold.h (string_hash): New template.
11953 * output.h (Input_section_specifier::hash_value): Use
11954 gold::string_hash.
11955 (Input_section_specifier::string_hash): Remove.
11956 * stringpool.cc (Stringpool_template::string_hash): Use
11957 gold::string_hash.
11958
11959 2009-10-20 Doug Kwan <dougkwan@google.com>
11960
11961 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11962 symbols of relaxed input sections.
11963 * output.h (Output_section::find_relaxed_input_section): Make
11964 method public.
11965
11966 2009-10-16 Doug Kwan <dougkwan@google.com>
11967
11968 * dynobj.cc (Versions::Versions): Initialize version_script_.
11969 Only insert base version symbol definition for a shared object
11970 if version script defines any version versions.
11971 (Versions::define_base_version): New method definition.
11972 (Versions::add_def): Check that base version is not needed.
11973 (Versions::add_need): Define base version lazily.
11974 * dynobj.h (Versions::define_base_version): New method declaration.
11975 (Versions::needs_base_version_): New data member declaration.
11976 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11977 (check_DATA): Add no_version_test.stdout.
11978 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11979 New make rules.
11980 * testsuite/Makefile.in: Regenerate.
11981 * testsuite/no_version_test.c: New file.
11982 * testsuite/no_version_test.sh: Ditto.
11983
11984 2009-10-16 Doug Kwan <dougkwan@google.com>
11985
11986 * expression.cc (class Segment_start_expression): New class definition.
11987 (Segment_start_expression::value): New method definition.
11988 (script_exp_function_segment_start): Return a new
11989 Segment_start_expression.
11990 * gold/script-c.h (script_saw_segment_start_expression): New function
11991 prototype.
11992 * script-sections.cc (Script_sections::Script_sections): Initialize
11993 SAW_SEGMENT_START_EXPRESSION_ to false.
11994 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11995 and -Tbbs options to specify section addresses if given in
11996 command line and no SEGMENT_START expression is seen in a script.
11997 * script-sections.h (Script_sections::saw_segment_start_expression,
11998 Script_sections::set_saw_segment_start_expression): New method
11999 definition.
12000 (Script_sections::saw_segment_start_expression_): New data member
12001 declaration.
12002 * script.cc (script_saw_segment_start_expression): New function.
12003 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12004 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12005 script_test_7.sh and script_test_8.sh.
12006 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12007 script_test_8.stdout.
12008 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12009 (script_test_6, script_test_6.stdout, script_test_7,
12010 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12011 * Makefile.in: Regenerate.
12012 * testsuite/script_test_6.sh: New file.
12013 * testsuite/script_test_6.t: Same.
12014 * testsuite/script_test_7.sh: Same.
12015 * testsuite/script_test_7.t: Same.
12016 * testsuite/script_test_8.sh: Same.
12017
12018 2009-10-16 Doug Kwan <dougkwan@google.com>
12019
12020 * output.cc (Output_segment::set_section_list_address): Cast
12021 expressions to unsigned long long type to avoid format warnings.
12022
12023 2009-10-15 Ian Lance Taylor <iant@google.com>
12024
12025 * script.cc (Script_options::add_symbol_assignment): Always add a
12026 dot assignment to script_sections_.
12027 * script-sections.cc (Script_sections::add_dot_assignment):
12028 Initialize if necessary.
12029
12030 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12031 program headers with no load segment if there is a linker script.
12032
12033 * layout.cc (Layout::set_segment_offsets): Align the file offset
12034 to the segment aligment for -N or -n with no load segment.
12035 * output.cc (Output_segment::add_output_section): Don't crash if
12036 the first section is a TLS section.
12037 (Output_segment::set_section_list_addresses): Print an error
12038 message if the address moves backward in a linker script.
12039 * script-sections.cc
12040 (Output_section_element_input::set_section_addresses): Don't
12041 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12042 (Orphan_output_section::set_section_addresses): Likewise.
12043
12044 2009-10-15 Doug Kwan <dougkwan@google.com>
12045
12046 * layout.cc (Layout::finish_dynamic_section): Generate tags
12047 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12048 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12049 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12050
12051 2009-10-14 Ian Lance Taylor <iant@google.com>
12052
12053 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12054 fields.
12055 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12056 data_shdr fields of relinfo.
12057 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12058 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12059 R_386_TLS_LDO_32, adjust based on section flags.
12060 (Target_i386::Relocate::fix_up_ldo): Remove.
12061
12062 2009-10-13 Ian Lance Taylor <iant@google.com>
12063
12064 Add support for -pie.
12065 * options.h (class General_options): Add -pie and
12066 --pic-executable.
12067 (General_options::output_is_position_independent): Test -pie.
12068 (General_options::output_is_executable): Return true if not shared
12069 and not relocatable.
12070 (General_options::output_is_pie): Remove.
12071 * options.cc (General_options::finalize): Reject incompatible uses
12072 of -pie.
12073 * gold.cc (queue_middle_tasks): A -pie link is not static.
12074 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12075 * symtab.cc (Symbol::final_value_is_known): Return false if
12076 output_is_position_independent.
12077 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12078 output_is_position_independent.
12079 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12080 output_is_position_independent.
12081 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12082 output_is_position_independent.
12083 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12084 two_file_pie_test.
12085 (basic_pie_test.o, basic_pie_test): New targets.
12086 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12087 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12088 (two_file_pie_test): New target.
12089 * testsuite/Makefile.in: Rebuild.
12090 * README: Remove note saying that -pie is not supported.
12091
12092 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
12093
12094 * options.h (class General_options): Add -init and -fini.
12095 * layout.cc (Layout::finish_dynamic_section): Emit
12096 given init and fini functions.
12097
12098 2009-10-13 Sriraman Tallam <tmsriram@google.com>
12099
12100 * gc.h (gc_process_relocs): Check if icf is enabled using new
12101 function.
12102 * gold.cc (queue_initial_tasks): Likewise.
12103 (queue_middle_tasks): Likewise.
12104 * object.cc (do_layout): Likewise.
12105 * symtab.cc (is_section_folded): Likewise.
12106 * main.cc (main): Likewise.
12107 * reloc.cc (Read_relocs::run): Likewise.
12108 (Sized_relobj::do_scan_relocs): Likewise.
12109 * icf.cc (is_function_ctor_or_dtor): New function.
12110 (Icf::find_identical_sections): Check if function is ctor or dtor when
12111 safe icf is chosen.
12112 * options.h (General_options::icf): Change option to be an enum.
12113 (Icf_status): New enum.
12114 (icf_enabled): New method.
12115 (icf_safe_folding): New method.
12116 (set_icf_status): New method.
12117 (icf_status_): New variable.
12118 * (options.cc) (General_options::finalize): Set icf_status_.
12119 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12120 icf_test and icf_keep_unique_test to use the --icf enum flag.
12121 * testsuite/icf_safe_test.sh: New file.
12122 * testsuite/icf_safe_test.cc: New file.
12123
12124 2009-10-12 Sriraman Tallam <tmsriram@google.com>
12125
12126 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12127 includes to gc.h and icf.h.
12128 * arm.cc: Include gc.h.
12129 * gold.cc: Likewise.
12130 * i386.cc: Likewise.
12131 * powerpc.cc: Likewise.
12132 * sparc.cc: Likewise.
12133 * x86_64.cc: Likewise.
12134 * gc.h: Include icf.h.
12135
12136 2009-10-11 Ian Lance Taylor <iant@google.com>
12137
12138 * plugin.cc: Include "gold.h" before other header files.
12139
12140 2009-10-10 Chris Demetriou <cgd@google.com>
12141
12142 * options.h (Input_file_argument::Input_file_type): New enum.
12143 (Input_file_argument::is_lib_): Replace with...
12144 (Input_file_argument::type_): New member.
12145 (Input_file_argument::Input_file_argument): Take Input_file_type
12146 'type' rather than boolean 'is_lib' as second argument.
12147 (Input_file_argument::is_lib): Use type_.
12148 (Input_file_argument::is_searched_file): New function.
12149 (Input_file_argument::may_need_search): Handle is_searched_file.
12150 * options.cc (General_options::parse_library): Support -l:filename.
12151 (General_options::parse_just_symbols): Update for Input_file_argument
12152 changes.
12153 (Command_line::process): Likewise.
12154 * archive.cc (Archive::get_file_and_offset): Likewise.
12155 * plugin.cc (Plugin_manager::release_input_file): Likewise.
12156 * script.cc (read_script_file, script_add_file): Likewise.
12157 * fileread.cc (Input_file::Input_file): Likewise.
12158 (Input_file::will_search_for): Handle is_searched_file.
12159 (Input_file::open): Likewise.
12160 * readsyms.cc (Read_symbols::get_name): Likewise.
12161 * testsuite/Makefile.am (searched_file_test): New test.
12162 * testsuite/Makefile.in: Regenerate.
12163 * testsuite/searched_file_test.cc: New file.
12164 * testsuite/searched_file_test_lib.cc: New file.
12165
12166 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12167 Ian Lance Taylor <iant@google.com>
12168
12169 * descriptor.cc: Include <cstdio> and "binary-io.h".
12170 (Descriptors::open): Open the files in binary mode always.
12171 * script.cc (Lex::get_token): Treat \r as whitespace.
12172
12173 2009-10-09 Ian Lance Taylor <iant@google.com>
12174
12175 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12176
12177 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12178 Ian Lance Taylor <iant@google.com>
12179
12180 * configure.ac: Check for readv function also.
12181 * fileread.cc (readv): Define if not HAVE_READV.
12182 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12183 does not exist.
12184 * config.in: Regenerate.
12185 * configure: Regenerate.
12186
12187 2009-10-09 Doug Kwan <dougkwan@google.com>
12188
12189 * layout.cc (Layout::make_output_section): Call target hook to make
12190 ordinary output section.
12191 (Layout::finalize): Adjust parameter list of call the
12192 Target::may_relax().
12193 * layout.h (class Layout::section_list): New method.
12194 * merge.h (Output_merge_base::entsize): Change visibility to public.
12195 (Output_merge_base::is_string, Output_merge_base::do_is_string):
12196 New methods.
12197 (Output_merge_string::do_is_string): New method.
12198 * object.cc (Sized_relobj::do_setup): renamed from
12199 Sized_relobj::set_up.
12200 * object.h (Sized_relobj::adjust_shndx,
12201 Sized_relobj::initializ_input_to_output_maps,
12202 Sized_relobj::free_input_to_output_maps): Change visibilities to
12203 protected.
12204 (Sized_relobj::setup): Virtualize.
12205 (Sized_relobj::do_setup): New method declaration.
12206 (Sized_relobj::invalidate_section_offset,
12207 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12208 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12209 * options.cc (parse_int): New function.
12210 * options.h (parse_int): New declaration.
12211 (DEFINE_int): New macro.
12212 (stub_group_size): New option.
12213 * output.cc (Output_section::Output_section): Initialize memebers
12214 merge_section_map_, merge_section_by_properties_map_,
12215 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12216 (Output_section::add_input_section): Handled deferred code-fill
12217 generation and remove an old comment.
12218 (Output_section::add_relaxed_input_section): New method definition.
12219 (Output_section::add_merge_input_section): Use merge section by
12220 properties map to speed to search. Update merge section maps
12221 as appropriate.
12222 (Output_section::build_relaxation_map): New method definition.
12223 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12224 Same.
12225 (Output_section::relax_input_section): Renamed to
12226 Output_section::convert_input_sections_to_relaxed_sections and change
12227 interface to take a vector of pointers to relaxed sections.
12228 (Output_section::find_merge_section,
12229 Output_section::find_relaxed_input_section): New method definitions.
12230 (Output_section::is_input_address_mapped,
12231 Output_section::output_offset, Output_section::output_address):
12232 Use output section data maps to speed up searching.
12233 (Output_section::find_starting_output_address): Add comments.
12234 (Output_section::do_write,
12235 Output_section::write_to_postprocessing_buffer): Do code-fill
12236 generation as appropriate.
12237 (Output_section::get_input_sections): Invalidate relaxed input section
12238 map.
12239 (Output_section::restore_states): Adjust type of checkpoint .
12240 Invalidate relaxed input section map.
12241 * output.h (Output_merge_base): New class declaration.
12242 (Input_section_specifier): New class defintion.
12243 (class Output_relaxed_input_section) Change base class to
12244 Output_section_data_build.
12245 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12246 base class initializer.
12247 (Output_section::add_relaxed_input_section): New method declaration.
12248 (Output_section::Input_section): Change visibility to protected.
12249 (Output_section::Input_section::relobj,
12250 Output_section::Input_section::shndx): Handle relaxed input sections.
12251 Output_section::input_sections) Change visibility to protected. Also
12252 define overload to return a non-const pointer.
12253 (Output_section::Merge_section_properties): New class defintion.
12254 (Output_section::Merge_section_by_properties_map,
12255 Output_section::Output_section_data_by_input_section_map,
12256 Output_section::Relaxation_map): New types.
12257 (Output_section::relax_input_section): Rename method to
12258 Output_section::convert_input_sections_to_relaxed_sections and change
12259 interface to take a vector of relaxed section pointers.
12260 (Output_section::find_merge_section,
12261 Output_section::find_relaxed_input_section,
12262 Output_section::build_relaxation_map,
12263 Output_section::convert_input_sections_in_list_to_relaxed_sections):
12264 New method declarations.
12265 (Output_section::merge_section_map_
12266 Output_section::merge_section_by_properties_map_,
12267 Output_section::relaxed_input_section_map_,
12268 Output_section::is_relaxed_input_section_map_valid_,
12269 Output_section::generate_code_fills_at_write_): New data members.
12270 * script-sections.cc
12271 (Output_section_element_input::set_section_addresses): Call
12272 current_data_size and addralign methods of relaxed input sections.
12273 (Orphan_output_section::set_section_addresses): Call current_data_size
12274 and addralign methods of relaxed input sections.
12275 * symtab.cc (Symbol_table::compute_final_value): Extract template
12276 from the body of Symbol_table::sized_finalize_symbol.
12277 (Symbol_table::sized_finalized_symbol): Call
12278 Symbol_table::compute_final_value.
12279 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12280 (Symbol_table::compute_final_value): New templated method declaration.
12281 * target.cc (Target::do_make_output_section): New method defintion.
12282 * target.h (Target::make_output_section): New method declaration.
12283 (Target::relax): Add more parameters for input objects, symbol table
12284 and layout. Adjust call to do_relax.
12285 (Target::do_make_output_section): New method declaration.
12286 (Target::do_relax): Add parameters for input objects, symbol table
12287 and layout.
12288
12289 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12290
12291 * pread.c: Include stdio.h.
12292
12293 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12294
12295 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12296 defined.
12297
12298 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12299
12300 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12301 Change read_shndx type to unsigned int.
12302 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12303 int.
12304 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12305 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12306 Change read_shndx type to unsigned int.
12307 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12308 int.
12309 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12310 * layout.cc (Layout::create_symtab_sections): Cast the result of
12311 local_symcount * symsize to off_t in the gold_assert.
12312
12313 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12314
12315 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12316 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12317 R_ARM_BASE_ABS.
12318 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12319 (Arm_relocate_functions::thm_abs5): New function.
12320 (Arm_relocate_functions::abs12): New function.
12321 (Arm_relocate_functions::abs16): New function.
12322 (Arm_relocate_functions::base_abs): New function.
12323 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12324 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
12325 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12326 R_ARM_BASE_ABS.
12327 (Scan::global): Likewise.
12328 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12329 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12330 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12331 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12332 R_ARM_BASE_ABS.
12333
12334 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12335
12336 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12337 (Arm_relocate_functions::movt_prel): New function.
12338 (Arm_relocate_functions::thm_movw_prel_nc): New function.
12339 (Arm_relocate_functions::thm_movt_prel): New function.
12340 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12341 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12342 (Scan::global, Relocate::relocate): Likewise.
12343 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12344
12345 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12346
12347 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12348 Incremental_checker.
12349 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12350 unsigned int.
12351 (class Incremental_inputs_header): New class.
12352 (Incremental_inputs_header_writer): Edit comment.
12353 (Incremental_inputs_entry): New class.
12354 (Incremental_inputs_entry_writer): Edit comment.
12355 (Sized_incremental_binary::do_find_incremental_inputs_section):
12356 Add *strtab_shndx parameter, fill it.
12357 (Sized_incremental_binary::do_check_inputs): New method.
12358 (Incremental_checker::can_incrementally_link_output_file): Use
12359 Sized_incremental_binary::check_inputs.
12360 (Incremental_inputs::report_command_line): Save command line in
12361 command_line_.
12362 * incremental.h:
12363 (Incremental_binary::find_incremental_inputs_section): New
12364 method.
12365 (Incremental_binary::do_find_incremental_inputs_section): Add
12366 strtab_shndx parameter.
12367 (Incremental_binary::do_check_inputs): New pure virtual method.
12368 (Sized_incremental_binary::do_check_inputs): Declare.
12369 (Incremental_checker::Incremental_checker): Add incremental_inputs
12370 parameter, use it to initialize incremental_inputs_.
12371 (Incremental_checker::incremental_inputs_): New field.
12372 (Incremental_checker::command_line): New method.
12373 (Incremental_checker::inputs): New method.
12374 (Incremental_checker::command_line_): New field.
12375
12376 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12377
12378 * incremental.cc: Include <cstdarg> and "target-select.h".
12379 (vexplain_no_incremental): New function.
12380 (explain_no_incremental): New function.
12381 (Incremental_binary::error): New method.
12382 (Sized_incremental_binary::do_find_incremental_inputs_section): New
12383 method.
12384 (make_sized_incremental_binary): New function.
12385 (open_incremental_binary): New function.
12386 (can_incrementally_link_file): Add checks if output is ELF and has
12387 inputs section.
12388 * incremental.h: Include "elfcpp_file.h" and "output.h".
12389 (Incremental_binary): New class.
12390 (Sized_incremental_binary): New class.
12391 (open_incremental_binary): Declare.
12392 * object.cc (is_elf_object): Use
12393 elfcpp::Elf_recognizer::is_elf_file.
12394 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12395 * output.h (Output_file::filesize): New method.
12396
12397 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12398
12399 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12400 New function.
12401 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12402 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12403 function.
12404 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12405 function.
12406 (Arm_relocate_functions::movw_abs_nc): New function.
12407 (Arm_relocate_functions::movt_abs): New function.
12408 (Arm_relocate_functions::thm_movw_abs_nc): New function.
12409 (Arm_relocate_functions::thm_movt_abs): New function.
12410 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12411 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12412 (Scan::global): Likewise.
12413 (Relocate::relocate): Likewise.
12414 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12415
12416 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12417
12418 * arm.cc (Arm_relocate_functions::got_prel) New function.
12419 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12420 (Relocate::relocate): Likewise.
12421 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12422
12423 2009-10-06 Ian Lance Taylor <iant@google.com>
12424
12425 * options.h (class General_options): Define
12426 split_stack_adjust_size parameter.
12427 * object.h (class Object): Add uses_split_stack_ and
12428 has_no_split_stack_ fields. Add uses_split_stack and
12429 has_no_split_stack accessor functions. Declare
12430 handle_split_stack_section.
12431 (class Reloc_symbol_changes): Define.
12432 (class Sized_relobj): Define Function_offsets. Declare
12433 split_stack_adjust, split_stack_adjust_reltype, and
12434 find_functions.
12435 * object.cc (Object::handle_split_stack_section): New function.
12436 (Sized_relobj::do_layout): Call handle_split_stack_section.
12437 * dynobj.cc (Sized_dynobj::do_layout): Call
12438 handle_split_stack_section.
12439 * reloc.cc (Sized_relobj::relocate_sections): Call
12440 split_stack_adjust for executable sections in split_stack
12441 objects. Pass reloc_map to relocate_section.
12442 (Sized_relobj::split_stack_adjust): New function.
12443 (Sized_relobj::split_stack_adjust_reltype): New function.
12444 (Sized_relobj::find_functions): New function.
12445 * target-reloc.h: Include "object.h".
12446 (relocate_section): Add reloc_symbol_changes parameter. Change
12447 all callers.
12448 * target.h (class Target): Add calls_non_split method. Declare
12449 do_calls_non_split virtual method. Declare match_view and
12450 set_view_to_nop.
12451 * target.cc: Include "elfcpp.h".
12452 (Target::do_calls_non_split): New function.
12453 (Target::match_view): New function.
12454 (Target::set_view_to_nop): New function.
12455 * gold.cc (queue_middle_tasks): Give an error if mixing
12456 split-stack and non-split-stack objects with -r.
12457 * i386.cc (Target_i386::relocate_section): Add
12458 reloc_symbol_changes parameter.
12459 (Target_i386::do_calls_non_split): New function.
12460 * x86_64.cc (Target_x86_64::relocate_section): Add
12461 reloc_symbol_changes parameter.
12462 (Target_x86_64::do_calls_non_split): New function.
12463 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12464 parameter.
12465 * powerpc.cc (Target_powerpc::relocate_section): Add
12466 reloc_symbol_changes parameter.
12467 * sparc.cc (Target_sparc::relocate_section): Add
12468 reloc_symbol_changes parameter.
12469 * configure.ac: Call AM_CONDITIONAL for the default target.
12470 * configure: Rebuild.
12471 * testsuite/Makefile.am (TEST_AS): New variable.
12472 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12473 (check_DATA): Add split_i386 and split_x86_64 files.
12474 (SPLIT_DEFSYMS): Define.
12475 (split_i386_[1234n].o): New targets.
12476 (split_i386_[124]): New targets.
12477 (split_i386_[1234r].stdout): New targets.
12478 (split_x86_64_[1234n].o): New targets.
12479 (split_x86_64_[124]): New targets.
12480 (split_x86_64_[1234r].stdout): New targets.
12481 (MOSTLYCLEANFILES): Add new executables.
12482 * testsuite/split_i386.sh: New file.
12483 * testsuite/split_x86_64.sh: New file.
12484 * testsuite/split_i386_1.s: New file.
12485 * testsuite/split_i386_2.s: New file.
12486 * testsuite/split_i386_3.s: New file.
12487 * testsuite/split_i386_4.s: New file.
12488 * testsuite/split_i386_n.s: New file.
12489 * testsuite/split_x86_64_1.s: New file.
12490 * testsuite/split_x86_64_2.s: New file.
12491 * testsuite/split_x86_64_3.s: New file.
12492 * testsuite/split_x86_64_4.s: New file.
12493 * testsuite/split_x86_64_n.s: New file.
12494 * testsuite/testfile.cc (Target_test): Update relocation_section
12495 function.
12496 * testsuite/Makefile.in: Rebuild.
12497
12498 2009-10-06 Ian Lance Taylor <iant@google.com>
12499
12500 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12501 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12502 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
12503 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12504 the address on ldo_addrs_.
12505 (Target_i386::Relocate::fix_up_ldo): New function.
12506
12507 2009-10-06 Rafael Espindola <espindola@google.com>
12508
12509 * plugin.cc (add_input_library): New.
12510 (Plugin::load): Add add_input_library to tv.
12511 (Plugin_manager::add_input_file): Add the is_lib argument.
12512 (add_input_file): Update call to Plugin_manager::add_input_file.
12513 (add_input_library): New.
12514 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12515
12516 2009-09-30 Doug Kwan <dougkwan@google.com>
12517
12518 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12519 symbol and call Symbol::may_need_copy_reloc to determine if
12520 a copy reloc is needed.
12521 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12522 nocopyreloc is given in command line.
12523 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12524 given in command line.
12525 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12526 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12527 of the removed Target_i386::may_need_copy_reloc.
12528 * options.h (copyreloc): New option with default value false.
12529 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12530 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12531 instead of the removed Target_powerpc::may_need_copy_reloc.
12532 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12533 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12534 instead of the removed Target_sparc::may_need_copy_reloc.
12535 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12536 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12537 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12538 instead of the removed Target_x86_64::may_need_copy_reloc.
12539
12540 2009-09-30 Ian Lance Taylor <iant@google.com>
12541
12542 * object.h (class Object): Remove target_ field, and target,
12543 sized_target, and set_target methods.
12544 (Object::sized_target): Remove.
12545 (class Sized_relobj): Update declarations. Remove sized_target.
12546 * object.cc (Sized_relobj::setup): Remove target parameter.
12547 Change all callers.
12548 (Input_objects::add_object): Don't do anything with the target.
12549 (make_elf_sized_object): Add punconfigured parameter. Change all
12550 callers. Set or test parameter target.
12551 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12552 Change all callers.
12553 * parameters.cc (Parameters::set_target): Change parameter type to
12554 be non-const.
12555 (Parameters::default_target): Remove.
12556 (set_parameters_target): Change parameter type to be non-const.
12557 (parameters_force_valid_target): New function.
12558 (parameters_clear_target): New function.
12559 * parameters.h (class Parameters): Update declarations. Remove
12560 default_target method. Add sized_target and clear_target
12561 methods. Change target_ to be non-const.
12562 (set_parameters_target): Update declaration.
12563 (parameters_force_valid_target): Declare.
12564 (parameters_clear_target): Declare.
12565 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12566 as NULL if we aren't searching.
12567 (Add_symbols::run): Don't check for compatible target.
12568 * fileread.cc (Input_file::open_binary): Call
12569 parameters_force_valid_target.
12570 * gold.cc (queue_middle_tasks): Likewise.
12571 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12572 set_target on object.
12573 * dynobj.h (class Sized_dynobj): Update declarations.
12574 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12575 make_elf_object returns NULL.
12576 (Archive::include_member): Don't check whether object target is
12577 compatible.
12578 * output.cc (Output_section::add_input_section): Get target from
12579 parameters.
12580 (Output_section::relax_input_section): Likewise.
12581 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12582 parameters.
12583 (Sized_relobj::do_scan_relocs): Likewise.
12584 (Sized_relobj::relocate_sections): Likewise.
12585 * resolve.cc (Symbol_table::resolve): Likewise.
12586 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12587 parameter. Change all callers.
12588 (Symbol_table::add_from_object): Get target from parameters.
12589 (Symbol_table::add_from_relobj): Don't check object target.
12590 (Symbol_table::add_from_dynobj): Likewise.
12591 (Symbol_table::define_special_symbol): Get target from
12592 parameters.
12593 * symtab.h (class Symbol_table): Update declaration.
12594 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12595 parameter. Change all callers. Clear parameter target.
12596 (Binary_test): Test target here.
12597 * testsuite/object_unittest.cc (gold_testsuite): Remove
12598 target_test_pointer parameter. Change all callers.
12599 (Object_test): Test target here.
12600
12601 2009-09-26 Ian Lance Taylor <iant@google.com>
12602
12603 * testsuite/initpri1.c: Don't try to use constructor priorities if
12604 compiling with gcc before 4.3.
12605
12606 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
12607
12608 * testsuite/retain_symbols_file_test.sh (check_present): Change
12609 output file name to retain_symbols_file_test.stdout.
12610 (check_absent): Likewise.
12611
12612 2009-09-18 Craig Silverstein <csilvers@google.com>
12613
12614 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12615 * options.cc: Include <cerrno> and <fstream>.
12616 (General_options::finalize): Parse -retain-symbols-file tag.
12617 * options.h: New flag.
12618 (General_options): New method should_retain_symbol, new
12619 variable symbols_to_retain.
12620 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12621 should_retain_symbol map.
12622 * testsuite/Makefile.am (retain_symbols_file_test): New test.
12623 * testsuite/Makefile.in: Regenerate.
12624 * testsuite/retain_symbols_file_test.sh: New file.
12625
12626 2009-09-18 Nick Clifton <nickc@redhat.com>
12627
12628 * po/es.po: Updated Spanish translation.
12629
12630 2009-09-17 Doug Kwan <dougkwan@google.com>
12631
12632 * debug.h (DEBUG_RELAXATION): New constant.
12633 (DEBUG_ALL): Add DEBUG_RELAXATION.
12634 (debug_string_to_enum): Add relaxation debug option.
12635 * layout.cc
12636 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12637 Layout::Relaxation_debug_check::read_sections,
12638 Layout::Relaxation_debug_check::read_sections): New method definitions.
12639 (Layout::Layout): Initialize data members
12640 record_output_section_data_from_scrips_,
12641 script_output_section_data_list_ and relaxation_debug_check_.
12642 (Layout::save_segments, Layout::restore_segments,
12643 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12644 Layout::relaxation_loop_body): New method definitions.
12645 (Layout::finalize): Support relaxation. Move section layout code to
12646 Layout::relaxation_loop_body.
12647 (Layout::set_asection_address_from_script): Move code for orphan
12648 section placement out.
12649 (Layout::place_orphan_sections_in_script): New method definition.
12650 * layout.h (Output_segment_headers, Output_file_header):
12651 New forward class declarations.
12652 (Layout::~Layout): Define.
12653 (Layout::new_output_section_data_from_script): New method definition.
12654 (Layout::place_orphan_sections_in_script): New method declaration.
12655 (Layout::Segment_states): New type declaration.
12656 (Layout::save_segments, Layout::restore_segments,
12657 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12658 Layout::relaxation_loop_body): New method declarations.
12659 (Layout::Output_section_data_list): New type declaration.
12660 (Layout::Relaxation_debug_check): New class definition.
12661 (Layout::record_output_section_data_from_script_,
12662 Layout::script_output_section_data_list_, Layout::segment_states_,
12663 Layout::relaxation_debug_check_): New data members.
12664 * output.cc: (Output_section_headers::do_size): New method definition.
12665 (Output_section_headers::Output_section_headers): Move size
12666 computation to Output_section_headers::do_size.
12667 (Output_segment_headers::do_size): New method definition.
12668 (Output_file_header::Output_file_header): Move size computation to
12669 Output_file_header::do_size and call it.
12670 (Output_file_header::do_size): New method definition.
12671 (Output_data_group::Output_data_group): Adjust call to
12672 Output_section_data.
12673 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12674 (Output_symtab_xindex::do_write): Add array bound check.
12675 (Output_section::Input_section::print_to_mapfile): Handle
12676 RELAXED_INPUT_SECTION_CODE.
12677 (Output_section::Output_section): Initialize data member checkpoint_.
12678 (Output_section::~Output_section): Delete checkpoint object pointed
12679 by checkpoint_.
12680 (Output_section::add_input_section): Always add an Input_section if
12681 relaxing.
12682 (Output_section::add_merge_input_section): Add assert.
12683 (Output_section::relax_input_section): New method definition.
12684 (Output_section::set_final_data_size): Set load address to zero for
12685 an unallocated section.
12686 (Output_section::do_address_and_file_offset_have_reset_values):
12687 New method definition.
12688 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12689 Handle relaxed input section.
12690 (Output_section::sort_attached_input_sections): Checkpoint input
12691 section list lazily.
12692 (Output_section::get_input_sections): Change type of input_sections to
12693 list of Simple_input_section pointers. Checkpoint input section list
12694 lazily. Also handle relaxed input sections.
12695 (Output_section::add_input_section_for_script): Take a reference to
12696 a Simple_input_section object instead of Relobj pointer and section
12697 index as parameter. Handle relaxed input sections.
12698 (Output_section::save_states, Output_section::restore_states): New
12699 method definitions.
12700 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12701 (Output_data::is_data_size_fixed): New method definition.
12702 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12703 if it is fixed.
12704 (Output_data::address_and_file_offset_have_reset_values): New method
12705 definition.
12706 (Output_data::do_address_and_file_offset_have_reset_values): New method
12707 definition.
12708 (Output_data::set_data_size): Check that data size is not fixed.
12709 (Output_data::fix_data_size): New method definition.
12710 (Output_data::is_data_size_fixed_): New data member.
12711 (Output_section_headers::set_final_data_size): New method definition.
12712 (Output_section_headers::do_size): New method declaration.
12713 (Output_segment_headers::set_final_data_size): New method definition.
12714 (Output_segment_headers::do_size): New method declaration.
12715 (Output_file_header::set_final_data_size)::New method definition.
12716 (Output_file_header::do_size)::New method declaration.
12717 (Output_section_data::Output_section_data): Add new parameter
12718 is_data_size_fixed and use it to fix data size.
12719 (Output_data_const::Output_data_const): Adjust call to base class
12720 constructor and fix data size.
12721 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12722 base class constructor and fix data size.
12723 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12724 base class constructor and fix data size.
12725 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12726 class constructor and fix data size.
12727 (Output_data_group::set_final_data_size): New method definition.
12728 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12729 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12730 class constructor and fix data size.
12731 (Output_relaxed_input_section): New class definition.
12732 (Output_section::Simple_input_section): New class definition.
12733 (Output_section::get_input_sections): Adjust parameter list.
12734 (Output_section::add_input_section_for_script): Same.
12735 (Output_section::save_states, Output_section::restore_states,
12736 Output_section::do_address_and_file_offset_have_reset_values,
12737 (Output_section::Input_section::Input_section): Handle
12738 RELAXED_INPUT_SECTION_CODE. Add new overload for
12739 Output_relaxed_input_section.
12740 (Output_section::Input_section::is_input_section,
12741 Output_section::Input_section::set_output_section): Handle relaxed
12742 input section.
12743 (Output_section::Input_section::is_relaxed_input_section,
12744 Output_section::Input_section::output_section_data,
12745 Output_section::Input_section::relaxed_input_section): New method
12746 definitions.
12747 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12748 value.
12749 (Output_section::Input_section::u1_): Update comments.
12750 (Output_section::Input_section::u2_): Add new union member poris.
12751 (Output_section::Checkpoint_output_section): New classs definition.
12752 (Output_section::relax_input_section): New method declaration.
12753 (Output_section::checkpoint_): New data member.
12754 (Output_segment): Update comments.
12755 (Output_segment::Output_segment): Un-privatize copy constructor.
12756 (Output_segment::operator=): Un-privatize.
12757 * script-sections.cc (Output_section_element::Input_section_list):
12758 Change element type to Output_section::Simple_input_section.
12759 (Output_section_element_dot_assignment::set_section_addresses):
12760 Register output section data for relaxation clean up.
12761 (Output_data_exression::Output_data_expression): Adjust call to base
12762 constructor to fix data size.
12763 (Output_section_element_data::set_section_addresses): Register
12764 Output_data_expression object for relaxation clean up.
12765 (struct Input_section_info): Replace Relobj pointer and section index
12766 pair with Output_section::Simple_input_section and Convert struct to a
12767 class.
12768 (Input_section_sorter::operator()): Adjust access to
12769 Input_section_info data member to use accessors.
12770 (Output_section_element_input::set_section_addresses): Use layout
12771 parameter. Adjust code to use Output_section::Simple_input_section
12772 and Input_secction_info classes. Register filler for relaxation
12773 clean up.
12774 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12775 and section index pair with Output_section::Simple_input_section
12776 class. Adjust code accordingly.
12777 (Phdrs_element::release_segment): New method definition.
12778 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12779 segment list.
12780 (Script_sections::release_segments): New method definition.
12781 * gold/script-sections.h (Script_sections::release_segments): New
12782 method declaration.
12783 * gold/target.h (Target::may_relax, Target::relax,
12784 Target::do_may_relax, Target::do_relax): New method definitions.
12785
12786 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12787
12788 * arm.cc (has_signed_unsigned_overflow): New function.
12789 (Arm_relocate_functions::abs8): New function.
12790 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12791 (Target_arm::Scan::global): Likewise.
12792 (Target_arm::relocate::relocate): Likewise.
12793 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12794 Likewise.
12795
12796 2009-09-16 Cary Coutant <ccoutant@google.com>
12797
12798 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12799 * testsuite/Makefile.in: Regenerate.
12800
12801 2009-09-11 Nick Clifton <nickc@redhat.com>
12802
12803 * po/gold.pot: Updated by the Translation project.
12804
12805 2009-09-08 Cary Coutant <ccoutant@google.com>
12806
12807 * output.cc (Output_file::open): Add execute permission to empty file.
12808 * testsuite/Makefile.am (permission_test): New test.
12809 * testsuite/Makefile.in: Regenerate.
12810
12811 2009-09-02 Ian Lance Taylor <iant@google.com>
12812
12813 * output.cc (Output_file::resize): Call map_no_anonymous rather
12814 than map.
12815
12816 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12817
12818 * gold.cc: Include "incremental.h".
12819 (queue_initial_tasks): Call Incremental_checker methods.
12820 * incremental.cc: Include "output.h".
12821 (Incremental_checker::can_incrementally_link_output_file): New
12822 method.
12823 * incremental.h (Incremental_checker): New class.
12824
12825 * output.cc (Output_file::open_for_modification): New method.
12826 (Output_file::map_anonymous): Changed return type to bool. Record
12827 map in base_ field.
12828 (Output_file::map_no_anonymous): New method, broken out of map.
12829 (Output_file::map): Use map_no_anonymous and map_anonymous.
12830 * output.h (class Output_file): Update declarations.
12831
12832 2009-08-24 Cary Coutant <ccoutant@google.com>
12833
12834 * options.h (Command_line::Pre_options): New class.
12835 (Command_line::pre_options): New member.
12836 * options.cc (gold::options::ready_to_register): New variable.
12837 (One_option::register_option): Do nothing if not registering options.
12838 Assert if same short option registered twice.
12839 (General_options::General_options): Turn off option registration when
12840 done constructing.
12841 (Command_line::Pre_options::Pre_options): New constructor.
12842
12843 2009-08-24 Cary Coutant <ccoutant@google.com>
12844
12845 * options.h (General_options::no_keep_memory): Remove incorrect
12846 short option.
12847
12848 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12849
12850 * Makefile.am (am__skiplex, am__skipyacc): New.
12851 * Makefile.in: Regenerate.
12852
12853 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12854
12855 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12856 (INCLUDES): ... this.
12857 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12858 (AM_CPPFLAGS): Renamed from ...
12859 (INCLUDE): ... this.
12860 * Makefile.in, testsuite/Makefile.in: Regenerate.
12861
12862 * Makefile.in: Regenerate.
12863 * aclocal.m4: Likewise.
12864 * config.in: Likewise.
12865 * configure: Likewise.
12866 * testsuite/Makefile.in: Likewise.
12867
12868 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12869 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12870 * Makefile.in: Regenerate.
12871 * testsuite/Makefile.in: Regenerate.
12872
12873 2009-08-19 Cary Coutant <ccoutant@google.com>
12874
12875 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12876 symbols in shared libraries overridden by hidden or internal symbols
12877 in the main program.
12878
12879 2009-08-19 Chris Demetriou <cgd@google.com>
12880
12881 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12882 checking source file names in error messages.
12883
12884 2009-08-18 Doug Kwan <dougkwan@google.com>
12885
12886 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12887 an elcpp::Ehdr as parameter. Adjust call to set_target.
12888 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12889 an elfcpp::Ehdr as parameter.
12890 * object.cc (Object::set_target): Remove the version that looks up
12891 a target and sets it.
12892 (Sized_relobj::setup): Take a Target object instead of
12893 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12894 (make_elf_sized_object): Find target and ask target to
12895 make an ELF object.
12896 * object.h: (Object::set_target): Remove the version that looks up
12897 a target and sets it.
12898 (Sized_relobj::setup): Take a Target object instead of
12899 an elfcpp:Ehdr as parameter.
12900 * target.cc: Include dynobj.h.
12901 (Target::do_make_elf_object_implementation): New.
12902 (Target::do_make_elf_object): New.
12903 * target.h (Target::make_elf_object): New template declaration.
12904 (Target::do_make_elf_object): New method declarations.
12905 (Target::do_make_elf_object_implementation): New template declaration.
12906
12907 2009-08-14 Ian Lance Taylor <iant@google.com>
12908
12909 * gold.h (FUNCTION_NAME): Define.
12910 (gold_unreachable): Use FUNCTION_NAME.
12911
12912 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12913
12914 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12915 symbol in the --keep-unique list is not found.
12916
12917 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12918
12919 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12920 been maked as --keep-unique.
12921 (Icf::unfold_section): New function.
12922 * icf.h (Icf::unfold_section): New function.
12923 * options.h (General_options::keep_unique): New option.
12924 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12925 * testsuite/Makefile.in: Regenerate.
12926 * testsuite/icf_keep_unique_test.sh: New file.
12927 * testsuite/icf_keep_unique_test.cc: New file.
12928
12929 2009-08-12 Cary Coutant <ccoutant@google.com>
12930
12931 PR 10471
12932 * resolve.cc (Symbol_table::resolve): Check for references from
12933 dynamic objects to hidden and internal symbols.
12934 * testsuite/Makefile.am (hidden_test.sh): New test.
12935 * testsuite/Makefile.in: Regenerate.
12936 * testsuite/hidden_test.sh: New script.
12937 * testsuite/hidden_test_1.c: New test source.
12938 * testsuite/hidden_test_main.c: New test source.
12939
12940 2009-08-11 Doug Kwan <dougkwan@google.com>
12941
12942 * arm.cc: Update comments.
12943 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12944 segment to locate the .ARM.exidx section if present.
12945
12946 2009-08-09 Doug Kwan <dougkwan@google.com>
12947
12948 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12949 patch.
12950
12951 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12952 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12953 compiler warnings.
12954
12955 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12956
12957 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12958 valid tls_segment only for non-debug-section relocations.
12959 * testsuite/Makefile.am: Add gc_tls_test.
12960 * testsuite/Makefile.in: Regenerate.
12961 * testsuite/gc_tls_test.cc: New file.
12962 * testsuite/gc_tls_test.sh: New file.
12963
12964 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12965
12966 * icf.cc: New file.
12967 * icf.h: New file.
12968 * Makefile.am (CCFILES): Add icf.cc.
12969 (HFILES): Add icf.h
12970 * Makefile.in: Regenerate.
12971 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12972 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12973 section, symbol and addend information for the relocs.
12974 * gold.cc (queue_middle_tasks): Call identical code folding.
12975 * gold.h: Add defines for multimap.
12976 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12977 to the call of finalize_local_symbols.
12978 * main.cc (main): Create object of class Icf.
12979 * object.cc (Sized_relobj::do_layout): Allow this function to be
12980 called twice during icf.
12981 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12982 to sections marked as identical by icf.
12983 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12984 when available.
12985 (Sized_relobj::do_section_entsize): New function.
12986 * object.h (Object::section_entsize): New function.
12987 (Object::do_section_entsize): New pure virtual function.
12988 (Relobj::finalize_local_symbols): Add new parameter.
12989 (Relobj::do_section_entsize): New function.
12990 * options.h (General_options::icf): New option.
12991 (General_options::icf_iterations): New option.
12992 (General_options::print_icf_sections): New option.
12993 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12994 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12995 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12996 icf.
12997 * symtab.cc (Symbol_table::is_section_folded): New function.
12998 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12999 to sections marked as identical by icf.
13000 * symtab.h (Symbol_table::set_icf): New function.
13001 (Symbol_table::icf): New function.
13002 (Symbol_table::is_section_folded): New function.
13003 (Symbol_table::icf_): New data member.
13004 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13005 * testsuite/Makefile.am: Add commands to build icf_test.
13006 * testsuite/Makefile.in: Regenerate.
13007 * testsuite/icf_test.sh: New file.
13008 * testsuite/icf_test.cc: New file.
13009
13010 2009-07-24 Chris Demetriou <cgd@google.com>
13011
13012 * layout.cc (is_compressible_debug_section): Fix incorrect
13013 comment about compressed section names.
13014
13015 2009-07-20 Ian Lance Taylor <ian@airs.com>
13016
13017 PR 10419
13018 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13019
13020 2009-07-16 Ian Lance Taylor <iant@google.com>
13021
13022 PR 10400
13023 * layout.h: #include <map>.
13024 (class Kept_section): Change from struct to class. Add accessors
13025 and setters. Add section size to Comdat_group mapping. Change
13026 Comdat_group to std::map. Add is_comdat_ field. Add
13027 linkonce_size field in union.
13028 (class Layout): Update declaration of find_or_add_kept_section.
13029 Don't declare find_kept_object.
13030 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13031 parameter. Add object, shndx, is_comdat, and is_group_name
13032 parameters. Change all callers. Adjust for new Kept_section.
13033 (Layout::find_kept_object): Remove.
13034 * object.cc (Sized_relobj::include_section_group): Update use of
13035 Kept_section. Rename secnum to shndx. Only record
13036 Kept_comdat_section if sections are the same size.
13037 (Sized_relobj::include_linkonce_section): Update use of
13038 Kept_section. Only record Kept_comdat_section if sections are the
13039 same size. Set size of linkonce section.
13040 (Sized_relobj::map_to_kept_section): Update call to
13041 get_kept_comdat_section.
13042 * object.h (class Sized_relobj): Rename fields in
13043 Kept_comdat_section to drop trailing underscores; change object
13044 field to Relobj*. Change Kept_comdat_section_table to store
13045 struct rather than pointer.
13046 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13047 Add kept_object and kept_shndx parameters. Change all callers.
13048 (Sized_relobj::get_kept_comdat_section): Change return type to
13049 bool. Add kept_object and kept_shndx parameters. Change all
13050 callers.
13051 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13052 Layout::find_or_add_kept_section.
13053
13054 2009-07-09 Ian Lance Taylor <iant@google.com>
13055
13056 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13057 Reserve space in the hash table.
13058
13059 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
13060
13061 * fileread.cc (File_read::get_mtime): New method.
13062 * fileread.h (Timespec): New structure.
13063 (File_read::get_mtime): New method.
13064 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13065 Renamed from timestamp_nsec.
13066 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13067 Elf_Xword.
13068 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13069 timestamp_nsec.
13070 (Incremental_inputs::report_archive): Save mtime; style fix.
13071 (Incremental_inputs::report_obejct): Save mtime; style fix.
13072 (Incremental_inputs::report_script): Save mtime; style fix.
13073 (Incremental_inputs::finalize_inputs): Style fix.
13074 (Incremental_inputs::finalize): Style fix.
13075 (Incremental_inputs::create_input_section_data): Store inputs
13076 mtime.
13077 * incremental.h (Incremental_inputs::report_script): Add mtime
13078 argument.
13079 (Incremental_inputs::Input_info::Input_info): Intialize only one
13080 union member.
13081 (Incremental_inputs::Input_info::archive): Move to nameless
13082 union.
13083 (Incremental_inputs::Input_info::obejct): Move to nameless union.
13084 (Incremental_inputs::Input_info::script): Move to nameless union.
13085 (Incremental_inputs::mtime): New field.
13086 * script.cc (read_input_script): Pass file mtime to
13087 Incremental_input.
13088 * script.h (Script_info::inputs): Style fix.
13089
13090 2009-07-01 Ian Lance Taylor <ian@airs.com>
13091
13092 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13093 instead of 32.
13094
13095 2009-06-24 Ian Lance Taylor <iant@google.com>
13096
13097 PR 10156
13098 * layout.cc (Layout::choose_output_section): If we find an
13099 existing section, update the flags.
13100 (Layout::create_notes): New function, broken out of
13101 Layout::finalize.
13102 (Layout::finalize): Don't create note sections.
13103 (Layout::create_note): Don't crash if linker script discards
13104 section.
13105 (Layout::create_gold_note): Likewise.
13106 (Layout::create_build_id): Likewise. Don't set
13107 after_input_sections on the section.
13108 (Layout::create_executable_stack_info): Remove target parameter.
13109 Change caller.
13110 * layout.h (class Layout): Declare create_notes. Update
13111 declaration of create_executable_stack_info.
13112 * gold.cc (queue_middle_tasks): Call create_notes.
13113 * output.cc (Output_section::update_flags_for_input_section): Move
13114 here from output.h. If SHF_ALLOC flag is newly set, mark address
13115 invalid.
13116 * output.h (Output_data::mark_address_invalid): New function.
13117 (class Output_section): Only declare, not define,
13118 update_flags_for_input_section. Remove set_flags.
13119
13120 2009-06-24 Ian Lance Taylor <iant@google.com>
13121
13122 * script-sections.cc (Output_section_definition::
13123 set_section_addresses): Rename shadowing local load_address to
13124 laddr.
13125
13126 2009-06-24 Ian Lance Taylor <iant@google.com>
13127
13128 PR 10244
13129 * reloc.cc (relocate_sections): Skip empty relocation sections.
13130
13131 2009-06-23 Ian Lance Taylor <iant@google.com>
13132
13133 PR 10156
13134 * layout.cc (Layout::create_note): Use choose_output_section
13135 rather than make_output_section.
13136
13137 2009-06-23 Ian Lance Taylor <iant@google.com>
13138
13139 PR 10237
13140 * options.cc (General_options::parse_V): Set printed_version_.
13141 (General_options::General_options): Initialize printed_version_.
13142 * options.h (class General_options): Add printed_version_ field.
13143 * gold.cc (queue_initial_tasks): If there are no input files,
13144 don't give a fatal error if we printed the version information.
13145 (queue_middle_tasks): If using -r with a shared object, give a
13146 fatal error rather than an ordinary error.
13147
13148 2009-06-23 Ian Lance Taylor <iant@google.com>
13149
13150 PR 10219
13151 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13152 (Layout::make_output_section): Set have_stabstr_section_ if we see
13153 a .stab*str section.
13154 (Layout::finalize): Call link_stabs_sections.
13155 (Layout::link_stabs_sections): New file.
13156 * layout.h (class Layout): Add have_stabstr_section_ field.
13157 Declare link_stabs_sections.
13158
13159 2009-06-23 Doug Kwan <dougkwan@google.com>
13160
13161 * Makefile.am (libgold_a_LIBADD): New.
13162 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13163 * Makefile.in: Regenerate.
13164 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13165 * configure: Regenerate.
13166 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13167 * fileread.cc: Include sys/state.h
13168 * gold.h: Declare memmem and strndup if found missing.
13169 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13170
13171 2009-06-23 Ian Lance Taylor <iant@google.com>
13172
13173 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13174 * configure: Rebuild.
13175
13176 2009-06-23 Ian Lance Taylor <iant@google.com>
13177
13178 PR 10147
13179 * object.cc (Object::section_contents): Don't try to get a view if
13180 the section has length zero.
13181 (Object::handle_gnu_warning_section): If the section is empty, use
13182 the name of the section as the warning.
13183
13184 2009-06-23 Ian Lance Taylor <iant@google.com>
13185
13186 PR 10133
13187 * stringpool.h (class Stringpool_template): Add optimize_ field.
13188 (Stringpool_template::set_optimize): New function.
13189 * stringpool.cc (Stringpool_template::Stringpool_template):
13190 Initialize optimize_ field.
13191 (Stringpool_template::set_string_offsets): Test local optimize
13192 fild rather than parameter.
13193 * layout.cc (Layout::Layout): Call set_optimize on the section
13194 name stringpool.
13195
13196 2009-06-22 Ian Lance Taylor <iant@google.com>
13197
13198 PR 10030
13199 * yyscript.y: Parse TARGET.
13200 * script.cc (script_set_target): New function.
13201 * script-c.h (script_set_target): Declare.
13202 * options.cc (General_options::string_to_object_format): Rename
13203 from string_to_object_format in anonymous namespace. Change
13204 callers.
13205 * options.h (class General_options): Declare
13206 string_to_object_format.
13207
13208 2009-06-22 Ian Lance Taylor <iant@google.com>
13209
13210 * script-sections.cc (Script_sections::create_segments): Don't put
13211 program headers in a PT_LOAD segment if -n or -N.
13212
13213 2009-06-22 Ian Lance Taylor <iant@google.com>
13214
13215 PR 10141
13216 * options.h (class General_options): Add -z lazy and -z now. Sort
13217 -z options into alphabetical order.
13218 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13219
13220 2009-06-21 Ian Lance Taylor <iant@google.com>
13221
13222 * layout.cc (Layout::make_output_section): Call
13223 Target::new_output_section.
13224 (Layout::attach_allocated_section_to_segment): Put large section
13225 sections in a separate load segment with the large segment flag
13226 set.
13227 (Layout::segment_precedes): Sort large data segments after other
13228 load segments.
13229 (align_file_offset): New static function.
13230 (Layout::set_segment_offsets): Use align_file_offset.
13231 * output.h (class Output_section): Add is_small_section_ and
13232 is_large_section_ fields.
13233 (Output_section::is_small_section): New function.
13234 (Output_section::set_is_small_section): New function.
13235 (Output_section::is_large_section): New function.
13236 (Output_section::set_is_large_section): New function.
13237 (Output_section::is_large_data_section): New function.
13238 (class Output_segment): Add is_large_data_segment_ field.
13239 (Output_segment::is_large_data_segment): New function.
13240 (Output_segment::set_is_large_data_segment): New function.
13241 * output.cc (Output_section::Output_section): Initialize new
13242 fields.
13243 (Output_segment::Output_segment): Likewise.
13244 (Output_segment::add_output_section): Add assertion that large
13245 data sections always go in large data segments. Force small data
13246 sections to the end of the list of data sections. Force small BSS
13247 sections to the start of the list of BSS sections. For large BSS
13248 sections to the end of the list of BSS sections.
13249 * symtab.h (class Symbol): Declare is_common_shndx.
13250 (Symbol::is_defined): Check Symbol::is_common_shndx.
13251 (Symbol::is_common): Likewise.
13252 (class Symbol_table): Define enum Commons_section_type. Update
13253 declarations. Add small_commons_ and large_commons_ fields.
13254 * symtab.cc (Symbol::is_common_shndx): New function.
13255 (Symbol_table::Symbol_table): Initialize new fields.
13256 (Symbol_table::add_from_object): Put small and large common
13257 symbols in the right list.
13258 (Symbol_table::sized_finalized_symbol): Check
13259 Symbol::is_common_shndx.
13260 (Symbol_table::sized_write_globals): Likewise.
13261 * common.cc (Symbol_table::do_allocate_commons): Allocate new
13262 common symbol lists. Don't call do_allocate_commons_list if the
13263 list is empty.
13264 (Symbol_table::do_allocate_commons_list): Remove is_tls
13265 parameter. Add comons_section_type parameter. Change all
13266 callers. Handle small and large common symbols.
13267 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13268 Symbol::is_common_shndx.
13269 * resolve.cc (symbol_to_bits): Likewise.
13270 * target.h (Target::small_common_shndx): New function.
13271 (Target::small_common_section_flags): New function.
13272 (Target::large_common_shndx): New function.
13273 (Target::large_common_section_flags): New function.
13274 (Target::new_output_section): New function.
13275 (Target::Target_info): Add small_common_shndx, large_common_shndx,
13276 small_common_section_flags, and large_common_section_flags
13277 fields.
13278 (Target::do_new_output_section): New virtual function.
13279 * arm.cc (Target_arm::arm_info): Initialize new fields.
13280 * i386.cc (Target_i386::i386_info): Likewise.
13281 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13282 Likewise.
13283 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13284 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13285 (Target_x86_64::do_new_output_section): New function.
13286 * configure.ac: Define conditional MCMODEL_MEDIUM.
13287 * testsuite/Makefile.am (check_PROGRAMS): Add large.
13288 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13289 (large_LDFLAGS): Define.
13290 * testsuite/large.c: New file.
13291 * testsuite/testfile.cc (Target_test::test_target_info):
13292 Initialize new fields.
13293 * configure, testsuite/Makefile.in: Rebuild.
13294
13295 2009-06-05 Doug Kwan <dougkwan@google.com>
13296
13297 * Makefile.am (CCFILES): Add target.cc.
13298 * Makefile.in: Regenerate.
13299 * i386.cc (class Target_i386): Define new virtual method to
13300 override do_is_local_label_name in parent.
13301 * object.cc (Sized_relobj::do_count_local_symbols): Discard
13302 local symbols if --discard-locals or -X is given.
13303 * options.h (class General_options): Declare new options
13304 '--discard-locals' and '-X' for discarding locals.
13305 * target.h (class Target): Define new methods is_local_label_name.
13306 Declare new virtual method do_is_local_label_name.
13307 * target.cc: New file.
13308 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13309 (check_SCRIPTS): Add discard_locals_test.sh.
13310 (check_DATA): Add discard_local_tests.syms.
13311 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13312 (discard_local_tests.syms, discard_locals_test.o): New make rules.
13313 * testsuite/Makefile.in: Regenerate.
13314 * testsuite/discard_locals_test.c: New file.
13315 * testsuite/discard_locals_test.sh: Same.
13316
13317 2009-06-05 Doug Kwan <dougkwan@google.com>
13318
13319 * object.cc (Sized_relobj::Sized_relobj): Initialize
13320 discarded_eh_frame_shndx_ to -1U.
13321 (Sized_relobj::do_layout): Record index of a discard .eh_frame
13322 section.
13323 (Sized_relobj::do_count_local_symbols): Skip local symbols in
13324 a discarded .eh_frame section.
13325 (Sized_relobj::do_finalize_local_symbols): Ditto.
13326 * object.h (class Sized_relobj): Declare new member
13327 discarded_eh_frame_shndx_.
13328 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13329 (local_labels_test.o, local_labels_test): New rules.
13330 * testsuite/Makefile.in: Regenerate.
13331
13332 2009-06-04 Doug Kwan <dougkwan@google.com>
13333
13334 * layout.cc (Layout::section_name_mapping): Add mapping for
13335 special ARM sections.
13336
13337 2009-06-03 Doug Kwan <dougkwan@google.com>
13338
13339 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13340 (utils::has_overflow): Same.
13341
13342 2009-06-03 Ian Lance Taylor <iant@google.com>
13343
13344 * layout.cc (Layout::section_name_mapping): New array, replacing
13345 Layout::linkonce_mapping.
13346 (Layout::section_name_mapping_count): New variable, replacing
13347 Layout::linkonce_mapping_count.
13348 (Layout::linkonce_output_name): Remove.
13349 (Layout::output_section_name): Rewrite.
13350 * layout.h (class Layout): Rename Linkonce_mapping to
13351 Section_name_mapping, linkonce_mapping to section_name_mapping,
13352 linkonce_mapping_count to section_name_mapping_count. Don't
13353 declare linkonce_output_name.
13354
13355 2009-06-03 Doug Kwan <dougkwan@google.com>
13356
13357 * gold/arm.cc (namespace utils): New.
13358 (Target_arm::reloc_is_non_pic): Define new method.
13359 (class Arm_relocate_functions): New.
13360 (Target_arm::Relocate::relocate): Handle relocation types used by
13361 Android.
13362
13363 2009-06-03 Ian Lance Taylor <iant@google.com>
13364
13365 * arm.cc (Target_arm::scan::global): Use || instead of |.
13366
13367 2009-06-02 Doug Kwan <dougkwan@google.com>
13368
13369 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
13370 issued_non_pic_error_.
13371 (class Target_arm::Scan): Declare new method check_non_pic.
13372 Define new method symbol_needs_plt_entry.
13373 Declare new data member issued_non_pic_error_.
13374 (class Target_arm::Relocate): Declare new method
13375 should_apply_static_reloc.
13376 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13377 (Target_arm::Scan::check_non_pic): Define new method.
13378 (Target_arm::Scan::local): Handle a small subset of reloc types used
13379 by Android.
13380 (Target_arm::Scan::local): Same.
13381 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13382
13383 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
13384
13385 * incremental.cc (Incremental_inputs::report_command_line): Filter
13386 out --incremental-* options.
13387
13388 2009-05-29 Doug Kwan <dougkwan@google.com>
13389
13390 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13391 template class.
13392 (class Target_arm): Update comment.
13393 (Target_arm::Target_arm): Initialize new data members GOT_,
13394 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13395 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13396 and Target_arm::rel_dyn_section.
13397 Declare new_enum Target_arm::Got_type.
13398 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13399 and DYNBSS_.
13400 Update commments for member do_dynsym_value.
13401 (Target_arm::got_size, Target_arm::plt_section,
13402 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13403 new methods inside class defintion.
13404 (Target_arm::got_section): Define new method.
13405 (Target_arm::rel_dyn_section): Same.
13406 (Output_data_plt_arm): New template class.
13407 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13408 (Output_data_plt_arm:do_adjust_output_section): Define new method.
13409 (Output_data_plt_arm::add_entry): Same.
13410 (Output_data_plt_arm::first_plt_entry): Define new
13411 static data member for PLT instruction template.
13412 (Output_data_plt_arm::plt_entry): Same.
13413 (Output_data_plt_arm::do_write): Define new method.
13414 (Target_arm::make_plt_entry): Same.
13415 (Target_arm::do_finalize_sections): Same.
13416 (Target_arm::do_dynsym_value): Same.
13417
13418 2009-05-28 Doug Kwan <dougkwan@google.com>
13419
13420 * Makefile.am (TARGETSOURCES): Add arm.cc.
13421 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13422 * Makefile.in: Regenerate.
13423 * arm.cc: New file.
13424 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13425
13426 2009-05-26 Doug Kwan <dougkwan@google.com>
13427
13428 * options.cc (General_options::parse_exclude_libs). Fix a comment.
13429 (General_options::check_excluded_libs): Strip off directories in
13430 archive name before matching like GNU ld does.
13431 * testsuite/Makefile.am (MOSTLYCLEANFILES,
13432 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13433 (exclude_libs_test_LDFLAGS): Add linker option
13434 -Wl,--exclude-libs,libexclude_libs_test_3
13435 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13436 an explicit archive without using -l.
13437 (alt/libexclude_libs_test_3.a): New make rule.
13438 * testsuite/Makefile.in: Regenerate.
13439 * testsuite/exclude_libs_test.c : Declare lib3_default().
13440 (main): Call it.
13441 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13442 * exclude_libs_test_3.c: New file.
13443
13444 2009-05-26 Nick Clifton <nickc@redhat.com>
13445
13446 * po/id.po: New Indonesian translation.
13447 * po/gold.pot: Updated template file.
13448
13449 2009-05-22 Sriraman Tallam <tmsriram@google.com>
13450
13451 * testsuite/Makefile.am: Add -ffunction-sections to compile
13452 gc_comdat_test files. Add -Wl,--gc-sections to build
13453 gc_comdat_test.
13454 * testsuite/Makefile.in: Regenerate.
13455 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13456
13457 2009-05-21 Sriraman Tallam <tmsriram@google.com>
13458
13459 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13460 kept comdat section was garbage collected.
13461 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13462 * testsuite/Makefile.in: Regenerate.
13463 * testsuite/gc_comdat_test.sh: New file.
13464 * testsuite/gc_comdat_test_1.cc: New file.
13465 * testsuite/gc_comdat_test_2.cc: New file.
13466
13467 2009-05-19 Doug Kwan <dougkwan@google.com>
13468
13469 * archive.cc (Archive::Archive): Move constructor from archive.h
13470 to here. Initialize no_export_.
13471 (Archive::get_elf_object_for_member): Set no_export flag of object.
13472 * archive.h (Archive::Archive): Move constructor body to
13473 archive.cc.
13474 (Archive::no_export): New method.
13475 (Archive::no_export_): New field.
13476 * object.h (Object::Object): Initialize no_export_ to false.
13477 (Object::no_export, Object::set_no_export): New methods.
13478 (Object::no_export_): New field.
13479 * options.cc (General_options::parse_exclude_libs): New method.
13480 (General_options::check_excluded_libs) Same.
13481 * options.h (exclude_libs): New option.
13482 (General_options::check_excluded_libs): New method declaration.
13483 (General_options::excluded_libs_): New field.
13484 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13485 default or protected visibility if an object has no-export flag set.
13486 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13487 (check_SCRIPTS): Add exclude_libs_test.sh.
13488 (check_DATA): Add exclude_libs_test.syms.
13489 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13490 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13491 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13492 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13493 (exclude_libs_test.syms, libexclude_libs_test_1.a,
13494 libexclude_libs_test_2.a): New rules.
13495 * testsuite/Makefile.in: Regenerate.
13496 * testsuite/exclude_libs_test.c: New file.
13497 * testsuite/exclude_libs_test.sh: Ditto.
13498 * testsuite/exclude_libs_test_1.c: Ditto.
13499 * testsuite/exclude_libs_test_2.c: Ditto.
13500
13501 2009-05-15 Ian Lance Taylor <iant@google.com>
13502
13503 * configure.ac: Check for declarations for cases where libiberty.h
13504 checks HAVE_DECL_xxx.
13505 * configure, config.in: Rebuild.
13506
13507 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
13508
13509 * gold.h (Incremental_argument_list): Remove (invalid) forward
13510 declaration.
13511 * incremental.cc (Incremental_inputs::report_achive): New method.
13512 (Incremental_inputs::report_object): New method.
13513 (Incremental_inputs::report_script): New method.
13514 (Incremental_inputs::finalize_inputs): New method.
13515 (Incremental_inputs::finalize): Call finalize_inputs().
13516 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13517 Create inputs entries.
13518 * incremental.h (Incremental_input_type): New enum.
13519 (Incremental_inputs::Incremental_input): Initialize new fields.
13520 (Incremental_inputs::report_inputs): New method.
13521 (Incremental_inputs::report_achive): New method.
13522 (Incremental_inputs::report_object): New method.
13523 (Incremental_inputs::report_script): New method.
13524 (Incremental_inputs::finalize_inputs): New method.
13525 (Incremental_inputs::Input_info): New struct.
13526 (Incremental_inputs::Input_info_map): New typedef.
13527 (Incremental_inputs::lock_): New field.
13528 (Incremental_inputs::Inputs_): New field.
13529 (Incremental_inputs::Inputs_map): New field.
13530 * main.cc (main): Call Incremental_input::report_inputs.
13531 * options.h (Input_argument_list): Typedef moved from
13532 Input_arguments.
13533 (Input_file_group::Files): Remove, use ::Input_argument_list.
13534 (Input_file_group::Input_argument_list): Remove, use
13535 ::Input_argument_list.
13536 * plugin.cc (Plugin_manager::add_input_file): Add error in
13537 incremental build.
13538 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13539 functions.
13540 * script.cc (read_input_script): Call
13541 Incremental_input::report_script.
13542 * script.h (Script_info): New class.
13543
13544 2009-04-27 Ian Lance Taylor <iant@google.com>
13545
13546 * x86_64.cc (do_adjust_output_section): Set entsize to
13547 plt_entry_size.
13548
13549 2009-04-23 Elliott Hughes <enh@google.com>
13550
13551 * output.cc (Output_file::close): After short writes, continue
13552 writing from the correct offset in the buffer being written.
13553
13554 2009-04-23 Chris Demetriou <cgd@google.com>
13555
13556 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13557 * configure: Regenerate.
13558 * config.in: Regenerate.
13559 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13560 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13561
13562 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
13563
13564 * incremental.cc (Incremental_inputs_header_data): Renamed from
13565 Incremental_input_header_data.
13566 (Incremental_inputs_header_data::data_size): New field.
13567 (Incremental_inputs_header_data::put_input_file_count): Renamed
13568 from input_file_count.
13569 (Incremental_inputs_header_data::put_command_line_offset): Renamed
13570 from command_line_offset.
13571 (Incremental_inputs_header_data::put_reserved): Renamed from
13572 put_reserved.
13573 (Incremental_inputs_entry_data): Renamed from
13574 Incremental_input_entry_data.
13575 (Incremental_inputs_entry_data::data_size): New field.
13576 (Incremental_inputs::report_command_line): New method.
13577 (Incremental_inputs::finalize): New method.
13578 (Incremental_inputs::create_incremental_inputs_data): New method.
13579 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13580 * incremental.h: New file.
13581 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13582 (Layout::finalize): Create incremental inputs section in
13583 incremental builds.
13584 (Layout::create_incremental_info_sections): New method.
13585 * layout.h (Layout::incremental_inputs): New method.
13586 (Layout::create_incremental_info_sections): New method.
13587 (Layout::incremental_inputs_): New field.
13588 * main.cc (main): Notify Incremental_input of the command line.
13589
13590 2009-04-01 Ian Lance Taylor <iant@google.com>
13591 Mikolaj Zalewski <mikolajz@google.com>
13592
13593 * gold.h (reserve_unordered_map): Define, three versions, one for
13594 each version of Unordered_map.
13595 * layout.cc (Layout::Layout): Remove options parameter. Add
13596 number_of_input_files parameter. Don't initialize options_.
13597 Initialize number_of_input_files_ and resized_signatures_. Move
13598 sections_are_attached_.
13599 (Layout::layout_group): Reserve space for group_signatures_.
13600 (Layout::find_or_add_kept_section): Change name parameter to be a
13601 reference. Resize signatures_ map when it gets large enough.
13602 (Layout::layout_eh_frame): Use parameters->options() instead of
13603 this->options_.
13604 (Layout::make_output_section): Likewise.
13605 (Layout::attach_allocated_section_to_segment): Likewise.
13606 (Layout::finalize, Layout::create_executable_stack): Likewise.
13607 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13608 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13609 * layout.h (class Layout): Update declarations. Remove options_
13610 field. Add number_of_input_files_ and resized_signatures_
13611 fields. Move sections_are_attached_ field.
13612 * main.cc (main): Pass number of input files to Layout
13613 constructor. Don't pass options.
13614
13615 2009-03-30 Ian Lance Taylor <iant@google.com>
13616
13617 * ffsll.c (ffsll): Correct implementation.
13618
13619 2009-03-27 Ian Lance Taylor <iant@google.com>
13620
13621 * ffsll.c: New file.
13622 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13623 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13624 * ftruncate.c (ftruncate): Declare before definition.
13625 * mremap.c (mremap): Likewise.
13626 * pread.c (pread): Likewise.
13627 * configure, Makefile.in, config.in: Rebuild.
13628
13629 * mremap.c: New file.
13630 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13631 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13632 (mremap): Declare if HAVE_MREMAP is not defined.
13633 * configure, Makefile.in, config.in: Rebuild.
13634
13635 2009-03-27 Cary Coutant <ccoutant@google.com>
13636
13637 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13638 position independent.
13639 * sparc.cc (Target_sparc::check_non_pic): Likewise.
13640 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13641
13642 2009-03-24 Cary Coutant <ccoutant@google.com>
13643
13644 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13645 an executable.
13646 (needs_dynamic_reloc): Likewise.
13647
13648 2009-03-24 Ian Lance Taylor <iant@google.com>
13649
13650 * yyscript.y (file_cmd): Recognize EXTERN.
13651 (extern_name_list, extern_name_list_body): New nonterminals.
13652 * script.cc (script_add_extern): Define.
13653 * script-c.h (script_add_extern): Declare.
13654
13655 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13656
13657 * object.cc (is_elf_object): Define.
13658 * object.h (is_elf_object): Declare.
13659 * archive.cc (Archive::get_elf_object_for_member): Call
13660 is_elf_object.
13661 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13662
13663 2009-03-24 Elliott Hughes <enh@google.com>
13664
13665 * output.cc (Output_file::map_anonymous): Define.
13666 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13667 try an anonymous one. Report the size if the mmap fails.
13668 * output.h (class Output_file): Declare map_anonymous.
13669
13670 2009-03-24 Ian Lance Taylor <iant@google.com>
13671
13672 * target-select.cc (instantiate_target): Don't acquire the lock if
13673 the instantiated_target_ field has already been set.
13674
13675 2009-03-23 Ian Lance Taylor <iant@google.com>
13676
13677 * gold-threads.h (class Initialize_lock): Define.
13678 * gold-threads.cc (class Initialize_lock_once): Define.
13679 (initialize_lock_control): New static variable.
13680 (initialize_lock_pointer): New static variable.
13681 (initialize_lock_once): New static function.
13682 (Initialize_lock::Initialize_lock): Define.
13683 (Initialize_lock::initialize): Define.
13684 * target-select.h: Include "gold-threads.h".
13685 (class Target_selector): Add lock_ and initialize_lock_ fields.
13686 Don't define instantiate_target, just declare it.
13687 * target-select.cc (Target_selector::Target_selector): Initialize
13688 new fields.
13689 (Target_selector::instantiate_target): Define.
13690 * descriptors.h: Include "gold-threads.h".
13691 (class Descriptors): Add initialize_lock_ field.
13692 * descriptors.cc (Descriptors::Descriptors): Initialize new
13693 field.
13694 (Descriptors::open): Use initialize_lock_ field
13695 * errors.h (class Errors): Add initialize_lock_ field.
13696 * errors.cc (Errors::Errors): Initialize new field.
13697 (Errors::initialize_lock): Use initialize_lock_ field.
13698 * powerpc.cc (class Target_selector_powerpc): Remove
13699 instantiated_target_ field. In do_recognize call
13700 instantiate_target rather than do_instantiate_target. In
13701 do_instantiate_target just allocate a new target.
13702 * sparc.cc (class Target_selector_sparc): Likewise.
13703
13704 * freebsd.h: New file.
13705 * i386.cc: Include "freebsd.h".
13706 (Target_i386): Derive from Target_freebsd rather than
13707 Sized_target.
13708 (Target_selector_i386): Derive from Target_selector_freebsd rather
13709 than Target_selector.
13710 * x86_64.cc: Include "freebsd.h".
13711 (Target_x86_64): Derive from Target_freebsd rather than
13712 Sized_target.
13713 (Target_selector_x86_64): Derive from Target_selector_freebsd
13714 rather than Target_selector.
13715 * target.h (class Target): Add adjust_elf_header and
13716 do_adjust_elf_header.
13717 * output.cc (Output_file_header:: do_sized_write): Call target
13718 adjust_elf_header routine.
13719 * configure.tgt: Set targ_osabi.
13720 * configure.ac: Define GOLD_DEFAULT_OSABI.
13721 * parameters.cc (Parameters::default_target): Pass
13722 GOLD_DEFAULT_OSABI to select_target.
13723 * target-select.h (class Target_selector): Make instantiate_target
13724 protected rather than private.
13725 * Makefile.am (HFILES): Add freebsd.h.
13726 * configure, Makefile.in, config.in: Rebuild.
13727
13728 * merge.cc (do_add_input_section): Correct pend value. Change
13729 message about last entry not being null terminated from error to
13730 warning.
13731
13732 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13733
13734 * incremental.cc: New file.
13735 * Makefile.am (CCFILES): Add incremental.cc.
13736 * Makefile.in: Rebuild.
13737
13738 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13739
13740 * layout.cc (Layout::output_section_name): Preserve names
13741 of '.note.' sections.
13742
13743 2009-03-19 Ian Lance Taylor <iant@google.com>
13744
13745 * descriptors.cc (Descriptors::open): Check that the options are
13746 valid before using them.
13747
13748 2009-03-18 Ian Lance Taylor <iant@google.com>
13749
13750 * script-sections.h: Include <list>.
13751 (class Script_sections): Change Sections_elements from std::vector
13752 to std::list. Typedef public Elements_iterator. Add
13753 orphan_section_placement_, data_segment_align_start_, and
13754 saw_data_segment_align_ fields. Remove data_segment_align_index_
13755 field.
13756 * script-sections.cc (class Orphan_section_placement): New class.
13757 (class Sections_element): Add virtual functions is_relro and
13758 orphan_section_init. Remove virtual function place_orphan_here.
13759 (class Output_section_definition): Add is_relro and
13760 orphan_section_init. Remove place_orphan_here.
13761 (class Orphan_output_section): Likewise.
13762 (Script_sections::Script_sections): Update for field changes.
13763 (Script_sections::data_segment_align): Set saw_data_segment_align_
13764 and data_segment_align_start_, not data_segment_align_index.
13765 (Script_sections::data_segment_relro_end): Check
13766 saw_data_segment_align_. Use data_segment_align_start_ rather
13767 than data_segment_align_index_.
13768 (Script_sections::place_orphan): Rewrite to use
13769 Orphan_section_placement.
13770
13771 2009-03-17 Ian Lance Taylor <iant@google.com>
13772
13773 * archive.cc (Archive::add_symbols): Check for a version attached
13774 to the symbol name in the archive map.
13775 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13776 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13777 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13778 (ver_test_11.a): New target.
13779 * testsuite/Makefile.in: Rebuild.
13780
13781 * configure.ac: Check for chsize and posix_fallocate. Replace
13782 ftruncate.
13783 * ftruncate.c: New file, from gnulib.
13784 * output.cc (posix_fallocate): Define dummy version if not
13785 HAVE_POSIX_FALLOCATE.
13786 (Output_file::map): Call posix_fallocate rather than lseek and
13787 write.
13788 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13789 * configure, Makefile.in, config.in: Rebuild.
13790
13791 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13792
13793 * layout.h (Layout::create_note): Add section_name parameter.
13794 * layout.cc (Layout::create_note): Likewise.
13795 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13796
13797 2009-03-17 Ian Lance Taylor <iant@google.com>
13798
13799 * descriptors.cc: Include "options.h".
13800 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13801 (Descriptors::open): Always use O_CLOEXEC when opening a new
13802 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13803 then set FD_CLOEXEC.
13804
13805 * sparc.cc (class Target_sparc): Add has_got_section.
13806 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13807 make sure we have a GOT section.
13808
13809 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13810 (Target_sparc::Scan::local): Likewise.
13811 (Target_sparc::Scan::global): Likewise.
13812 (Target_sparc::Relocate::relocate): Likewise.
13813 (Target_sparc::Relocate::relocate_tls): Likewise.
13814
13815 * symtab.cc (Symbol_table::define_default_version): New function,
13816 broken out of add_from_object.
13817 (Symbol_table::add_from_object): Call define_default_version.
13818 (Symbol_table::define_special_symbol): Add resolve_oldsym
13819 parameter. Change all callers. If the version for a symbol comes
13820 from a version script, resolve it with the symbol with the same
13821 name with no version. Also add the symbol without a version if
13822 appropriate.
13823 (do_define_in_output_data): If resolving with oldsym, don't delete
13824 sym.
13825 (do_define_in_output_segment): Likewise.
13826 (do_define_as_constant): Likewise.
13827 * symtab.h (class Symbol_table): Update declarations.
13828
13829 2009-03-13 Ian Lance Taylor <iant@google.com>
13830
13831 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13832 (Read_symbols::requeue): New function.
13833 (Read_symbols::do_read_symbols): If make_elf_object fails because
13834 the target type is not configured, and the file was searched for,
13835 issue a warning and retry with the next directory.
13836 (Add_symbols::run): If the file has an incompatible format, and
13837 it was searched for, requeue the Read_symbols task. On error,
13838 release the object.
13839 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13840 dirindex parameter to constructor. Change all callers. Declare
13841 incompatible_warning and requeue.
13842 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13843 input_argument_ and input_group_ fields. Add them to
13844 constructor. Change all callers.
13845 (class Read_script): Add dirindex_ field. Add it to constructor.
13846 Change all callers.
13847 * archive.cc (Archive::setup): Remove input_objects parameter.
13848 Change all callers.
13849 (Archive::get_file_and_offset): Likewise.
13850 (Archive::read_all_symbols): Likewise.
13851 (Archive::read_symbols): Likewise.
13852 (Archive::get_elf_object_for_member): Remove input_objects
13853 parameter. Add punconfigured parameter. Change all callers.
13854 (Archive::add_symbols): Change return type to bool. Check return
13855 value of include_member.
13856 (Archive::include_all_members): Likewise.
13857 (Archive::include_member): Change return type to bool. Return
13858 false if first included object has incompatible target. Set
13859 included_member_ field.
13860 (Add_archive_symbols::run): If add_symbols returns false, requeue
13861 Read_symbols task.
13862 * archive.h (class Archive): Add included_member_ field.
13863 Initialize it in constructor. Add input_file and searched_for
13864 methods. Update declarations.
13865 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13866 input_argument_ fields. Add them to constructor. Change all
13867 callers.
13868 * script.cc: Include "target-select.h".
13869 (class Parser_closure): Add skip_on_incompatible_target_ and
13870 found_incompatible_target_ fields. Add
13871 skip_on_incompatible_target parameter to constructor. Change all
13872 callers. Add methods skip_on_incompatible_target,
13873 clear_skip_on_incompatible_target, found_incompatible_target, and
13874 set_found_incompatible_target.
13875 (read_input_script): Add dirindex parameter. Change all callers.
13876 If parser finds an incompatible target, requeue Read_symbols
13877 task.
13878 (script_set_symbol): Clear skip_on_incompatible_target in
13879 closure.
13880 (script_add_assertion, script_parse_option): Likewise.
13881 (script_start_sections, script_add_phdr): Likewise.
13882 (script_check_output_format): New function.
13883 * script.h (read_input_script): Update declaration.
13884 * script-c.h (script_check_output_format): Declare.
13885 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13886 (ignore_cmd): Remove OUTPUT_FORMAT.
13887 * fileread.cc (Input_file::Input_file): Add explicit this.
13888 (Input_file::will_search_for): New function.
13889 (Input_file::open): Add pindex parameter. Change all callers.
13890 * fileread.h (class Input_file): Add input_file_argument method.
13891 Declare will_search_for. Update declarations.
13892 * object.cc (make_elf_object): Add punconfigured parameter.
13893 Change all callers.
13894 * object.h (class Object): Make input_file public. Add
13895 searched_for method.
13896 (make_elf_object): Update declaration.
13897 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13898 restart search.
13899 * dirsearch.h (class Dirsearch): Update declaration.
13900 * options.h (class General_options): Add --warn-search-mismatch.
13901 * parameters.cc (Parameters::is_compatible_target): New function.
13902 * parameters.h (class Parameters): Declare is_compatible_target.
13903 * workqueue.cc (Workqueue::add_blocker): New function.
13904 * workqueue.h (class Workqueue): Declare add_blocker.
13905
13906 * fileread.cc (Input_file::open): Remove options parameter.
13907 Change all callers.
13908 (Input_file::open_binary): Likewise.
13909 * script.cc (read_input_script): Likewise.
13910 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13911 options parameter from constructor. Change all callers.
13912 (class Read_script): Likewise.
13913 * fileread.h (class Input_file): Update declarations.
13914 * script.h (read_input_script): Update declaration.
13915
13916 2009-03-10 Nick Clifton <nickc@redhat.com>
13917
13918 * po/es.po: New Spanish translation.
13919
13920 2009-03-06 Cary Coutant <ccoutant@google.com>
13921
13922 * options.cc (parse_short_option): Keep dash_z from registering itself.
13923
13924 2009-03-03 Ian Lance Taylor <iant@google.com>
13925
13926 PR 9918
13927 * target-reloc.h (relocate_section): Pass output_section to
13928 relocate.
13929 * i386.cc (Target_i386::should_apply_static_reloc): Add
13930 output_section parameter. Change all callers.
13931 (Target_i386::Relocate::relocate): Add output_section parameter.
13932 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13933 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13934 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13935 * testsuite/two_file_shared.sh: New script.
13936 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13937 (check_DATA): Add two_file_shared.dbg.
13938 (two_file_shared.dbg): New target.
13939 * testsuite/Makefile.in: Rebuild.
13940
13941 2009-03-01 Ian Lance Taylor <iant@google.com>
13942
13943 * configure.ac: Check for byteswap.h.
13944 * configure: Rebuild.
13945 * config.in: Rebuild.
13946
13947 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13948
13949 * layout.cc (Layout::find_or_add_kept_section): New function.
13950 (Layout::add_comdat): Removed.
13951 * layout.h (struct Kept_section): Move out of class Layout.
13952 Remove trailing underscores from field names. Add group_sections
13953 field. Rename group_ field to is_group. Change all uses.
13954 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13955 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13956 comdat_groups_ field.
13957 (Sized_relobj::include_section_group): Use
13958 find_or_add_kept_section and Kept_section::group_sections.
13959 (Sized_relobj::include_linkonce_section): Likewise.
13960 * object.cc (class Sized_relobj): Don't define Comdat_group or
13961 Comdat_group_table. Remove find_comdat_group and
13962 add_comdat_group. Remove comdat_groups_ field.
13963 * plugin.cc (include_comdat_group): Use
13964 Layout::find_or_add_kept_section.
13965
13966 2009-02-28 Ian Lance Taylor <iant@google.com>
13967
13968 * README: --gc-sections and map files are now supported. Document
13969 some build requirements.
13970
13971 PR 6992
13972 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13973 relocatable link set the value of the section symbol to zero.
13974 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13975 relocatable link don't include the section address in the local
13976 symbol value.
13977
13978 2009-02-27 Ian Lance Taylor <iant@google.com>
13979
13980 PR 6811
13981 * options.h (class Search_directory): Add is_system_directory.
13982 (class General_options): Declare is_in_system_directory.
13983 * options.cc (get_relative_sysroot): Make static.
13984 (get_default_sysroot): Make static.
13985 (General_optoins::is_in_system_directory): New function.
13986 * fileread.cc (Input_file::is_in_system_directory): New function.
13987 * fileread.h (class Input_file): Declare is_in_system_directory.
13988 * object.h (class Object): Add is_in_system_directory.
13989 (class Input_objects): Remove system_library_directory_ field.
13990 * object.cc (Input_objects::add_object): Don't set
13991 system_library_directory_.
13992 (input_objects::found_in_system_library_directory): Remove.
13993 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13994 parameter. Change all callers.
13995 (Symbol_table::sized_write_globals): Likewise.
13996 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13997 Call Object::is_in_system_directory.
13998 * symtab.h (class Symbol_table): Update declarations.
13999
14000 PR 5990
14001 * descriptors.h (Open_descriptor): Add is_on_stack field.
14002 * descriptors.cc (Descriptors::open): If the descriptor is on the
14003 top of the stack, remove it. Initialize is_on_stack field.
14004 (Descriptors::release): Only add pod to stack if it is not on the
14005 stack already.
14006 (Descriptors::close_some_descriptor): Clear stack_next and
14007 is_on_stack fields.
14008
14009 PR 7091
14010 * output.cc (Output_section::find_starting_output_address): Rename
14011 from starting_output_address; add PADDR parameter; change return
14012 type.
14013 * output.h (class Output_section): Declare
14014 find_starting_output_address instead of starting_output_address.
14015 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14016 section symbol for which we can't find a merge section.
14017
14018 PR 9836
14019 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14020 hidden or internal, force the symbol to be local.
14021 * resolve.cc (Symbol::override_visibility): Define.
14022 (Symbol::override_base): Use override_visibility.
14023 (Symbol_table::resolve): Likewise.
14024 (Symbol::override_base_with_special): Likewise.
14025 (Symbol_table::override_with_special): If the visibility is hidden
14026 or internal, force the symbol to be local.
14027 * symtab.h (class Symbol): Add set_visibility and
14028 override_visibility.
14029 * testsuite/ver_test_1.sh: New file.
14030 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14031 (check_DATA): Add ver_test_1.syms.
14032 (ver_test_1.syms): New target.
14033 * testsuite/Makefile.in: Rebuild.
14034
14035 2009-02-25 Cary Coutant <ccoutant@google.com>
14036
14037 * layout.cc (Layout::choose_output_section): Don't rename sections
14038 when using a linker script that has a SECTIONS clause.
14039 * Makefile.in: Regenerate.
14040
14041 * testsuite/Makefile.am (script_test_5.sh): New test case.
14042 * testsuite/Makefile.in: Regenerate.
14043 * testsuite/script_test_5.cc: New file.
14044 * testsuite/script_test_5.sh: New file.
14045 * testsuite/script_test_5.t: New file.
14046
14047 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14048
14049 * archive.cc (Archive::include_member): Update calls to add_symbols.
14050 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14051 the Layout argument.
14052 * dynobj.h (do_add_symbols): Add the Layout argument.
14053 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14054 Layout argument.
14055 * object.h (Object::add_symbols): Add the Layout argument.
14056 (Object::do_add_symbols): Add the Layout argument.
14057 (Sized_relobj::do_add_symbols): Add the Layout argument.
14058 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14059 Unify the two versions.
14060 (Add_plugin_symbols): Remove.
14061 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14062 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14063 (Add_plugin_symbols): Remove.
14064 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14065 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14066 (Add_symbols::run): Make it work with Pulginobj.
14067
14068 2009-02-06 Ian Lance Taylor <iant@google.com>
14069
14070 * object.cc (Sized_relobj::do_layout): Make info message start
14071 with lower case letter.
14072
14073 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
14074
14075 * binary.cc: Fix file comment.
14076
14077 * options.h (enum Incremental_disposition): Define.
14078 (class General_options): Add new options: --incremental,
14079 --incremental_changed, --incremental_unchanged,
14080 --incremental_unknown. Add incremental_disposition_ and
14081 implicit_incremental_ fields.
14082 (General_options::incremental_disposition): New function.
14083 (class Position_dependent_options): Add incremental_disposition
14084 option.
14085 (Position_dependent_options::copy_from_options): Set incremental
14086 dispositions.
14087 * options.cc (General_options::parse_incremental_changed): New
14088 function.
14089 (General_options::parse_incremental_unchanged): New function.
14090 (General_options::parse_incremental_unknown): New function.
14091 (General_options::General_options): Initialize new fields
14092 incremental_disposition_ and implicit_incremental_.
14093 (General_options::finalize): Check for uasge of --incremental-*
14094 without --incremental.
14095
14096 2009-02-06 Chris Demetriou <cgd@google.com>
14097
14098 * gold.h (gold_undefined_symbol): Change to take only a Symbol
14099 pointer and to report location as the file name associated with
14100 the symbol.
14101 (gold_undefined_symbol_at_location): New function to replace the
14102 old gold_undefined_symbol functionality.
14103 * target-reloc.h (relocate_section): Update to use
14104 gold_undefined_symbol_at_location.
14105 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14106 Call gold_undefined_symbol function rather than gold_error.
14107 * errors.h (Errors::undefined_symbol): Take location as a
14108 string, rather than calculating it from a relocation.
14109 * errors.cc (Errors::fatal): Print "fatal error:" before the
14110 formatted message.
14111 (Errors::error, Errors::error_at_location): Print "error: "
14112 before the formatted message.
14113 (Errors::undefined_symbol): Take location as a string, rather
14114 than calculating it from a relocation.
14115 (gold_undefined_symbol_at_location): New function akin to
14116 old gold_undefined_symbol, calculates location from relocation.
14117 (gold_undefined_symbol): Change to take only a Symbol pointer
14118 and to report location as the file name associated with the symbol.
14119 * testsuite/debug_msg.sh: Update for changed error messages.
14120 * testsuite/undef_symbol.sh: Likewise.
14121
14122 2009-02-04 Duncan Sands <baldrick@free.fr>
14123
14124 PR 9812
14125 * reduced_debug_output.h
14126 (Output_reduced_debug_abbrev_section::failed): Use format for
14127 gold_warning.
14128 (Output_reduced_debug_info_section::faild): Likewise.
14129
14130 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
14131
14132 * script.cc (Lazy_demangler): New class.
14133 (Version_script_info::get_symbol_version_helper): Demangle a
14134 symbol only once.
14135
14136 2009-01-29 Cary Coutant <ccoutant@google.com>
14137
14138 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14139 to __tls_get_addr.
14140 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14141
14142 2009-01-28 Ian Lance Taylor <iant@google.com>
14143
14144 * version.cc (version_string): Bump to 1.9.
14145
14146 * gold.h: Include <cstring> and <stdint.h>.
14147 * version.cc: Include <cstdio>.
14148 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14149 warning.
14150 * reduced_debug_output.cc (insert_into_vector): Rename from
14151 Insert_into_vector; change all callers. Use Swap_unaligned to
14152 avoid aliasing issue; remove union since it is unnecessary.
14153
14154 2009-01-27 Sriraman Tallam <tmsriram@google.com>
14155
14156 * Makefile.am (CCFILES): Add gc.cc.
14157 (HFILES): Add gc.h.
14158 * Makefile.in: Regenerate.
14159 * gold.cc (Gc_runner): New class.
14160 (queue_initial_tasks): Call garbage collection related tasks
14161 when corresponding options are invoked.
14162 (queue_middle_gc_tasks): New function.
14163 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14164 processed early before laying out sections during garbage collection.
14165 * gold.h (queue_middle_gc_tasks): New function.
14166 (is_prefix_of): Move from "layout.cc".
14167 * i386.cc (Target_i386::gc_process_relocs): New function.
14168 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14169 * main.cc (main): Create object of class "Garbage_collection".
14170 * object.cc (Relobj::copy_symbols_data): New function.
14171 (Relobj::is_section_name_included): New function.
14172 (Sized_relobj::do_layout): Allow this function to be called twice
14173 during garbage collection and defer layout of section during the
14174 first call.
14175 * object.h (Relobj::get_symbols_data): New function.
14176 (Relobj::is_section_name_included): New function.
14177 (Relobj::copy_symbols_data): New function.
14178 (Relobj::set_symbols_data): New function.
14179 (Relobj::get_relocs_data): New function.
14180 (Relobj::set_relocs_data): New function.
14181 (Relobj::is_output_section_offset_invalid): New pure virtual function.
14182 (Relobj::gc_process_relocs): New function.
14183 (Relobj::do_gc_process_relocs): New pure virtual function.
14184 (Relobj::sd_): New data member.
14185 (Sized_relobj::is_output_section_offset_invalid): New function.
14186 (Sized_relobj::do_gc_process_relocs): New function.
14187 * options.h (General_options::gc_sections): Modify to not be a no-op.
14188 (General_options::print_gc_sections): New option.
14189 * plugin.cc (Plugin_finish::run): Remove function call to
14190 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
14191 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14192 * reloc.cc (Read_relocs::run): Add task to process relocs and
14193 determine unreferenced sections when doing garbage collection.
14194 (Gc_process_relocs): New class.
14195 (Sized_relobj::do_gc_process_relocs): New function.
14196 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14197 sections that are garbage collected.
14198 * reloc.h (Gc_process_relocs): New class.
14199 * sparc.cc (Target_sparc::gc_process_relocs): New function.
14200 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14201 symbols whose corresponding sections are garbage collected.
14202 (Symbol_table::Symbol_table): Add new parameter for the garbage
14203 collection object.
14204 (Symbol_table::gc_mark_undef_symbols): New function.
14205 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14206 (Symbol_table::gc_mark_dyn_syms): New function.
14207 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14208 as garbage.
14209 (Symbol_table::add_from_object): Likewise.
14210 (Symbol_table::add_from_relobj): When building shared objects, do not
14211 treat externally visible symbols as garbage.
14212 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14213 table information for static and relocatable links.
14214 * symtab.h (Symbol_table::set_gc): New function.
14215 (Symbol_table::gc): New function.
14216 (Symbol_table::gc_mark_undef_symbols): New function.
14217 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14218 (Symbol_table::gc_mark_dyn_syms): New function.
14219 (Symbol_table::gc_): New data member.
14220 * target.h (Sized_target::gc_process_relocs): New pure virtual
14221 function.
14222 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14223 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14224
14225 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
14226
14227 * options.h (General_options::gc_sections): Define as a no-op for now.
14228 (General_options::no_keep_memory): Ditto.
14229 (General_options::Bshareable): Define.
14230 * options.cc (General_options::finalize): Honor -Bshareable.
14231
14232 2009-01-20 Andreas Schwab <schwab@suse.de>
14233
14234 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14235 read the value in the contents, since we don't use it. Use the
14236 template endianness when writing.
14237 (Relocate::relocate): Use it for R_PPC_REL16_HA.
14238
14239 2009-01-19 Andreas Schwab <schwab@suse.de>
14240
14241 * configure.tgt (powerpc64-*): Fix targ_obj.
14242
14243 2009-01-15 Ian Lance Taylor <iant@google.com>
14244
14245 * object.cc (Sized_relobj::write_local_symbols): Don't write out
14246 local symbols when stripping all symbols.
14247
14248 2009-01-14 Cary Coutant <ccoutant@google.com>
14249
14250 * output.cc (Output_reloc): Add explicit instantiations.
14251
14252 2009-01-14 Cary Coutant <ccoutant@google.com>
14253
14254 * archive.cc (Archive::get_elf_object_for_member): Remove call
14255 to File_read::claim_for_plugin.
14256 * descriptors.cc (Descriptors::open): Remove reference to
14257 is_claimed.
14258 (Descriptors::claim_for_plugin): Remove.
14259 * descriptors.h (Descriptors::claim_for_plugin): Remove.
14260 (Descriptors::is_claimed): Remove.
14261 (claim_descriptor_for_plugin): Remove.
14262 * fileread.cc (File_read::claim_for_plugin): Remove.
14263 * fileread.h (File_read::claim_for_plugin): Remove.
14264 (File_read::descriptor): Reopen descriptor if necessary.
14265 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
14266 (Plugin_manager::all_symbols_read): Add task parameter. Change
14267 all callers.
14268 (Plugin_manager::get_input_file): New function.
14269 (Plugin_manager::release_input_file): New function.
14270 (Pluginobj::Pluginobj): Add filesize parameter and initialize
14271 corresponding data member.
14272 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14273 and pass to base constructor. Change all callers.
14274 (get_input_file, release_input_file): New functions.
14275 (make_sized_plugin_object): Add filesize parameter. Change all callers.
14276 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14277 (Plugin_manager::all_symbols_read): Add task parameter.
14278 (Plugin_manager::get_input_file): New function.
14279 (Plugin_manager::release_input_file): New function.
14280 (Plugin_manager::task_): New data member.
14281 (Pluginobj::Pluginobj): Add filesize parameter.
14282 (Pluginobj::filename): New function.
14283 (Pluginobj::descriptor): New function.
14284 (Pluginobj::filesize): New function.
14285 (Pluginobj::filesize_): New data member.
14286 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14287 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14288 File_read::claim_for_plugin; use Object::unlock to unlock the file.
14289
14290 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14291 with archive libraries.
14292 * testsuite/Makefile.in: Regenerate.
14293 * testsuite/plugin_test.c (struct sym_info): New type.
14294 (get_input_file, release_input_file): New static variables.
14295 (onload): Capture new transfer vector entries.
14296 (claim_file_hook): Stop reading at end of file according to filesize.
14297 Factor out parsing of readelf output into separate function.
14298 (all_symbols_read_hook): Exercise get_input_file and release_input_file
14299 APIs and get the source file name from the symbol table. Convert
14300 source file name to corresponding object file name. Print info
14301 message when adding new input files.
14302 (parse_readelf_line): New function.
14303 * testsuite/plugin_test_1.sh: Add checks for new info messages.
14304 * testsuite/plugin_test_2.sh: Likewise.
14305 * testsuite/plugin_test_3.sh: Likewise.
14306 * testsuite/plugin_test_4.sh: New test case.
14307
14308 2009-01-07 Ian Lance Taylor <iant@google.com>
14309
14310 * version.cc (version_string): Bump to 1.8.
14311
14312 2008-12-23 Cary Coutant <ccoutant@google.com>
14313
14314 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14315 * plugin.cc (Plugin_manager::finish): Rename as
14316 layout_deferred_objects. Move cleanup to separate function.
14317 (Plugin_manager::cleanup): New function.
14318 (Plugin_finish::run): Call layout_deferred_objects and cleanup
14319 separately.
14320 * plugin.h (Plugin_manager::finish): Rename as
14321 layout_deferred_objects.
14322 (Plugin_manager::cleanup): New function.
14323 (Plugin_manager::cleanup_done): New field.
14324
14325 2008-12-23 Cary Coutant <ccoutant@google.com>
14326
14327 * plugin.cc (is_visible_from_outside): New function.
14328 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14329 so we don't return "IR only" status for exported symbols or -r links.
14330
14331 * testsuite/Makefile.am (plugin_test_3): New test case.
14332 * testsuite/Makefile.in: Regenerate.
14333 * testsuite/plugin_test_3.sh: New file.
14334
14335 2008-12-22 Cary Coutant <ccoutant@google.com>
14336
14337 * object.cc (Sized_relobj::layout_section): New function.
14338 (Sized_relobj::do_layout): Defer layout of input sections until after
14339 plugin has provided replacement files.
14340 (Sized_relobj::do_layout_deferred_sections): New function.
14341 * object.h (Relobj::set_section_offset): Remove virtual keyword.
14342 (Relobj::layout_deferred_sections): New function.
14343 (Relobj::do_layout_deferred_sections): New function.
14344 (Sized_relobj::do_layout_deferred_sections): New function.
14345 (Sized_relobj::layout_section): New function.
14346 (Sized_relobj::Deferred_layout): New structure.
14347 (Sized_relobj::deferred_layout_): New field.
14348 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14349 Change all callers. Layout deferred sections.
14350 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
14351 references.
14352 (Plugin_hook::run): Move code from do_plugin_hook inline.
14353 (Plugin_hook::do_plugin_hook): Remove.
14354 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14355 (Plugin_manager::finish): Renamed, was cleanup.
14356 (Plugin_manager::should_defer_layout): New function.
14357 (Plugin_manager::add_deferred_layout_object): New function.
14358 (Plugin_manager::Deferred_layout_list): New type.
14359 (Plugin_manager::deferred_layout_objects_): New field.
14360 (Plugin_hook::do_plugin_hook): Remove.
14361
14362 2008-12-17 Ian Lance Taylor <iant@google.com>
14363
14364 * options.h (class General_options): Add --no case for
14365 --export-dynamic.
14366
14367 2008-12-16 Cary Coutant <ccoutant@google.com>
14368
14369 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14370 vector.
14371 (Plugin_manager::claim_file): Create plugin object even if
14372 plugin did not call the add_symbols callback.
14373 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14374 asking for more symbols than were added.
14375 * testsuite/Makefile.am (plugin_test_1): Add test case with
14376 no global symbols.
14377 (empty.syms): New target.
14378 * testsuite/Makefile.in: Regenerate.
14379 * testsuite/plugin_test.c (claim_file_hook): Add new debug
14380 message. Don't call add_symbols if no globals.
14381 (all_symbols_read_hook): Don't provide replacement for empty
14382 claimed file.
14383
14384 2008-12-12 Ian Lance Taylor <iant@google.com>
14385
14386 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14387 r_type == 0 for a local symbol with r_sym == 0.
14388 (scan_relocatable_relocs): Pass r_sym to
14389 local_non_section_strategy.
14390 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14391 r_sym parameter.
14392
14393 * configure.ac: Update test for TLS descriptors: they are
14394 supported as of glibc 2.9.
14395 * configure: Rebuild.
14396
14397 2008-12-11 Ian Lance Taylor <iant@google.com>
14398
14399 PR 7091
14400 * target-reloc.h (Default_scan_relocatable_relocs): For each
14401 function, map r_type == 0 to RELOC_DISCARD.
14402
14403 2008-12-10 Cary Coutant <ccoutant@google.com>
14404
14405 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14406 object to override a kept COMDAT group from a plugin object.
14407
14408 2008-12-09 Ian Lance Taylor <iant@google.com>
14409
14410 PR 7088
14411 * yyscript.y (file_cmd): Handle INPUT.
14412
14413 * testsuite/initpri1.c: Change all declarations to be full
14414 prototypes by adding void, to avoid compiler warnings.
14415
14416 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
14417
14418 * options.cc (General_options::parse_plugin_opt): New.
14419 (General_options::add_plugin): The argument now is just the filename.
14420 (General_options::add_plugin_option): New.
14421 * options.h (plugin_opt): New.
14422 (add_plugin): Change argument name.
14423 (add_plugin_option): New.
14424 * plugin.cc (Plugin::load): Don't parse the plugin option.
14425 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14426 (Plugin::add_option): New.
14427 (Plugin::args_): Change type.
14428 (Plugin::filename_): New.
14429 (Plugin_manager::add_plugin_option): New.
14430 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14431 * testsuite/Makefile.in: Regenerate.
14432
14433 2008-12-05 Cary Coutant <ccoutant@google.com>
14434
14435 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14436 Handle --strip-lto-sections option.
14437 * options.h (strip_lto_sections): New option.
14438
14439 2008-12-01 Cary Coutant <ccoutant@google.com>
14440
14441 * plugin.cc (ld_plugin_message): Change format parameter to const.
14442 Fix mismatch between new[] and delete.
14443
14444 2008-11-14 Cary Coutant <ccoutant@google.com>
14445
14446 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14447 instead of -1U.
14448
14449 2008-11-05 Craig Silverstein <csilvers@google.com>
14450
14451 * options.cc (General_options::parse_dynamic_list): New function.
14452 * options.h (General_options): New flags dynamic_list,
14453 dynamic_list_data, dynamic_list_cpp_new, and
14454 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
14455 (General_options::in_dynamic_list): New function.
14456 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14457 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14458 (Lex::can_continue_name): Likewise.
14459 (yylex): Likewise.
14460 (read_script_file): New parameter script_options.
14461 (read_dynamic_list): New function.
14462 (Script_options::define_dynamic_list): New function.
14463 (dynamic_list_keyword_parsecodes): New variable.
14464 (dynamic_list_keywords): New variable.
14465 * script.h (Script_options::define_dynamic_list): New function
14466 prototype.
14467 (read_dynamic_list): New function prototype.
14468 * symtab.cc (strprefix): New macro.
14469 (Symbol::should_add_dynsym_entry): Support dynamic_list,
14470 dynamic_list_data, dynamic_list_cpp_new, and
14471 dynamic_list_cpp_typeinfo.
14472 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14473 (dynamic_list_expr): New rule.
14474 (dynamic_list_nodes): Likewise.
14475 (dynamic_list_node): Likewise.
14476 * testsuite/Makefile.am (dynamic_list): New test.
14477 * testsuite/Makefile.in: Regenerated.
14478 * testsuite/dynamic_list.t: New file.
14479 * testsuite/dynamic_list.sh: New file.
14480
14481 2008-11-05 Craig Silverstein <csilvers@google.com>
14482
14483 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14484 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14485 (t11_last): Likewise.
14486 * testsuite/ver_test_6.c (main): Likewise.
14487
14488 2008-10-07 Cary Coutant <ccoutant@google.com>
14489
14490 * options.c (General_options::finalize): Add check for -static and
14491 -shared.
14492 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14493 is not empty.
14494
14495 2008-10-02 Cary Coutant <ccoutant@google.com>
14496
14497 * plugin.cc (make_sized_plugin_object): Fix conditional
14498 compilation to work when not all targets are enabled.
14499
14500 2008-09-29 Cary Coutant <ccoutant@google.com>
14501
14502 * archive.cc (Archive::get_file_and_offset): Use filename instead
14503 of name to get library path.
14504 (Archive::include_member): Unlock external member of a thin archive.
14505
14506 * testsuite/Makefile.am (TEST_AR): New variable.
14507 (thin_archive_test_1): New test.
14508 (thin_archive_test_2): New test.
14509 * testsuite/Makefile.in: Regenerate.
14510 * testsuite/thin_archive_main.cc: New file.
14511 * testsuite/thin_archive_test_1.cc: New file.
14512 * testsuite/thin_archive_test_2.cc: New file.
14513 * testsuite/thin_archive_test_3.cc: New file.
14514 * testsuite/thin_archive_test_4.cc: New file.
14515
14516 2008-09-29 Cary Coutant <ccoutant@google.com>
14517
14518 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14519 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14520 instead of -1U.
14521 (Sized_relobj::do_finalize_local_symbols): Likewise.
14522 (Sized_relobj::map_to_kept_section): Likewise.
14523 * object.h (Sized_relobj::invalid_address): New constant.
14524 (Sized_relobj::do_output_section_offset): Check for invalid_address
14525 and return -1ULL.
14526 * output.cc (Output_reloc::local_section_offset): Use constant
14527 invalid_address instead of -1U.
14528 (Output_reloc::get_address): Likewise.
14529 (Output_section::output_address): Change -1U to -1ULL.
14530 * output.h (Output_reloc::invalid_address): New constant.
14531 * reloc.cc (Sized_relobj::write_sections): Use constant
14532 invalid_address instead of -1U.
14533 (Sized_relobj::relocate_sections): Likewise.
14534 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14535 values for merge sections.
14536 * target-reloc.h (relocate_for_relocatable): Use constant
14537 invalid_address instead of -1U.
14538
14539 2008-09-19 Cary Coutant <ccoutant@google.com>
14540
14541 Add plugin functionality for link-time optimization (LTO).
14542 * configure.ac (plugins): Add --enable-plugins option.
14543 * configure: Regenerate.
14544 * config.in: Regenerate.
14545 * Makefile.am (LIBDL): New variable.
14546 (CCFILES): Add plugin.cc.
14547 (HFILES): Add plugin.h.
14548 (ldadd_var): Add LIBDL.
14549 * Makefile.in: Regenerate.
14550
14551 * archive.cc: Include "plugin.h".
14552 (Archive::setup): Don't preread archive symbols when using a plugin.
14553 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
14554 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14555 files.
14556 (Archive::include_member): Add symbols from plugin objects.
14557 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14558 * descriptors.cc (Descriptors::open): Check for file descriptors
14559 abandoned by plugins.
14560 (Descriptors::claim_for_plugin): New function.
14561 * descriptors.h (Descriptors::claim_for_plugin): New function.
14562 (Open_descriptor::is_claimed): New field.
14563 (claim_descriptor_for_plugin): New function.
14564 * fileread.cc (File_read::claim_for_plugin): New function.
14565 * fileread.h (File_read::claim_for_plugin): New function.
14566 (File_read::descriptor): New function.
14567 * gold.cc: Include "plugin.h".
14568 (queue_initial_tasks): Add task to call plugin hooks for generating
14569 new object files.
14570 * main.cc: Include "plugin.h".
14571 (main): Load plugin libraries.
14572 * object.h (Pluginobj): Declare.
14573 (Object::pluginobj): New function.
14574 (Object::do_pluginobj): New function.
14575 (Object::set_target): New function.
14576 * options.cc: Include "plugin.h".
14577 (General_options::parse_plugin): New function.
14578 (General_options::General_options): Initialize plugins_ field.
14579 (General_options::add_plugin): New function.
14580 * options.h (Plugin_manager): Declare.
14581 (General_options): Add --plugin option.
14582 (General_options::has_plugins): New function.
14583 (General_options::plugins): New function.
14584 (General_options::add_plugin): New function.
14585 (General_options::plugins_): New field.
14586 * plugin.cc: New file.
14587 * plugin.h: New file.
14588 * readsyms.cc: Include "plugin.h".
14589 (Read_symbols::do_read_symbols): Check for archive before checking
14590 for ELF file. Call plugin hooks to claim files.
14591 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14592 from a real object file; force override when processing replacement
14593 files.
14594 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14595 (Symbol::init_base_object): Likewise.
14596 (Symbol::init_base_output_data): Likewise.
14597 (Symbol::init_base_output_segment): Likewise.
14598 (Symbol::init_base_constant): Likewise.
14599 (Symbol::init_base_undefined): Likewise.
14600 (Symbol::output_section): Assert that object is not a plugin.
14601 (Symbol_table::add_from_pluginobj): New function.
14602 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14603 undefined.
14604 (Symbol_table::sized_write_globals): Likewise.
14605 (Symbol_table::add_from_pluginobj): Instantiate template.
14606 * symtab.h (Sized_pluginobj): Declare.
14607 (Symbol::in_real_elf): New function.
14608 (Symbol::set_in_real_elf): New function.
14609 (Symbol::in_real_elf_): New field.
14610 (Symbol_table::add_from_pluginobj): New function.
14611
14612 * testsuite/Makefile.am (AM_CFLAGS): New variable.
14613 (LIBDL): New variable.
14614 (LDADD): Add LIBDL.
14615 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14616 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14617 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14618 (MOSTLYCLEANFILES): Likewise.
14619 * testsuite/Makefile.in: Regenerate.
14620 * testsuite/plugin_test.c: New file.
14621 * testsuite/plugin_test_1.sh: New file.
14622 * testsuite/plugin_test_2.sh: New file.
14623
14624 2008-09-16 Ian Lance Taylor <iant@google.com>
14625
14626 * target-reloc.h (relocate_section): Check whether a symbol is
14627 defined by the ABI before reporting an undefined symbol error.
14628 * target.h (Target::is_defined_by_abi): Make parameter const.
14629 (Target::do_is_defined_by_abi): Likewise.
14630 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14631 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14632 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14633 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14634 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14635 * testsuite/Makefile.in: Rebuild.
14636
14637 * fileread.cc (make_view): Add casts to avoid warning.
14638
14639 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14640
14641 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14642 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14643
14644 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14645
14646 * options.h (General_options::output_is_executable): New.
14647 (General_options::output_is_pie): New.
14648 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14649 for shared libraries.
14650 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14651
14652 2008-09-11 Chris Demetriou <cgd@google.com>
14653
14654 * options.h (origin): New -z option.
14655 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14656 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14657 in DT_FLAGS_1.
14658
14659 2008-09-05 Cary Coutant <ccoutant@google.com>
14660
14661 * fileread.cc (File_read::make_view): Add check for attempt to map
14662 beyond end of file.
14663
14664 2008-09-05 Cary Coutant <ccoutant@google.com>
14665
14666 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14667 explicit instantiations.
14668
14669 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14670
14671 PR gold/6858
14672 * options.cc (General_options::finalize): Allow undefined symbols
14673 in shlibs if linking -shared.
14674
14675 PR gold/6859
14676 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14677 symbols as not needing a dynsym entry.
14678
14679 2008-08-20 Craig Silverstein <csilvers@google.com>
14680
14681 * fileread.cc (File_read::open): Do not lock the file unless it
14682 was successfully opened.
14683
14684 2008-08-14 Cary Coutant <ccoutant@google.com>
14685
14686 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14687 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14688 * testsuite/tls_test.cc (struct int128): 128-bit struct
14689 for testing TLS relocs with non-zero addend.
14690 (v12): New TLS variable.
14691 (t12): New test.
14692 (t_last): Add check for v12.
14693 * testsuite/tls_test.h (t12): New function.
14694 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14695
14696 2008-08-13 Ian Lance Taylor <iant@google.com>
14697
14698 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14699 set tls_segment_ or relro_segment_.
14700 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14701 when appropriate.
14702 * output.h (Output_section::clear_is_relro): New function.
14703 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14704 sections specially even when output_data_ is empty.
14705 (Output_segment::maximum_alignment): When first section is relro,
14706 only force alignment for PT_LOAD segments.
14707 * script.cc (script_data_segment_align): New function.
14708 (script_data_segment_relro_end): New function.
14709 * script-c.h (script_data_segment_align): Declare.
14710 (script_data_segment_relro_end): Declare.
14711 * script-sections.h (class Script_sections): Declare
14712 data_segment_align and data_segment_relro_end. Add fields
14713 segment_align_index_ and saw_relro_end_.
14714 * script-sections.cc (class Sections_element): Add set_is_relro
14715 virtual function. Add new bool* parameter to place_orphan_here.
14716 Add get_output_section virtual function.
14717 (class Output_section_definition): Add set_is_relro. Add new
14718 bool* parameter to place_orphan_here. Add get_output_section.
14719 Add is_relro_ field.
14720 (Output_section_definition::Output_section_definition): Initialize
14721 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14722 and is_relro_ fields.
14723 (Output_section_definition::place_orphan_here): Add is_relro
14724 parameter.
14725 (Output_section_definition::set_section_addresses): Set relro for
14726 output section.
14727 (Output_section_definition::alternate_constraint): Likewise.
14728 (class Orphan_output_section): Add new bool* parameter to
14729 place_orphan_here. Add get_output_section.
14730 (Orphan_output_section::place_orphan_here): Add is_relro
14731 parameter.
14732 (Script_sections::Script_sections): Initialize
14733 data_segment_align_index_ and saw_relro_end_.
14734 (Script_sections::data_segment_align): New function.
14735 (Script_sections::data_segment_relro_end): New function.
14736 (Script_sections::place_orphan): Set or clear is_relro.
14737 (Script_sections::set_section_addresses): Force alignment of first
14738 TLS section.
14739 * yyscript.y (exp): Call script_data_segment_align and
14740 script_data_segment_relro_end.
14741 * testsuite/relro_script_test.t: New file.
14742 * testsuite/relro_test.cc (using_script): Declare.
14743 (t1, t2): Test using_script.
14744 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14745 (relro_script_test_SOURCES): Define.
14746 (relro_script_test_DEPENDENCIES): Define.
14747 (relro_script_test_LDFLAGS): Define.
14748 (relro_script_test_LDADD): Define.
14749 (relro_script_test.so): New target.
14750 * testsuite/Makefile.in: Rebuild.
14751
14752 2008-08-06 Cary Coutant <ccoutant@google.com>
14753
14754 * archive.cc (Archive::total_archives, Archive::total_members)
14755 (Archive::total_members_loaded): New variables.
14756 (Archive::setup): Add parameter. Add option to preread
14757 archive symbols.
14758 (Archive::read_armap): Add counter.
14759 (Archive::get_file_and_offset): New function.
14760 (Archive::get_elf_object_for_member): New function.
14761 (Archive::read_all_symbols): New function.
14762 (Archive::read_symbols): New function.
14763 (Archive::add_symbols): Add counters.
14764 (Archive::include_all_members): Use armap to find members if it's
14765 already built.
14766 (Archive::include_member): Skip reading symbols if already read.
14767 Factored code into Archive::get_file_and_offset and
14768 Archive::get_elf_object_for_member. Changed call to
14769 Mapfile::report_include_archive_member.
14770 (Archive::print_stats): New function.
14771 * archive.h: Declare Object and Read_symbols_data classes.
14772 (Archive::Archive): Add initializers for new members.
14773 (Archive::setup): Add parameter.
14774 (Archive::print_stats): New function.
14775 (Archive::total_archives, Archive::total_members)
14776 (Archive::total_members_loaded): New variables.
14777 (Archive::get_file_and_offset): New function.
14778 (Archive::get_elf_object_for_member): New function.
14779 (Archive::read_all_symbols): New function.
14780 (Archive::read_symbols): New function.
14781 (Archive::Archive_member): New class.
14782 (Archive::members_): New member.
14783 (Archive::num_members_): New member.
14784 * main.cc: Include archive.h.
14785 (main): Call Archive::print_stats.
14786 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14787 archive parameter; member_name is now the fully-decorated name.
14788 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14789 * options.h: (General_options): Add --preread-archive-symbols option.
14790 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14791 Archive::setup.
14792
14793 2008-08-04 Ian Lance Taylor <iant@google.com>
14794
14795 * symtab.h (Symbol::use_plt_offset): New function.
14796 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14797 * powerpc.cc (Relocate::relocate): Likewise.
14798 * sparc.cc (Relocate::relocate): Likewise.
14799 * x86_64.cc (Relocate::relocate): Likewise.
14800 * testsuite/weak_plt.sh: New test.
14801 * testsuite/weak_plt_main.cc: New test.
14802 * testsuite/weak_plt_shared.cc: New test.
14803 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14804 (check_PROGRAMS): Add weak_plt.
14805 (check_DATA): Add weak_plt_shared.so.
14806 (weak_plt_main_pic.o, weak_plt): New targets.
14807 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14808 * testsuite/Makefile.in: Rebuild.
14809
14810 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14811 gcctestdir/ld.
14812 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14813 * testsuite/Makefile.in: Rebuild.
14814
14815 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14816
14817 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14818 * Makefile.in: Regenerate.
14819 * po/POTFILES.in: Regenerate.
14820
14821 2008-07-29 Ian Lance Taylor <iant@google.com>
14822
14823 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14824 symbols before other symbols.
14825 * testsuite/script_test_2.cc (test_addr): Declare.
14826 (test_addr_alias): Declare.
14827 (main): Check that test_addr and test_addr_alias have the right
14828 values.
14829 * testsuite/script_test_2.t: Define test_addr_alias and
14830 test_addr.
14831
14832 2008-07-24 Ian Lance Taylor <iant@google.com>
14833
14834 PR 5990
14835 * descriptors.cc: New file.
14836 * descriptors.h: New file.
14837 * gold-threads.h (class Hold_optional_lock): New class.
14838 * fileread.cc: Include "descriptors.h".
14839 (File_read::~File_read): Release descriptor rather than closing
14840 it.
14841 (File_read::open) [file]: Call open_descriptor rather than open.
14842 Set is_descriptor_opened_.
14843 (File_read::open) [memory]: Assert that descriptor is not open.
14844 (File_read::reopen_descriptor): New function.
14845 (File_read::release): Release descriptor.
14846 (File_read::do_read): Make non-const. Reopen descriptor.
14847 (File_read::read): Make non-const.
14848 (File_read::make_view): Reopen descriptor.
14849 (File_read::do_readv): Likewise.
14850 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14851 Update declarations.
14852 * layout.cc: Include "descriptors.h".
14853 (Layout::create_build_id): Use open_descriptor rather than open.
14854 * output.cc: Include "descriptors.h".
14855 (Output_file::open): Use open_descriptor rather than open.
14856 * archive.cc (Archive::const_iterator): Change Archive to be
14857 non-const.
14858 (Archive::begin, Archive::end): Make non-const.
14859 (Archive::count_members): Likewise.
14860 * archive.h (class Archive): Update declarations.
14861 * object.h (Object::read): Make non-const.
14862 * Makefile.am (CCFILES): Add descriptors.cc.
14863 (HFILES): Add descriptors.h.
14864 * Makefile.in: Rebuild.
14865
14866 PR 6716
14867 * gold.h: Always include <clocale>. Add Solaris workarounds
14868 following code in binutils/sysdep.h.
14869
14870 PR 6048
14871 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14872 this->eh_frame_hdr_ is NULL before using it.
14873
14874 * dynobj.cc (Versions::Versions): Update comment.
14875
14876 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14877 the base version name.
14878
14879 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14880 array size plus one.
14881 (Stringpool_template::set_string_offsets): Subtract one from key
14882 before using it as an array index.
14883 (Stringpool_template::get_offset_with_length): Likewise.
14884 (Stringpool_template::write_to_buffer): Likewise.
14885 * stringpool.h (Stringpool_template::get_offset_from_key):
14886 Likewise.
14887
14888 2008-07-23 Ian Lance Taylor <iant@google.com>
14889
14890 PR 6658
14891 * object.h (Merged_symbol_value::value): Do our best to handle a
14892 negative addend.
14893
14894 PR 6647
14895 * script.cc (Version_script_info::get_versions): Don't add empty
14896 version tag to return value.
14897 (Version_script_info::get_symbol_version_helper): Change return
14898 type to bool. Add pversion parameter. Change all callers.
14899 (script_register_vers_node): Don't require a non-NULL tag.
14900 * script.h (class Version_script_info): Update declarations.
14901 (Version_script_info::get_symbol_version): Change return type to
14902 bool. Add version parameter. Change all callers.
14903 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14904 handling. Handle an empty version from a version script.
14905 (Symbol_table::define_special_symbol): Likewise.
14906 * testsuite/ver_test_10.script: New file.
14907 * testsuite/ver_test_10.sh: New file.
14908 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14909 (check_DATA): Add ver_test_10.syms.
14910 (ver_test_10.syms, ver_test_10.so): New target.
14911 * testsuite/Makefile.in: Rebuild.
14912
14913 2008-07-23 Simon Baldwin <simonb@google.com>
14914
14915 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14916 to zero for undefined symbols from dynamic libraries.
14917
14918 2008-07-23 Ian Lance Taylor <iant@google.com>
14919
14920 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14921 Change all callers.
14922 * symtab.h (class Symbol_table): Update declaration.
14923 * testsuite/ver_test_9.cc: New file.
14924 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14925 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14926 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14927 (ver_test_9.so, ver_test_9.o): New targets.
14928 * testsuite/Makefile.in: Rebuild.
14929
14930 2008-07-22 Ian Lance Taylor <iant@google.com>
14931
14932 * options.h (class General_options): Define --check-sections.
14933 * layout.cc (Layout::set_segment_offsets): Handle
14934 --check-sections.
14935
14936 * options.h (class General_options): Define -n/--nmagic and
14937 -N/--omagic.
14938 * options.cc (General_options::finalize): For -n/--nmagic or
14939 -N/--omagic, set -static.
14940 * layout.cc (Layout::attach_allocated_section_to_segment): If
14941 -N/--omagic, don't put read-only and read-write sections in
14942 different segments.
14943 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14944 finding a read-only segment.
14945 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14946 don't set the minimum segment alignment to the common page size,
14947 and don't set the file offset to the address modulo the page size.
14948 * script-sections.cc (Script_sections::create_segments): If
14949 -n/--omagic, don't put read-only and read-write sections in
14950 different segments.
14951
14952 * cref.cc: New file.
14953 * cref.h: New file.
14954 * options.h (class General_options): Add --print-symbol-counts.
14955 * main.cc (main): Issue defined symbol report if requested.
14956 * archive.cc (Archive::interpret_header): Make into a const member
14957 function.
14958 (Archive::add_symbols): Call Input_objects::archive_start and
14959 archive_stop.
14960 (Archive::const_iterator): Define new class.
14961 (Archive::begin, Archive::end): New functions.
14962 (Archive::include_all_members): Rewrite to use iterator.
14963 (Archive::count_members): New function.
14964 * archive.h (class Archive): Update declarations.
14965 (Archive::filename): New function.
14966 * object.cc: Include "cref.h".
14967 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14968 (Sized_relobj::do_get_global_symbol_counts): New function.
14969 (Input_objects::add_object): Add object to cross-referencer.
14970 (Input_objects::archive_start): New function.
14971 (Input_objects::archive_stop): New function.
14972 (Input_objects::print_symbol_counts): New function.
14973 * object.h: Declare Cref and Archive.
14974 (Object::get_global_symbol_counts): New function.
14975 (Object::do_get_global_symbol_counts): New pure virtual function.
14976 (class Sized_relobj): Add defined_count_ field. Update
14977 declarations.
14978 (class Input_objects): Add cref_ field. Update constructor.
14979 Update declarations.
14980 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14981 defined_count_.
14982 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14983 symbol counts.
14984 (Sized_dynobj::do_get_global_symbol_counts): New function.
14985 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14986 defined_count_. Update declarations. Define Symbols typedef.
14987 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14988 parameter. Change all callers.
14989 (Symbol_table::add_from_dynobj): Add sympointers and defined
14990 parameters. Change all callers.
14991 * symtab.h (class Symbol_table): Update declarations.
14992 * Makefile.am (CCFILES): Add cref.cc.
14993 (HFILES): Add cref.h.
14994 * Makefile.in: Rebuild.
14995
14996 2008-07-22 Simon Baldwin <simonb@google.com>
14997
14998 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14999 to zero when writing undefined symbols.
15000
15001 2008-07-22 Ian Lance Taylor <iant@google.com>
15002
15003 * output.cc (Output_section::add_input_section): Don't try to
15004 merge empty merge sections.
15005
15006 2008-07-21 Craig Silverstein <csilvers@google.com>
15007
15008 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15009 Include symbol version in error message.
15010
15011 2008-07-20 Chris Demetriou <cgd@google.com>
15012
15013 * configure.ac (gold_cv_c_random_seed): New configured variable.
15014 (RANDOM_SEED_CFLAGS): New substituted variable.
15015 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15016 * configure: Rebuild.
15017 * Makefile.in: Likewise.
15018 * testsuite/Makefile.in: Likewise.
15019
15020 2008-07-18 Ian Lance Taylor <iant@google.com>
15021
15022 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15023 where we see NAME/NULL and NAME/VERSION as separate symbols.
15024 * testsuite/ver_test_main.cc (main): Call t4.
15025 (t4, t4_2a): Define.
15026 * testsuite/ver_test_2.cc (t4_2): Define.
15027 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15028 * testsuite/ver_test_4.cc (t4_2a): Define.
15029 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15030 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15031
15032 2008-07-17 Ian Lance Taylor <iant@google.com>
15033
15034 * dynobj.cc (Versions::add_def): If we give an error about a
15035 missing version, go ahead and create the version anyhow.
15036
15037 2008-07-10 Ian Lance Taylor <iant@google.com>
15038
15039 Handle output sections with more than 0x7fffffff bytes.
15040 * object.h (class Relobj): Change map_to_output_ to
15041 output_sections_, and just keep a section pointer. Change all
15042 uses. Move comdat group support to Sized_relobj.
15043 (Relobj::is_section_specially_mapped): Remove.
15044 (Relobj::output_section): Remove poff parameter. Change all
15045 callers.
15046 (Relobj::output_section_offset): New function.
15047 (Relobj::set_section_offset): Rewrite.
15048 (Relobj::map_to_output): Remove.
15049 (Relobj::output_sections): New function.
15050 (Relobj::do_output_section_offset): New pure virtual function.
15051 (Relobj::do_set_section_offset): Likewise.
15052 (class Sized_relobj): Add section_offsets_ field. Add comdat
15053 group support from Relobj. Update declarations.
15054 (Sized_relobj::get_output_section_offset): New function.
15055 (Sized_relobj::do_output_section_offset): New function.
15056 (Sized_relobj::do_set_section_offset): New function.
15057 * object.cc (Relobj::output_section_address): Remove.
15058 (Sized_relobj::Sized_relobj): Initialize new fields.
15059 (Sized_relobj::include_section_group): Cast find_kept_object to
15060 Sized_relobj.
15061 (Sized_relobj::include_linkonce_section): Likewise.
15062 (Sized_relobj::do_layout): Use separate arrays for output section
15063 and output offset.
15064 (Sized_relobj::do_count_local_symbols): Change map_to_output to
15065 output_sections.
15066 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15067 output_sections and section_offsets.
15068 (Sized_relobj::write_local_symbols): Likewise.
15069 (map_to_kept_section): Compute output address directly.
15070 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15071 output_sections and section_offsets.
15072 (Sized_relobj::write_sections): Likewise.
15073 (Sized_relobj::relocate_sections): Likewise.
15074 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15075 * output.h (class Output_reloc): Update declarations. Change
15076 u2_.relobj to Sized_relobj*.
15077 (class Output_data_reloc): Change add functions to use
15078 Sized_relobj*.
15079 * output.cc (Output_reloc::Output_reloc): Change relobj to
15080 Sized_relobj*.
15081 (Output_reloc::local_section_offset): Change return type to
15082 Elf_Addr. Use get_output_section_offset.
15083 (Output_reloc::get_address): Likewise.
15084 (Output_section::is_input_address_mapped): Don't call
15085 is_section_specially_mapped.
15086 (Output_section::output_offset): Likewise.
15087 (Output_section::output_address): Likewise.
15088 (Output_section::starting_output_address): Likewise.
15089 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15090 parameter to Sized_relobj*.
15091 (Copy_relocs::need_copy_reloc): Likewise.
15092 (Copy_relocs::save): Likewise.
15093 * copy-relocs.h (class Copy_relocs): Update declarations.
15094 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15095 Sized_relobj*. Change relobj_ field to Sized_relobj*.
15096 * target-reloc.h (relocate_for_relocatable): Change
15097 offset_in_output_section type to Elf_Addr. Change code that uses
15098 it as well.
15099 * layout.cc (Layout::layout): Always set *off.
15100 * mapfile.cc (Mapfile::print_input_section): Use
15101 output_section_offset.
15102 * i386.cc (Target_i386::copy_reloc): Change object parameter to
15103 Sized_relobj*.
15104 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15105 * sparc.cc (Target_sparc::copy_reloc): Likewise.
15106 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15107
15108 2008-07-03 Ian Lance Taylor <iant@google.com>
15109
15110 * layout.cc (Layout::include_section): Do not discard unrecognized
15111 SHT_STRTAB sections.
15112
15113 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
15114
15115 * script.cc (Lex::can_continue_name): Make '?' allowable in
15116 version-script names.
15117 * testsuite/version_script.map: Change glob pattern to use '?'
15118
15119 2008-06-30 Manish Singh <yosh@gimp.org>
15120
15121 PR 6585
15122 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15123 Correct typo.
15124
15125 2008-06-30 Ian Lance Taylor <iant@google.com>
15126
15127 PR 6660
15128 PR 6682
15129 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15130 versions]: Don't try to read the value in the contents, since we
15131 don't use it. Use the template endianness when writing.
15132
15133 2008-06-25 Cary Coutant <ccoutant@google.com>
15134
15135 * fileread.cc (File_read::make_view): Assert on zero-length view.
15136 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15137 symbol table when there are no symbols to read.
15138
15139 2008-06-23 Craig Silverstein <csilvers@google.com>
15140
15141 * version.cc (version_string): Bump to 1.7
15142
15143 2008-06-18 Craig Silverstein <csilvers@google.com>
15144
15145 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15146 constant 0xFFFF to type Valtype.
15147 (Powerpc_relocate_functions::rel16_ha): Likewise.
15148
15149 2008-06-17 Ian Lance Taylor <iant@google.com>
15150
15151 * output.h (Output_section::Input_section): Initialize p2align_ to
15152 zero for Output_section_data constructors.
15153 (Output_section::Input_section::addralign): If not an input
15154 section, return the alignment of the Output_section_data.
15155 * testsuite/copy_test.cc: New file.
15156 * testsuite/copy_test_1.cc: New file.
15157 * testsuite/copy_test_2.cc: New file.
15158 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15159 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15160 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15161 (copy_test_1_pic.o, copy_test_1.so): New targets.
15162 (copy_test_2_pic.o, copy_test_2.so): New targets.
15163 * testsuite/Makefile.in: Rebuild.
15164
15165 * script-sections.cc (Script_sections::place_orphan): Initialize
15166 local variable exact.
15167
15168 2008-06-13 David Edelsohn <edelsohn@gnu.org>
15169
15170 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15171
15172 2008-06-12 David Edelsohn <edelsohn@gnu.org>
15173 David S. Miller <davem@davemloft.net>
15174
15175 * powerpc.cc: New file.
15176 * Makefile.am (TARGETSOURCES): Add powerpc.cc
15177 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15178 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15179 * Makefile.in: Rebuild.
15180
15181 2008-06-09 Ian Lance Taylor <iant@google.com>
15182
15183 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15184 <exception>.
15185 (throwing, orig_terminate): New static variables.
15186 (terminate_handler): New static function.
15187 (t2): Set terminate handler.
15188
15189 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
15190
15191 PR 6584
15192 * binary.cc (Binary_to_elf::sized_convert): Fix .data
15193 alignment.
15194
15195 2008-05-30 Cary Coutant <ccoutant@google.com>
15196
15197 * archive.cc (Archive::include_all_members) Correct to step
15198 over symbol table and extended name table in thin archives.
15199
15200 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
15201
15202 PR 6407
15203 * target-reloc.h (relocate_for_relocatable): Fix new_offset
15204 calculation.
15205
15206 2008-05-28 Caleb Howe <cshowe@google.com>
15207
15208 * reduced_debug_output.cc: New file.
15209 * reduced_debug_output.h: New file.
15210 * options.h (class General_options): Add --strip-debug-non-line.
15211 * options.cc (General_options::finalize): Add strip_debug_non_line
15212 to the strip heirarchy.
15213 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15214 fields.
15215 * layout.cc: Include "reduced_debug_output.h".
15216 (Layout::Layout): Initialize new fields.
15217 (line_only_debug_sections): New static array.
15218 (is_lines_only_debug_sections): New static inline function.
15219 (Layout::include_section): Handle --strip-debug-non-line.
15220 (Layout::make_output_section): If --strip-debug-non-line, build
15221 new output sections for .debug_abbrev and .debug_info.
15222 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15223 gold. Warn about possible overflow.
15224 (read_signed_LEB_128): Likewise.
15225 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15226 (read_signed_LEB_128): Declare.
15227 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15228 (HFILES): Add reduced_debug_output.h.
15229 * Makefile.in: Rebuild.
15230
15231 2008-05-21 Ian Lance Taylor <iant@google.com>
15232
15233 * mapfile.cc: New file.
15234 * mapfile.h: New file.
15235 * options.h (class General_options): Add -M/--print-map and -Map.
15236 * options.cc (General_options::finalize): Make -M equivalent to
15237 -Map -.
15238 * main.cc: Include <cstdio> and "mapfile.h".
15239 (main): Open mapfile if requested.
15240 * gold.cc (class Middle_runner): Add mapfile_ field. Update
15241 constructor. Change caller.
15242 (queue_initial_tasks): Add mapfile parameter. Change caller.
15243 (queue_middle_tasks): Likewise.
15244 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15245 declarations.
15246 * archive.cc: Include "mapfile.h".
15247 (Archive::add_symbols): Add mapfile parameter. Change all
15248 callers. Pass mapfile, symbol, and reason to include_member.
15249 (Archive::include_all_members): Add mapfile parameter. Change all
15250 callers.
15251 (Archive::include_member): Add mapfile, sym, and why parameters.
15252 Change all callers. Report inclusion to map file.
15253 * archive.h: Include "fileread.h".
15254 (class Archive): Update declarations.
15255 (Archive::file): New const method.
15256 (class Add_archive_symbols): Add mapfile_ field. Update
15257 constructor. Change all callers.
15258 * readsyms.h (class Read_symbols): Likewise.
15259 (class Finish_group): Likewise.
15260 (class Read_script): Likewise.
15261 * common.cc: Include "mapfile.h".
15262 (Symbol_table::allocate_commons): Add mapfile parameter. Change
15263 all callers.
15264 (Symbol_table::do_allocate_commons): Likewise.
15265 (Symbol_table::do_allocate_commons_list): Likewise. Report common
15266 symbol allocation to mapfile.
15267 * common.h (class Allocate_commons_task): Add mapfile_ field.
15268 Update constructor. Change all callers.
15269 * symtab.h (class Symbol_table): Update declarations.
15270 * layout.cc: Include "mapfile.h".
15271 (Layout_task_runner::run): Print information to mapfile.
15272 (Layout::create_gold_note): Change Output_data_fixed_space to
15273 Output_data_zero_fill.
15274 (Layout::create_build_id): Likewise.
15275 (Layout::print_to_mapfile): New function.
15276 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
15277 constructor. Change caller.
15278 (class Layout): Declare print_to_mapfile.
15279 * output.cc (Output_section::Input_section::print_to_mapfile): New
15280 function.
15281 (Output_section::add_input_section): If producing a map, always
15282 add to input_sections_ list.
15283 (Output_section::do_print_to_mapfile): New function.
15284 (Output_segment::print_sections_to_mapfile): New function.
15285 (Output_segment::print_section_list_to_mapfile): New function.
15286 * output.h: Include "mapfile.h".
15287 (Output_data::print_to_mapfile): New function.
15288 (Output_data::do_print_to_mapfile): New virtual function.
15289 (Output_segment_headers::do_print_to_mapfile): New function.
15290 (Output_file_header::do_print_to_mapfile): New function.
15291 (Output_data_const::do_print_to_mapfile): New function.
15292 (class Output_data_const_buffer): Add map_name_ field. Update
15293 constructor. Change all callers. Add do_print_to_mapfile
15294 function.
15295 (class Output_data_fixed_space): Likewise.
15296 (class Output_data_space): Likewise.
15297 (class Output_data_zero_fill): New class.
15298 (Output_data_strtab::do_print_to_mapfile): New function.
15299 (Output_data_reloc_base::do_print_to_mapfile): New function.
15300 (Output_relocatable_relocs::do_print_to_mapfile): New function.
15301 (Output_data_group::do_print_to_mapfile): New function.
15302 (Output_data_got::do_print_to_mapfile): New function.
15303 (Output_data_dynamic::do_print_to_mapfile): New function.
15304 (Output_symtab_xindex::do_print_to_mapfile): New function.
15305 (class Output_section): Declare do_print_to_mapflie. Declare
15306 print_to_mapfile in Input_section.
15307 (class Output_segment): Declare new functions.
15308 * object.h (Sized_relobj::symbol_count): New function.
15309 * script-sections.cc
15310 (Output_section_element_dot_assignment::set_section_addresses):
15311 Change Output_data_fixed_space to Output_data_zero_fill.
15312 (Output_data_expression::do_print_to_mapfile): New function.
15313 * script.cc (read_input_script): Add mapfile parameter. Change
15314 all callers.
15315 * script.h (read_input_script): Update declaration.
15316 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15317 (Eh_frame::do_print_to_mapfile): New function.
15318 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15319 (Output_merge_string::do_print_to_mapfile): New function.
15320 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15321 function.
15322 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15323 function.
15324 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15325 function.
15326 * Makefile.am (CCFILES): Add mapfile.cc.
15327 (HFILES): Add mapfile.h.
15328 * Makefile.in: Rebuild.
15329
15330 2008-05-19 Ian Lance Taylor <iant@google.com>
15331
15332 * options.h (class General_options): Add -z relro.
15333 * layout.cc (Layout::Layout): Initialize relro_segment_.
15334 (Layout::add_output_section_data): Return the output section.
15335 (Layout::make_output_section): Rcognize relro sections and mark
15336 them appropriately.
15337 (Layout::attach_allocated_section_to_segment): Put relro sections
15338 in a PT_GNU_RELRO segment.
15339 (Layout::create_initial_dynamic_sections): Mark the .dynamic
15340 section as relro.
15341 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15342 PT_TLS segments.
15343 (Layout::linkonce_mapping): Map d.rel.ro.local to
15344 .data.rel.ro.local.
15345 (Layout::output_section_name): Us .data.rel.ro.local for any
15346 section which begins with that.
15347 * layout.h (class Layout): Update add_output_section_data
15348 declaration. Add relro_segment_ field.
15349 * output.cc (Output_section::Output_section): Initialize is_relro_
15350 and is_relro_local_ fields.
15351 (Output_segment::add_output_section): Group relro sections.
15352 (Output_segment::is_first_section_relro): New function.
15353 (Output_segment::maximum_alignment): If there is a relro section,
15354 align the segment to the common page size.
15355 (Output_segment::set_section_addresses): Track whether we are
15356 looking at relro sections. If the last section is a relro
15357 section, align to the common page size.
15358 (Output_segment::set_section_list_addresses): Add in_relro
15359 parameter. Change all callers. Align to the page size when
15360 moving from relro to non-relro section.
15361 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15362 segment.
15363 * output.h (class Output_section): Add is_relro_ and
15364 is_relro_local_ fields.
15365 (Output_section::is_relro): New function.
15366 (Output_section::set_is_relro): New function.
15367 (Output_section::is_relro_local): New function.
15368 (Output_section::set_is_relro_local): New function.
15369 (class Output_segment): Update declarations.
15370 * i386.cc (Target_i386::got_section): Mark .got section as relro.
15371 * sparc.cc (Target_sparc::got_section): Likewise.
15372 * x86_64.cc (Target_x86_64::got_section): Likewise.
15373 * testsuite/relro_test_main.cc: New file.
15374 * testsuite/relro_test.cc: New file.
15375 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15376 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15377 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15378 (relro_test.so, relro_test_pic.o): New targets.
15379 * testsuite/Makefile.in: Rebuild.
15380
15381 2008-05-16 Ian Lance Taylor <iant@google.com>
15382
15383 * output.cc (Output_segment::add_output_section): Remove front
15384 parameter.
15385 * output.h (class Output_segment): Remove
15386 add_initial_output_section and overloaded add_output_section.
15387 Update declaration of remaining add_output_section.
15388 * layout.cc (Layout::create_interp): Call add_output_section
15389 rather than add_initial_output_section.
15390 (Layout::finish_dynamic_section): Likewise.
15391
15392 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15393 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
15394 know the dynamic type.
15395 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15396 field. Initialize it in constructor.
15397 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15398 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15399 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15400 reloc.
15401
15402 * output.cc (Output_reloc::get_address): Change return type to
15403 Elf_Addr.
15404 * output.h (class Output_reloc): Update get_address declaration.
15405 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15406 for section addresses.
15407
15408 2008-05-09 Ian Lance Taylor <iant@google.com>
15409
15410 PR 6493
15411 * gold.cc (gold_nomem): Use return value of write.
15412
15413 2008-05-08 Ian Lance Taylor <iant@google.com>
15414
15415 * symtab.c (Symbol::init_base_output_data): Add version
15416 parameter. Change all callers.
15417 (Symbol::init_base_output_segment): Likewise.
15418 (Symbol::init_base_constant): Likewise.
15419 (Symbol::init_base_undefined): Likewise.
15420 (Sized_symbol::init_output_data): Likewise.
15421 (Sized_symbol::init_output_segment): Likewise.
15422 (Sized_symbol::init_constant): Likewise.
15423 (Sized_symbol::init_undefined): Likewise.
15424 (Symbol_table::do_define_in_output_data): If the new symbol has a
15425 version, mark it as the default.
15426 (Symbol_table::do_define_in_output_segment): Likewise.
15427 (Symbol_table::do_define_as_constant): Likewise.
15428 * symtab.h (class Symbol): Update declarations.
15429 (class Sized_symbol): Likewise.
15430 * resolve.cc (Symbol::override_version): New function.
15431 (Symbol::override_base): Call override_version.
15432 (Symbol::override_base_with_special): Likewise.
15433 * testsuite/ver_script_8.script: New file.
15434 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15435 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15436 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15437 (ver_test_8_1.so, ver_test_8_2.so): New targets.
15438
15439 2008-05-06 Ian Lance Taylor <iant@google.com>
15440
15441 PR 6049
15442 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15443 functions.
15444 (class General_options): Remove existing --undefined, and add
15445 --no-undefined instead. Add new --undefined as synonym for -u.
15446 * archive.cc (Archive::add_symbols): Check whether symbol was
15447 named with -u.
15448 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15449 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15450 all uses. Add IS_UNDEFINED. Update declarations to split
15451 different versions of init_base. Declare init_base_undefined.
15452 (Symbol::is_defined): Handle IS_UNDEFINED.
15453 (Symbol::is_undefined): Likewise.
15454 (Symbol::is_weak_undefined): Call is_undefined.
15455 (Symbol::is_absolute): Handle IS_CONSTANT.
15456 (class Sized_symbol): Update declarations to split different
15457 versions of init. Declare init_undefined.
15458 (class Symbol_table): Declare new functions.
15459 * symtab.cc (Symbol::init_base_object): Rename from init_base.
15460 Change all callers.
15461 (Symbol::init_base_output_data): Likewise.
15462 (Symbol::init_base_output_segment): Likewise.
15463 (Symbol::init_base_constant): Likewise.
15464 (Symbol::init_base_undefined): New function.
15465 (Sized_symbol::init_object): Rename from init. Change all
15466 callers.
15467 (Sized_symbol::init_output_data): Likewise.
15468 (Sized_symbol::init_output_segment): Likewise.
15469 (Sized_symbol::init_constant): Likewise.
15470 (Sized_symbol::init_undefined): New function.
15471 (Symbol_table::add_undefined_symbols_from_command_line): New
15472 function.
15473 (Symbol_table::do_add_undefined_symbols_from_command_line): New
15474 function.
15475 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15476 (Symbol::output_section): Likewise.
15477 (Symbol::set_output_section): Likewise.
15478 (Symbol_table::sized_finalize_symbol): Likewise.
15479 (Symbol_table::sized_write_globals): Likewise.
15480 * resolve.cc (Symbol_table::should_override): Likewise.
15481 (Symbol::override_base_with_special): Likewise.
15482
15483 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15484 symbol, change it to have default visibility.
15485 * testsuite/protected_1.cc: New file.
15486 * testsuite/protected_2.cc: New file.
15487 * testsuite/protected_3.cc: New file.
15488 * testsuite/protected_main_1.cc: New file.
15489 * testsuite/protected_main_2.cc: New file.
15490 * testsuite/protected_main_3.cc: New file.
15491 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15492 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15493 (protected_1_LDFLAGS, protected_1_LDADD): Define.
15494 (protected_1.so): New target.
15495 (protected_1_pic.o, protected_2_pic.o): New targets.
15496 (protected_3_pic.o): New target.
15497 (check_PROGRAMS): Add protected_2.
15498 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15499 (protected_2_LDFLAGS, protected_2_LDADD): Define.
15500 * testsuite/Makefile.in: Rebuild.
15501
15502 * options.h (DEFINE_var): Add set_user_set_##varname__.
15503 (DEFINE_bool_alias): New macro.
15504 (class General_options): Define -Bstatic using DEFINE_bool_alias
15505 rather than DEFINE_special. Add --undefined as an alias for -z
15506 defs.
15507 * options.cc (General_options::parse_Bstatic): Remove.
15508
15509 * options.h (class General_options): Add --fatal-warnings.
15510 * main.cc (main): Implement --fatal-warnings.
15511 * errors.h (Errors::warning_count): New function.
15512
15513 * options.h (class General_options): Add -Bsymbolic-functions.
15514 * symtab.h (Symbol::is_preemptible): Check for
15515 -Bsymbolic-functions.
15516
15517 2008-05-05 Ian Lance Taylor <iant@google.com>
15518
15519 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15520 as noVARNAME rather than no-VARNAME.
15521 (class General_options): Add option -z combreloc.
15522 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15523 get_address.
15524 (Output_reloc::sort_before) [SHT_REL]: New function.
15525 (Output_reloc::sort_before) [SHT_RELA]: New function.
15526 (class Output_data_reloc_base): Add sort_relocs_ field. Define
15527 Sort_relocs_comparison.
15528 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15529 parameter. Change all callers.
15530 (Output_data_reloc::Output_data_reloc) [both versions]: Add
15531 sort_relocs parameter. Change all callers.
15532 * output.cc (Output_reloc::get_address): New function, broken out
15533 of write_rel.
15534 (Output_reloc::write_rel): Call it.
15535 (Output_reloc::compare): New function.
15536 (Output_data_reloc_base::do_write): Optionally sort relocs.
15537
15538 * configure.ac: If targ_extra_obj is set, link it in.
15539 * configure.tgt: Initialize all variables.
15540 (x86_64*): Set targ_extra_obj and targ_extra_size.
15541 * configure: Rebuild.
15542
15543 * object.cc (Sized_relobj::include_section_group): Adjust section
15544 indexes read from group data. Build vector to pass to
15545 layout_group.
15546 * layout.cc (Layout::layout_group): Add flags and shndxes
15547 parameters. Remove contents parameter. Change caller. Update
15548 explicit instantiations.
15549 * layout.h (class Layout): Update layout_group declaration.
15550 * output.cc (Output_data_group::Output_data_group): Add flags and
15551 input_shndxes parameters. Remove contents parameter. Change
15552 caller.
15553 (Output_data_group::do_write): Change input_sections_ to
15554 input_shndxes_.
15555 * output.h (class Output_data_group): Update constructor
15556 declaration. Rename input_sections_ to input_shndxes_.
15557 * testsuite/many_sections_test.cc: Add template.
15558
15559 2008-04-30 Cary Coutant <ccoutant@google.com>
15560
15561 * target-reloc.h (relocate_section): Fix dead-pointer bug.
15562
15563 * layout.cc (Layout::include_section): Refactored check for debug
15564 info section.
15565 (Layout::add_comdat): Add new parameters. Change type
15566 of signature parameter. Add object and shndx to signatures table.
15567 (Layout::find_kept_object): New function.
15568 * layout.h: Include <cstring>.
15569 (Layout::is_debug_info_section): New function.
15570 (Layout::add_comdat): Add new parameters.
15571 (Layout::find_kept_object): New function.
15572 (Layout::Kept_section): New struct.
15573 (Layout::Signatures): Change type of map range.
15574 * object.cc (Relobj::output_section_address): New function.
15575 (Sized_relobj::include_section_group): Add new parameters. Change
15576 calls to Layout::add_comdat. Change to build table of kept comdat
15577 groups and table mapping discarded sections to kept sections.
15578 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15579 (Sized_relobj::do_layout): Change calls to include_section_group and
15580 include_linkonce_section.
15581 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15582 value to zero when section is discarded.
15583 (Sized_relobj::map_to_kept_section): New function.
15584 * object.h (Relobj::output_section_address): New function.
15585 (Relobj::Comdat_group): New type.
15586 (Relobj::find_comdat_group): New function.
15587 (Relobj::Comdat_group_table): New type.
15588 (Relobj::Kept_comdat_section): New type.
15589 (Relobj::Kept_comdat_section_table): New type.
15590 (Relobj::add_comdat_group): New function.
15591 (Relobj::set_kept_comdat_section): New function.
15592 (Relobj::get_kept_comdat_section): New function.
15593 (Relobj::comdat_groups_): New field.
15594 (Relobj::kept_comdat_sections_): New field.
15595 (Symbol_value::input_value): Update comment.
15596 (Sized_relobj::map_to_kept_section) New function.
15597 (Sized_relobj::include_linkonce_section): Add new parameter.
15598 * target-reloc.h (Comdat_behavior): New type.
15599 (get_comdat_behavior): New function.
15600 (relocate_section): Add code to map a discarded section to the
15601 corresponding kept section when applying a relocation.
15602
15603 2008-04-30 Craig Silverstein <csilvers@google.com>
15604
15605 * dwarf_reader.cc (next_generation_count): New static var.
15606 (Addr2line_cache_entry): New struct.
15607 (addr2line_cache): New static var.
15608 (Dwarf_line_info::one_addr2line): Added caching.
15609 (Dwarf_line_info::clear_addr2line_cache): New function.
15610 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15611 cache-size parameter.
15612 (Dwarf_line_info::one_addr2line_cache): New function.
15613 * symtab.cc (Symbol_table::detect_odr_violations): Pass
15614 new cache-size argument to one_addr2line(), and clear cache.
15615
15616 2008-04-28 Cary Coutant <ccoutant@google.com>
15617
15618 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15619 R_386_PC8 relocations.
15620
15621 2008-04-23 Ian Lance Taylor <iant@google.com>
15622
15623 * object.cc (Sized_relobj::include_section_group): Check for
15624 invalid section group.
15625
15626 * object.cc (make_elf_object): Correct test for 64-bit ELF file
15627 header size.
15628
15629 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15630 than read for file header.
15631 * archive.cc (Archive::include_member): Likewise.
15632
15633 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
15634
15635 * aclocal.m4: Regenerate.
15636 * configure: Regenerate.
15637
15638 2008-04-19 Ian Lance Taylor <iant@google.com>
15639
15640 * version.cc (version_string): Bump to 1.6.
15641
15642 * testsuite/Makefile.am (many_sections_r_test): New target.
15643 (many_sections_r_test_SOURCES): Remove.
15644 (many_sections_r_test_DEPENDENCIES): Remove.
15645 (many_sections_r_test_LDFLAGS): Remove.
15646 (many_sections_r_test_LDADD): Remove.
15647
15648 * object.cc (Sized_relobj::do_add_symbols): Always pass
15649 local_symbol_count_ to add_from_relobj.
15650
15651 * testsuite/Makefile.am (many_sections_check.h): Only check one in
15652 every thousand variables.
15653 * testsuite/Makefile.in: Rebuild.
15654
15655 * object.cc (Xindex::initialize_symtab_xindex): New function.
15656 (Xindex::read_symtab_xindex): New function.
15657 (Xindex::sym_xindex_to_shndx): New function.
15658 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15659 available.
15660 (Sized_relobj::do_initialize_xindex): New function.
15661 (Sized_relobj::do_read_symbols): Adjust section links.
15662 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15663 parameter. Change all callers.
15664 (Sized_relobj::include_section_group): Adjust section links and
15665 symbol section indexes.
15666 (Sized_relobj::do_layout): Adjust section links.
15667 (Sized_relobj::do_count_local_symbols): Adjust section links and
15668 symbol section indexes.
15669 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15670 ordinary and special symbols.
15671 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15672 dynsym_xindex parameters. Change all callers. Adjust section
15673 links. Use SHN_XINDEX when needed.
15674 (Sized_relobj::get_symbol_location_info): Adjust section links.
15675 Don't get fooled by special symbols.
15676 * object.h (class Xindex): Define.
15677 (class Object): Add xindex_ parameter. Declare virtual functoin
15678 do_initialize_xindex.
15679 (Object::adjust_sym_shndx): New function.
15680 (Object::set_xindex): New protected function.
15681 (class Symbol_value): Add is_ordinary_shndx_ field.
15682 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15683 (Symbol_value::value): Assert ordinary section.
15684 (Symbol_value::initialize_input_to_output_map): Likewise.
15685 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15686 Change all callers.
15687 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15688 all callers.
15689 (class Sized_relobj): Update declarations.
15690 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15691 parameter. Change all callers.
15692 (Sized_relobj::adjust_shndx): New function.
15693 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15694 field.
15695 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15696 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15697 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15698 (Sized_dynobj::read_dynsym_section): Adjust section links.
15699 (Sized_dynobj::read_dynamic): Likewise.
15700 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15701 section links.
15702 (Sized_dynobj::do_initialize_xindex): New function.
15703 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15704 do_initialize_xindex.
15705 (Sized_dynobj::adjust_shndx): New function.
15706 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15707 dynsym_xindex_ fields.
15708 (Layout::finalize): Add a call to set_section_indexes before
15709 creating the symtab sections.
15710 (Layout::set_section_indexes): Don't do anything if the section
15711 already has a section index.
15712 (Layout::create_symtab_sections): Add shnum parameter. Change
15713 caller. Create .symtab_shndx section if needed.
15714 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15715 caller.
15716 (Layout::allocated_output_section_count): New function.
15717 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15718 needed.
15719 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15720 fields. Update declarations.
15721 (Layout::symtab_xindex): New function.
15722 (Layout::dynsym_xindex): New function.
15723 (class Write_symbols_task): Add layout_ field.
15724 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15725 Change caller.
15726 * output.cc (Output_section_headers::Output_section_headers): Add
15727 shstrtab_section parameter. Change all callers.
15728 (Output_section_headers::do_sized_write): Store overflow values
15729 for section count and section string table section index in
15730 section header zero.
15731 (Output_file_header::do_sized_write): Check for overflow of
15732 section count and section string table section index.
15733 (Output_symtab_xindex::do_write): New function.
15734 (Output_symtab_xindex::endian_do_write): New function.
15735 * output.h (class Output_section_headers): Add shstrtab_section_.
15736 Update declarations.
15737 (class Output_symtab_xindex): Define.
15738 (Output_section::has_out_shndx): New function.
15739 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15740 field.
15741 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15742 Change all callers.
15743 (Sized_symbol::init): Likewise.
15744 (Symbol::output_section): Check for ordinary symbol.
15745 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15746 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15747 callers.
15748 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15749 Change all callers. Simplify handling of symbols from sections
15750 not included in the link.
15751 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15752 distinction.
15753 (Weak_alias_sorter::operator()): Assert that symbols are
15754 ordinary.
15755 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15756 distinction.
15757 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15758 parameters. Change all callers.
15759 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15760 symbol distinction. Use SHN_XINDEX when needed.
15761 (Symbol_table::write_section_symbol): Add symtab_xindex
15762 parameter. Change all callers.
15763 (Symbol_table::sized_write_section_symbol): Likewise. Use
15764 SHN_XINDEX when needed.
15765 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15766 declarations.
15767 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15768 (Symbol::is_defined): Check is_ordinary.
15769 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15770 (Symbol::is_absolute, Symbol::is_common): Likewise.
15771 (class Sized_symbol): Update declarations.
15772 (class Symbol_table): Update declarations.
15773 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15774 parameters. Change all callers.
15775 (Sized_symbol::override): Likewise.
15776 (Symbol_table::override): Likewise.
15777 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15778 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15779 is_ordinary, and orig_st_shndx parameters. Change all callers.
15780 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15781 to be in an ordinary section.
15782 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15783 object and is_ordinary parameters. Change all callers.
15784 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15785 Change all callers. Don't add undefined or non-ordinary symbols
15786 to reloc_map_.
15787 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15788 Change all callers.
15789 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15790 declarations.
15791 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15792 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15793 (Sized_relobj::relocate_sections): Likewise.
15794 * target-reloc.h (scan_relocs): Adjust section symbol index.
15795 (scan_relocatable_relocs): Likewise.
15796 * i386.cc (Scan::local): Check for ordinary symbols.
15797 * sparc.cc (Scan::local): Likewise.
15798 * x86_64.cc (Scan::local): Likewise.
15799 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15800 to symbol_section_and_value.
15801 * testsuite/many_sections_test.cc: New file.
15802 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15803 (check_PROGRAMS): Add many_sections_test.
15804 (many_sections_test_SOURCES): Define.
15805 (many_sections_test_DEPENDENCIES): Define.
15806 (many_sections_test_LDFLAGS): Define.
15807 (BUILT_SOURCES): Add many_sections_define.h.
15808 (many_sections_define.h): New target.
15809 (BUILT_SOURCES): Add many_sections_check.h.
15810 (many_sections_check.h): New target.
15811 (check_PROGRAMS): Add many_sections_r_test.
15812 (many_sections_r_test_SOURCES): Define.
15813 (many_sections_r_test_DEPENDENCIES): Define.
15814 (many_sections_r_test_LDFLAGS): Define.
15815 (many_sections_r_test_LDADD): Define.
15816 (many_sections_r_test.o): New target.
15817 * testsuite/Makefile.in: Rebuild.
15818
15819 2008-04-17 Cary Coutant <ccoutant@google.com>
15820
15821 * errors.cc (Errors::info): New function.
15822 (gold_info): New function.
15823 * errors.h (Errors::info): New function.
15824 * gold.h (gold_info): New function.
15825 * object.cc (Input_objects::add_object): Print trace output.
15826 * options.cc (options::parse_set): New function.
15827 (General_options::parse_wrap): Deleted.
15828 (General_options::General_options): Deleted initializer.
15829 * options.h (options::String_set): New typedef.
15830 (options::parse_set): New function.
15831 (DEFINE_set): New macro.
15832 (General_options::wrap): Changed to use DEFINE_set. Changed
15833 callers of any_wrap_symbols and is_wrap_symbol.
15834 (General_options::trace, General_options::trace_symbol):
15835 New options.
15836 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15837 (General_options::wrap_symbols_): Deleted.
15838 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15839
15840 2008-04-17 David S. Miller <davem@davemloft.net>
15841
15842 * options.cc (General_options::parse_V): New function.
15843 * options.h: Add entries for -V and -Qy.
15844
15845 2008-04-17 Ian Lance Taylor <iant@google.com>
15846
15847 * common.cc (Symbol_table::allocate_commons): Remove options
15848 parameter. Change caller.
15849 (Symbol_table::do_allocate_commons): Remove options parameter.
15850 Change caller. Just call do_allocate_commons_list twice.
15851 (Symbol_table::do_allocate_commons_list): New function, broken out
15852 of do_allocate_commons.
15853 * common.h (class Allocate_commons_task): Remove options_ field.
15854 Update constructor.
15855 * symtab.cc (Symbol_table::Symbol_table): Initialize
15856 tls_commons_.
15857 (Symbol_table::add_from_object): Put TLS common symbols on
15858 tls_commons_ list.
15859 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15860 which are IN_OUTPUT_DATA.
15861 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15862 allocate_commons and do_allocate_commons declarations. Declare
15863 do_allocate_commons_list.
15864 * gold.cc (queue_middle_tasks): Update creation of
15865 Allocate_commons_task to not pass options.
15866 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15867 (TLS_TEST_C_FLAGS): New variable.
15868 (tls_test_c_pic.o): New target.
15869 (tls_test_shared.so): Link in tls_test_c_pic.o.
15870 (tls_test_c_pic_ie.o): New target.
15871 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15872 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15873 (tls_test_c.o): New target.
15874 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15875 (tls_pic_test_LDADD): Likewise.
15876 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15877 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15878 (tls_test_c_gnu2.o): New target.
15879 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15880 tls_test_c_gnu2.o.
15881 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15882 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15883 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15884 * testsuite/tls_test.cc: Include "config.h".
15885 (t_last): Call t11_last.
15886 * testsuite/tls_test.h (t11, t11_last): Declare.
15887 * testsuite/tls_test_c.c: New file.
15888 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15889 * configure.ac: Check for OpenMP support.
15890 * configure, config.in, Makefile.in: Rebuild.
15891 * testsuite/Makefile.in: Rebuild.
15892
15893 2008-04-16 Cary Coutant <ccoutant@google.com>
15894
15895 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15896 (Target_i386::tls_base_symbol_defined_): New field.
15897 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15898 (Target_i386::Scan::global): Likewise.
15899 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15900 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15901 (Target_x86_64::tls_base_symbol_defined_): New field.
15902 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15903 (Target_x86_64::Scan::global): Likewise.
15904
15905 2008-04-16 Cary Coutant <ccoutant@google.com>
15906
15907 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15908 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15909 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15910 building shared libraries.
15911 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15912 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15913 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15914 * testsuite/Makefile.in: Rebuild.
15915 * testsuite/weak_undef.h: New file.
15916 * testsuite/weak_undef_file1.cc: Add extra test cases.
15917 * testsuite/weak_undef_file2.cc: Likewise.
15918 * testsuite/weak_undef_test.cc: Likewise.
15919
15920 2008-04-16 David S. Miller <davem@davemloft.net>
15921
15922 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15923 Add issued_non_pic_error_ field. Declare check_non_pic.
15924 (Target_sparc::Scan::check_non_pic): New function.
15925 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15926 (Target_sparc::Scan::global): Likewise.
15927
15928 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15929 * configure: Rebuild.
15930
15931 * options.h (DEFINE_enable): New macro.
15932 (new_dtags): New enable option.
15933 (initfirst, interpose, loadfltr, nodefaultlib,
15934 nodelete, nodlopen, nodump): New -z options.
15935 * layout.cc (Layout:finish_dynamic_section): If new
15936 dtags enabled, emit DT_RUNPATH. Also, emit a
15937 DT_FLAGS_1 containing any specified -z flags.
15938
15939 2008-04-16 Ian Lance Taylor <iant@google.com>
15940
15941 * copy-relocs.cc: New file.
15942 * copy-relocs.h: New file.
15943 * reloc.cc: Remove Copy_relocs code.
15944 * reloc.h: Likewise.
15945 * reloc-types.h (struct Reloc_types) [both versions]: Add
15946 get_reloc_addend_noerror.
15947 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15948 variants of add_global which take an addend which must be zero.
15949 * i386.cc: Include "copy-relocs.h".
15950 (class Target_i386): Change type of copy_relocs_ to variable,
15951 update initializer.
15952 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15953 Change all callers.
15954 (Target_i386::do_finalize_sections): Change handling of
15955 copy_relocs_.
15956 * sparc.cc: Include "copy-relocs.h".
15957 (class Target_sparc): Change type of copy_relocs_ to variable,
15958 update initializer.
15959 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15960 Change all callers.
15961 (Target_sparc::do_finalize_sections): Change handling of
15962 copy_relocs_.
15963 * x86_64.cc: Include "copy-relocs.h".
15964 (class Target_x86_64): Change type of copy_relocs_ to variable,
15965 update initializer.
15966 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15967 class. Change all callers.
15968 (Target_x86_64::do_finalize_sections): Change handling of
15969 copy_relocs_.
15970 * Makefile.am (CCFILES): Add copy-relocs.cc.
15971 (HFILES): Add copy-relocs.h.
15972
15973 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15974
15975 * testsuite/script_test_4.sh: Permit leading zeroes.
15976
15977 2008-04-15 Ian Lance Taylor <iant@google.com>
15978
15979 * script-sections.cc (Script_sections::create_segments): Use
15980 header_size_adjustment even when there is enough room for the
15981 headers.
15982 * testsuite/script_test_4.sh: New file.
15983 * testsuite/script_test_4.t: New file.
15984 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15985 (check_DATA): Add script_test_4.stdout.
15986 (MOSTLYCLEANFILES): Likewise.
15987 (script_test_4): New target.
15988 (script_test_4.stdout): New target.
15989 * testsuite/Makefile.in: Rebuild.
15990
15991 * sparc.cc: Add definitions for Output_data_plt_sparc class
15992 constants.
15993
15994 2008-04-14 David S. Miller <davem@davemloft.net>
15995
15996 * sparc.cc: New file.
15997 * Makefile.am (TARGETSOURCES): Add sparc.cc
15998 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15999 * configure.tgt: Document targ_extra_size and
16000 targ_extra_big_endian. Add entries for sparc-* and
16001 sparc64-*.
16002 * configure.ac: Handle targ_extra_size and
16003 targ_extra_big_endian.
16004 * Makefile.in: Rebuild.
16005 * configure: Likewise.
16006 * po/POTFILES.in: Likewise.
16007 * po/gold.pot: Likewise.
16008
16009 2008-04-14 Ian Lance Taylor <iant@google.com>
16010
16011 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16012 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16013 in the name/type/flags to section mapping. Don't call
16014 allocate_output_section.
16015 (Layout::choose_output_section): Change parameter from adjust_name
16016 to is_input_section. Don't permit input sections after sections
16017 are attached to segments. Don't call allocate_output_section.
16018 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16019 not write_enable_output_section.
16020 (Layout::make_output_section): Don't push to
16021 unattached_section_list_ nor call attach_to_segment. Call
16022 attach_section_to_segment if sections are attached.
16023 (Layout::attach_sections_to_segments): New function.
16024 (Layout::attach_section_to_segment): New function.
16025 (Layout::attach_allocated_section_to_segment): Rename from
16026 attach_to_segment. Remove flags parameter.
16027 (Layout::allocate_output_section): Remove function.
16028 (Layout::write_enable_output_section): Remove function.
16029 * layout.h (class Layout): Update for above changes. Add new
16030 field sections_are_attached_.
16031 * output.h (Output_section::update_flags_for_input_section): New
16032 function.
16033 * output.cc (Output_section::add_input_section): Call
16034 update_flags_for_input_section.
16035 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16036
16037 2008-04-11 Cary Coutant <ccoutant@google.com>
16038
16039 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16040 thought unnecessary.
16041 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16042
16043 2008-04-11 Ian Lance Taylor <iant@google.com>
16044
16045 * output.h (class Output_section_data): Remove inline definition
16046 of set_addralign.
16047 * output.cc (Output_section_data::set_addralign): New function.
16048
16049 2008-04-11 Cary Coutant <ccoutant@google.com>
16050
16051 Add support for TLS descriptors for i386 and x86_64.
16052 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16053 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16054 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16055 GOT_TYPE_TLS_DESC.
16056 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16057 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16058 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16059 relocations.
16060 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16061 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16062 Fix problem with initial-exec relocations.
16063 (Target_i386::Relocate::relocate_tls): Likewise.
16064 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16065 relaxation.
16066 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16067 support for section-plus-offset dynamic table entries.
16068 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16069 (Output_data_dynamic::Dynamic_entry): Add support for
16070 section-plus-offset dynamic table entries.
16071 (Output_data_dynamic::Classification): Likewise.
16072 (Output_data_dynamic::classification_): Renamed offset_.
16073 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16074 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16075 (Target_x86_64::make_plt_section): New function.
16076 (Target_x86_64::reserve_tlsdesc_entries): New function.
16077 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16078 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16079 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16080 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16081 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16082 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16083 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16084 add extra PLT entry for TLS descriptors.
16085 (Output_data_plt_x86_64::got_): New field.
16086 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16087 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16088 fields.
16089 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16090 descriptors.
16091 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16092 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16093 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16094 R_386_TLS_DESC_CALL relocations.
16095 (Target_x86_64::Scan::global): Likewise.
16096 (Target_x86_64::do_finalize_sections): Add dynamic table entries
16097 for TLS descriptors.
16098 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16099 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16100 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16101 GD-to-IE relaxation.
16102 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16103 and TLS_DESCRIPTORS.
16104 * Makefile.in: Rebuild.
16105 * configure: Rebuild.
16106 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16107 (tls_test_shared2.so): New target.
16108 (tls_shared_gd_to_ie_test_SOURCES): New variable.
16109 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16110 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16111 (tls_shared_gd_to_ie_test_LDADD): New variable.
16112 (tls_shared_gnu2_gd_to_ie_test): New target.
16113 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16114 New targets.
16115 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16116 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16117 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16118 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16119 (tls_shared_gnu2_test): New target.
16120 (tls_test_gnu2_shared.so): New target.
16121 (tls_shared_gnu2_test_SOURCES): New variable.
16122 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16123 (tls_shared_gnu2_test_LDFLAGS): New variable.
16124 (tls_shared_gnu2_test_LDADD): New variable.
16125 * testsuite/Makefile.in: Rebuild.
16126 * testsuite/Makefile.
16127
16128 2008-04-11 Ian Lance Taylor <iant@google.com>
16129
16130 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16131 justsyms.t.
16132 * testsuite/Makefile.in: Rebuild.
16133
16134 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16135 long.
16136 * testsuite/script_test_2.cc (main): Adjust test.
16137
16138 2008-04-11 David S. Miller <davem@davemloft.net>
16139 Ian Lance Taylor <iant@google.com>
16140
16141 * options.h (General_options): Add entries for '-Y' and
16142 '-relax'.
16143 * options.cc (General_options:finalize): If -Y was used, add those
16144 entries to the library path instead of the default "/lib" and
16145 "/usr/lib".
16146
16147 2008-04-11 David S. Miller <davem@davemloft.net>
16148
16149 * testsuite/justsyms.t: Start at 0x100.
16150 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16151 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16152 long.
16153 * testsuite/script_test_2.cc: Adjust string and section length
16154 checks.
16155
16156 2008-04-09 Ian Lance Taylor <iant@google.com>
16157
16158 PR gold/5996
16159 * script-sections.cc (Sections_element::allocate_to_segment): Add
16160 orphan parameter.
16161 (Output_section_definition::allocate_to_segment): Likewise.
16162 (Orphan_output_section::allocate_to_segment): Likewise.
16163 (Script_sections::attach_sections_using_phdrs_clause): Don't
16164 propagate non-PT_LOAD segments to orphan sections.
16165 * testsuite/Makefile.am (script_test_3.stdout): Generate using
16166 readelf rather than objdump.
16167 * testsuite/script_test_3.sh: Adjust accordingly. Test that
16168 .interp section and PT_INTERP segment are the same size.
16169 * testsuite/Makefile.in: Rebuild.
16170
16171 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16172 aliases for symbols defined in the same object.
16173 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16174 (weak_alias_test_SOURCES): New variable.
16175 (weak_alias_test_DEPENDENCIES): New variable.
16176 (weak_alias_test_LDFLAGS): New variable.
16177 (weak_alias_test_LDADD): New variable.
16178 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16179 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16180 (weak_alias_test_3.o): New target.
16181 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16182 * testsuite/weak_alias_test_main.cc: New file.
16183 * testsuite/weak_alias_test_1.cc: New file.
16184 * testsuite/weak_alias_test_2.cc: New file.
16185 * testsuite/weak_alias_test_3.cc: New file.
16186
16187 2008-04-08 Ian Lance Taylor <iant@google.com>
16188
16189 * options.h (class General_options): Add --noinhibit-exec option.
16190 * main.cc (main): Check --noinhibit-exec.
16191
16192 * options.h (class General_options): Define --wrap as a special
16193 option. Add wrap_symbols_ field.
16194 (General_options::any_wrap_symbols): New function.
16195 (General_options::is_wrap_symbol): New function.
16196 * options.cc (General_options::parse_wrap): New function.
16197 (General_options::General_options): Initialize wrap_symbols_.
16198 * symtab.cc (Symbol_table::wrap_symbol): New function.
16199 (Symbol_table::add_from_object): Handle --wrap.
16200 * symtab.h (class Symbol_table): Declare wrap_symbol.
16201 * target.h (Target::wrap_char): New function.
16202 (Target::Target_info): Add wrap_char field.
16203 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16204 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16205 * testsuite/testfile.cc (Target_test::test_target_info):
16206 Likewise.
16207
16208 * errors.cc (Errors::undefined_symbol): Mention symbol version if
16209 there is one.
16210
16211 * layout.h (class Layout): Add added_eh_frame_data_ field.
16212 * layout.cc (Layout::Layout): Initialize new field.
16213 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16214 output section until we find a section we merged successfully.
16215 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16216 that the size be non-zero.
16217
16218 * merge.cc (Object_merge_map::get_output_offset): Remove inline
16219 qualifier.
16220
16221 2008-04-08 Craig Silverstein <csilvers@google.com>
16222
16223 * configure.ac: Export new conditional variable HAVE_ZLIB.
16224 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16225 on HAVE_ZLIB.
16226 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16227 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16228
16229 2008-04-07 Ian Lance Taylor <iant@google.com>
16230
16231 * version.cc (version_string): Set to "1.5".
16232
16233 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16234 Add issued_non_pic_error_ field. Declare check_non_pic.
16235 (Target_x86_64::Scan::check_non_pic): New function.
16236 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16237 (Target_x86_64::Scan::global): Likewise.
16238
16239 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16240 addend parameter. Change caller. Handle merge sections.
16241 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16242 Address to Addend. Don't add in the result of
16243 local_section_offset, pass down the addend and use the returned
16244 value.
16245 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16246 Update declarations of local_section_offset and symbol_value.
16247 * testsuite/two_file_test_1.cc (t18): New function.
16248 * testsuite/two_file_test_2.cc (f18): New function.
16249 * testsuite/two_file_test_main.cc (main): Call t18.
16250 * testsuite/two_file_test.h (t18, f18): Declare.
16251
16252 * configure.ac: Don't test for objdump, c++filt, or readelf.
16253 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16254 conditionals.
16255 (TEST_READELF): New variable.
16256 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16257 (check_PROGRAMS): Add two_file_strip_test.
16258 (two_file_strip_test): New target.
16259 (check_PROGRAMS): Add two_file_same_shared_strip_test.
16260 (two_file_same_shared_strip_test_SOURCES): New variable.
16261 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16262 (two_file_same_shared_strip_test_LDFLAGS): New variable.
16263 (two_file_same_shared_strip_test_LDADD): New variable.
16264 (two_file_shared_strip.so): New target.
16265 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16266 (ver_test_5.syms, ver_test_7.syms): Likewise.
16267 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16268 (strip_test_3.stdout): Use TEST_OBJDUMP.
16269 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16270
16271 2008-04-04 Cary Coutant <ccoutant@google.com>
16272
16273 * symtab.h (Symbol::is_weak_undefined): New function.
16274 (Symbol::is_strong_undefined): New function.
16275 (Symbol::is_absolute): New function.
16276 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16277 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16278 absolute symbols.
16279 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16280 (weak_undef_test): New target.
16281 * testsuite/Makefile.in: Rebuild.
16282 * testsuite/weak_undef_file1.cc: New file.
16283 * testsuite/weak_undef_file2.cc: New file.
16284 * testsuite/weak_undef_test.cc: New file.
16285
16286 2008-04-03 Craig Silverstein <csilvers@google.com>
16287
16288 * compressed_output.h (class Output_compressed_section): Use
16289 unsigned buffer.
16290 * compressed_output.cc (zlib_compress): Use unsigned buffers,
16291 add zlib header.
16292 (zlib_compressed_suffix): Removed.
16293 (Output_compressed_section::set_final_data_size): Use unsigned
16294 buffers.
16295 * testsuite/Makefile.am (flagstest_compress_debug_sections):
16296 Fix linker invocation.
16297 (flagstest_o_specialfile_and_compress_debug_sections):
16298 Likewise.
16299 * testsuite/Makefile.in: Regenerated.
16300
16301 2008-04-02 David S. Miller <davem@davemloft.net>
16302
16303 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16304 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16305
16306 2008-04-02 Craig Silverstein <csilvers@google.com>
16307
16308 * TODO: New file.
16309
16310 2008-04-02 Ian Lance Taylor <iant@google.com>
16311
16312 * fileread.cc (File_read::find_view): Add byteshift and vshifted
16313 parameters. Update for new key type to views_. Change all
16314 callers.
16315 (File_read::read): Adjust for byteshift in returned view.
16316 (File_read::add_view): New function, broken out of
16317 find_and_make_view.
16318 (File_read::make_view): New function, broken out of
16319 find_and_make_view.
16320 (File_read::find_or_make_view): Add offset and aligned
16321 parameters. Rewrite accordingly. Change all callers.
16322 (File_read::get_view): Add offset and aligned parameters. Adjust
16323 for byteshift in return value.
16324 (File_read::get_lasting_view): Likewise.
16325 * fileread.h (class File_read): Update declarations.
16326 (class File_read::View): Add byteshift_ field. Add byteshift to
16327 constructor. Add byteshift method.
16328 * archive.h (Archive::clear_uncached_views): New function.
16329 (Archive::get_view): Add aligned parameter. Change all callers.
16330 * object.h (Object::get_view): Add aligned parameter. Change all
16331 callers.
16332 (Object::get_lasting_view): Likewise.
16333
16334 * fileread.cc (File_read::release): Don't call clear_views if
16335 there are multiple objects.
16336 * fileread.h (File_read::clear_uncached_views): New function.
16337 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16338 on the archive.
16339
16340 2008-03-31 Cary Coutant <ccoutant@google.com>
16341
16342 Add thin archive support.
16343 * archive.cc (Archive::armagt): New const.
16344 (Archive::setup): Remove task parameter and calls to unlock.
16345 (Archive::unlock_nested_archives): New function.
16346 (Archive::read_header): Add nested_off parameter. Change
16347 all callers.
16348 (Archive::interpret_header): Likewise.
16349 (Archive::include_all_members): Change to handle thin
16350 archives.
16351 (Archive::include_member): Likewise.
16352 * archive.h (Archive::Archive): Add new parameters and
16353 initializers.
16354 (Archive::armagt): New const.
16355 (Archive::setup): Remove task parameter.
16356 (Archive::unlock_nested_archives): New function.
16357 (Archive::read_header): Add nested_off parameter.
16358 (Archive::interpret_header): Likewise.
16359 (Archive::Nested_archive_table): New typedef.
16360 (Archive::is_thin_archive_): New field.
16361 (Archive::nested_archives_): New field.
16362 (Archive::options_): New field.
16363 (Archive::dirpath_): New field.
16364 (Archive::task_): New field.
16365 * readsyms.cc (Read_symbols::do_read_symbols): Add check
16366 for thin archives. Pass additional parameters to
16367 Archive::Archive. Unlock the archive file after calling
16368 Archive::setup.
16369
16370 2008-03-29 Ian Lance Taylor <iant@google.com>
16371
16372 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16373 version symbol to be local.
16374 * testsuite/ver_test_4.sh: New file.
16375 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16376 (check_DATA): Add ver_test_4.syms.
16377 (ver_test_4.syms): New target.
16378 * testsuite/Makefile.in: Rebuild.
16379
16380 * output.cc
16381 (Output_section::Input_section_sort_entry::has_priority): New
16382 function.
16383 (Output_section::Input_section_sort_entry::match_file_name): New
16384 function.
16385 (Output_section::Input_section_sort_entry::match_section_name):
16386 Remove.
16387 (Output_section::Input_section_sort_entry::match_section_name_prefix):
16388 Remove.
16389 (Output_section::Input_section_sort_entry::match_section_file):
16390 Remove.
16391 (Output_section::Input_section_sort_compare::operator()): Rewrite
16392 using new Input_section_sort_entry functions. Sort crtbegin and
16393 crtend first. Sort sections with no priority before sections with
16394 a priority.
16395 * testsuite/initpri1.c (d3): Check j != 4.
16396 (cd5): New constructor/destructor function.
16397 (main): Check j != 2.
16398
16399 * symtab.cc (Symbol_table::add_from_object): If we don't use the
16400 new symbol when resolving, don't call set_is_default.
16401 * testsuite/ver_test_7.cc: New file.
16402 * testsuite/ver_test_7.sh: New file.
16403 * testsuite/Makefile.am (ver_test_7.so): New target.
16404 (ver_test_7.o): New target.
16405 (check_SCRIPTS): Add ver_test_7.sh.
16406 (check_DATA): Add ver_test_7.syms.
16407 (ver_test_7.syms): New target.
16408
16409 2008-03-28 Ian Lance Taylor <iant@google.com>
16410
16411 * layout.cc (Layout::layout): If we see an input section with a
16412 name that needs sorting, set the must_sort flag for the output
16413 section.
16414 (Layout::make_output_section): If the name of the output section
16415 indicates that it might require sorting, set the may_sort flag.
16416 * output.h (Output_section::may_sort_attached_input_sections): New
16417 function.
16418 (Output_section::set_may_sort_attached_input_sections): New
16419 function.
16420 (Output_section::must_sort_attached_input_sections): New
16421 function.
16422 (Output_section::set_must_sort_attached_input_sections): New
16423 function.
16424 (class Output_section): Declare Input_section_sort_entry. Define
16425 Input_section_sort_compare. Declare
16426 sort_attached_input_sections. Add new fields:
16427 may_sort_attached_input_sections_,
16428 must_sort_attached_input_sections_,
16429 attached_input_sections_are_sorted_.
16430 * output.cc (Output_section::Output_section): Initialize new
16431 fields.
16432 (Output_section::add_input_section): Add an entry to
16433 input_sections_ if may_sort or must_sort are true.
16434 (Output_section::set_final_data_size): Call
16435 sort_attached_input_sections if necessary.
16436 (Output_section::Input_section_sort_entry): Define new class.
16437 (Output_section::Input_section_sort_compare::operator()): New
16438 function.
16439 (Output_section::sort_attached_input_sections): New function.
16440 * configure.ac: Check whether the compiler supports constructor
16441 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
16442 * testsuite/initpri1.c: New file.
16443 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16444 CONSTRUCTOR_PRIORITY.
16445 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16446 (initpri1_LDFLAGS): New variable.
16447 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16448
16449 2008-03-27 Ian Lance Taylor <iant@google.com>
16450
16451 * common.cc (Sort_commons::operator): Correct sorting algorithm.
16452 * testsuite/common_test_1.c: New file.
16453 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16454 (common_test_1_SOURCES): New variable.
16455 (common_test_1_DEPENDENCIES): New variable.
16456 (common_test_1_LDFLAGS): New variable.
16457
16458 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16459 and commons_ correctly when NAME/VERSION does not override
16460 NAME/NULL.
16461 * testsuite/ver_test_6.c: New file.
16462 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16463 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16464 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16465
16466 2008-03-26 Ian Lance Taylor <iant@google.com>
16467
16468 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16469 of an undefined symbol from a version script.
16470 * testsuite/Makefile.am (ver_test_5.so): New target.
16471 (ver_test_5.o): New target.
16472 (check_SCRIPTS): Add ver_test_5.sh.
16473 (check_DATA): Add ver_test_5.syms.
16474 (ver_test_5.syms): New target.
16475 * testsuite/ver_test_5.cc: New file.
16476 * testsuite/ver_test_5.script: New file.
16477 * testsuite/ver_test_5.sh: New file.
16478 * Makefile.in, testsuite/Makefile.in: Rebuild.
16479
16480 PR gold/5986
16481 Fix problems building gold with gcc 4.3.0.
16482 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16483 (gold_error_at_location, gold_warning_at_location): Use it.
16484 * configure.ac: Check whether we can compile and use a template
16485 function with a printf attribute.
16486 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16487 when jumping over bytes.
16488 * object.cc: Instantiate Object::read_section_data.
16489 * debug.h: Include <cstring>
16490 * dwarf_reader.cc: Include <algorithm>
16491 * main.cc: Include <cstring>.
16492 * options.cc: Include <cstring>.
16493 * output.cc: Include <cstring>.
16494 * script.cc: Include <cstring>.
16495 * script.h: Include <string>.
16496 * symtab.cc: Include <cstring> and <algorithm>.
16497 * target-select.cc: Include <cstring>.
16498 * version.cc: Include <string>.
16499 * testsuite/testmain.cc: Include <cstdlib>.
16500 * configure, config.in: Rebuild.
16501
16502 2008-03-25 Ian Lance Taylor <iant@google.com>
16503
16504 * options.cc: Include "../bfd/bfdver.h".
16505 (options::help): Print bug reporting address.
16506
16507 * version.cc (print_version): Adjust output for current value of
16508 BFD_VERSION_STRING.
16509
16510 * NEWS: New file.
16511
16512 * options.cc (options::help): Print list of supported targets.
16513 * target-select.h: Include <vector>.
16514 (class Target_selector): Make machine_, size_, and is_big_endian_
16515 fields const. Add bfd_name_ and instantiated_target_ fields.
16516 (Target_selector::Target_selector): Add bfd_name parameter.
16517 (Target_selector::recognize): Make non-virtual, call
16518 do_recognize.
16519 (Target_selector::recognize_by_name): Make non-virtual, call
16520 do_recognize_by_name.
16521 (Target_selector::supported_names): New function.
16522 (Target_selector::bfd_name): New function.
16523 (Target_selector::do_instantiate_target): New pure virtual
16524 function.
16525 (Target_selector::do_recognize): New virtual function.
16526 (Target_selector::do_recognize_by_name): New virtual function.
16527 (Target_selector::instantiate_target): New private function.
16528 (supported_target_names): Declare.
16529 * target-select.cc (Target_selector::Target_selector): Update for
16530 new parameter and fields.
16531 (select_target_by_name): Check that the name matches before
16532 calling recognize_by_name.
16533 (supported_target_names): New function.
16534 * i386.cc (class Target_selector_i386): Update Target_selector
16535 constructor call. Remove recognize and recognize_by_name. Add
16536 do_instantiate_target.
16537 * x86_64.cc (class Target_selector_x86_64): Likewise.
16538 * testsuite/testfile.cc (class Target_selector_test): Update for
16539 changes to Target_selector.
16540
16541 * README: Rewrite, with some notes on unsupported features.
16542
16543 2008-03-24 Cary Coutant <ccoutant@google.com>
16544
16545 * i386.cc (Target_i386::Got_type): New enum declaration.
16546 (Target_i386::Scan::local): Updated callers of Output_data_got
16547 member functions.
16548 (Target_i386::Scan::global): Likewise.
16549 (Target_i386::Relocate::relocate): Likewise.
16550 (Target_i386::Relocate::relocate_tls): Likewise.
16551 * object.h (Got_offset_list): New class.
16552 (Sized_relobj::local_has_got_offset): Added got_type parameter.
16553 (Sized_relobj::local_got_offset): Likewise.
16554 (Sized_relobj::set_local_got_offset): Likewise.
16555 (Sized_relobj::local_has_tls_got_offset): Removed.
16556 (Sized_relobj::local_tls_got_offset): Removed.
16557 (Sized_relobj::set_local_tls_got_offset): Removed.
16558 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16559 * output.cc (Output_data_got::add_global): Added got_type parameter.
16560 (Output_data_got::add_global_with_rel): Likewise.
16561 (Output_data_got::add_global_with_rela): Likewise.
16562 (Output_data_got::add_global_pair_with_rel): New function.
16563 (Output_data_got::add_global_pair_with_rela): New function.
16564 (Output_data_got::add_local): Added got_type parameter.
16565 (Output_data_got::add_local_with_rel): Likewise.
16566 (Output_data_got::add_local_with_rela): Likewise.
16567 (Output_data_got::add_local_pair_with_rel): New function.
16568 (Output_data_got::add_local_pair_with_rela): New function.
16569 (Output_data_got::add_global_tls): Removed.
16570 (Output_data_got::add_global_tls_with_rel): Removed.
16571 (Output_data_got::add_global_tls_with_rela): Removed.
16572 (Output_data_got::add_local_tls): Removed.
16573 (Output_data_got::add_local_tls_with_rel): Removed.
16574 (Output_data_got::add_local_tls_with_rela): Removed.
16575 * output.h (Output_data_got::add_global): Added got_type parameter.
16576 (Output_data_got::add_global_with_rel): Likewise.
16577 (Output_data_got::add_global_with_rela): Likewise.
16578 (Output_data_got::add_global_pair_with_rel): New function.
16579 (Output_data_got::add_global_pair_with_rela): New function.
16580 (Output_data_got::add_local): Added got_type parameter.
16581 (Output_data_got::add_local_with_rel): Likewise.
16582 (Output_data_got::add_local_with_rela): Likewise.
16583 (Output_data_got::add_local_pair_with_rel): New function.
16584 (Output_data_got::add_local_pair_with_rela): New function.
16585 (Output_data_got::add_global_tls): Removed.
16586 (Output_data_got::add_global_tls_with_rel): Removed.
16587 (Output_data_got::add_global_tls_with_rela): Removed.
16588 (Output_data_got::add_local_tls): Removed.
16589 (Output_data_got::add_local_tls_with_rel): Removed.
16590 (Output_data_got::add_local_tls_with_rela): Removed.
16591 * resolve.cc (Symbol::override_base_with_special): Removed
16592 reference to has_got_offset_ field.
16593 * symtab.cc (Symbol::init_fields): Replaced initialization
16594 of got_offset_ with got_offsets_. Removed initialization
16595 of has_got_offset_
16596 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16597 (Symbol::got_offset): Likewise.
16598 (Symbol::set_got_offset): Likewise.
16599 (Symbol::has_tls_got_offset): Removed.
16600 (Symbol::tls_got_offset): Removed.
16601 (Symbol::set_tls_got_offset): Removed.
16602 (Symbol::got_offset_): Removed.
16603 (Symbol::tls_mod_got_offset_): Removed.
16604 (Symbol::tls_pair_got_offset_): Removed.
16605 (Symbol::got_offsets_): New field.
16606 (Symbol::has_got_offset): Removed.
16607 (Symbol::has_tls_mod_got_offset): Removed.
16608 (Symbol::has_tls_pair_got_offset): Removed.
16609 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16610 (Target_x86_64::Scan::local): Updated callers of Output_data_got
16611 member functions.
16612 (Target_x86_64::Scan::global): Likewise.
16613 (Target_x86_64::Relocate::relocate): Likewise.
16614 (Target_x86_64::Relocate::relocate_tls): Likewise.
16615
16616 2008-03-25 Ben Elliston <bje@au.ibm.com>
16617
16618 * yyscript.y: Fix spelling error in comment.
16619
16620 2008-03-24 Ian Lance Taylor <iant@google.com>
16621
16622 * options.h (class General_options): Define build_id option.
16623 * layout.h (class Layout): Declare write_build_id, create_note,
16624 create_build_id. Add build_id_note_ member.
16625 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16626 "libiberty.h", "md5.h", "sha1.h".
16627 (Layout::Layout): Initialize eh_frame_data_,
16628 eh_frame_hdr_section_, and build_id_note_.
16629 (Layout::finalize): Call create_build_id.
16630 (Layout::create_note): New function, broken out of
16631 Layout::create_gold_note.
16632 (Layout::create_gold_note): Call create_note.
16633 (Layout::create_build_id): New function.
16634 (Layout::write_build_id): New function.
16635 (Close_task_runner::run): Call write_build_id.
16636
16637 * x86_64.cc: Correct license to GPLv3.
16638
16639 2008-03-23 Ian Lance Taylor <iant@google.com>
16640
16641 * options.cc: Include "demangle.h".
16642 (parse_optional_string): New function.
16643 (parse_long_option): Handle takes_optional_argument.
16644 (parse_short_option): Update dash_z initializer. Handle
16645 takes_optional_argument.
16646 (General_options::General_options): Initialize do_demangle_.
16647 (General_options::finalize): Set do_demangle_. Handle demangling
16648 style.
16649 * options.h (parse_optional_string): Declare.
16650 (struct One_option): Add optional_arg field. Update constructor.
16651 Update call constructor calls. Add takes_optional_argument
16652 function.
16653 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16654 (DEFINE_optional_string): Define.
16655 (General_options::demangle): Change from DEFINE_bool to
16656 DEFINE_optional_string.
16657 (General_options::no_demangle): New function.
16658 (General_options::do_demangle): New function.
16659 (General_options::set_do_demangle): New function.
16660 (General_options::execstack_status_): Move definition to end of
16661 class definition.
16662 (General_options::static_): Likewise.
16663 (General_options::do_demangle_): New field.
16664 * object.cc (big_endian>::get_symbol_location_info): Call
16665 Options::do_demangle, not Options::demangle.
16666 * symtab.cc (demangle): Likewise.
16667
16668 2008-03-22 Ian Lance Taylor <iant@google.com>
16669
16670 * gold.h: Include <cstddef> and <sys/types.h>
16671 * options.h: Include <cstring>.
16672
16673 2008-03-21 Ian Lance Taylor <iant@google.com>
16674
16675 * Added source code to GNU binutils.
16676 \f
16677 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16678
16679 Copying and distribution of this file, with or without modification,
16680 are permitted in any medium without royalty provided the copyright
16681 notice and this notice are preserved.
16682
16683 Local Variables:
16684 mode: change-log
16685 left-margin: 8
16686 fill-column: 74
16687 version-control: never
16688 End: