Add missing TLSLE relocations for gold aarch64 backend.
[binutils-gdb.git] / gold / ChangeLog
1 2015-02-12 Jing Yu <jingyu@google.com>
2
3 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
4 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
5 New relocation.
6 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
7 TLSLE_MOVW_* relocations.
8 (Target_aarch64::Scan::global): Likewise.
9 (Target_aarch64::Relocate::relocate): Likewise.
10 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
11 for new TLSLE_MOVW_* relocations.
12
13 2015-02-11 Will Newton <will.newton@linaro.org>
14
15 PR gold/13321
16 * arm.cc (Target_arm::make_plt_section): Create an ARM
17 state mapping symbol at the start of the PLT.
18
19 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
20
21 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
22 Replace two_file_shared_2.so with two_file_shared_1.so.
23 * testsuite/Makefile.in: Regenerated.
24
25 2015-02-09 Alan Modra <amodra@gmail.com>
26
27 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
28 plugin_test_thin.a and defsym_test.
29 * testsuite/Makefile.in: Regenerate.
30
31 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
32
33 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
34 body.
35
36 2015-02-04 Peter Collingbourne <pcc@google.com>
37
38 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
39 forwarding symbols when computing symbol resolution info for plugins.
40 * plugin.h (Plugin_manager::symtab): New method.
41 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
42
43 2015-02-03 Cary Coutant <ccoutant@google.com>
44 Peter Collingbourne <pcc@google.com>
45
46 PR gold/15660
47 * archive.cc (Thin_archive_object_unlocker): New class.
48 (Archive::include_member): Unlock external members of thin archives.
49 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
50 (plugin_test_2): Likewise.
51 (plugin_test_3): Likewise.
52 (plugin_test_4): Likewise.
53 (plugin_test_5): Likewise.
54 (plugin_test_6): Likewise.
55 (plugin_test_7): Likewise.
56 (plugin_test_8): Likewise.
57 (plugin_test_9): Likewise.
58 (plugin_test_10): Likewise.
59 (plugin_test_11): New test case.
60 * testsuite/Makefile.in: Regenerate.
61 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
62 file to decide whether to claim file.
63 (all_symbols_read_hook): Likewise.
64 * testsuite/plugin_test_1.sh: Adjust expected output.
65 * testsuite/plugin_test_2.sh: Likewise.
66 * testsuite/plugin_test_3.sh: Likewise.
67 * testsuite/plugin_test_6.sh: Likewise.
68 * testsuite/plugin_test_tls.sh: Likewise.
69 * testsuite/plugin_test_11.sh: New testcase.
70
71 2015-02-03 Cary Coutant <ccoutant@google.com>
72
73 * descriptors.cc (Descriptors::open): Set artificially-low limit for
74 file descriptors when debugging enabled. Add debug output.
75 (Descriptors::release): Add debug output.
76 (Descriptors::close_some_descriptor): Likewise.
77 (Descriptors::close_all): Likewise.
78 * fileread.cc (File_read::lock): Likewise.
79 (File_read::unlock): Likewise.
80
81 2015-02-02 Cary Coutant <ccoutant@google.com>
82
83 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
84 executable output file.
85
86 2015-01-22 Han Shen <shenhan@google.com>
87
88 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
89 (Target_arm::do_plt_address_for_global): New method.
90 (Target_arm::do_plt_address_for_local): New method.
91 (Target_arm::rel_irelative_section): New method.
92 (Target_arm::make_data_plt): Add more parameters for plt ctor.
93 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
94 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
95 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
96 (Target_arm::Scan::check_non_pic): Add ifunc support.
97 (Target_arm::Scan::local): Add ifunc support.
98 (Target_arm::Scan::global): Add ifunc support.
99 (Target_arm::make_plt_section): New method.
100 (Target_arm::make_plt_entry): Change to call to make_plt_section.
101 (Target_arm::make_local_ifunc_plt_entry): New method.
102 (Target_arm::got_irelative_): New member.
103 (Target_arm::rel_irelative_): New member.
104 (Target_arm::got_section): Add creation for got_irelative_.
105 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
106 (Target_arm::Relocate::relocate): Properly set local ifunc address.
107 (Target_arm::do_dynsym_value): Properly set global ifunc address.
108 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
109 (Output_data_plt_arm::IRelative_data): New type.
110 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
111 (Output_data_plt_arm::add_entry): Add more parameters.
112 (Output_data_plt_arm::add_relocation): New method.
113 (Output_data_plt_arm::add_local_ifunc_entry): New method.
114 (Output_data_plt_arm::rel_irelative): New method.
115 (Output_data_plt_arm::entry_count): Modified.
116 (Output_data_plt_arm::address_for_global): New method.
117 (Output_data_plt_arm::address_for_local): New method.
118 gold/
119 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
120 (Output_data_plt_arm::insert_irelative_data): New method.
121 (Output_data_plt_arm::irelative_rel_): New member.
122 (Output_data_plt_arm::got_): New member.
123 (Output_data_plt_arm::got_irelative_): New member.
124 (Output_data_plt_arm::irelative_count_): New member.
125 (Output_data_plt_arm::IRelative_data_vec): New typedef.
126 (Output_data_plt_arm::irelative_data_vec_): New member.
127 (Output_data_plt_arm::do_write): Write out irelative entries.
128 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
129 more parameters to ctor.
130 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
131 more parameters to ctor.
132 * output.h (Output_data_reloc::add_local_relative): New method.
133 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
134
135 2015-01-29 Alan Modra <amodra@gmail.com>
136
137 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
138 and GOT_TLSGD to LE optimization.
139
140 2015-01-28 Cary Coutant <ccoutant@google.com>
141
142 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
143 for undef TLS symbols.
144 (Target_x86_64::Relocate::relocate_tls): Likewise.
145 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
146
147 2015-01-25 Cary Coutant <ccoutant@google.com>
148
149 * output.cc (Output_segment::set_section_addresses): Fix calculation
150 of size of relro segment.
151
152 2015-01-22 Alan Modra <amodra@gmail.com>
153
154 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
155 condition for need of ifunc plt entry.
156 (Target_powerpc::Scan::global <got relocs>): Likewise.
157
158 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
159
160 * mips.cc (reloc_high): Add r_sym.
161 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
162 reloc_high constructor.
163 (Mips_relocate_functions::relgot16_local): Likewise.
164 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
165 r_type to decide whether LO16 matches HI16.
166 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
167 rello16 and relgot16_local.
168
169 2015-01-09 Cary Coutant <ccoutant@google.com>
170
171 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
172 unless alignment is larger than page size.
173
174 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
175 Cary Coutant <ccoutant@google.com>
176
177 PR gold/17729
178 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
179 (DEFAULT_TARGET_X32): Set for x32.
180 * x86_64.cc (cmp_insn_32): New.
181 (lea_r10_insn_32): Likewise.
182 (lea_r11_insn_32): Likewise.
183 (cmp_insn_64): Likewise.
184 (lea_r10_insn_64): Likewise.
185 (lea_r11_insn_64): Likewise.
186 (Target_x86_64<size>::do_calls_non_split): Handle x32.
187 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
188 (check_DATA): Add split_x32 files.
189 (split_x32_[1234n].o): New targets.
190 (split_x32_[124]): New targets.
191 (split_x32_[1234r].stdout): New targets.
192 * testsuite/split_x32.sh: New file.
193 * testsuite/split_x32_1.s: Likewise.
194 * testsuite/split_x32_2.s: Likewise.
195 * testsuite/split_x32_3.s: Likewise.
196 * testsuite/split_x32_4.s: Likewise.
197 * testsuite/split_x32_n.s: Likewise.
198 * configure: Regenerated.
199 * testsuite/Makefile.in: Likewise.
200
201 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
202
203 PR gold/17809
204 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
205 x32.
206
207 2015-01-02 Alan Modra <amodra@gmail.com>
208
209 * version.cc (print_version): Just print current year.
210 * dwp.cc (print_version): Likewise.
211
212 2015-01-01 Alan Modra <amodra@gmail.com>
213
214 Update year range in copyright notice of all files.
215
216 2014-12-25 Alan Modra <amodra@gmail.com>
217
218 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
219 new enums.
220 (Target_arm::merge_object_attributes, ): Likewise.
221
222 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
223
224 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
225 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
226 AEABI_VFP_args_vfp to check that.
227 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
228 value and replace hardcoded values by enum values.
229
230 2014-12-22 Cary Coutant <ccoutant@google.com>
231
232 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
233
234 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
235
236 PR gold/14608
237 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
238 to "return i * i * 3;".
239
240 2014-12-16 Cary Coutant <ccoutant@google.com>
241
242 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
243 (Mapfile::print_output_data): Use current_data_size() to avoid
244 assert for sections requiring postprocessing; if address is not valid,
245 print 0.
246 (Mapfile::print_output_section): Use current_data_size(); print note
247 that addresses and sizes are before compression.
248
249 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
250
251 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
252 Cast current_group_size to unsigned long when reporting error.
253
254 2014-12-10 Jing Yu <jingyu@google.com>
255
256 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
257 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
258 Update error message.
259 (Target_aarch64::do_relax): Use absolute value of option
260 stub_group_size. Replace local variable with class member
261 stub_group_size_.
262
263 2014-12-04 Alan Modra <amodra@gmail.com>
264
265 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
266 addend of PLTREL24 reloc when not generating a plt stub. Make
267 max_branch_offset an "Address".
268 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
269 (Target_powerpc::Relocate::relocate): Likewise.
270
271 2014-12-04 Alan Modra <amodra@gmail.com>
272
273 PR 17670
274 * symtab.cc (Symbol::set_undefined): Remove assertion.
275 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
276 on symbols defined in discarded sections, instead return false.
277 Rearrange params, update all callers.
278 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
279 branches to syms in discarded sections.
280 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
281 undefined and flag as discarded.
282 (Target_powerpc::Relocate::relocate): Localize variable.
283
284 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
285
286 PR gold/17675
287 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
288 * testsuite/Makefile.in: Regenerated.
289
290 2014-12-03 Alan Modra <amodra@gmail.com>
291
292 PR 17566
293 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
294 when adding dynamic relocations against section symbols.
295
296 2014-12-01 Dimitry Ivanov <dimitry@google.com>
297
298 * layout.cc (Layout::finish_dynamic_section): When '-z global'
299 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
300 * options.h (General_options): New -z option (global).
301
302 2014-12-01 Cary Coutant <ccoutant@google.com>
303
304 PR gold/17578
305 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
306 is given.
307 (Layout::create_executable_stack_info): Warn when -z noexecstack is
308 given but some inputs require executable stack.
309
310 2014-11-26 Cary Coutant <ccoutant@google.com>
311
312 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
313 .debug_str_offsets; strip .debug_gnu_pubnames and
314 .debug_gnu_pubtypes.
315 (lines_only_debug_sections): Strip all four new sections.
316
317 2014-11-26 Jing Yu <jingyu@google.com>
318
319 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
320 register to be x0 when to relax TLSDESC_LD64_LO12.
321
322 2014-11-26 Alan Modra <amodra@gmail.com>
323
324 * powerpc.cc (struct Stub_table_owner): New.
325 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
326 unsigned int vector. Update all references.
327 (powerpc_relobj::set_stub_table): Take an unsigned int param
328 rather than a Stub_table. Update callers.
329 (Powerpc_relobj::clear_stub_table): New function.
330 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
331 stub_group_size_ vars.
332 (Target_powerpc::new_stub_table): Delete.
333 (max_branch_delta): New function, extracted from..
334 (Target_powerpc::Relocate::relocate): ..here..
335 (Target_powerpc::Branch_info::make_stub): ..and here. Return
336 status on whether stub created successfully.
337 (Stub_control::Stub_control): Add "no_size_errors" param. Move
338 default sizing to..
339 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
340 reduce on relax failure.
341 (Target_powerpc::group_sections): Add "no_size_errors" param.
342 Use stub_group_size_. Set up group info in a temp vector,
343 before building Stub_table vector. Account for input sections
344 possibly already converted to relaxed sections.
345 (Stub_table::init): Delete. Merge into..
346 (Stub_table::Stub_table): ..here.
347 (Stub_table::can_reach_stub): New function.
348 (Stub_table::add_plt_call_entry): Add "from" parameter and
349 return true iff stub could be reached.
350 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
351 param too.
352 (Stub_table::clear_stubs): Add "all" param.
353
354 2014-11-26 Alan Modra <amodra@gmail.com>
355
356 * powerpc.cc (Stub_control::set_output_and_owner): New function.
357 (Target_powerpc::group_sections): Use it.
358
359 2014-11-25 Cary Coutant <ccoutant@google.com>
360
361 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
362 (Binary_to_elf::write_symbol): Add st_size parameter.
363 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
364
365 2014-11-25 Cary Coutant <ccoutant@google.com>
366
367 PR gold/17639
368 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
369 (Sized_relobj_file::do_layout): Handle deferred sections properly
370 during GC pass 1. Don't add reloc sections to deferred list twice.
371 * object.h (Sized_relobj_file::is_deferred_layout): New function.
372 (Sized_relobj_file::is_deferred_layout_): New data member.
373
374 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
375
376 PR gold/17619
377 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
378 Check PC-relative offset overflow in PLT entry.
379
380 2014-11-21 Alan Modra <amodra@gmail.com>
381
382 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
383 for undefined weaks.
384
385 2014-11-20 Alan Modra <amodra@gmail.com>
386
387 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
388 from --stub-group-size parameter divided by 1024.
389 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
390 template parameter. Update all uses.
391 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
392 has_stub_value. Set for long branches. Don't report overflow for
393 branch to undefined weak symbols. Print info message on
394 overflowing branch to stub.
395
396 2014-11-20 Alan Modra <amodra@gmail.com>
397
398 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
399
400 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
401
402 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
403 entry for R_X86_64_GOTPLT64.
404 (Target_x86_64<size>::Relocate::relocate): Update comments for
405 R_X86_64_GOTPLT64.
406
407 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
408
409 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
410 * plugin.h: add lock definition
411
412 2014-10-29 Han Shen <shenhan@google.com>
413 Jing Yu <jingyu@google.com>
414
415 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
416 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
417 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
418 Symbol::TLS_REF.
419 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
420 method.
421 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
422 (Target_aarch64::tls_ld_to_le): New method.
423 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
424 for 64bit targets.
425 (Output_data_plt_aarch64::irelative_rel_): New data member.
426 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
427 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
428 (Output_data_plt_aarch64::add_relocation): New method.
429 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
430 offset. Add got_irelative size to got size.
431 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
432 type string with the new typename.
433 (AArch64_relocate_functions::update_adr): Replace parameter x with
434 immed.
435 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
436 (AArch64_relocate_functions::reloc_common): New method.
437 (AArch64_relocate_funcsions::rela_general): Extract common part out
438 into reloc_common method.
439 (AArch64_relocate_functions::rela_general): Likewise.
440 (AArch64_relocate_functions::pcrela_general): Likewise.
441 (AArch64_relocate_functions::adr): New method.
442 (AArch64_relocate_functions::adrp): Calculate immed before calling
443 update_adr.
444 (AArch64_relocate_functions::adrp): Likewise.
445 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
446 comparing x to 0. Calculate immed from ~x when x < 0.
447 (Target_aarch64::optimize_tls_reloc): Add new cases for
448 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
449 TLSLD_MOVW_DTPREL_G0_NC.
450 (Target_aarch64::possible_function_pointer_reloc): Implement this
451 method.
452 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
453 comment.
454 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
455 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
456 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
457 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
458 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
459 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
460 (Target_aarch64::make_plt_entry): Call add_entry with two more
461 parameters.
462 (Target_aarch64::make_local_ifunc_plt_entry): New method.
463 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
464 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
465 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
466 (Target_aarch64::Relocate::relocate_tls): Add cases for
467 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
468 TLSLD_MOVW_DTPREL_G0_NC.
469 * testsuite/icf_safe_so_test.cc: Correct test comment.
470 * testsuite/icf_safe_test.sh: Add AArch64 arch.
471
472 2014-10-22 Alan Modra <amodra@gmail.com>
473
474 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
475 thread_starter.
476
477 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
478
479 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
480
481 2014-10-17 Cary Coutant <ccoutant@google.com>
482
483 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
484 Add "typename" keyword.
485
486 2014-10-15 Han Shen <shenhan@google.com>
487 Jing Yu <jingyu@google.com>
488
489 Patch for gold aarch64 backend to support relaxation.
490 * aarch64-reloc.def: Change format.
491 * aarch64.cc (class Reloc_stub): New class.
492 (class Stub_table): New class.
493 (class AArch64_relobj): New class.
494 (class AArch64_input_section): New class.
495 (class AArch64_output_section): New class.
496 (Target_aarch64::new_stub_table): New method.
497 (Target_aarch64::new_aarch64_input_section): New method.
498 (Target_aarch64::find_aarch64_input_section): New method.
499 (Target_aarch64::scan_section_for_stubs): New method.
500 (Target_aarch64::scan_reloc_section_for_stubs): New method.
501 (Target_aarch64::relocate_stub): New method.
502 (Target_aarch64::current_target): New method.
503 (Target_aarch64::do_make_elf_object): New method.
504 (Target_aarch64::do_may_relax): New method.
505 (Target_aarch64::do_relax): New method.
506 (Target_aarch64::group_sections): New method.
507 (Target_aarch64::scan_reloc_for_stub): New method.
508 (Target_aarch64::do_make_output_section): New method.
509 (Target_aarch64::stub_tables_): New data member.
510 (Target_aarch64::aarch64_input_section_map_): New data member.
511 (AArch64_relocate_functions::maybe_apply_stub): New method.
512
513 2014-09-30 Cary Coutant <ccoutant@google.com>
514
515 PR gold/17432
516 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
517
518 2014-09-30 Kito Cheng <kito@0xlab.org>
519
520 PR gold/13597
521 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
522 hash table before sysv-style hash table.
523
524 2014-09-29 Sriraman Tallam <tmsriram@google.com>
525
526 * options.h (--pic-executable): Add negative to alias to -no-pie.
527
528 2014-09-26 Cary Coutant <ccoutant@google.com>
529
530 PR gold/16773
531 * object.cc (Sized_relobj_file): Compute value of section symbols
532 for TLS sections the same as TLS symbols.
533
534 2014-09-25 Cary Coutant <ccoutant@google.com>
535
536 PR gold/17432
537 * resolve.cc (Symbol_table::resolve): Override common placeholder
538 symbols, but adjust sizes.
539 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
540 symbols to common lists.
541
542 2014-09-24 Alan Modra <amodra@gmail.com>
543
544 * po/POTFILES.in: Regenerate.
545
546 2014-09-23 Taiju Tsuiki <tzik@google.com>
547 Cary Coutant <ccoutant@google.com>
548
549 PR gold/14860
550 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
551 on input_sections_blocker.
552 * layout.cc (Write_sections_task::locks): Unblock
553 input_sections_blocker_.
554 * layout.h (Write_sections_task::Write_sections_task): Add
555 input_sections_blocker.
556 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
557 to DEPENDENCIES.
558 * testsuite/Makefile.in: Regenerate.
559
560 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
561
562 * testsuite/Makefile.am (plugin_test_10): New test.
563 * testsuite/Makefile.in: Regenerate
564 * testsuite/plugin_common_test_2.c (c1): Align to 8.
565 * testsuite/plugin_test_10.sh: New file.
566
567 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
568
569 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
570 * resolve.cc (Symbol_table::resolve): Don't override common symbols
571 during the replacement phase.
572
573 2014-09-17 Han Shen <shenhan@google.com>
574 Jing Yu <jingyu@google.com>
575
576 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
577 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
578 * aarch64.cc (Target_aarch64): Add data members
579 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
580 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
581 constructor.
582 (Target_aarch64::do_reloc_symbol_index): New method.
583 (Target_aarch64::do_reloc_addend): New method.
584 (Target_aarch64::add_tlsdesc_info): New method.
585 (Target_aarch64::do_dynsym_value): New method.
586 (Target_aarch64::do_make_data_plt): Add new parameters: got,
587 got_irelative. Pass them to Output_data_plt_aarch64_standard.
588 (Target_aarch64::make_data_plt): Add new parameters: got,
589 got_irelative. Pass them to do_make_data_plt.
590 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
591 (Target_aarch64::Relocate:tls_gd_to_le): New method.
592 (Target_aarch64::Relocate:tls_ie_to_le): New method.
593 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
594 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
595 (Target_aarch64::got_tlsdesc_section): New method.
596 (Target_aarch64::make_local_ifunc_plt_entry): New method.
597 (Target_aarch64::define_tls_base_symbol): New method.
598 (Target_aarch64::reserve_tlsdesc_entries): New method.
599 (Target_aarch64::got_mod_index_entry): New method.
600 (Target_aarch64::rela_tlsdesc_section): New method.
601 (Target_aarch64::rela_irelative_section): New method.
602 (Target_aarch64::Tlsdesc_info): New struct.
603 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
604 relocations and tlsdesc relocations.
605 (Target_aarch64::optimize_tls_reloc): Implement method.
606 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
607 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
608 in constructor.
609 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
610 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
611 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
612 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
613 (Output_data_plt_aarch64::rela_tlsdesc): New method.
614 (Output_data_plt_aarch64::rela_irelative): New method.
615 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
616 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
617 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
618 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
619 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
620 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
621 (Output_data_plt_aarch64_standard): New member variables:
622 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
623 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
624 New parameter: got, got_irelative.
625 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
626 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
627 (Output_data_plt_aarch64::do_write): Replace got_address with
628 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
629 (AArch64_relocate_functions::update_movnz): New method.
630 (AArch64_relocate_functions): Correct format.
631 (AArch64_relocate_functions::movnz): New method.
632 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
633 before the switch. Add new cases to switch.
634 Check ie_to_le relaxation on tlsie relocations. Add code handling
635 tlsgd tlsdesc cases.
636 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
637 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
638 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
639 Call reloc_name_in_error_message to print unsupported reloc.
640 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
641 make_data_plt.
642 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
643 relocs. Fill in some more dynamic tags.
644 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
645 Skip call tls_get_addr when tlsgd is relaxed.
646 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
647 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
648 tlsdesc->ie relaxation.
649
650 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
651
652 * mips.cc (Target_mips_nacl): New class.
653 (Target_selector_mips_nacl): New class.
654 (target_selector_mips32): Rename from target_selector_mips32be and use
655 Target_selector_mips_nacl instead of Target_selector_mips.
656 (target_selector_mips32el): Rename from target_selector_mips32 and use
657 Target_selector_mips_nacl instead of Target_selector_mips.
658 (target_selector_mips64): Rename from target_selector_mips64be and use
659 Target_selector_mips_nacl instead of Target_selector_mips.
660 (target_selector_mips64el): Rename from target_selector_mips64 and use
661 Target_selector_mips_nacl instead of Target_selector_mips.
662 (Target_mips::mips_info): Add const attribute.
663
664 2014-09-02 Cary Coutant <ccoutant@google.com>
665
666 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
667 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
668 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
669 (Sized_incr_dynobj::do_section_name): Likewise.
670 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
671 (Sized_incr_dynobj::do_section_name): Likewise.
672 * object.h (Object::section_name): Likewise.
673 (Object::do_section_name): Likewise.
674 (Sized_relobj_file::do_section_name): Likewise.
675 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
676 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
677
678 2014-09-02 Cary Coutant <ccoutant@google.com>
679
680 PR gold/17005
681 * ehframe.cc (Fde::write): Add output_offset parameter.
682 (Cie::write): Likewise.
683 (Eh_frame::set_final_data_size): Account for offset within output
684 section.
685 (Eh_frame::do_sized_write): Likewise.
686 * ehframe.h (Fde::write): Add output_offset parameter.
687 (Cie::write): Likewise.
688 * output.cc (Output_section::Input_section_sort_entry): Remove
689 section_has_name_; add output_section_name parameter. Use
690 output section name for non-input sections.
691 (Output_section::Input_section_sort_entry::section_has_name): Remove.
692 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
693 (Output_section::Input_section_sort_compare): Remove logic for
694 sections without names.
695 (Output_section::Input_section_sort_init_fini_compare): Likewise.
696 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
697 Likewise.
698 (Output_section::Input_section_sort_section_name_compare): Likewise.
699
700 2014-08-29 Han Shen <shenhan@google.com>
701 Jing Yu <jingyu@google.com>
702
703 * aarch64-reloc-property.cc
704 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
705 reference reloc property in the table.
706 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
707 3 other entries.
708 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
709 2 new overloaded methods.
710 (Output_data_got_aarch64::do_write): Add code to write out
711 static relocs.
712 (class Output_data_got_aarch64::Static_reloc): New class to wrap
713 static relocs.
714 (Output_data_got_aarch64::static_relocs): New vector to
715 hold static relocs.
716 (Target_aarch64::TCB_SIZE): New const static memeber.
717 (Target_aarch64::tcb_size): New method.
718 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
719 (Target_aarch64::Relocate::relocate_tls): New method.
720 (Target_aarch64::Scan::local): Add code handling new reloc types.
721 (Target_aarch64::Scan::global): Add code handling new reloc types.
722
723 2014-08-13 Sriraman Tallam <tmsriram@google.com>
724
725 * options.h (-no-pie): Add option.
726
727 2014-08-08 Jing Yu <jingyu@google.com>
728 Han Shen <shenhan@google.com>
729
730 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
731 (DEFFILES): add aarch64-reloc.def.
732 (TARGETSOURCES): Add aarch64-reloc-property.cc.
733 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
734 * Makefile.in: Regenerate.
735 * aarch64-reloc-property.cc: New file.
736 * aarch64-reloc-property.h: New file.
737 * aarch64-reloc.def: New file.
738 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
739 with tab to make the format consistent.
740 (Output_data_got_aarch64::symbol_table_): New method.
741 (Target_aarch64::do_plt_address_for_global): New method.
742 (Target_aarch64::do_plt_address_for_local): New method.
743 (Target_aarch64::do_select_as_default_target): New method.
744 (Target_aarch64::do_make_data_plt): New method.
745 (Target_aarch64::make_data_plt): New method.
746 (Output_data_plt_aarch64::has_irelative_section): New method.
747 (Output_data_plt_aarch64::address_for_global): New method.
748 (Output_data_plt_aarch64::address_for_local): New method.
749 (Output_data_plt_aarch64::irelative_rel_): New parameter.
750 (Output_data_plt_aarch64::add_entry): Implement contents.
751 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
752 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
753 the got_pov entry to plt0.
754 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
755 Implement contents.
756 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
757 (AArch64_howto): New struct.
758 (aarch64_howto[]): New static const array.
759 (AArch64_relocate_functions): New class.
760 (Target_aarch64::Scan::get_reference_flags): Remove method.
761 (Target_aarch64::Scan::local): Implement to support a few relocations.
762 (Target_aarch64::Scan::global): Implement to support a few relocations.
763 (Target_aarch64::make_plt_section): Implement contents.
764 (Target_aarch64::make_plt_entry): Implement contents.
765 (Target_aarch64::do_finalize_sections): Implement contents.
766 (Target_aarch64::Relocate::relocate): Implement a few relocations.
767 (Target_aarch64::relocate_section): Implement contents.
768
769 2014-08-06 Alan Modra <amodra@gmail.com>
770
771 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
772
773 2014-08-06 Alan Modra <amodra@gmail.com>
774
775 PR 13227
776 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
777
778 2014-07-21 Sriraman Tallam <tmsriram@google.com>
779
780 * object.cc (Relobj::is_section_name_included): Add
781 ".rodata.nptl_version" to not garbage collect this section.
782
783 2014-07-08 Cary Coutant <ccoutant@google.com>
784
785 * expression.cc (struct Expression::Expression_eval_info): Add
786 new fields type_pointer, vis_pointer, and nonvis_pointer.
787 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
788 nonvis_pointer parameters. Adjust all calls.
789 (Symbol_expression::value): Update type, visibility, and nonvis bits
790 in caller.
791 * script.cc (Symbol_assignment::sized_finalize): Update type,
792 visibility, and remaining st_other bits for new symbol.
793 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
794 vis_pointer, and nonvis_pointer parameters.
795 * symtab.h (Symbol::set_type): New method.
796
797 * testsuite/Makefile.am (defsym_test): New test.
798 * testsuite/Makefile.in: Regenerate.
799 * testsuite/defsym_test.c: New file.
800 * testsuite/defsym_test.sh: New file.
801
802 2014-07-08 Cary Coutant <ccoutant@google.com>
803
804 PR gold/15639
805 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
806 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
807 (Sized_dynobj::base_read_symbols): ...new method.
808 * object.h (Sized_relobj_file::base_read_symbols): New method.
809 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
810 (Sized_relobj_file::base_read_symbols): ...new method.
811 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
812 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
813 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
814
815 2014-07-04 Alan Modra <amodra@gmail.com>
816
817 * po/POTFILES.in: Regenerate.
818
819 2014-07-02 Jing Yu <jingyu@google.com>
820
821 * aarch64.cc: New file
822 * Makefile.am (TARGETSOURCES): Add aarch64.cc
823 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
824 * Makefile.in: Regenerate.
825 * configure.tgt: Add entries for aarch64*.
826 * configure.ac: Likewise.
827 * configure: Likewise.
828
829 2014-06-27 Alan Modra <amodra@gmail.com>
830
831 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
832
833 2014-06-24 Cary Coutant <ccoutant@google.com>
834
835 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
836 sections.
837 (Dwo_file::sized_read_unit_index): Likewise.
838
839 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
840
841 * mips.cc: New file.
842 * Makefile.am (TARGETSOURCES): Add mips.cc
843 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
844 * configure.tgt: Add entries for mips*.
845 * configure.ac: Likewise.
846 * Makefile.in: Regenerate.
847 * configure: Likewise.
848
849 2014-06-09 Cary Coutant <ccoutant@google.com>
850
851 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
852 unit_length is within section bounds.
853
854 2014-06-09 Cary Coutant <ccoutant@google.com>
855
856 PR gold/16980
857 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
858 map.
859
860 2014-06-07 Alan Modra <amodra@gmail.com>
861
862 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
863
864 2014-06-06 Cary Coutant <ccoutant@google.com>
865
866 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
867 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
868 (Dwarf_pubnames_table::read_header): Likewise.
869 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
870 .debug_gnu_pubtypes.
871
872 2014-06-05 Joel Brobecker <brobecker@adacore.com>
873
874 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
875 * Makefile.in, configure: Regenerate.
876
877 2014-06-03 Alan Modra <amodra@gmail.com>
878
879 * powerpc.cc (addis_12_2): Define.
880 (Stub_table::do_write): Support fusion on ELFv2 stubs.
881
882 2014-06-03 Alan Modra <amodra@gmail.com>
883
884 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
885 st_other output.
886
887 2014-06-02 Alan Modra <amodra@gmail.com>
888
889 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
890 Only ignore relocs on ELFv1.
891 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
892
893 2014-05-30 Cary Coutant <ccoutant@google.com>
894
895 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
896 * testsuite/Makefile.in: Regenerate.
897 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
898
899 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
900
901 PR gold/16945
902 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
903 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
904
905 2014-05-15 Alan Modra <amodra@gmail.com>
906
907 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
908 Compare FDE contents with DW_CFA_nop rather than 0.
909
910 2014-05-13 Sriraman Tallam <tmsriram@google.com>
911
912 * symtab.h (may_need_copy_reloc): Remove check for position independent
913 code.
914 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
915 position independence before pc absolute may_need_copy_reloc call.
916 Add check for executable output befor pc relative may_need_copy_reloc
917 call.
918 * i386.cc: Ditto.
919 * arm.cc: Ditto.
920 * sparc.cc: Ditto.
921 * tilegx.cc: Ditto.
922 * powerpc.cc: Add check for no position independence before
923 may_need_copy_reloc calls.
924 * testsuite/pie_copyrelocs_test.cc: New file.
925 * testsuite/pie_copyrelocs_shared_test.cc: New file.
926 * Makefile.am (pie_copyrelocs_test): New test.
927 * Makefile.in: Regenerate.
928
929 2014-05-08 Martin Liška <mliska@suse.cz>
930
931 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
932
933 2014-05-06 Cary Coutant <ccoutant@google.com>
934
935 PR gold/16900
936 * i386.cc (Output_data_got_plt_i386): New class.
937 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
938 parameter. Change all callers.
939 (Output_data_plt_i386::layout_): Remove.
940 (Output_data_plt_i386::got_plt_): Change type.
941 (Target_i386::got_plt_): Change type. Change all references.
942 (Target_i386::got_section): Create instance of new class.
943 (Output_data_got_plt_i386::do_write): New function.
944 * x86_64.cc (Output_data_got_plt_x86_64): New class.
945 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
946 parameter. Change all callers.
947 (Output_data_plt_x86_64::layout_): Remove.
948 (Output_data_plt_x86_64::got_plt_): Change type.
949 (Target_x86_64::got_plt_): Change type. Change all references.
950 (Target_x86_64::got_section): Create instance of new class.
951 (Output_data_got_plt_x86_64::do_write): New function.
952 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
953 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
954 class.
955
956 2014-05-05 Cary Coutant <ccoutant@google.com>
957
958 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
959 if we have pubnames/pubtypes.
960
961 2014-05-02 Cary Coutant <ccoutant@google.com>
962
963 * defstd.cc (in_segment): Define __ehdr_start here...
964 * layout.cc (Layout::finalize): ...Instead of here. Set the
965 output segment when known.
966 * resolve.cc (Symbol::override_base_with_special): Remember
967 the original binding.
968 * symtab.cc (Symbol::set_output_segment): New function.
969 (Symbol::set_undefined): New function.
970 * symtab.h (Symbol::is_weak_undefined): Check original undef
971 binding.
972 (Symbol::is_strong_undefined): New function.
973 (Symbol::set_output_segment): New function.
974 (Symbol::set_undefined): New function.
975 * target-reloc.h (is_strong_undefined): Remove.
976 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
977 Check for hidden undefs.
978 (relocate_section): Call Symbol::is_strong_undefined.
979
980 * testsuite/Makefile.am (ehdr_start_test_1)
981 (ehdr_start_test_2, ehdr_start_test_3)
982 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
983 * testsuite/Makefile.in: Regenerate.
984 * testsuite/ehdr_start_def.cc: New source file.
985 * testsuite/ehdr_start_test.cc: New source file.
986 * testsuite/ehdr_start_test.t: New linker script.
987 * testsuite/ehdr_start_test_4.sh: New shell script.
988
989 2014-04-23 Cary Coutant <ccoutant@google.com>
990
991 PR gold/16870
992 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
993
994 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
995
996 * layout.cc (Layout::include_section): Allow a target to decide
997 whether to include a section.
998 * target.h (Target::should_include_section): New function.
999 (Target::do_should_include_section): New function.
1000
1001 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1002
1003 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1004 inline into ...
1005 (Copy_relocs::emit): ... here.
1006 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1007 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1008 (Copy_reloc_entry::entries_): Change from private to protected.
1009
1010 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1011
1012 * icf.cc (get_section_contents): Replace copies of reloc
1013 vectors with const references.
1014
1015 2014-04-02 Cary Coutant <ccoutant@google.com>
1016
1017 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1018 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1019 * configure: Regenerate.
1020 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1021 -fno-use-linker-plugin.
1022 (LINK1, CXXLINK1): Add it to the link command.
1023 * testsuite/Makefile.in: Regenerate.
1024
1025 2014-03-12 Alan Modra <amodra@gmail.com>
1026
1027 * Makefile.in: Regenerate.
1028
1029 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1030
1031 * symtab.h (Symbol::set_nonvis): New function.
1032
1033 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1034
1035 * symtab.cc (Sized_symbol<32>::init_output_data):
1036 Instantiate the template.
1037 (Sized_symbol<64>::init_output_data): Likewise.
1038
1039 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1040
1041 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1042 adjust dynamic symbol value.
1043 * target.h (Target::adjust_dyn_symbol): New function.
1044 (Target::do_adjust_dyn_symbol): New function.
1045
1046 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1047
1048 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1049 Get the value of DYNAMIC_CUSTOM dynamic entry.
1050 * output.h (Output_data_dynamic::add_custom): New function.
1051 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1052 dynamic entry.
1053 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1054 * target.h (Target::dynamic_tag_custom_value): New function.
1055 (Target::do_dynamic_tag_custom_value): New function.
1056
1057 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1058
1059 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1060 dynsym indexes.
1061 * target.h (Target::has_custom_set_dynsym_indexes): New function.
1062 (Target::do_has_custom_set_dynsym_indexes): New function.
1063 (Target::set_dynsym_indexes): New function.
1064 (Target::do_set_dynsym_indexes): New function.
1065
1066 2014-03-07 Alan Modra <amodra@gmail.com>
1067
1068 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1069 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1070 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1071 (Powerpc_relocate_functions::has_overflow_bitfield,
1072 overflowed): Use the above.
1073 (Target_powerpc::Relocate::relocate): Correct overflow checking
1074 for a number of relocations. Modify overflow test for 16-bit
1075 fields in instructions to signed/unsigned according to whether
1076 the field takes a signed or unsigned value.
1077
1078 2014-03-05 Alan Modra <amodra@gmail.com>
1079
1080 Update copyright years.
1081
1082 2014-03-05 Alan Modra <amodra@gmail.com>
1083
1084 * powerpc.cc (Target_powerpc::Scan::local, global): Support
1085 R_PPC64_ADDR64_LOCAL.
1086 (Target_powerpc::Relocate::relocate): Likewise.
1087
1088 2014-03-03 Alan Modra <amodra@gmail.com>
1089
1090 * dwp.cc (print_version): Update copyright year to current.
1091
1092 2014-02-10 Alan Modra <amodra@gmail.com>
1093
1094 * po/gold.pot: Regenerate.
1095
1096 2014-02-06 Cary Coutant <ccoutant@google.com>
1097
1098 Fix problem where -u is ignored when a weak undef is seen.
1099
1100 * archive.cc (Library_base::should_include_member): Reorder
1101 code to check for -u option if a weak undef has already been seen.
1102 * testsuite/Makefile.am (weak_undef_test_2): New test case.
1103 * testsuite/Makefile.in: Regenerate.
1104 * testsuite/weak_undef_file3.cc: New file.
1105 * testsuite/weak_undef_file4.cc: New file.
1106 * testsuite/weak_undef_test_2.cc: New file.
1107
1108 2014-02-05 Cary Coutant <ccoutant@google.com>
1109
1110 Fix issues with gold undefined symbol diagnostics.
1111
1112 PR binutils/15435
1113 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1114 check to here.
1115 * target-reloc.h (is_strong_undefined): New function.
1116 (relocate_section): Move undef vtable symbol check from here.
1117 Check for is_strong_undefined.
1118
1119 2014-02-05 Cary Coutant <ccoutant@google.com>
1120
1121 Fix problems with the --dynamic-list option.
1122
1123 PR gold/13577
1124 * options.cc (General_options::parse_dynamic_list):
1125 Set have_dynamic_list_.
1126 (General_options::General_options): Initialize have_dynamic_list_.
1127 (General_options::finalize): Turn off -Bsymbolic and
1128 -Bsymbolic-functions if --dynamic-list provided.
1129 * options.h (General_options::have_dynamic_list): New function.
1130 (General_options::have_dynamic_list_): New data member.
1131 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1132 correctly.
1133
1134 PR gold/16530
1135 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1136 in --dynamic-list, mark it.
1137
1138 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1139 (dynamic_list_2): New test case.
1140 * testsuite/Makefile.in: Regenerate.
1141 * testsuite/dynamic_list_2.cc: New file.
1142 * testsuite/dynamic_list_2.t: New file.
1143 * testsuite/dynamic_list_lib1.cc: New file.
1144 * testsuite/dynamic_list_lib2.cc: New file.
1145 * testsuite/gc_dynamic_list_test.c: New file.
1146 * testsuite/gc_dynamic_list_test.sh: New file.
1147 * testsuite/gc_dynamic_list_test.t: New file.
1148
1149 2014-01-28 Cary Coutant <ccoutant@google.com>
1150
1151 Add .gdb_index version 7 support.
1152
1153 * gold/dwarf_reader.cc: include <utility> (for make_pair).
1154 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1155 debug sections.
1156 (Dwarf_ranges_table::read_ranges_table): Likewise.
1157 (Dwarf_pubnames_table::read_section): Check for GNU-style
1158 sections, and for compressed debug sections.
1159 (Dwarf_pubnames_table::read_header): Compute end address of table.
1160 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
1161 for end of list by offset, not by offset == 0.
1162 (Dwarf_info_reader::do_read_string_table): Check for compressed
1163 debug sections.
1164 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1165 Initialize new data members.
1166 (Dwarf_pubnames_table::next_name): return flag_byte.
1167 (Dwarf_pubnames_table::end_of_table_): New data member.
1168 (Dwarf_pubnames_table::is_gnu_style_): New data member.
1169 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1170 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1171 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1172 read skeleton type unit DIEs.
1173 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1174 (Gdb_index::do_write): Write flag_byte.
1175 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1176 (Gdb_index::Cu_vector): Store flags along with cu indexes.
1177 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1178 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1179
1180 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
1181
1182 * version.cc (print_version): Update copyright year to 2014.
1183
1184 2013-12-19 Dimitry Andric <dimitry@andric.com>
1185
1186 * stringpool.cc (Stringpool_template::reserve): Add
1187 HAVE_UNORDERED_MAP case.
1188 * stringpool.cc (Stringpool_template::print_stats): Likewise.
1189
1190 2013-12-18 Cary Coutant <ccoutant@google.com>
1191
1192 * configure.ac: Check for <unordered_set> and <unordered_map>.
1193 * config.in: Regenerate.
1194 * configure: Regenerate.
1195 * system.h: Use <unordered_set> and <unordered_map> if available.
1196
1197 2013-12-10 Roland McGrath <mcgrathr@google.com>
1198
1199 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1200 with $(INSTALL_PROGRAM_ENV).
1201 * Makefile.in: Regenerate.
1202
1203 2013-11-22 Cary Coutant <ccoutant@google.com>
1204
1205 * configure.ac: Add check for which library is needed for
1206 dlopen.
1207 * configure: Regenerate.
1208
1209 2013-11-22 Cary Coutant <ccoutant@google.com>
1210
1211 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1212 assembler.
1213 * testsuite/Makefile.in: Regenerate.
1214
1215 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
1216
1217 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1218 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1219 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1220 (Target_x86_64<size>::Scan::local): Likewise.
1221 (Target_x86_64<size>::Scan::global): Likewise.
1222 (Target_x86_64<size>::Relocate::relocate): Likewise.
1223 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1224 Likewise.
1225 (Target_x86_64<size>::Scan::check_non_pic(): Handle
1226 R_X86_64_PC32_BND.
1227
1228 * testsuite/Makefile.am (check_PROGRAMS): Add
1229 exception_x86_64_bnd_test.
1230 (exception_x86_64_bnd_test_SOURCES): New macro.
1231 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1232 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1233 (exception_x86_64_bnd_test_LDADD): Likewise.
1234 (exception_x86_64_bnd_1.o): New rule.
1235 (exception_x86_64_bnd_2.o): Likewise.
1236 * testsuite/Makefile.in: Regenerated.
1237
1238 2013-11-15 Alan Modra <amodra@gmail.com>
1239
1240 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1241 accessor.
1242 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1243 Only call ppc64_local_entry_offset for 64-bit. Restrict
1244 symval_for_branch lookup to ELFv1.
1245 (Stub_table::add_plt_call_entry): Use unsigned int off.
1246 (Output_data_glink::Address, invalid_address): New.
1247 (Output_data_glink::add_eh_frame): Move out of line. Add
1248 support for ELFv2.
1249 (Output_data_glink::add_global_entry, find_global_entry,
1250 global_entry_address): New functions.
1251 (Output_data_glink::global_entry_stubs_, end_branch_table_,
1252 ge_size): New variables.
1253 (Output_data_glink::set_final_data_size): Add global entry
1254 stub sizing.
1255 (Output_data_glink::do_write): Write global entry stubs.
1256 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1257 parameter. Return true for ELFv2. Adjust callers.
1258 (Target_powerpc::Scan::local, global): Restrict opd lookup to
1259 ELFv1. Similarly for ifunc and dynamic relocation processing
1260 specific to ELFv1. Recognize that symbols are defined on
1261 their plt entries for ELFv2.
1262 (Target_powerpc::symval_for_branch): Assert if called for
1263 ELFv2 or ppc32.
1264 (Target_powerpc::Relocate::relocate): Use global entry plt
1265 stub for symbol value if such exists on ELFv2.
1266 (Target_powerpc::Relocate::relocate): Don't call
1267 symval_for_branch when ELFv2. Do adjust for local entry
1268 offset when ELFv2.
1269 (Target_powerpc::do_dynsym_value): Set symbols to global entry
1270 plt stub for ELFv2.
1271 (Target_powerpc::do_plt_address_for_global): Similarly.
1272
1273 2013-11-14 Cary Coutant <ccoutant@google.com>
1274
1275 Revert patch -- this did not fix the problem, and there is
1276 no race there.
1277
1278 2013-11-14 Cary Coutant <ccoutant@google.com>
1279
1280 PR gold/14860
1281 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1282 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1283 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1284 updating fde_offsets_.
1285 (Eh_frame_hdr::lock_): New data member.
1286
1287 2013-11-14 Cary Coutant <ccoutant@google.com>
1288
1289 * dwp.cc (Dwo_file_entry): New type.
1290 (File_list): Use Dwo_file_entry.
1291 (Dwo_file::verify): New function.
1292 (Dwo_file::verify_dwo_list): New function.
1293 (Dwo_file::sized_verify_dwo_list): New function.
1294 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1295 list.
1296 (Dwp_options): New enum type.
1297 (dwp_options): Add --verify-only.
1298 (usage): Likewise.
1299 (main): Likewise.
1300 * dwp.h (gold_info): Add declaration.
1301
1302 2013-11-14 Cary Coutant <ccoutant@google.com>
1303
1304 PR gold/14860
1305 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1306 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1307 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1308 updating fde_offsets_.
1309 (Eh_frame_hdr::lock_): New data member.
1310
1311 2013-11-06 Cary Coutant <ccoutant@google.com>
1312
1313 PR gold/15758
1314 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1315 before reloc sections.
1316
1317 2013-11-04 Alan Modra <amodra@gmail.com>
1318
1319 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1320 (Symbol::needs_dynamic_reloc): Test new flag.
1321 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1322 (Target_powerpc::Scan::get_reference_flags): Add target param.
1323 Return FUNC_DESC_ABI for 64-bit ELFv1.
1324 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1325 call.
1326 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1327 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1328
1329 2013-10-31 Cary Coutant <ccoutant@google.com>
1330
1331 Restore support for dwp v2 DWARF package file format.
1332
1333 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1334 tu_length parameter. Adjust all callers.
1335 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1336 * dwp.cc: Include dwarf.h.
1337 (Section_bounds): New struct type.
1338 (Unit_set): New struct type.
1339 (Dwo_file::Dwo_file): Initialize new data member.
1340 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1341 Combine and rename to...
1342 (Dwo_file::read_unit_index): ...this.
1343 (Dwo_file::sized_read_compunit_index)
1344 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1345 (Dwo_file::sized_read_unit_index): ...this.
1346 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1347 parameters; add section_id parameter.
1348 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1349 (Dwo_file::add_unit_set): ...this.
1350 (Dwo_file::shndx_map_): Remove.
1351 (Dwo_file::sect_offsets_): New data member.
1352 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1353 (Dwp_output_file::add_section): Rename to...
1354 (Dwp_output_file::add_contribution): ...this.
1355 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1356 (Dwp_output_file::add_tu_set): Likewise.
1357 (Dwp_output_file::Contribution): New type.
1358 (Dwp_output_file::Section::contributions): New data member.
1359 (Dwp_output_file::Cu_or_tu_set): Remove.
1360 (Dwp_output_file::Section::Section): New ctor.
1361 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1362 (Dwp_output_file::Dwp_index::Section_table): New type.
1363 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1364 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1365 parameter.
1366 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1367 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1368 (Dwp_output_file::Dwp_index::section_table): New member function.
1369 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1370 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1371 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1372 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1373 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1374 (Dwp_output_file::Dwp_index::section_table_): New data member.
1375 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1376 (Dwp_output_file::add_output_section): New member function.
1377 (Dwp_output_file::write_new_section): New member function.
1378 (Dwp_output_file::write_contributions): New member function.
1379 (Dwp_output_file::section_id_map_): New data member.
1380 (class Dwo_id_info_reader): Remove.
1381 (class Unit_reader): New class.
1382 (get_dwarf_section_name): New function.
1383 (Dwo_file::read_executable): Adjust initializations of class data.
1384 (Dwo_file::read): Add support for v2 package file format.
1385 (Dwo_file::read_unit_index): Likewise.
1386 (Dwo_file::sized_read_unit_index): Likewise.
1387 (Dwo_file::copy_section): Likewise.
1388 (Dwo_file::add_unit_set): Likewise.
1389 (Dwp_output_file::add_output_section): Likewise.
1390 (Dwp_output_file::add_contribution): Likewise.
1391 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1392 for empty slot.
1393 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1394 file format.
1395 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1396 slot.
1397 (Dwp_output_file::initialize): Remove unused function.
1398 (Dwp_output_file::finalize): Add support for v2 package file format.
1399 (Dwp_output_file::write_index): Likewise.
1400 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1401 function prototype.
1402
1403 2013-10-31 Cary Coutant <ccoutant@google.com>
1404
1405 * configure.ac: Fix check for -fmerge-constants.
1406 * configure.ac: Regenerate.
1407
1408 2013-10-30 Roland McGrath <mcgrathr@google.com>
1409
1410 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1411 Correct 9-byte nop sequence to match what the assembler generates.
1412
1413 2013-10-30 Alan Modra <amodra@gmail.com>
1414
1415 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1416 ppc64_local_entry_offset, ppc64_local_entry_offset,
1417 do_read_symbols): New functions.
1418 (Powerpc_relobj::e_flags_, st_other_): New vars.
1419 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1420 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1421 (Powerpc_relobj::e_flags_): New var.
1422 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1423 and adjust for ELFv2.
1424 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1425 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1426 (Powerpc_dynobj::do_find_special_sections): Likewise.
1427 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1428 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1429 to ELFv2 local entry.
1430 (Target_powerpc::do_relax): No thread safe barriers needed for
1431 ELFv2.
1432 (Output_data_plt_powerpc::initial_plt_entry_size_,
1433 plt_entry_size): Delete. Replace all uses with
1434 first_plt_entry_offset() and plt_entry_size().
1435 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1436 reserved_size parm. Update callers.
1437 (Output_data_plt_powerpc::entry_count): Update.
1438 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1439 and use Target_powerpc::first_plt_entry_offset().
1440 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1441 rename to plt_entry_size.
1442 (Output_data_plt_powerpc::add_ifunc_entry,
1443 add_local_ifunc_entry): Adjust reloc for ELFv2.
1444 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1445 (glink_eh_frame_fde_64v2): New.
1446 (Stub_table::plt_call_size): Support ELFv2 sizing.
1447 (Output_data_glink::add_eh_frame): Use the new FDE.
1448 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1449 (Stub_table::do_write): Write ELFv2 stubs and glink.
1450 (Target_powerpc::Relocate::relocate): Replaces nop after call
1451 with ld 2,24(1) and adjust local offset destination for ELFv2.
1452
1453 2013-10-30 Alan Modra <amodra@gmail.com>
1454
1455 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1456 (Target_powerpc::Scan::global, local): Likewise.
1457 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
1458 on all ppc64 @h and @ha relocs.
1459
1460 2013-10-14 Alan Modra <amodra@gmail.com>
1461
1462 * output.h (Output_data_got::add_constant): Tidy.
1463 (Output_data_got::add_constant_pair): New function.
1464 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1465 methods used so as to first call reserve_ent().
1466
1467 2013-10-11 Roland McGrath <mcgrathr@google.com>
1468
1469 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1470 add_got_entry and add_got_entry_pair.
1471
1472 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1473 (HAVE_PUBNAMES): Likewise.
1474 * configure: Regenerate.
1475
1476 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1477 * testsuite/Makefile.in: Regenerate.
1478
1479 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1480 Remove const from declaration.
1481 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1482 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1483 * output.h (Output_file_header): Remove const from member target_
1484 and corresponding constructor argument.
1485 * output.cc (Output_file_header::Output_file_header): Update prototype.
1486 (Output_file_header::do_sized_write): Use this->target_ in place
1487 of parameters()->target().
1488
1489 * testsuite/undef_symbol.cc (Foo::get_a): New method.
1490
1491 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1492 * configure: Regenerate.
1493 * Makefile.in: Regenerate.
1494 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1495 * testsuite/merge_string_literals_2.c: Likewise.
1496 * testsuite/Makefile.am
1497 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1498 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1499 literal -fmerge-constants.
1500 * testsuite/Makefile.in: Regenerate.
1501
1502 * i386.cc (Target_i386): Remove unused member dynbss_.
1503 * arm.cc (Target_arm): Likewise.
1504 * powerpc.cc (Target_powerpc): Likewise.
1505 * sparc.cc (Target_sparc): Likewise.
1506 * tilegx.cc (Target_tilegx): Likewise.
1507 * x86_64.cc (Target_x86_64): Likewise.
1508 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1509 type_signature_, type_offset_.
1510 * plugin.h (Plugin_hook): Remove unused member layout_.
1511 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1512 mapfile_.
1513 (Read_member): Remove unused members input_objects_, symtab_,
1514 mapfile_, layout_.
1515 (Check_library): Remove unused member symtab_.
1516 * archive.h (Lib_group): Remove unused member lib_.
1517 * archive.cc (Lib_group::Lib_group): Update initializer.
1518 * incremental.h (Incremental_binary): Remove unused member target_.
1519 (Incremental_script_entry): Removed unused member script_.
1520 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1521 * icf.h (Icf): Remove unused member num_tracked_relocs.
1522
1523 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1524 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1525 its only use.
1526 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1527
1528 * archive.h: Use struct rather than class for forward declaration
1529 of Read_symbols_data.
1530
1531 2013-10-07 Cary Coutant <ccoutant@google.com>
1532
1533 PR gold/16010
1534 * testsuite/Makefile.am (icf_test): Fix dependencies.
1535 (icf_safe_test): Likewise.
1536 (icf_safe_so_test): Likewise.
1537 (large_symbol_alignment): Add empty _LDADD rule.
1538 * testsuite/Makefile.in: Regenerate.
1539
1540 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
1541
1542 PR gold/15927
1543 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1544 relocation for R_X86_64_32 on x32.
1545
1546 2013-08-27 Roland McGrath <mcgrathr@google.com>
1547
1548 * output.cc (Output_segment::set_section_addresses): Take new
1549 Target* argument. If target->isolate_execinstr() and the segment
1550 is executable and starts at a target->abi_pagesize() boundary,
1551 pad its end out to a target->abi_pagesize() boundary with code fill.
1552 * output.h (Output_segment::set_section_addresses): Update decl.
1553 * layout.h (Layout::check_output_data_for_reset_values): Take new
1554 argument RELAX_OUTPUTS.
1555 (Layout): New member relax_output_list_.
1556 (Layout::add_relax_output): New method.
1557 * layout.cc (Layout::Layout): Update constructor.
1558 (Layout::reset_relax_output): New method.
1559 (Layout::clean_up_after_relaxation): Call it.
1560 (Layout::prepare_for_relaxation): Update caller.
1561 (Layout::set_segment_offsets): Update callers of set_section_addresses.
1562 Call reset_relax_output before re-processing segments for
1563 isolate_execinstr case.
1564 (Layout::write_data): Handle relax_output_list_.
1565 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1566 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1567
1568 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1569
1570 PR binutils/15834
1571 * object.h: Fix typos.
1572
1573 2013-08-16 Roland McGrath <mcgrathr@google.com>
1574
1575 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1576 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1577
1578 2013-08-07 Cary Coutant <ccoutant@google.com>
1579
1580 Revert support for v2 DWP files:
1581
1582 2013-03-01 Cary Coutant <ccoutant@google.com>
1583
1584 Add dwp support for v2 DWARF package file format.
1585 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1586 tu_length parameter. Adjust all callers.
1587 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1588 * dwp.cc: Include dwarf.h.
1589 (Section_bounds): New struct type.
1590 (Unit_set): New struct type.
1591 (Dwo_file::Dwo_file): Initialize new data member.
1592 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1593 Combine and rename to...
1594 (Dwo_file::read_unit_index): ...this.
1595 (Dwo_file::sized_read_compunit_index)
1596 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1597 (Dwo_file::sized_read_unit_index): ...this.
1598 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1599 parameters; add section_id parameter.
1600 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1601 (Dwo_file::add_unit_set): ...this.
1602 (Dwo_file::shndx_map_): Remove.
1603 (Dwo_file::sect_offsets_): New data member.
1604 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1605 (Dwp_output_file::add_section): Rename to...
1606 (Dwp_output_file::add_contribution): ...this.
1607 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1608 (Dwp_output_file::add_tu_set): Likewise.
1609 (Dwp_output_file::Contribution): New type.
1610 (Dwp_output_file::Section::contributions): New data member.
1611 (Dwp_output_file::Cu_or_tu_set): Remove.
1612 (Dwp_output_file::Section::Section): New ctor.
1613 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1614 (Dwp_output_file::Dwp_index::Section_table): New type.
1615 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1616 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1617 parameter.
1618 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1619 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1620 (Dwp_output_file::Dwp_index::section_table): New member function.
1621 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1622 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1623 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1624 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1625 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1626 (Dwp_output_file::Dwp_index::section_table_): New data member.
1627 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1628 (Dwp_output_file::add_output_section): New member function.
1629 (Dwp_output_file::write_new_section): New member function.
1630 (Dwp_output_file::write_contributions): New member function.
1631 (Dwp_output_file::section_id_map_): New data member.
1632 (class Dwo_id_info_reader): Remove.
1633 (class Unit_reader): New class.
1634 (get_dwarf_section_name): New function.
1635 (Dwo_file::read_executable): Adjust initializations of class data.
1636 (Dwo_file::read): Add support for v2 package file format.
1637 (Dwo_file::read_unit_index): Likewise.
1638 (Dwo_file::sized_read_unit_index): Likewise.
1639 (Dwo_file::copy_section): Likewise.
1640 (Dwo_file::add_unit_set): Likewise.
1641 (Dwp_output_file::add_output_section): Likewise.
1642 (Dwp_output_file::add_contribution): Likewise.
1643 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1644 for empty slot.
1645 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1646 file format.
1647 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1648 slot.
1649 (Dwp_output_file::initialize): Remove unused function.
1650 (Dwp_output_file::finalize): Add support for v2 package file format.
1651 (Dwp_output_file::write_index): Likewise.
1652 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1653 function prototype.
1654
1655 2013-07-31 Cary Coutant <ccoutant@google.com>
1656
1657 * object.cc (Sized_relobj::do_output_section_address): New function.
1658 (Sized_relobj): Instantiate explicitly.
1659 * object.h (Object::output_section_address): New function.
1660 (Object::do_output_section_address): New function.
1661 (Sized_relobj::do_output_section_address): New function.
1662 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1663
1664 2013-07-30 Cary Coutant <ccoutant@google.com>
1665 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1666
1667 * parameters.cc (Parameters::entry): Return target-specific entry
1668 symbol name.
1669 * target.h (Target::entry_symbol_name): New function.
1670 (Target_info::entry_symbol_name): New data member.
1671
1672 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1673 * i386.cc (Target_i386::i386_info): Likewise.
1674 (Target_i386_nacl::i386_nacl_info): Likewise.
1675 * sparc.cc (Target_sparc::sparc_info): Likewise.
1676 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1677 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1678 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1679 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1680
1681 2013-07-22 Sterling Augustine <saugustine@google.com>
1682
1683 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1684 Convert parameter shndx to local variable. Add parameters symtab
1685 and symtab_size. Scan over section names. Find relocation
1686 section corresponding to current section. Create and initialize
1687 reloc_mapper_ and reloc_type_.
1688 (Dwarf_pubnames_table::read_header): Add assertion. Change
1689 unit_length to off_t. Initialize member unit_length_. Fill in field
1690 cu_offset_.
1691 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1692 Initialize new fields unit_length_ and cu_offset_.
1693 (Dwarf_pubnames_table::read_section): Update prototype.
1694 (Dwarf_pubnames_table::cu_offset): New member function.
1695 (Dwarf_pubnames_table::subsection_size): Likewise.
1696 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1697 New fields.
1698 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1699 member functions public.
1700 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1701 Update comment. Rework logic. Move repeated parts to...
1702 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1703 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1704 pubtypes_table_, and stmt_list_offset.
1705 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1706 Gdb_index::find_pubtype_offset,
1707 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1708 (Gdb_index::pubnames_read): Update prototype and rework logic.
1709 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1710 Forward declare.
1711 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1712 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1713 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1714 Gdb_index::map_pubtable_to_dies):
1715 Declare functions.
1716 (Gdb_index::pubnames_read): Update declaration.
1717 (Gdb_index::Pubname_offset_map): New type.
1718 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1719 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1720 Gdb_index::stmt_list_offset): Declare.
1721 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1722 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1723 Gdb_index::pubtypes_offset_): Remove.
1724
1725 2013-07-19 Roland McGrath <mcgrathr@google.com>
1726
1727 * options.h (General_options): Add -Trodata-segment option.
1728 * parameters.cc (Parameters::check_rodata_segment): New function.
1729 (Parameters::set_target_once): Call it.
1730 * parameters.h (Parameters): Declare it (private member function).
1731 * layout.cc (load_seg_unusable_for_headers): New function, broken
1732 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1733 then validate rodata segment rather than text segment.
1734 (relaxation_loop_body): Call that.
1735 (is_text_segment): New function. Don't admit a non-executable
1736 segment if TARGET->isolate_execinstr().
1737 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1738
1739 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1740
1741 PR gold/15070
1742 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1743 * nacl.h (Sniff_file::View::View): Request aligned view.
1744
1745 2013-07-11 Cary Coutant <ccoutant@google.com>
1746
1747 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1748 correct BRLT entry size.
1749
1750 2013-07-03 Alan Modra <amodra@gmail.com>
1751
1752 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1753 comment.
1754
1755 2013-07-01 Cary Coutant <ccoutant@google.com>
1756
1757 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1758 reloc_type_.
1759 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1760 (Dwarf_ranges_table::lookup_reloc): New function.
1761 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1762 reloc_type_.
1763 (Dwarf_ranges_table::lookup_reloc): New function.
1764 (Dwarf_ranges_table::reloc_type_): New data member.
1765
1766 2013-06-27 Jing Yu <jingyu@google.com>
1767
1768 PR gold/15662
1769 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1770 function.
1771 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1772 (Target_powerpc::do_relax): Call the above.
1773
1774 2013-06-27 Cary Coutant <ccoutant@google.com>
1775
1776 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1777 on garbage collected .opd section.
1778
1779 2013-06-27 Alan Modra <amodra@gmail.com>
1780
1781 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1782 is non-zero.
1783 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1784 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1785
1786 2013-06-14 Cary Coutant <ccoutant@google.com>
1787
1788 * resolve.cc (Symbol::override_base): Don't override st_type
1789 from plugin placeholder symbols.
1790 (Symbol_table::resolve): Likewise.
1791 (Symbol_table::should_override): Don't complain about TLS mismatch
1792 if the TO symbol is a plugin placeholder.
1793 * testsuite/Makefile.am (plugin_test_tls): New test.
1794 * testsuite/Makefile.in: Regenerate.
1795 * testsuite/plugin_test_tls.sh: New test script.
1796 * testsuite/two_file_test_2_tls.cc: New test source.
1797 * testsuite/two_file_test_tls.cc: New test source.
1798
1799 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1800
1801 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1802 the maximum segment alignment is larger than the page size.
1803 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1804 correctly aligns the symbols with large alignemnt.
1805 * testsuite/Makefile.in: Regenerate.
1806 * testsuite/large_symbol_alignment.cc: New file.
1807
1808 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1809 Sriraman Tallam <tmsriram@google.com>
1810
1811 * options.h (sort_section): New option.
1812 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1813 Rename from Input_section_sort_section_name_special_ordering_compare.
1814 (Input_section_sort_section_name_compare): New struct.
1815 * output.cc (Output_section::Input_section_sort_section_name_compare::
1816 operator()): New function.
1817 (Output_section::sort_attached_input_sections): Use new sort function
1818 for .text if --sort-section=name is specified.
1819 * layout.cc (Layout::make_output_section):
1820 Add sorting by name when --sort-section=name is specified.
1821 * testsuite/Makefile.am (text_section_grouping): Test option
1822 --sort-section=name.
1823 * testsuite/Makefile.in: Regenerate.
1824 * testsuite/section_sorting_name.cc: New file.
1825 * testsuite/section_sorting_name.sh: New file.
1826
1827 2013-05-21 Cary Coutant <ccoutant@google.com>
1828
1829 * symtab.h (Symbol::is_cxx_vtable): New function.
1830 * target-reloc.h (relocate_section): Check for vtable symbol.
1831 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1832 * testsuite/Makefile.in: Regenerate.
1833 * testsuite/missing_key_func.cc: New test source.
1834 * testsuite/missing_key_func.sh: New test script.
1835
1836 2013-05-21 Cary Coutant <ccoutant@google.com>
1837
1838 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1839 type of enclosing symbol.
1840 (Relocate_info::location): Check symbol type when describing symbol.
1841 * object.h (Symbol_location_info): Remove unused line_number;
1842 add enclosing_symbol_type.
1843 * testsuite/debug_msg.sh: Adjust expected output.
1844
1845 2013-05-13 Cary Coutant <ccoutant@google.com>
1846
1847 * configure.ac: Export DEFAULT_TARGET.
1848 * configure: Regenerate.
1849 * Makefile.in: Regenerate.
1850 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1851 * testsuite/Makefile.in: Regenerate.
1852 * testsuite/debug_msg.sh: Delete duplicate tests.
1853 Don't check undef_int error message match for powerpc where the
1854 source file and line number aren't available.
1855
1856 2013-05-10 Roland McGrath <mcgrathr@google.com>
1857
1858 * options.h (General_options): Add --rosegment-gap option.
1859 * options.cc (finalize): --rosegment-gap implies --rosegment.
1860 * layout.cc (set_segment_offsets): Let user option override
1861 target->rosegment_gap().
1862
1863 2013-05-10 Roland McGrath <mcgrathr@google.com>
1864
1865 * options.h (General_options): Remove leading space from help
1866 messages for -nostdlib and --rosegment.
1867
1868 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1869
1870 PR ld/15365
1871 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1872
1873 2013-05-03 Alan Modra <amodra@gmail.com>
1874
1875 * merge.cc (Output_merge_string::do_add_input_section): Correct
1876 scan for number of strings. Rename vars to avoid shadowing.
1877 Include missing terminator in input_size_.
1878
1879 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1880
1881 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1882 Restore empty string handling.
1883
1884 2013-05-01 Cary Coutant <ccoutant@google.com>
1885
1886 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1887 uninitialized warning.
1888
1889 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1890
1891 * output.cc (Output_section::add_merge_input_section): Allow
1892 to merge sections if the alignment is more than character size.
1893 * merge.h (Output_merge_string::Output_merge_string): Remove
1894 assert.
1895 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1896 only not-null strings. Check the alignment of strings.
1897 * stringpool.h
1898 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1899 alignment as the argument.
1900 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1901 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1902 Align non-zero length strings according to the addralign_.
1903 (Stringpool_template<Stringpool_char>::set_string_offsets):
1904 Updating offsets according to the given alignment.
1905 * testsuite/Makefile.am (text_section_grouping): Test if string
1906 literals are getting merged.
1907 * testsuite/Makefile.in: Regenerate.
1908 * testsuite/merge_string_literals_1.c: New file.
1909 * testsuite/merge_string_literals_2.c: Ditto.
1910 * testsuite/merge_string_literals.sh: Ditto.
1911
1912 2013-04-26 Ian Lance Taylor <iant@google.com>
1913
1914 * target-reloc.h (relocate_section): If the reloc offset is out of
1915 range, pass VIEW as NULL to relocate.relocate.
1916 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1917 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1918 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1919 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1920 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1921 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1922
1923 2013-04-26 Geoff Pike <gpike@chromium.org>
1924
1925 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1926 * layout.cc (Hash_task): New class.
1927 (Layout::queue_build_id_tasks): New function.
1928 (Layout::write_build_id): Handle single-thread portion of build ID
1929 computation. (In some cases, all of it is single-threaded.) Replace
1930 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1931 functionality in fewer lines of code.
1932 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1933 * options.h (General_options): make "--build-id" default to tree
1934 rather than sha1. Add two new options related to --build-id=tree:
1935 --build-id-chunk-size-for-treehash and
1936 --build-id-min-file-size-for-treehash.
1937 * Makefile.am: add testing of --build-id=tree and related new options
1938 (these tests will be invoked by "make check").
1939 * Makefile.in: Regenerate.
1940
1941 2013-04-25 Alan Modra <amodra@gmail.com>
1942
1943 * configure.tgt: Add powerpcle and powerpc64le.
1944
1945 2013-04-22 Alan Modra <amodra@gmail.com>
1946
1947 PR gold/15355
1948 * layout.cc (Layout::segment_precedes): Allow more than one
1949 segment with the same type and flags.
1950
1951 2013-04-15 Cary Coutant <ccoutant@google.com>
1952
1953 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1954 allocate space in file for BSS sections.
1955
1956 2013-04-15 Cary Coutant <ccoutant@google.com>
1957
1958 * script-sections.cc (Orphan_output_section): Reset address
1959 to zero after each orphaned section for relocatable links.
1960
1961 2013-04-15 Cary Coutant <ccoutant@google.com>
1962
1963 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1964 section starting address for relocatable link.
1965 * testsuite/Makefile.am (script_test_11): New test.
1966 * testsuite/Makefile.in: Regenerate.
1967 * testsuite/script_test_11.c: New source file.
1968 * testsuite/script_test_11.t: New linker script.
1969
1970 2013-04-13 Alan Modra <amodra@gmail.com>
1971
1972 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1973 owner when sections are not adjacent and exceed group size.
1974 (Target_powerpc::group_sections): Handle corner case.
1975 (Target_powerpc::Branch_info::make_stub): Handle case where
1976 stub table doesn't exist due to branches in non-exec sections.
1977 (Target_powerpc::Relocate::relocate): Likewise.
1978
1979 2013-04-11 Alan Modra <amodra@gmail.com>
1980
1981 PR gold/15354
1982 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1983 .branch_lt to match bfd ld. Adjust comments throughout file.
1984
1985 2013-04-04 Ian Lance Taylor <iant@google.com>
1986
1987 GCC PR c++/56840
1988 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1989 sections before checking whether they are included in the link.
1990
1991 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1992
1993 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1994 object before calling the plugin claim_file handler. Pass the elf
1995 object of the archive to the plugin. Delete the elf object if the
1996 plugin claims the file.
1997
1998 2013-03-21 Alan Modra <amodra@gmail.com>
1999
2000 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2001 segment when omagic.
2002
2003 2013-03-21 Alan Modra <amodra@gmail.com>
2004
2005 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2006 comparison warning.
2007 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2008 uninitialized" warning.
2009
2010 2013-03-20 Alan Modra <amodra@gmail.com>
2011
2012 * symtab.h (Symbol::clear_version): New function.
2013 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2014 is_needed by weak references. Clear version for symbols defined
2015 in as-needed objects that are not needed.
2016
2017 2013-03-15 Alan Modra <amodra@gmail.com>
2018
2019 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2020 static and public. Add report_err param. Return false for data refs.
2021 (Target_powerpc::rela_dyn_section): New overloaded function.
2022 (Target_powerpc::plt_, iplt_): Elucidate.
2023 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2024 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2025 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2026 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2027 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2028 push_branch and make_plt_entry for ifunc syms when
2029 reloc_needs_plt_for_ifunc.
2030 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2031 for ifunc unless reloc_needs_plt_for_ifunc.
2032
2033 2013-03-15 Alan Modra <amodra@gmail.com>
2034
2035 * gc.h (gc_process_relocs): Don't look through function descriptors.
2036 * icf.cc (get_section_contents): Do so here instead.
2037
2038 2013-03-13 Alan Modra <amodra@gmail.com>
2039
2040 * powerpc.cc (is_branch_reloc): Forward declare.
2041 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2042 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2043 false for 64-bit, true for 32-bit non-branch relocs.
2044 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2045 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2046 nm output.
2047 (icf_safe_test): Generate linker map file as well as nm output.
2048 (icf_safe_so_test): Likewise.
2049 * testsuite/Makefile.in: Regenerate.
2050 * testsuite/icf_test.sh: Parse linker map file to determine
2051 section folding.
2052 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2053 * testsuite/icf_safe_so_test.sh: Likewise.
2054 (X86_32_or_ARM_specific_safe_fold): Merge into..
2055 (arch_specific_safe_fold): ..this.
2056 (X86_64_specific_safe_fold): Delete unused function.
2057
2058 2013-03-12 Alan Modra <amodra@gmail.com>
2059
2060 * gc.h (gc_process_relocs): Look through function descriptors
2061 to determine shndx, symvalue and addend used by ICF. Tidy
2062 variable duplication.
2063
2064 2013-03-11 Alan Modra <amodra@gmail.com>
2065
2066 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2067 * layout.cc (Layout_task_runner::run): ..to here.
2068 * symtab.h (struct Symbol_location): Extract from..
2069 (class Symbol_table): ..here.
2070 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2071 * target.h (class Target): Add function_location and
2072 do_function_location functions.
2073 (class Sized_target): Add do_function_location.
2074 * object.h (class Sized_relobj_file): Move find_shdr..
2075 (class Object): ..to here.
2076 * object.cc: Likewise. Update to suit. Instantiate.
2077 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2078 * powerpc.cc (class Powerpc_dynobj): New.
2079 (Target_powerpc::do_function_location): New function.
2080 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2081 (Powerpc_dynobj::do_read_symbols): New function.
2082 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2083
2084 2013-03-08 Ian Lance Taylor <iant@google.com>
2085
2086 * options.cc (General_options::string_to_object_format): Accept
2087 "default".
2088
2089 2013-03-08 Alan Modra <amodra@gmail.com>
2090
2091 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2092 pointer to Post_fde.
2093 (struct Post_fde): Move definition to here..
2094 * ehframe.cc (struct Post_fde): ..from here.
2095 (Cie::write): Don't alloc Post_fde.
2096 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2097
2098 2013-03-07 Alan Modra <amodra@gmail.com>
2099
2100 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2101 relocation referencing .LC0.
2102 * testsuite/discard_locals_test.sh: Remove FIXMEs.
2103
2104 2013-03-07 Alan Modra <amodra@gmail.com>
2105
2106 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2107 always_inline. Add assembly for powerpc to avoid GOT.
2108
2109 2013-03-07 Alan Modra <amodra@gmail.com>
2110
2111 * testsuite/script_test_10.sh: Don't test .bss section
2112 header number.
2113
2114 2013-03-06 Alan Modra <amodra@gmail.com>
2115
2116 * powerpc.cc (class Powerpc_relobj): Move some member functions.
2117 (Target_powerpc::symval_for_branch): Add symtab param. Update
2118 all callers. Handle folded sections.
2119 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2120 to Powerpc_relobj.
2121 (Global_symbol_visitor_opd::operator()): Likewise.
2122
2123 2013-03-04 Alan Modra <amodra@gmail.com>
2124
2125 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2126 * testsuite/Makefile.in: Regenerate.
2127
2128 2013-03-01 Cary Coutant <ccoutant@google.com>
2129
2130 Add dwp support for v2 DWARF package file format.
2131 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2132 tu_length parameter. Adjust all callers.
2133 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2134 * dwp.cc: Include dwarf.h.
2135 (Section_bounds): New struct type.
2136 (Unit_set): New struct type.
2137 (Dwo_file::Dwo_file): Initialize new data member.
2138 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2139 Combine and rename to...
2140 (Dwo_file::read_unit_index): ...this.
2141 (Dwo_file::sized_read_compunit_index)
2142 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2143 (Dwo_file::sized_read_unit_index): ...this.
2144 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2145 parameters; add section_id parameter.
2146 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2147 (Dwo_file::add_unit_set): ...this.
2148 (Dwo_file::shndx_map_): Remove.
2149 (Dwo_file::sect_offsets_): New data member.
2150 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2151 (Dwp_output_file::add_section): Rename to...
2152 (Dwp_output_file::add_contribution): ...this.
2153 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2154 (Dwp_output_file::add_tu_set): Likewise.
2155 (Dwp_output_file::Contribution): New type.
2156 (Dwp_output_file::Section::contributions): New data member.
2157 (Dwp_output_file::Cu_or_tu_set): Remove.
2158 (Dwp_output_file::Section::Section): New ctor.
2159 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2160 (Dwp_output_file::Dwp_index::Section_table): New type.
2161 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2162 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2163 parameter.
2164 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2165 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2166 (Dwp_output_file::Dwp_index::section_table): New member function.
2167 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2168 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2169 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2170 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2171 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2172 (Dwp_output_file::Dwp_index::section_table_): New data member.
2173 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2174 (Dwp_output_file::add_output_section): New member function.
2175 (Dwp_output_file::write_new_section): New member function.
2176 (Dwp_output_file::write_contributions): New member function.
2177 (Dwp_output_file::section_id_map_): New data member.
2178 (class Dwo_id_info_reader): Remove.
2179 (class Unit_reader): New class.
2180 (get_dwarf_section_name): New function.
2181 (Dwo_file::read_executable): Adjust initializations of class data.
2182 (Dwo_file::read): Add support for v2 package file format.
2183 (Dwo_file::read_unit_index): Likewise.
2184 (Dwo_file::sized_read_unit_index): Likewise.
2185 (Dwo_file::copy_section): Likewise.
2186 (Dwo_file::add_unit_set): Likewise.
2187 (Dwp_output_file::add_output_section): Likewise.
2188 (Dwp_output_file::add_contribution): Likewise.
2189 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2190 for empty slot.
2191 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2192 file format.
2193 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2194 slot.
2195 (Dwp_output_file::initialize): Remove unused function.
2196 (Dwp_output_file::finalize): Add support for v2 package file format.
2197 (Dwp_output_file::write_index): Likewise.
2198 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2199 function prototype.
2200
2201 2013-03-01 Cary Coutant <ccoutant@google.com>
2202
2203 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2204 function into class definition in header file.
2205 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2206 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2207 New function.
2208 (Dwarf_info_reader::check_buffer): Move here from .cc file.
2209
2210 2013-02-28 Alan Modra <amodra@gmail.com>
2211
2212 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2213 * target.cc (Target::do_plt_fde_location): New function.
2214 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2215 accessor function, and constructor param.
2216 (struct Post_fde, Post_fdes): Declare.
2217 (Cie::write): Add post_fdes param.
2218 * ehframe.cc (Fde::write): Use plt_fde_location.
2219 (struct Post_fde): Define.
2220 (Cie::write): Stash FDEs added post merge mapping.
2221 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2222 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
2223 (Eh_frame::do_sized_write): Arrange to write post map FDES after
2224 other FDEs.
2225 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2226 (Target_powerpc::has_glink): New function.
2227 (Target_powerpc::do_relax): Add eh_frame info for stubs.
2228 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2229 glink_eh_frame_fde_32, default_fde): New data.
2230 (Stub_table::eh_frame_added_): New var.
2231 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2232 Make const.
2233 (Stub_table::add_eh_frame): New function.
2234 (Output_data_glink::add_eh_frame): New function.
2235 (Target_powerpc::make_glink_section): Call add_eh_frame.
2236
2237 2013-02-15 Ian Lance Taylor <iant@google.com>
2238
2239 * options.h (DEFINE_uint64_alias): Define.
2240 (class General_options): Add -Ttext-segment as an alias for
2241 -Ttext.
2242
2243 2013-02-15 Alan Modra <amodra@gmail.com>
2244
2245 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2246 (Stub_table::do_write): ..here, two places.
2247 (Stub_table::plt_call_size): Use it here too.
2248
2249 2013-02-11 Ian Lance Taylor <iant@google.com>
2250
2251 * descriptors.cc (Descriptors::close_all): New function.
2252 * descriptors.h (class Descriptors): Declare close_all.
2253 (close_all_descriptors): New inline function.
2254 * plugin.cc: Include "descriptors.h".
2255 (Plugin_manager::cleanup): Call close_all_descriptors.
2256
2257 2013-02-06 Alan Modra <amodra@gmail.com>
2258
2259 * README: Update coding style link.
2260
2261 2013-01-28 Cary Coutant <ccoutant@google.com>
2262
2263 * dwp.cc (File_list): New typedef.
2264 (Dwo_name_info_reader): New class.
2265 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2266 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2267 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2268 (Dwo_file::read_executable): New function.
2269 (Dwo_file::read): Move common setup code to ...
2270 (Dwo_file::make_object): ... here.
2271 (dwp_options): Add --exec/-e.
2272 (usage): Likewise.
2273 (main): Likewise.
2274
2275 2013-01-24 Sriraman Tallam <tmsriram@google.com>
2276
2277 * layout.cc (Layout::layout): Check for option text_reorder.
2278 (Layout::make_output_section): Ditto.
2279 * options.h (text_reorder): New option.
2280 * output.cc (Input_section_sort_compare): Remove special ordering
2281 of section names.
2282 (Output_section::
2283 Input_section_sort_section_name_special_ordering_compare::
2284 operator()): New function.
2285 (Output_section::sort_attached_input_sections): Use new sort function
2286 for .text.
2287 * output.h (Input_section_sort_section_name_special_ordering_compare):
2288 New struct.
2289 * testsuite/Makefile.am (text_section_grouping): Test option
2290 --no-text-reorder
2291 * testsuite/Makefile.in: Regenerate.
2292 * testsuite/text_section_grouping.sh: Check order of functions without
2293 default text reordering.
2294
2295 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2296
2297 * options.h (General_options): Change default to true for new_dtags.
2298
2299 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2300
2301 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2302 when enable_new_dtags is false. Only add DT_RUNPATH when
2303 enable_new_dtags is true.
2304
2305 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
2306
2307 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2308 used in declaration and definition consistent.
2309 (Target_powerpc::symval_for_branch): Ditto.
2310
2311 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2312
2313 * testsuite/plugin_final_layout.cc: Fix comment.
2314
2315 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2316
2317 * layout.cc (Layout::layout): Do not do default sorting for
2318 text sections when section ordering is specified.
2319 (make_output_section): Ditto.
2320 * testsuite/plugin_final_layout.cc: Name the function sections
2321 to catch reordering issues.
2322
2323 2013-01-15 Alan Modra <amodra@gmail.com>
2324
2325 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2326 plt-thread-safe.
2327
2328 2013-01-15 Alan Modra <amodra@gmail.com>
2329
2330 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2331 * testsuite/Makefile.in: Regenerate.
2332
2333 2013-01-14 Alan Modra <amodra@gmail.com>
2334
2335 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2336 * testsuite/Makefile.in: Regenerate.
2337
2338 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
2339
2340 PR bfd/14430
2341 Fix mingw gold build with plugins enabled
2342 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2343 * configure.ac: Export DLOPEN_LIBS and add headers check.
2344 * plugin.cc: Handle non-dlfcn case.
2345 * Makefile.in: Regenerate.
2346 * config.in: Regenerate.
2347 * configure: Regenerate.
2348 * testsuite/Makefile.in: Regenerate.
2349
2350 2013-01-09 Sriraman Tallam <tmsriram@google.com>
2351
2352 * output.h (sort_attached_input_sections): Change to be public.
2353 * script-sections.cc
2354 (Output_section_definition::set_section_addresses): Sort
2355 attached input sections according to section order before linker
2356 script assigns section addresses.
2357 (Orphan_output_section::set_section_addresses): Sort
2358 attached input sections according to section order before linker
2359 script assigns section addresses.
2360 * Makefile.am (final_layout.sh): Use a simple linker script to
2361 check if section ordering still works.
2362 * Makefile.in: Regenerate.
2363
2364 2013-01-09 Ben Cheng <bccheng@google.com>
2365
2366 * arm.cc (Target_arm::attributes_accept_div): New function.
2367 (Target_arm::attributes_forbid_div): New function.
2368 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2369 attribute using the same new functions as what bfd/elf32_arm.c
2370 does.
2371
2372 2013-01-07 Cary Coutant <ccoutant@google.com>
2373
2374 PR gold/14993
2375 * output.cc (Output_section::add_input_section): For incremental
2376 updates, don't track input sections that are allocated from patch
2377 space.
2378
2379 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2380 Ian Lance Taylor <iant@google.com>
2381
2382 PR gold/14897
2383 * configure.ac (--enable-ld): Removed.
2384 (install_as_default): Set to yes only for --enable-gold=default
2385 or --disable-ld.
2386 * configure: Regenerated.
2387
2388 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2389
2390 * options.h (General_options): Add -fuse-ld= for GCC linker
2391 option compatibility.
2392
2393 2013-01-04 Cary Coutant <ccoutant@google.com>
2394
2395 * configure.ac: Fix typo restoring CXXFLAGS.
2396 * configure: Regenerate.
2397
2398 2013-01-04 Cary Coutant <ccoutant@google.com>
2399
2400 * testsuite/Makefile.am (CXXLINK_S): New macro.
2401 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2402 * testsuite/Makefile.in: Regenerate.
2403
2404 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
2405
2406 * version.cc (print_version): Update copyright year to 2013.
2407
2408 2012-12-20 Ian Lance Taylor <iant@google.com>
2409
2410 * layout.cc (Layout::special_ordering_of_input_section): New
2411 function.
2412 (Layout::layout): If input section requires special ordering, must
2413 sort input sections.
2414 (Layout::make_output_section): May sort .text input sections.
2415 (Layout::is_section_name_prefix_grouped): Remove.
2416 * layout.h (class Layout): Declare
2417 special_ordering_of_input_section. Don't declare
2418 is_section_name_prefix_grouped.
2419 * output.cc (Output_section::add_input_section): Revert last
2420 change.
2421 (Output_section::Input_section_sort::match_file_name): Don't crash
2422 if called on output section data.
2423 (Output_section::Input_section_sort_compare): Sort based on
2424 special ordering.
2425 (Output_section::Input_section_sort_section_order_index_compare):
2426 Revert last patch.
2427 (Output_section::sort_attached_input_sections): Likewise.
2428
2429 2012-12-18 Sriraman Tallam <tmsriram@google.com>
2430
2431 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2432 * layout.h (Layout::is_section_name_prefix_grouped): New function.
2433 * output.cc (Output_section::add_input_section): Check if section
2434 name contains special prefix. Keep input sections to sort such
2435 sections.
2436 (Output_section::Input_section_sort_section_order_index_compare
2437 ::operator()): Group sections according to prefixes.
2438 (Output_section::sort_attached_input_sections): Add condition to
2439 Input_section_entry constructor call.
2440 * testsuite/Makefile.am (text_section_grouping): New test.
2441 * testsuite/Makefile.in: Regenerate.
2442 * testsuite/text_section_grouping.cc: New file.
2443 * testsuite/text_section_grouping.sh: New file.
2444
2445 2012-12-17 Nick Clifton <nickc@redhat.com>
2446
2447 * Makefile.am: Add copyright notice.
2448 * NEWS: Likewise.
2449 * README: Likewise.
2450 * configure.ac: Likewise.
2451 * ftruncate.c: Likewise.
2452 * Makefile.in: Regenerate.
2453
2454 2012-12-14 Cary Coutant <ccoutant@google.com>
2455
2456 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2457 --no-as-needed flag.
2458 (exception_separate_shared_12_test): Likewise.
2459 (incremental_copy_test): Likewise.
2460 * testsuite/Makefile.in: Regenerate.
2461
2462 2012-12-14 Cary Coutant <ccoutant@google.com>
2463
2464 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2465 (Dwp_output_file::Dwp_index::enter_set): Add assert.
2466
2467 2012-12-12 Alan Modra <amodra@gmail.com>
2468
2469 * powerpc.cc (class Track_tls): New.
2470 (class Relocate, class Scan): Inherit Track_tls.
2471 (Target_powerpc::Scan::local, global): Track tls optimization
2472 and avoid creating plt entry for __tls_get_addr if all uses
2473 are optimized away.
2474 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2475
2476 2012-12-12 Alan Modra <amodra@gmail.com>
2477
2478 * options.h (General_options): Add --toc-sort/--no-toc-sort.
2479 Replace no_toc_optimize with toc_optimize.
2480 * output.h (Output_section::input_sections): Provide non-const variant.
2481 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2482 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2483 accessors.
2484 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2485 (class Sort_toc_sections): New.
2486 (Target_powerpc::do_finalize_sections): Sort toc sections.
2487 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2488
2489 2012-12-10 Roland McGrath <mcgrathr@google.com>
2490
2491 * testsuite/binary_unittest.cc (read_all): New function.
2492 (Sized_binary_test): Use it instead of ::read.
2493 * fileread.cc (do_read): Don't assume pread always reads the whole
2494 amount in a single call.
2495
2496 2012-12-10 Alan Modra <amodra@gmail.com>
2497
2498 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2499 Set EM_PPC64 or EM_PPC here.
2500 (Target_selector_powerpc::do_recognize): Delete.
2501
2502 2012-12-10 Alan Modra <amodra@gmail.com>
2503
2504 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2505 stub_table_.
2506 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2507
2508 2012-12-07 Roland McGrath <mcgrathr@google.com>
2509
2510 * testsuite/binary_unittest.cc (Sized_binary_test):
2511 Use open_descriptor rather than ::open.
2512
2513 2012-12-07 Alan Modra <amodra@gmail.com>
2514
2515 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2516 typedef and invalid_address constant.
2517 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2518 instantiate constants.
2519
2520 2012-12-06 Roland McGrath <mcgrathr@google.com>
2521
2522 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2523 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2524 * aclocal.m4: Regenerate.
2525 * configure: Regenerate.
2526 * Makefile.in: Regenerate.
2527 * testsuite/Makefile.in: Regenerate.
2528
2529 2012-12-07 Alan Modra <amodra@gmail.com>
2530
2531 * options.h (General_options): Add no_toc_optimize.
2532 * powerpc.cc (ok_lo_toc_insn): New function.
2533 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2534
2535 2012-12-06 Alan Modra <amodra@gmail.com>
2536
2537 * options.h (General_options): Add plt_align, plt_static_chain,
2538 plt_thread_safe. Update stub_group_size help text.
2539 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2540 for new plt_thread_safe_ var.
2541 (use_plt_offset): Correct comments.
2542 (Target_powerpc::do_relax): Look for thread creation symbols to
2543 determine default plt_thread_safe value. Clear plt call stubs
2544 as well as branch stubs each iteration.
2545 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2546 insn constants.
2547 (l, hi, ha, write_insn): Move earlier.
2548 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2549 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2550 plt stubs too.
2551 (Stub_table::update_size): Adjust.
2552 (Stub_table::prev_size, set_prev_size): Delete.
2553 (Stub_table::stub_align): Let --plt-align affect result.
2554 (Stub_table::plt_call_size): Calculate sizes for various stubs.
2555 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2556 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2557 (Stub_table::do_write): Support more stub variants.
2558
2559 2012-12-04 Alan Modra <amodra@gmail.com>
2560
2561 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2562 (Target_powerpc::do_define_standard_symbols): New function.
2563
2564 2012-12-03 Alan Modra <amodra@gmail.com>
2565
2566 * output.h: Formatting, whitespace.
2567
2568 2012-12-03 Alan Modra <amodra@gmail.com>
2569
2570 * layout.h (Layout::get_executable_sections): Declare.
2571 * layout.cc (Layout::get_executable_sections): New function.
2572 * arm.cc (Target_arm::group_sections): Use it.
2573 (Arm_output_section::group_sections): Delete now redundant test.
2574 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2575 param to handle relative relocs.
2576 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2577 (Output_data_reloc::add_absolute): Adjust.
2578 (Output_data_reloc::add_relative): New function.
2579 (Output_data::reset_data_size): New function.
2580 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2581 (Output_section::set_addralign): New function.
2582 (Output_section::checkpoint_set_addralign): New function.
2583 (Output_section::clear_section_offsets_need_adjustment): New function.
2584 (Output_section::input_sections): Make public.
2585 * powerpc.cc (class Output_data_brlt_powerpc): New.
2586 (class Stub_table, class Stub_control): New.
2587 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2588 stub_table_, set_stub_table, stub_table): New vectors and accessor
2589 functions.
2590 (Target_powerpc::do_may_relax, do_relax, push_branch,
2591 new_stub_table, stub_tables, brlt_section, group_sections,
2592 add_branch_lookup_table, find_branch_lookup_table,
2593 write_branch_lookup_table, make_brlt_section): New functions.
2594 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2595 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2596 branch_info_): New vars.
2597 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2598 make call stubs here.
2599 (Output_data_glink): Remove all call stub handling from this class.
2600 (Target_powerpc::Scan::local, global): Save interesting branch
2601 relocs and relocs for ifunc. Adjust calls to plt entry functions.
2602 (Target_powerpc::do_finalize_sections): Only make reg save/restore
2603 functions on final link.
2604 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2605 Handle long branch destinations too.
2606 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2607 do_plt_address_for_local): Adjust lookup of plt call stubs.
2608
2609 2012-11-30 Alan Modra <amodra@gmail.com>
2610
2611 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2612 relocs against protected symbols when building 32-bit shared libs.
2613
2614 2012-11-30 Alan Modra <amodra@gmail.com>
2615
2616 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2617 param. Call got_section() to make .got. Update all callers
2618 and their callers and so on.
2619
2620 2012-11-30 Alan Modra <amodra@gmail.com>
2621
2622 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2623 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2624 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2625 value if it already exists.
2626
2627 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
2628
2629 PR gold/14858
2630 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2631
2632 2012-11-14 Roland McGrath <mcgrathr@google.com>
2633
2634 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2635 than bfc instruction for data sandboxing.
2636
2637 2012-11-08 Alan Modra <amodra@gmail.com>
2638
2639 * po/POTFILES.in: Regenerate.
2640
2641 2012-11-05 Alan Modra <amodra@gmail.com>
2642
2643 * configure.ac: Apply 2012-09-10 change to config.in here.
2644 * configure: Regenerate.
2645
2646 2012-11-05 Alan Modra <amodra@gmail.com>
2647
2648 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2649 (struct Opd_ent): Use "Address" rather than "Offset".
2650 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2651 (Target_powerpc::got_section): Make public.
2652 (Target_powerpc::scan_relocs): Move code setting symbols..
2653 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2654 Create _SDA_BASE_ only when referenced.
2655
2656 2012-11-02 Roland McGrath <mcgrathr@google.com>
2657
2658 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2659 from last change.
2660
2661 2012-11-01 Roland McGrath <mcgrathr@google.com>
2662
2663 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2664 for offset_in_output_section parameter.
2665 (Sized_target::relocate_special_relocatable): Likewise.
2666 * arm.cc (Target_arm::relocate_relocs): Likewise.
2667 (Target_arm::relocate_special_relocatable): Likewise.
2668 * i386.cc (Target_i386::relocate_relocs): Likewise.
2669 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2670 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2671 * target-reloc.h (relocate_relocs): Likewise.
2672 * testsuite/testfile.cc (Target_test): Likewise.
2673 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2674 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2675
2676 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2677 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2678
2679 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2680 parameter, which is unused in the [!F_SETFD] case.
2681
2682 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2683 SYMNDX to off_t before comparing it to this->data_size().
2684 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2685 * incremental.cc (Output_section_incremental_inputs::do_write):
2686 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2687
2688 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2689
2690 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2691
2692 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2693 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2694 in EABI_VER5.
2695
2696 2012-10-29 Cary Coutant <ccoutant@google.com>
2697
2698 * dwp.cc (usage): Add file and exit status parameters;
2699 add --help and --version options.
2700 (print_version): New function.
2701 (main): Add --help and --version options.
2702
2703 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2704
2705 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2706 final_layout_sequence.txt.
2707 * testsuite/Makefile.in: Regenerated.
2708
2709 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2710
2711 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2712 COMPILE generated by automake.
2713 (LINK1): Likewise.
2714 (CXXCOMPILE1): Likewise.
2715 (CXXLINK1): Likewise.
2716 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2717 (LINK): Likewise.
2718 (CXXCOMPILE): Likewise.
2719 (CXXLINK): Likewise.
2720 * testsuite/Makefile.in: Regenerated.
2721
2722 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2723
2724 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2725 on bad fwrite return.
2726
2727 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2728
2729 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2730 on val.
2731
2732 2012-10-23 Cary Coutant <ccoutant@google.com>
2733
2734 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2735 * testsuite/Makefile.in: Regenerate.
2736 * testsuite/dwp_test.h: New source file.
2737 * testsuite/dwp_test_1.cc: New source file.
2738 * testsuite/dwp_test_1.s: New source file.
2739 * testsuite/dwp_test_1.sh: New source file.
2740 * testsuite/dwp_test_1b.cc: New source file.
2741 * testsuite/dwp_test_1b.s: New source file.
2742 * testsuite/dwp_test_2.cc: New source file.
2743 * testsuite/dwp_test_2.s: New source file.
2744 * testsuite/dwp_test_2.sh: New source file.
2745 * testsuite/dwp_test_main.cc: New source file.
2746 * testsuite/dwp_test_main.s: New source file.
2747
2748 2012-10-23 Cary Coutant <ccoutant@google.com>
2749
2750 * dwp.h: New header file.
2751 * dwp.cc: New source file.
2752 * gold.h: Move shared declarations to system.h.
2753 * system.h: New header file.
2754 * Makefile.am: Add dwp.
2755 * Makefile.in: Regenerate.
2756
2757 2012-10-23 Cary Coutant <ccoutant@google.com>
2758
2759 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2760 Dwarf_info_reader::read_from_pointer.
2761 (Dwarf_pubnames_table::read_header): Likewise.
2762 (Dwarf_pubnames_table::next_name): Likewise.
2763 (Dwarf_die::read_attributes): Likewise.
2764 (Dwarf_die::skip_attributes): Likewise.
2765 (Dwarf_info_reader::read_from_pointer): New function template.
2766 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2767 (Dwarf_pubnames_table): Likewise.
2768 (Dwarf_info_reader::read_from_pointer): New function template.
2769 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2770 Dwarf_pubnames_table ctor.
2771
2772 2012-10-23 Cary Coutant <ccoutant@google.com>
2773
2774 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2775 abbrev_shndx.
2776 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2777 abbrev_shndx_.
2778 (Dwarf_info_reader::set_abbrev_shndx): New method.
2779 (Dwarf_info_reader::abbrev_shndx_): New data member.
2780
2781 2012-10-23 Cary Coutant <ccoutant@google.com>
2782
2783 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2784 from object, not parameters.
2785 (Dwarf_info_reader::parse): Likewise.
2786 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2787 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2788 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2789 methods.
2790
2791 2012-10-23 Cary Coutant <ccoutant@google.com>
2792
2793 * fileread.cc (Input_file::Input_file): New constructor.
2794 * fileread.h (class Input_file): Add new constructor.
2795
2796 2012-10-18 Alan Modra <amodra@gmail.com>
2797
2798 PR gold/14727
2799 * object.cc (Relobj::is_section_name_included): Also match
2800 .sdata personality section.
2801
2802 2012-10-18 Alan Modra <amodra@gmail.com>
2803
2804 * target-reloc.h (class Default_comdat_behavior): New, package up..
2805 (get_comdat_behaviour): ..this.
2806 (relocate_section): Add Relocate_comdat_behavior template arg,
2807 adjust code to suit.
2808 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2809 (Target_arm::scan_reloc_section): Likewise.
2810 * i386.cc (Target_i386::relocate_section): Likewise.
2811 * sparc.cc (Target_sparc::relocate_section): Likewise.
2812 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2813 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2814 * powerpc.cc (class Relocate_comdat_behavior): New.
2815 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2816 gold::relocate_section with new template arg.
2817
2818 2012-10-18 Alan Modra <amodra@gmail.com>
2819
2820 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2821 dynamic relocs for GOT_TPREL got entries, without symbol if
2822 resolving locally.
2823 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2824 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2825 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2826
2827 2012-10-17 Alan Modra <amodra@gmail.com>
2828
2829 PR gold/14726
2830 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2831
2832 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2833
2834 * layout.cc (Layout::include_section): Keep sections marked
2835 SHF_EXCLUDE when doing relocatable links.
2836
2837 2012-10-16 Alan Modra <amodra@gmail.com>
2838
2839 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2840 (Target_powerpc::do_finalize_sections): Call it.
2841 (Output_data_save_res): New class and supporting functions.
2842 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2843 normal symbols defined in object files.
2844
2845 2012-10-12 Alan Modra <amodra@gmail.com>
2846
2847 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2848 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2849 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2850 section if scan_opd_relocs not yet called.
2851 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2852
2853 2012-10-12 Alan Modra <amodra@gmail.com>
2854
2855 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2856 add_local_ifunc_entry): Revert last change.
2857 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2858
2859 2012-10-05 Alan Modra <amodra@gmail.com>
2860
2861 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2862 do_plt_address_for_global): New functions.
2863 (Output_data_got_powerpc::do_write): Don't segfault when linking
2864 statically.
2865 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2866 add_local_ifunc_entry): Return true on adding entry..
2867 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2868 glink->add_entry call. Remove unused symtab param. Adjust calls.
2869 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2870 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2871 set up symbols here.
2872 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2873 syms here. Do so even when no .iplt. Don't segfault when linking
2874 statically.
2875 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2876 new variants without reloc param.
2877 (Glink_sym_ent::Glink_sym_ent): Likewise.
2878 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2879 reloc when refs will resolve to plt call stub.
2880 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2881 R_PPC_PLTREL24 to resolve locally.
2882 (Target_powerpc::Scan::global): Correct ifunc handling.
2883 (Target_powerpc::Relocate::relocate): Correct local sym glink
2884 lookup. Don't destroy "value" when we have a plt call stub,
2885 and when checking plt call validity.
2886 (Target_powerpc::do_dynsym_value): Simplify.
2887
2888 2012-10-05 Alan Modra <amodra@gmail.com>
2889
2890 * i386.cc (Output_data_plt_i386::address_for_global,
2891 address_for_local): Add plt offset to returned value. Adjust uses.
2892 * sparc.cc (Output_data_plt_sparc::address_for_global,
2893 address_for_local): Likewise.
2894 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2895 address_for_local): Likewise.
2896 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2897 address_for_local): Likewise.
2898 * target.h (Target::plt_address_for_global, plt_address_for_local):
2899 Update comment.
2900 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2901 (Output_data_got::Got_entry::write): Nor here.
2902 * output.h: Comment fix.
2903
2904 2012-10-02 Jiong Wang <jiwang@tilera.com>
2905
2906 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2907 global_offset_table_ value for larget got.
2908 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2909
2910 2012-09-29 Alan Modra <amodra@gmail.com>
2911
2912 * powerpc.cc (Target_powerpc::iplt_): New output section.
2913 (Target_powerpc::iplt_section, make_iplt_section,
2914 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2915 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2916 Target_powerpc::plt_entry_count): Count iplt entries too.
2917 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2918 reloc section in constructor. New params.
2919 (Target_powerpc::make_plt_section): Create reloc section here instead.
2920 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2921 functions.
2922 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2923 (Output_data_glink::add_entry, find_entry): New functions to
2924 deal with local syms.
2925 (Glink_sym_ent): Add support for local syms.
2926 (Output_data_glink::do_write): Handle ifunc plt entries.
2927 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2928 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2929 (Target_powerpc::Relocate::relocate): Likewise.
2930 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2931
2932 2012-09-25 Alan Modra <amodra@gmail.com>
2933
2934 * object.h (Sized_relobj_file::adjust_local_symbol,
2935 do_adjust_local_symbol): New functions.
2936 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2937 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2938 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2939 and irregular opd entry spacing.
2940 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2941 (Global_symbol_visitor_opd): New functor.
2942 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2943 on deleted opd entries.
2944
2945 2012-09-15 Jiong Wang <jiwang@tilera.com>
2946
2947 * tilegx.cc: New file.
2948 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2949 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2950 * configure.tgt: Add entries for tilegx*.
2951 * configure.ac: Likewise.
2952 * Makefile.in: Rebuild.
2953 * configure: Likewise.
2954 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2955 tilegx.
2956
2957 2012-09-13 Alan Modra <amodra@gmail.com>
2958
2959 * target-reloc.h (scan_relocs): Call scan.local for relocs
2960 against symbols in discarded sections. Pass is_discarded
2961 param.
2962 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2963 Add is_discarded param.
2964 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2965 is_discarded to flag opd entry as discarded. Don't emit dyn
2966 relocs on such entries.
2967 (Target_powerpc::Scan::global): Similarly detect and handle
2968 such opd entries.
2969 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2970 opd_ent_. Update all uses.
2971 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2972 (Target_powerpc::relocate_section): Zero out discarded opd
2973 entry relocs.
2974
2975 2012-09-12 Ian Lance Taylor <iant@google.com>
2976
2977 PR gold/14570
2978 * output.cc: Rename Output_data_got template parameter from size
2979 to got_size for all functions. Compile all variants of
2980 Output_data_got.
2981 (Output_data_got::Got_entry::write): Correct use of size for
2982 symbol value. Use local_is_tls rather than casting to
2983 Sized_relobj_file.
2984 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2985 (class Sized_relobj_file): Add do_local_is_tls.
2986 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2987
2988 2012-09-11 Alan Modra <amodra@gmail.com>
2989
2990 PR gold/14566
2991 * layout.cc (Layout::set_segment_offsets): When using
2992 common-page-size alignment, ensure we are on a new max-page-size
2993 page.
2994 * output.cc (Output_segment::set_section_addresses): Use
2995 abi_pagesize, not common_pagesize for relro boundary.
2996 (Output_segment::set_offset): Likewise.
2997
2998 2012-09-11 Alan Modra <amodra@gmail.com>
2999
3000 * output.h (Output_data_got::add_global_tls, add_local_tls,
3001 add_local_tls_pair): New functions.
3002 (Output_data_got::add_local_pair_with_rel): Remove second
3003 reloc param. Expand comment.
3004 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3005 use_plt_or_tls_offset_, similarly for constructor param.
3006 (Output_data_got::Got_entry::write): Add got_index param.
3007 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3008 add_local_tls_pair): New functions.
3009 (Output_data_got::Got_entry::write): Handle tls symbols
3010 with use_plt_or_tls_offset_ set specially.
3011 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3012 (Output_data_got::do_write): Replace iterator with index, pass
3013 index to entry write function.
3014 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3015 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3016 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3017 call.
3018 * i386.cc (Target_i386::Scan::local): Likewise.
3019 * sparc.cc (Target_sparc::Scan::local): Likewise.
3020 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3021 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3022 do_tls_offset_for_global): New functions.
3023 (Target_powerpc::Scan::local): Correct TLS relocations and got
3024 entry values.
3025 (Target_powerpc::Scan::global): Don't emit unnecessary
3026 dynamic relocations on TLS GOT entries.
3027
3028 2012-09-10 Matthias Klose <doko@ubuntu.com>
3029
3030 * config.in: Disable sanity check for kfreebsd.
3031
3032 2012-09-10 Sterling Augustine <saugustine@google.com>
3033
3034 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3035 (Gdb_index::pubtypes_read): New parameter.
3036 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3037 to calls.
3038 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3039 pubtypes_object_.
3040
3041 2012-09-09 Alan Modra <amodra@gmail.com>
3042
3043 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3044 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3045 * gc.h (gc_process_relocs): Call target gc_add_reference.
3046 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3047 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3048 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3049 unnecessary cast.
3050 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3051 to cater for when we don't need code offset. Update use.
3052 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3053 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3054 set_opd_valid): New functions.
3055 (Target_powerpc::do_gc_add_reference): New function.
3056 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3057 stashed refs.
3058 (Target_powerpc::do_gc_mark_symbol): New function.
3059
3060 2012-09-06 Cary Coutant <ccoutant@google.com>
3061
3062 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3063 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3064 (Dwarf_die::skip_attributes): Likewise.
3065 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3066 * testsuite/gdb_index_test.cc (inline_func_1): New function.
3067 (main): Call it.
3068 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3069
3070 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
3071
3072 * testsuite/script_test_3.t: Add .got.plt output section
3073 statement.
3074 * testsuite/script_test_4.t: Likewise.
3075
3076 2012-09-05 Alan Modra <amodra@gmail.com>
3077
3078 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3079 update all uses and lose "enum" when using type.
3080
3081 2012-09-05 Alan Modra <amodra@gmail.com>
3082
3083 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3084 * configure: Regenerate.
3085 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3086 (plugin_final_layout.stdout): Likewise.
3087 (memory_test): Set page sizes to 0x1000.
3088 * testsuite/Makefile.in: Regenerate.
3089 * testsuite/discard_locals_test.sh: Add FIXME comment.
3090 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3091 * testsuite/pr14265.t: Add .got output section statement.
3092 * testsuite/script_test_2.t: Likewise.
3093 * testsuite/script_test_3.t: Likewise.
3094 * testsuite/script_test_4.t: Likewise.
3095 * testsuite/script_test_5.t: Likewise.
3096 * testsuite/script_test_6.t: Likewise.
3097 * testsuite/script_test_7.t: Likewise.
3098 * testsuite/script_test_9.t: Likewise.
3099
3100 2012-09-05 Alan Modra <amodra@gmail.com>
3101
3102 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3103 (Powerpc_relocate_functions::Status): New typedef.
3104 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3105 (Target_powerpc::Scan::local): Handle REL64.
3106 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3107 for REL32 and REL64.
3108 (Target_powerpc::symval_for_branch): New function, extracted from..
3109 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
3110 checks. Report overflow errors.
3111
3112 2012-09-05 Alan Modra <amodra@gmail.com>
3113
3114 * object.h (Sized_relobj_file::emit_relocs): Delete.
3115 (Sized_relobj_file::emit_relocs_reltype): Delete.
3116 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3117 relocate_relocs for --emit-relocs.
3118 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3119 * output.h: Update comment.
3120 (Output_segment::first_section): New function.
3121 (Output_segment::first_section_load_address): Use first_section.
3122 * output.cc (Output_segment::first_section): New function extracted..
3123 (Output_segment::first_section_load_address): ..from here. Delete.
3124 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3125 * target.h (Sized_target::relocate_for_relocatable): Likewise.
3126 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3127 adjust call to target.h function.
3128 * i386.cc (Target_i386): Likewise.
3129 * sparc.cc (Target_sparc): Likewise.
3130 * x86_64.cc (Target_x86_64): Likewise.
3131 * powerpc.cc (Target_powerpc): Likewise.
3132 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
3133 first tls section has section symbol for optimised local dynamic
3134 output relocs.
3135 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3136 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3137 optimised tls code.
3138 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3139 Rename to relocate_relocs. Update error message.
3140
3141 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
3142
3143 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3144 --just-symbols.
3145
3146 2012-08-31 Alan Modra <amodra@gmail.com>
3147
3148 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3149 (Powerpc_relobj::toc_base_offset): New stub function.
3150 (Target_powerpc): Add tp_offset, dtp_offset. Rename
3151 got_mod_index_offset to tlsld_got_offset. Update all refs.
3152 (Target_powerpc::Relocate::enum skip_tls): New.
3153 (Target_powerpc::call_tls_get_addr_): New var.
3154 (Target_powerpc::is_branch_reloc): Move to file scope.
3155 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3156 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3157 New functions.
3158 (Target_powerpc::enum Got_type): Delete old values, add new ones.
3159 (powerpc_info): Correct common_pagesize for ppc64.
3160 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3161 (Powerpc_relocate_functions): Add overflow check enums and functions.
3162 Add non-shift version of rela, rela_ua. Delete all rel public
3163 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
3164 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3165 addr16_ha3, addr14 functions.
3166 (Output_data_got_powerpc::add_constant_pair): New function.
3167 (Output_data_got_powerpc::got_base_offset): Likewise.
3168 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3169 (instruction constants): Sort, add some more.
3170 (Output_data_glink::do_write): Add and use Address typedef. Use
3171 object->toc_base_offset() stub for 64-bit.
3172 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3173 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3174 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3175 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
3176 Always treat .opd relocs as against locally defined symbol.
3177 Correct condition for RELATIVE relocs.
3178 (Target_powerpc::do_finalize_sections): Test for NULL sections.
3179 (Target_powerpc::Relocate::relocate): Use plt call stub as value
3180 for 32-bit syms with a plt entry. Correct ppc64 toc base
3181 calculations. Handle TLS relocs, and more. Add overflow
3182 checking and adjust for Powerpc_relocate_functions changes.
3183 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3184 Reinstate --emit-relocs code with FIXME.
3185
3186 2012-08-30 Alan Modra <amodra@gmail.com>
3187
3188 * layout.cc (Layout::set_segment_offsets): Set p_align to
3189 abi_pagesize, not common_pagesize.
3190 (Layout::relaxation_loop_body): Similarly use abi_pagesize
3191 to determine whether file header can go in segment.
3192
3193 2012-08-30 Alan Modra <amodra@gmail.com>
3194
3195 * output.h (Output_reloc::Output_reloc <output section>): Add
3196 is_relative param. Adjust calls.
3197 (Output_reloc::add_output_section_relative): New functions.
3198 * output.cc (Output_reloc::Output_reloc <output section>): Handle
3199 is_relative.
3200 (Output_reloc::symbol_value): Handle SECTION_CODE.
3201
3202 2012-08-24 Sriraman Tallam <tmsriram@google.com>
3203
3204 * gold.cc (queue_middle_tasks): Call layout again when unique
3205 segments for sections is desired.
3206 * layout.cc (Layout::Layout): Initialize new members.
3207 (Layout::get_output_section_flags): New function.
3208 (Layout::choose_output_section): Call get_output_section_flags.
3209 (Layout::layout): Make output section for mapping to a unique segment.
3210 (Layout::insert_section_segment_map): New function.
3211 (Layout::attach_allocated_section_to_segment): Make unique segment for
3212 output sections marked so.
3213 (Layout::segment_precedes): Check for unique segments when sorting.
3214 * layout.h (Layout::Unique_segment_info): New struct.
3215 (Layout::Section_segment_map): New typedef.
3216 (Layout::insert_section_segment_map): New function.
3217 (Layout::get_output_section_flags): New function.
3218 (Layout::is_unique_segment_for_sections_specified): New function.
3219 (Layout::set_unique_segment_for_sections_specified): New function.
3220 (Layout::unique_segment_for_sections_specified_): New member.
3221 (Layout::section_segment_map_): New member.
3222 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3223 Rename is_gc_pass_one to is_pass_one.
3224 Rename is_gc_pass_two to is_pass_two.
3225 Rename is_gc_or_icf to is_two_pass.
3226 Check for which pass based on whether symbols data is present.
3227 Make it two pass when unique segments for sections is desired.
3228 * output.cc (Output_section::Output_section): Initialize new
3229 members.
3230 * output.h (Output_section::is_unique_segment): New function.
3231 (Output_section::set_is_unique_segment): New function.
3232 (Output_section::is_unique_segment_): New member.
3233 (Output_section::extra_segment_flags): New function.
3234 (Output_section::set_extra_segment_flags): New function.
3235 (Output_section::extra_segment_flags_): New member.
3236 (Output_section::segment_alignment): New function.
3237 (Output_section::set_segment_alignment): New function.
3238 (Output_section::segment_alignment_): New member.
3239 (Output_segment::Output_segment): Initialize is_unique_segment_.
3240 (Output_segment::is_unique_segment): New function.
3241 (Output_segment::set_is_unique_segment): New function.
3242 (Output_segment::is_unique_segment_): New member.
3243 * plugin.cc (allow_unique_segment_for_sections): New function.
3244 (unique_segment_for_sections): New function.
3245 (Plugin::load): Add new functions to transfer vector.
3246 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3247 * Makefile.in: Regenerate.
3248 * testsuite/plugin_final_layout.sh: Check if unique segment
3249 functionality works.
3250 * testsuite/plugin_section_order.c (onload): Check if new interfaces
3251 are available.
3252 (allow_unique_segment_for_sections): New global.
3253 (unique_segment_for_sections): New global.
3254 (claim_file_hook): Call allow_unique_segment_for_sections.
3255 (all_symbols_read_hook): Call unique_segment_for_sections.
3256
3257 2012-08-22 Cary Coutant <ccoutant@google.com>
3258
3259 * layout.cc (Layout::include_section): Don't assert on GROUP
3260 sections with --emit-relocs.
3261
3262 2012-08-21 Cary Coutant <ccoutant@google.com>
3263
3264 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3265 if --export-dynamic-symbol names an undef symbol.
3266
3267 2012-08-18 Alan Modra <amodra@gmail.com>
3268
3269 * powerpc.cc: Formatting and white space.
3270 (Powerpc_relobj): Rename got2_section_ to special_.
3271 Add opd_ent_shndx_ and opd_ent_off_ vectors.
3272 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3273 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3274 (Target_powerpc): Add Address typedef and invalid_address. Use
3275 throughout.
3276 (Target_powerpc::is_branch_reloc): New function.
3277 (Powerpc_relocate_functions): Add Address typedef, use throughout.
3278 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3279 for dst_mask, value and addend.
3280 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3281 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3282 (Output_data_glink::do_write): Correct toc base. Don't try to use
3283 uint16_t for 24-bit offset. Use get_output_section_offset and
3284 check return.
3285 (Target_powerpc::Scan::local): Handle more relocs.
3286 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3287 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3288 Plug in toc restoring insn after plt calls. Translate branches
3289 to function descriptor symbols to corresponding entry point.
3290 (Target_powerpc::relocate_for_relocatable): Check return from
3291 get_output_section_offset.
3292 * symtab.h: Comment typo.
3293
3294 2012-08-14 Ian Lance Taylor <iant@google.com>
3295
3296 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3297 unsupported_relocal_local to call unsupported_reloc_global.
3298
3299 2012-08-14 Nick Clifton <nickc@redhat.com>
3300
3301 PR ld/14265
3302 * script-sections.cc (Sections_element::output_section_name): Add
3303 keep return parameter.
3304 (Output_section_element::match_name): Add keep return parameter.
3305 Return the value of the keep_ member.
3306 * script-sections.h (class Output_section): Update
3307 output_section_name prototype.
3308 * layout.cc (Layout::keep_input_section): New public member
3309 function.
3310 (Layout::choose_output_section): Pass keep parameter to
3311 output_section_name.
3312 * layout.h (class Layout): Add keep_input_section.
3313 * object.cc (Sized_relobj_file::do_layout): Check for kept input
3314 sections.
3315 * testsuite/Makefile.am: Add a test.
3316 * testsuite/Makefile.in: Regenerate.
3317 * testsuite/pr14265.c: Source file for the test.
3318 * testsuite/pr14265.t: Linker script for the test.
3319 * testsuite/pr14265.sh: Shell script for the test.
3320
3321 2012-08-14 Alan Modra <amodra@gmail.com>
3322
3323 * target.h (Target::output_section_name): New function.
3324 (Target::do_output_section_name): New function.
3325 * layout.cc (Layout::choose_output_section): Call the above.
3326 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3327
3328 2012-08-14 Alan Modra <amodra@gmail.com>
3329
3330 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3331 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3332 for replace_constant call.
3333 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3334 (Output_data_glink::do_print_to_mapfile): New function.
3335 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3336 (Target_powerpc::Relocate::relocate): Likewise.
3337
3338 2012-08-14 Alan Modra <amodra@gmail.com>
3339
3340 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3341 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3342 (Output_data_glink::add_entry,find_entry): Remove shndx param.
3343 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
3344 all references to shndx_. Handle special case for R_PPC_PLTREL24
3345 here.
3346 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3347 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3348 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3349 here.
3350 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3351 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3352
3353 2012-08-12 Alan Modra <amodra@gmail.com>
3354
3355 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
3356 (glink insn constants): Use uint32_t.
3357 (Output_data_glink::add_entry): Use insert, not [] operator.
3358
3359 2012-08-11 Alan Modra <amodra@gmail.com>
3360
3361 * object.h (Sized_relobj_file::find_shdr): New function.
3362 (Sized_relobj_file::find_special_sections): New function.
3363 * object.cc (Sized_relobj_file::find_shdr): New function.
3364 (Sized_relobj_file::find_eh_frame): Use find_shdr.
3365 (Sized_relobj_file::find_special_sections): New function, split out..
3366 (Sized_relobj_file::do_read_symbols): ..from here.
3367 * output.h (Output_data_got::replace_constant): New function.
3368 (Output_data_got::num_entries): New function.
3369 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3370 (Output_data_got::got_offset): Protected rather than private.
3371 (Output_data_got::replace_got_entry): New function.
3372 * output.cc (Output_data_got::replace_got_entry): New function.
3373 * powerpc.cc (class Powerpc_relobj): New.
3374 (class Powerpc_relocate_functions): Delete all psymval variants or
3375 convert to value,addend type. Delete pcrela, pcrela_unaligned.
3376 Implement _ha functions using corresponding _hi function.
3377 (Powerpc_relobj::find_special_sections): New function.
3378 (Target_powerpc::do_make_elf_object): New function.
3379 (class Output_data_got_powerpc): New.
3380 (class Output_data_glink): New.
3381 (class Powerpc_scan_relocatable_reloc): New.
3382 Many more changes througout file.
3383
3384 2012-08-09 Nick Clifton <nickc@redhat.com>
3385
3386 * po/vi.po: Updated Vietnamese translation.
3387
3388 2012-08-07 Ian Lance Taylor <iant@google.com>
3389
3390 * layout.cc (Layout::add_target_dynamic_tags): If
3391 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3392 plt_rel.
3393
3394 2012-07-30 Nick Clifton <nickc@redhat.com>
3395
3396 * po/gold.pot: Updated template.
3397 * po/es.po: Updated Spanish translation.
3398
3399 2012-07-18 Cary Coutant <ccoutant@google.com>
3400
3401 PR gold/14344
3402 * configure.ac: Add check for -gpubnames support.
3403 * configure: Regenerate.
3404 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3405 support; force -gno-pubnames.
3406 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3407 support.
3408 (gdb_index_test_4): New test.
3409 * testsuite/Makefile.in: Regenerate.
3410 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3411 * testsuite/gdb_index_test_2.sh: Likewise.
3412 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3413 * testsuite/gdb_index_test_4.sh: New script.
3414 * testsuite/gdb_index_test_comm.sh: New script with common code;
3415 don't look for space after colon.
3416
3417 2012-07-16 Sriraman Tallam <tmsriram@google.com>
3418
3419 * gold.cc (queue_middle_tasks): Update function order only after
3420 deferred objects due to plugins are processed.
3421
3422 2012-07-11 Ian Lance Taylor <iant@google.com>
3423
3424 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3425 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3426 (Target_arm::scan_reloc_for_stub): Likewise.
3427 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3428 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3429 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3430 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3431 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3432
3433 2012-07-10 Dodji Seketeli <dodji@redhat.com>
3434 Ian Lance Taylor <iant@google.com>
3435
3436 PR gold/14309
3437 * configure.ac: Test whether std::tr1::hash<off_t> works.
3438 * gold.h: Add a specialization for std::tr1::hash<off_t> if
3439 needed.
3440 * output.h (class Output_fill): Add virtual destructor.
3441 * configure, config.in: Rebuild.
3442
3443 2012-06-22 Roland McGrath <mcgrathr@google.com>
3444
3445 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3446
3447 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
3448
3449 * plugin.cc (Plugin::load): Handle position independent executables.
3450
3451 2012-06-06 Cary Coutant <ccoutant@google.com>
3452
3453 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3454 add .debug_macro.
3455 (lines_only_debug_sections): Likewise.
3456 (gdb_fast_lookup_sections): New static array.
3457 (is_gdb_debug_section): Rename formal parameter.
3458 (is_lines_only_debug_section): Likewise.
3459 (is_gdb_fast_lookup_section): New function.
3460 (Layout::include_section): Check for ".zdebug_" prefix; pass
3461 section name suffix to is_gdb_debug_section, et al.; check for
3462 fast-lookup sections when building .gdb_index.
3463 * options.h (--strip-debug-gdb): Update GDB version number.
3464
3465 2012-06-06 Cary Coutant <ccoutant@google.com>
3466
3467 * configure.ac: Add check for fallocate.
3468 * configure: Regenerate.
3469 * config.in: Regenerate.
3470
3471 * options.h (class General_options): Add --mmap-output-file and
3472 --posix-fallocate options.
3473 * output.cc: (posix_fallocate): Remove; replace with...
3474 (gold_fallocate): New function.
3475 (Output_file::map_no_anonymous): Call gold_fallocate.
3476 (Output_file::map): Check --mmap-output-file option.
3477
3478 2012-06-05 Jing Yu <jingyu@google.com>
3479
3480 * gold.h (textdomain): Add do {} to empty while(0).
3481 (bindtextdomain): Likewise.
3482
3483 2012-06-04 Cary Coutant <ccoutant@google.com>
3484
3485 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3486 has_dynsym_index.
3487
3488 2012-05-25 Sriraman Tallam <tmsriram@google.com>
3489
3490 * symtab.cc (Symbol_table::define_special_symbol):
3491 Initialize *poldsym to prevent uninitialized variable errors.
3492
3493 2012-05-23 Cary Coutant <ccoutant@google.com>
3494
3495 * layout.cc (Layout::section_name_mapping): Add rules to handle
3496 exact match on .data.rel.ro.local or .data.rel.ro.
3497 (Layout::output_section_name): Check for exact matches.
3498
3499 2012-05-23 Cary Coutant <ccoutant@google.com>
3500
3501 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3502 more carefully.
3503
3504 2012-05-22 Cary Coutant <ccoutant@google.com>
3505
3506 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3507 object before exporting symbol.
3508
3509 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
3510
3511 * testsuite/tls_test.cc: Include "config.h" first.
3512 * testsuite/tls_test_c.c: Likewise.
3513
3514 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
3515 Nick Clifton <nickc@redhat.com>
3516
3517 PR 14072
3518 * configure.in: Add check that sysdep.h has been included before
3519 any system header files.
3520 * configure: Regenerate.
3521 * config.in: Regenerate.
3522
3523 2012-05-14 Cary Coutant <ccoutant@google.com>
3524
3525 * layout.cc (Layout::make_output_section): Mark .tdata section
3526 as RELRO.
3527 * testsuite/relro_test.cc: Add a TLS variable.
3528
3529 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
3530
3531 PR gold/14091
3532 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3533 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3534 R_X86_64_64.
3535
3536 2012-05-08 Cary Coutant <ccoutant@google.com>
3537
3538 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3539 (lines_only_debug_sections): Likewise.
3540
3541 2012-05-02 Roland McGrath <mcgrathr@google.com>
3542
3543 * nacl.cc: New file.
3544 * nacl.h: New file.
3545 * Makefile.am (CCFILES, HFILES): Add them.
3546 * Makefile.in: Regenerate.
3547 * i386.cc (Output_data_plt_i386_nacl): New class.
3548 (Output_data_plt_i386_nacl_exec): New class.
3549 (Output_data_plt_i386_nacl_dyn): New class.
3550 (Target_i386_nacl): New class.
3551 (Target_selector_i386_nacl): New class.
3552 (target_selector_i386): Use it instead of Target_selector_i386.
3553 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3554 (Target_x86_64_nacl): New class.
3555 (Target_selector_x86_64_nacl): New class.
3556 (target_selector_x86_64, target_selector_x32): Use it instead of
3557 Target_selector_x86_64.
3558 * arm.cc (Output_data_plt_arm_nacl): New class.
3559 (Target_arm_nacl): New class.
3560 (Target_selector_arm_nacl): New class.
3561 (target_selector_arm, target_selector_armbe): Use it instead of
3562 Target_selector_arm.
3563
3564 * target-select.cc (select_target): Take new Input_file* and off_t
3565 arguments, pass them on to recognize method of selector.
3566 * object.cc (make_elf_sized_object): Update caller.
3567 * parameters.cc (parameters_force_valid_target): Likewise.
3568 * incremental.cc (make_sized_incremental_binary): Likewise.
3569 * target-select.h: Update decl.
3570 (Target_selector::recognize): Take new Input_file* argument,
3571 pass it on to do_recognize.
3572 (Target_selector::do_recognize): Take new Input_file* argument.
3573 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3574 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3575 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3576 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3577
3578 * target.h (Target::Target_info): New members isolate_execinstr
3579 and rosegment_gap.
3580 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3581 * arm.cc (Target_arm::arm_info): Update initializer.
3582 * i386.cc (Target_i386::i386_info): Likewise.
3583 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3584 * sparc.cc (Target_sparc::sparc_info): Likewise.
3585 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3586 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3587 * layout.cc (Layout::attach_allocated_section_to_segment):
3588 Take new const Target* argument. If target->isolate_execinstr(), act
3589 like --rosegment.
3590 (Layout::find_first_load_seg): Take new const Target* argument;
3591 if target->isolate_execinstr(), reject PF_X segments.
3592 (Layout::relaxation_loop_body): Update caller.
3593 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3594 reset file offset to zero when we hit LOAD_SEG, and then do a second
3595 loop over the segments before LOAD_SEG to reassign offsets after
3596 addresses have been determined. Handle target->rosegment_gap().
3597 (Layout::attach_section_to_segment): Take new const Target* argument;
3598 pass it to attach_allocated_section_to_segment.
3599 (Layout::make_output_section): Update caller.
3600 (Layout::attach_sections_to_segments): Take new const Target* argument;
3601 pass it to attach_section_to_segment.
3602 * gold.cc (queue_middle_tasks): Update caller.
3603 * layout.h (Layout): Update method decls with new arguments.
3604
3605 * arm.cc (Target_arm::Target_arm): Take optional argument for the
3606 Target_info pointer to use.
3607 (Target_arm::do_make_data_plt): New virtual method.
3608 (Target_arm::make_data_plt): New method that calls it.
3609 (Target_arm::make_plt_entry): Use it.
3610 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3611 for the section alignment.
3612 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3613 method.
3614 (Output_data_plt_arm::first_plt_entry_offset): Call it.
3615 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3616 method.
3617 (Output_data_plt_arm::get_plt_entry_size): Call it.
3618 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3619 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3620 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3621 method.
3622 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3623 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3624 method instead of sizeof(plt_entry).
3625 (Output_data_plt_arm::add_entry): Likewise.
3626 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3627 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3628 than static method.
3629 (Target_arm::plt_entry_size): Likewise.
3630 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3631 Move to ...
3632 (Output_data_plt_arm_standard): ... here, new class.
3633 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3634 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3635 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3636
3637 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3638 Take additional argument for the PLT entry size.
3639 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3640 Use get_plt_entry_size method rather than plt_entry_size variable.
3641 (Output_data_plt_x86_64::reserve_slot): Likewise.
3642 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3643 (Output_data_plt_x86_64::add_entry): Likewise.
3644 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3645 (Output_data_plt_x86_64::address_for_global): Likewise.
3646 (Output_data_plt_x86_64::address_for_local): Likewise.
3647 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3648 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3649 Make method non-static.
3650 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3651 method.
3652 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3653 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3654 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3655 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3656 virtual method.
3657 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3658 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3659 virtual method.
3660 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3661 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3662 virtual method.
3663 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3664 (Output_data_plt_x86_64::plt_entry_size)
3665 (Output_data_plt_x86_64::first_plt_entry)
3666 (Output_data_plt_x86_64::plt_entry)
3667 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3668 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3669 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3670 (Output_data_plt_x86_64_standard): ... here, new class.
3671 (Target_x86_64::Target_x86_64): Take optional argument for the
3672 Target_info pointer to use.
3673 (Target_x86_64::do_make_data_plt): New virtual method.
3674 (Target_x86_64::make_data_plt): New method to call it.
3675 (Target_x86_64::init_got_plt_for_update): Use that.
3676 Call this->plt_->add_eh_frame method here.
3677 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3678 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3679 rather than static method.
3680 (Target_x86_64::plt_entry_size): Likewise.
3681 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3682 rather than plt_entry_size variable. Move guts of PLT filling to...
3683 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3684 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3685 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3686
3687 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3688 additional argument for the section alignment.
3689 Don't do add_eh_frame_for_plt here.
3690 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3691 non-static. Use get_plt_entry_size method rather than plt_entry_size
3692 variable.
3693 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3694 method.
3695 (Output_data_plt_i386::get_plt_entry_size): Call it.
3696 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3697 (Output_data_plt_i386::add_eh_frame): New method to call it.
3698 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3699 method.
3700 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3701 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3702 method.
3703 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3704 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3705 method instead of plt_entry_size.
3706 (Output_data_plt_i386::plt_entry_size)
3707 (Output_data_plt_i386::plt_eh_frame_fde_size)
3708 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3709 (Output_data_plt_i386_standard): ... here, new class.
3710 (Output_data_plt_i386_exec): New class.
3711 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3712 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3713 (Output_data_plt_i386::exec_plt_entry): Move to ...
3714 (Output_data_plt_i386_exec::plt_entry): ... here.
3715 (Output_data_plt_i386_dyn): New class.
3716 (Output_data_plt_i386::first_plt_entry): Move to ...
3717 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3718 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3719 (Output_data_plt_i386_dyn::plt_entry): ... here.
3720 (Target_i386::Target_i386): Take optional argument for the Target_info
3721 pointer to use.
3722 (Target_i386::do_make_data_plt): New virtual method.
3723 (Target_i386::make_data_plt): New method to call it.
3724 (Target_i386::make_plt_section): Use that.
3725 Call this->plt_->add_eh_frame method here.
3726 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3727 rather than plt_entry_size variable.
3728 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3729 (Output_data_plt_i386::address_for_local): Likewise.
3730 (Output_data_plt_i386::do_write): Likewise.
3731 Move guts of PLT filling to...
3732 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3733 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3734 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3735 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3736
3737 2012-05-01 Cary Coutant <ccoutant@google.com>
3738
3739 * dwarf_reader.cc (Dwarf_die::read_attributes)
3740 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3741 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3742 * reduced_debug_output.cc
3743 (Output_reduced_debug_info_section::get_die_end): Remove
3744 DW_FORM_GNU_ref_index. Add default case.
3745
3746 2012-04-26 Mark Wielaard <mjw@redhat.com>
3747
3748 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3749 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3750 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3751 DW_AT_high_pc as offset from DW_AT_low_pc.
3752
3753 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3754 * testsuite/Makefile.in: Regenerate.
3755 * testsuite/gdb_index_test_3.c: New test source file.
3756 * testsuite/gdb_index_test_3.sh: New test source file.
3757
3758 2012-04-25 Ian Lance Taylor <iant@google.com>
3759
3760 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3761 pointer.
3762 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3763 as a class, not a struct.
3764 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3765 (Target_arm::apply_cortex_a8_workaround): Likewise.
3766 * gc.h: Declare Reloc_types as a struct, not a class.
3767 * object.h: Declare Symbols_data as a struct.
3768 * reloc.h: Declare Read_relocs_data as a struct.
3769 * target.h: Declare Relocate_info as a struct.
3770
3771 2012-04-24 David S. Miller <davem@davemloft.net>
3772
3773 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3774 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3775 and R_SPARC_WPLT30.
3776
3777 2012-04-24 Cary Coutant <ccoutant@google.com>
3778
3779 * incremental-dump.cc (find_input_containing_global): Replace
3780 magic number with symbolic constant.
3781 (dump_incremental_inputs): Update version number.
3782 * incremental.cc (Output_section_incremental_inputs): Update version
3783 number; import symbolic constants from Incremental_inputs_reader.
3784 (Incremental_inputs::create_data_sections): Align relocations
3785 section correctly for 64-bit targets.
3786 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3787 constants; add padding.
3788 (Output_section_incremental_inputs::write_header): Add assert for
3789 header_size.
3790 (Output_section_incremental_inputs::write_input_files): Add assert
3791 for input_entry_size.
3792 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3793 add assert for object_info_size, input_section_entry_size,
3794 global_sym_entry_size.
3795 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3796 for data structure sizes; use them.
3797 (Incremental_input_entry_reader): Import symbolic constants from
3798 Incremental_inputs_reader; use them.
3799
3800 2012-04-23 David S. Miller <davem@davemloft.net>
3801
3802 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3803 and elf_flags_set_.
3804 (Target_sparc::Target_sparc): Initialize new fields.
3805 (Target_sparc::do_make_elf_object): New function.
3806 (Target_sparc::do_adjust_elf_header): New function.
3807
3808 2012-04-23 Cary Coutant <ccoutant@google.com>
3809
3810 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3811 CU range table of gdb index.
3812
3813 2012-04-20 David S. Miller <davem@davemloft.net>
3814
3815 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3816 instead of false.
3817
3818 2012-04-16 David S. Miller <davem@davemloft.net>
3819
3820 * sparc.cc (Target_sparc::got_address): New function.
3821 (Sparc_relocate_functions::gdop_hix22): New function.
3822 (Sparc_relocate_functions::gdop_lox10): New function.
3823 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3824 relocs.
3825 (Target_sparc::Scan::local): Likewise if the global symbol is not
3826 preemptible and is not IFUNC.
3827 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3828 transformations for local and non-preemptible non-IFUNC global
3829 symbols.
3830
3831 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3832 writing out 64-bit part of ranges.
3833
3834 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3835 -fpic and -fpie respectively.
3836 * Makefile.in: Regenerate.
3837
3838 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3839 (Target_sparc::Target_sparc): Initialize new field.
3840 (Target_sparc::do_plt_section_for_global): New function.
3841 (Target_sparc::do_plt_section_for_local): New function.
3842 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3843 (Target_sparc::make_plt_section): New function, broken out of
3844 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3845 (Target_sparc::make_plt_entry): Call make_plt_section.
3846 (Target_sparc::make_local_ifunc_plt_entry): New function.
3847 (Target_sparc::rela_ifunc_section): New function.
3848 (Target_sparc::plt_section): Remove const.
3849 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3850 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3851 and ifunc_count_ fields.
3852 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3853 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3854 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3855 (Output_data_plt_sparc::rela_ifunc): New function.
3856 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3857 (Output_data_plt_sparc::has_ifunc_section): New function.
3858 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3859 (Output_data_plt_sparc::address_for_global): New function.
3860 (Output_data_plt_sparc::address_for_local): New function.
3861 (Output_data_plt_sparc::plt_index_to_offset): New function.
3862 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3863 and entry_count.
3864 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3865 entry_count.
3866 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3867 R_SPARC_JMP_IREL to switch.
3868 (Target_sparc::Scan::check_non_pic): Likewise.
3869 (Target_sparc::Scan::local): Handle IFUNC symbols.
3870 (Target_sparc::Scan::local): Likewise.
3871 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3872 and plt_address_for_local.
3873 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3874 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3875
3876 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3877 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3878 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3879 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3880 global relocs too.
3881 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3882 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3883 calls.
3884 * sparc.cc (Target_sparc::Scan::global): Likewise.
3885 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3886
3887 2012-04-16 Cary Coutant <ccoutant@google.com>
3888
3889 * archive.cc (Library_base::should_include_member): Check for
3890 --export-dynamic-symbol.
3891 * options.h (class General_options): Add --export-dynamic-symbol.
3892 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3893 --export-dynamic-symbol.
3894 (Symbol_table::gc_mark_undef_symbols): Likewise.
3895 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3896
3897 2012-04-12 David S. Miller <davem@davemloft.net>
3898
3899 * sparc.cc (Reloc::wdisp10): New relocation method.
3900 (Reloc::h34): Likewise.
3901 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3902 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3903 R_SPARC_WDISP10.
3904 (Target_sparc::Scan::local): Likewise.
3905 (Target_sparc::Scan::global): Likewise.
3906 (Target_sparc::Relocate::relocate): Likewise.
3907
3908 2012-04-09 Cary Coutant <ccoutant@google.com>
3909
3910 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3911 low_pc == 0.
3912
3913 2012-04-06 Ian Lance Taylor <iant@google.com>
3914
3915 * timer.cc: #include <unistd.h>.
3916
3917 2012-04-06 Roland McGrath <mcgrathr@google.com>
3918
3919 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3920 * config.in: Regenerate.
3921 * configure: Regenerate.
3922
3923 2012-04-05 Nick Clifton <nickc@redhat.com>
3924
3925 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3926 (AM_LC_MESSAGES): Add.
3927 * aclocal.m4: Regenerate.
3928 * config.in: Regenerate.
3929 * configure: Regenerate.
3930
3931 2012-03-21 Cary Coutant <ccoutant@google.com>
3932
3933 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3934 * Makefile.in: Regenerate.
3935 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3936 (Sized_elf_reloc_mapper::symbol_section): New function.
3937 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3938 (make_elf_reloc_mapper): New function.
3939 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3940 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3941 (Dwarf_abbrev_table::do_get_abbrev): New function.
3942 (Dwarf_ranges_table::read_ranges_table): New function.
3943 (Dwarf_ranges_table::read_range_list): New function.
3944 (Dwarf_pubnames_table::read_section): New function.
3945 (Dwarf_pubnames_table::read_header): New function.
3946 (Dwarf_pubnames_table::next_name): New function.
3947 (Dwarf_die::Dwarf_die): New function.
3948 (Dwarf_die::read_attributes): New function.
3949 (Dwarf_die::skip_attributes): New function.
3950 (Dwarf_die::set_name): New function.
3951 (Dwarf_die::set_linkage_name): New function.
3952 (Dwarf_die::attribute): New function.
3953 (Dwarf_die::string_attribute): New function.
3954 (Dwarf_die::int_attribute): New function.
3955 (Dwarf_die::uint_attribute): New function.
3956 (Dwarf_die::ref_attribute): New function.
3957 (Dwarf_die::child_offset): New function.
3958 (Dwarf_die::sibling_offset): New function.
3959 (Dwarf_info_reader::check_buffer): New function.
3960 (Dwarf_info_reader::parse): New function.
3961 (Dwarf_info_reader::do_parse): New function.
3962 (Dwarf_info_reader::do_read_string_table): New function.
3963 (Dwarf_info_reader::lookup_reloc): New function.
3964 (Dwarf_info_reader::get_string): New function.
3965 (Dwarf_info_reader::visit_compilation_unit): New function.
3966 (Dwarf_info_reader::visit_type_unit): New function.
3967 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3968 Sized_elf_reloc_mapper.
3969 (Sized_dwarf_line_info::symbol_section): Remove function.
3970 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3971 (Sized_dwarf_line_info::read_line_mappings): Remove object
3972 parameter, adjust callers.
3973 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3974 * dwarf_reader.h: Include <sys/types.h>.
3975 (class Track_relocs): Remove forward declaration.
3976 (class Elf_reloc_mapper): New class.
3977 (class Sized_elf_reloc_mapper): New class.
3978 (class Dwarf_abbrev_table): New class.
3979 (class Dwarf_range_list): New class.
3980 (class Dwarf_ranges_table): New class.
3981 (class Dwarf_pubnames_table): New class.
3982 (class Dwarf_die): New class.
3983 (class Dwarf_info_reader): New class.
3984 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3985 (Sized_dwarf_line_info::symbol_section): Remove member function.
3986 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3987 base class.
3988 * gdb-index.cc: New source file.
3989 * gdb-index.h: New source file.
3990 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3991 and .debug_types sections, call Layout::add_to_gdb_index.
3992 (Sized_relobj_incr::do_section_name): Implement.
3993 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3994 return type; Implement.
3995 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3996 return type.
3997 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3998 parameter list and return type.
3999 (Sized_incr_dynobj::do_section_contents): Likewise.
4000 * layout.cc: Include gdb-index.h.
4001 (Layout::Layout): Initialize gdb_index_data_.
4002 (Layout::init_fixed_output_section): Check for .gdb_index section.
4003 (Layout::add_to_gdb_index): New function. Instantiate.
4004 * layout.h: Add forward declaration for class Gdb_index.
4005 (Layout::add_to_gdb_index): New member function.
4006 (Layout::gdb_index_data_): New data member.
4007 * main.cc: Include gdb-index.h.
4008 (main): Print statistics for gdb index.
4009 * object.cc (Object::section_contents): Move code into
4010 do_section_contents.
4011 (need_decompressed_section): Check for sections needed when building
4012 gdb index.
4013 (build_compressed_section_map): Likewise.
4014 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4015 gdb index.
4016 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4017 sections; call Layout::add_to_gdb_index.
4018 (Sized_relobj_file::do_decompressed_section_contents): Call
4019 do_section_contents directly.
4020 * object.h (Object::do_section_contents): Adjust parameter list and
4021 return type.
4022 (Object::do_decompressed_section_contents): Call do_section_contents
4023 directly.
4024 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4025 return type.
4026 * options.h (class General_options): Add --gdb-index option.
4027 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4028 list and return type.
4029 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4030 * reloc.h (Track_relocs::checkpoint): New function.
4031 (Track_relocs::reset): New function.
4032
4033 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4034 New test cases.
4035 * testsuite/Makefile.in: Regenerate.
4036 * testsuite/gdb_index_test.cc: New test source file.
4037 * testsuite/gdb_index_test_1.sh: New test source file.
4038 * testsuite/gdb_index_test_2.sh: New test source file.
4039
4040 2012-03-19 Doug Kwan <dougkwan@google.com>
4041
4042 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4043 (Target_arm::do_finalize_sections): Remove code which defines
4044 __exidx_start and __exidx_end. Make symbol table parameter
4045 anonymous as it is not used.
4046 * gold.cc (queue_middle_tasks): Call target hook to define any
4047 target-specific symbols.
4048 * target.h (Target::define_standard_symbols): New method.
4049 (Target::do_define_standard_symbols): Same.
4050 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4051 * testsuite/Makefile.in: Regenerate.
4052 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4053 and __exidx_end.
4054 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4055 relocations are generated for __exidx_start and __exidx_end.
4056
4057 2012-03-16 Doug Kwan <dougkwan@google.com>
4058
4059 * testsuite/Makefile.am: Disable test initpri3b.
4060 * testsuite/Makefile.in: Regenerate.
4061
4062 2012-03-15 Doug Kwan <dougkwan@google.com>
4063
4064 * arm.cc (Target_arm::got_section): Make .got section read-only
4065 if -z now is given.
4066
4067 2012-03-15 Ian Lance Taylor <iant@google.com>
4068
4069 PR gold/13850
4070 * layout.cc (Layout::make_output_section): Correctly mark
4071 SHT_INIT_ARRAY, et. al., as relro.
4072
4073 2012-03-14 Doug Kwan <dougkwan@google.com>
4074
4075 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4076 dynamic relocations for protected symbols in shared objects.
4077
4078 2012-03-13 Ian Lance Taylor <iant@google.com>
4079
4080 * resolve.cc (Symbol_table::resolve): When merging common symbols,
4081 keep the larger alignment.
4082
4083 2012-03-12 Cary Coutant <ccoutant@google.com>
4084
4085 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4086 handling of DW_LNE_define_file.
4087
4088 2012-03-12 Cary Coutant <ccoutant@google.com>
4089
4090 * reduced_debug_output.cc
4091 (Output_reduced_debug_info_section::get_die_end): Add new FORM
4092 codes to switch.
4093
4094 2012-02-29 Cary Coutant <ccoutant@google.com>
4095
4096 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4097
4098 2012-02-29 Cary Coutant <ccoutant@google.com>
4099
4100 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4101 Call Object::decompressed_section_contents.
4102 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4103 New dtor.
4104 (Sized_dwarf_line_info::buffer_start_): New data member.
4105 * merge.cc (Output_merge_data::do_add_input_section): Call
4106 Object::decompressed_section_contents.
4107 (Output_merge_string::do_add_input_section): Likewise.
4108 * object.cc (need_decompressed_section): New function.
4109 (build_compressed_section_map): Decompress sections needed later.
4110 (Sized_relobj_file::do_decompressed_section_contents): New function.
4111 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4112 * object.h (Object::decompressed_section_contents): New function.
4113 (Object::discard_decompressed_sections): New function.
4114 (Object::do_decompressed_section_contents): New function.
4115 (Object::do_discard_decompressed_sections): New function.
4116 (Compressed_section_info): New type.
4117 (Compressed_section_map): Include decompressed section contents.
4118 (Sized_relobj_file::do_decompressed_section_contents): New function.
4119 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4120
4121 2012-02-16 Cary Coutant <ccoutant@google.com>
4122
4123 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4124 * testsuite/Makefile.in: Regenerate.
4125
4126 2012-02-14 Cary Coutant <ccoutant@google.com>
4127
4128 * options.cc (General_options::finalize): Disallow -pie and -static.
4129
4130 2012-02-03 Doug Kwan <dougkwan@google.com>
4131
4132 * arm.cc (Arm_relocate_functions::abs8,
4133 Arm_relocate_functions::abs16): Use
4134 Bits::has_signed_unsigned_overflow32.
4135 (Arm_relocate_functions::thm_abs8): Correct range of
4136 overflow check.
4137 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4138 in assertions.
4139
4140 2012-02-02 Doug Kwan <dougkwan@google.com>
4141
4142 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4143 position independent outputs, not just shared objects.
4144
4145 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
4146
4147 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4148 * configure: Regenerated.
4149
4150 2012-01-27 Ian Lance Taylor <iant@google.com>
4151
4152 * reloc.h (Bits): New class with static functions, copied from
4153 namespace utils in arm.cc.
4154 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
4155 instead.
4156
4157 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4158
4159 * incremental.cc (write_info_blocks): Correct relocation offset.
4160
4161 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4162
4163 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4164 (Relocate::tls_gd_to_le): Likewise.
4165
4166 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4167
4168 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4169
4170 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4171
4172 * configure.ac: Check if -mcmodel=medium works.
4173 * configure: Regenerated.
4174
4175 2012-01-24 Cary Coutant <ccoutant@google.com>
4176
4177 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4178 definition and ...
4179 (read_unsigned_LEB_128_x): ... this new function.
4180 (read_signed_LEB_128): Replaced with inline definition and ...
4181 (read_signed_LEB_128_x): ... this new function.
4182 * int_encoding.h (read_unsigned_LEB_128_x): New function.
4183 (read_unsigned_LEB_128): Add inline definition.
4184 (read_signed_LEB_128_x): New function.
4185 (read_signed_LEB_128): Add inline definition.
4186 * testsuite/Makefile.am (leb128_unittest): New unit test.
4187 * testsuite/Makefile.in: Regenerate.
4188 * testsuite/leb128_unittest.cc: New unit test.
4189
4190 2012-01-23 Ian Lance Taylor <iant@google.com>
4191
4192 PR gold/13617
4193 * i386.cc (Target_i386::do_code_fill): When using a jmp
4194 instruction, pad with nop instructions.
4195 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4196
4197 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
4198
4199 * x86_64.cc (gc_process_relocs): Add typename on types used in
4200 template.
4201 (scan_relocs): Likewise.
4202 (relocate_section): Likewise.
4203 (apply_relocation): Likewise.
4204
4205 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
4206
4207 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4208 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4209 under x32.
4210
4211 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
4212
4213 * x86_64.cc: Initial support for x32.
4214
4215 2012-01-03 Cary Coutant <ccoutant@google.com>
4216
4217 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4218 Use abstract base class for GOT.
4219 * gold/output.h (class Output_data_got_base): New abstract base class.
4220 (class Output_data_got): Derive from new base class, adjust ctors.
4221 (Output_data_got::reserve_slot): Make virtual; rename to
4222 do_reserve_slot; Adjust callers.
4223 * gold/target.h (Sized_target::init_got_plt_for_update): Return
4224 pointer to abstract base class.
4225 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4226
4227 2011-12-18 Ian Lance Taylor <iant@google.com>
4228
4229 * object.h (Relobj::local_symbol_value): New function.
4230 (Relobj::local_plt_offset): New function.
4231 (Relobj::local_has_got_offset): New function.
4232 (Relobj::local_got_offset): New function.
4233 (Relobj::set_local_got_offset): New function.
4234 (Relobj::do_local_symbol_value): New pure virtual function.
4235 (Relobj::do_local_plt_offset): Likewise.
4236 (Relobj::do_local_has_got_offset): Likewise.
4237 (Relobj::do_local_got_offset): Likewise.
4238 (Relobj::do_set_local_got_offset): Likewise.
4239 (Sized_relobj::do_local_has_got_offset): Rename from
4240 local_has_got_offset.
4241 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4242 (Sized_relobj::do_set_local_got_offset): Rename from
4243 set_local_got_offset.
4244 (Sized_relobj_file::do_local_plt_offset): Rename from
4245 local_plt_offset.
4246 (Sized_relobj_file::do_local_symbol_value): New function.
4247 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4248 local_plt_offset.
4249 * output.cc (Output_data_got::Got_entry::write): Change object to
4250 Relobj. Use local_symbol_value.
4251 (Output_data_got::add_global_with_rel): Change rel_dyn to
4252 Output_data_reloc_generic*. Use add_global_generic.
4253 (Output_data_got::add_global_with_rela): Remove. Change all
4254 callers to use add_global_with_rel.
4255 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4256 Output_data_reloc_generic*. Use add_global_generic.
4257 (Output_data_got::add_global_pair_with_rela): Remove. Change all
4258 callers to use add_global_pair_with_rel.
4259 (Output_data_got::add_local): Change object to Relobj*.
4260 (Output_data_got::add_local_plt): Likewise.
4261 (Output_data_got::add_local_with_rel): Change object to Relobj*,
4262 change rel_dyn to Output_data_reloc_generic*. Use
4263 add_local_generic.
4264 (Output_data_got::add_local_with_rela): Remove. Change all
4265 callers to use all_local_with_rel.
4266 (Output_data_got::add_local_pair_with_rel): Change object to
4267 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
4268 add_output_section_generic.
4269 (Output_data_got::add_local_pair_with_rela): Remove. Change all
4270 callers to use add_local_pair_with_rel.
4271 (Output_data_got::reserve_local): Change object to Relobj*.
4272 * output.h: (class Output_data_reloc_generic): Add pure virtual
4273 declarations for add_global_generic, add_local_generic,
4274 add_output_section_generic.
4275 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4276 functions for Output_data_reloc_generic. Update declarations for
4277 changes listed in output.cc.
4278 (class Output_data_got): Change template parameter to got_size.
4279 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
4280 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4281 function.
4282 (Sized_relobj_incr::do_local_plt_offset): New function.
4283 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4284 add_global_generic.
4285
4286 2011-12-17 Cary Coutant <ccoutant@google.com>
4287
4288 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4289 * resolve.cc (Symbol_table::resolve): Likewise.
4290 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4291 arrays.
4292 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4293
4294 2011-12-16 Ian Lance Taylor <iant@google.com>
4295
4296 * output.h (Output_data_reloc_generic::add): Only call
4297 add_dynamic_reloc if this is a dynamic reloc section.
4298
4299 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
4300
4301 PR gold/13505
4302 * target-reloc.h (apply_relocation): Replace <64, false> with
4303 <size, big_endian>.
4304
4305 2011-11-25 Nick Clifton <nickc@redhat.com>
4306
4307 * po/it.po: New Italian translation.
4308
4309 2011-11-17 Sterling Augustine <saugustine@google.com>
4310
4311 * script.cc (script_include_directive): Implement.
4312 (read_script_file): New local variables name and search_path. Update
4313 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4314 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4315 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4316
4317 2011-11-11 Sterling Augustine <saugustine@google.com>
4318
4319 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4320 (file_or_sections_cmd): Likewise.
4321
4322 2011-11-11 Doug Kwan <dougkwan@google.com>
4323
4324 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4325 if --just-symbols is given.
4326
4327 2011-11-10 Doug Kwan <dougkwan@google.com>
4328
4329 PR gold/13362
4330 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4331 when processing data relocs.
4332 * reloc.h (Relocate_functions::rel_unaligned): New method.
4333 (Relocate_functions::pcrel_unaligned): Ditto.
4334 (Relocate_functions::rel32_unaligned): Ditto.
4335 (Relocate_functions::pcrel32_unaligned): Ditto.
4336
4337 2011-11-09 Doug Kwan <dougkwan@google.com>
4338
4339 PR gold/13362
4340 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4341 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4342 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4343 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4344 (Relocate_functions::rel_unaligned): New.
4345 (Relocate_functions::rel32_unaligned): New.
4346 * target-reloc.h (relocate_for_relocatable): Add code to handle
4347 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4348 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4349 arm_unaligned_reloc_r): New targets.
4350 * testsuite/Makefile.in: Regenerate.
4351 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4352 linking.
4353
4354 2011-11-02 Ian Lance Taylor <iant@google.com>
4355
4356 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
4357 NATIVE_LINKER.
4358 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4359 * options.cc (General_options::finalize): Use library search path
4360 from configure script if specified. If not native and no sysroot,
4361 only search TOOLLIBDIR.
4362 * options.h (Search_directory::Search_directory): Change name to
4363 const std::string&.
4364 (General_options::add_to_library_path_with_sysroot): Change arg to
4365 const std::string&.
4366 * configure, Makefile.in, config.in: Rebuild.
4367
4368 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4369
4370 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4371 we are working around the ARM1176 Erratum.
4372 * options.h (General_options::fix_arm1176): Add option.
4373 * testsuite/Makefile.am: Add testcases, and keep current ones
4374 working.
4375 * testsuite/Makefile.in: Regenerate.
4376 * testsuite/arm_fix_1176.s: New file.
4377 * testsuite/arm_fix_1176.sh: Likewise.
4378
4379 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4380
4381 * arm.cc (Target_arm::Target_arm): Remove initialisation of
4382 may_use_blx_.
4383 (Target_arm::may_use_blx): Remove method.
4384 (Target_arm::set_may_use_blx): Likewise.
4385 (Target_arm::may_use_v4t_interworking): New method.
4386 (Target_arm::may_use_v5t_interworking): Likewise.
4387 (Target_arm::may_use_blx_): Remove member variable.
4388 (Arm_relocate_functions::arm_branch_common): Check for v5T
4389 interworking.
4390 (Arm_relocate_functions::thumb_branch_common): Likewise.
4391 (Reloc_stub::stub_type_for_reloc): Likewise.
4392 (Target_arm::do_finalize_sections): Correct interworking checks.
4393 * testsuite/Makefile.am: Add new tests.
4394 * testsuite/Makefile.in: Regenerate.
4395 * testsuite/arm_farcall_arm_arm.s: New test.
4396 * testsuite/arm_farcall_arm_arm.sh: Likewise.
4397 * testsuite/arm_farcall_arm_thumb.s: Likewise.
4398 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4399 * testsuite/arm_farcall_thumb_arm.s: Likewise.
4400 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4401 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4402 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4403
4404 2011-10-31 Cary Coutant <ccoutant@google.com>
4405
4406 PR gold/13023
4407 * expression.cc (Expression::eval_with_dot): Add
4408 is_section_dot_assignment parameter.
4409 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
4410 absolute and assigning to dot within a section.
4411 * script-sections.cc
4412 (Output_section_element_assignment::set_section_addresses): Pass
4413 dot_section to set_if_absolute.
4414 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4415 as is_section_dot_assignment flag to eval_with_dot.
4416 (Output_section_element_dot_assignment::set_section_addresses):
4417 Likewise.
4418 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4419 parameter. Also set value if relative to dot_section; set the
4420 symbol's output_section.
4421 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4422 parameter. Adjust all callers.
4423 (Expression::eval_maybe_dot): Likewise.
4424 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4425 Adjust all callers.
4426 * testsuite/script_test_2.t: Test assignment of an absolute value
4427 to dot within an output section element.
4428
4429 2011-10-31 Cary Coutant <ccoutant@google.com>
4430
4431 * options.h (class General_options): Add --[no-]gnu-unique options.
4432 * symtab.cc (Symbol_table::sized_write_globals): Convert
4433 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4434
4435 2011-10-31 Cary Coutant <ccoutant@google.com>
4436
4437 PR gold/13359
4438 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4439 unnecessary assertion.
4440 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4441
4442 2011-10-31 Sriraman Tallam <tmsriram@google.com>
4443
4444 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4445 gc_mark_symbol.
4446 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4447 gc_mark_symbol.
4448 Change to just keep the section associated with symbol.
4449 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4450 they are externally visible and --export-dynamic is turned on.
4451 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4452
4453 2011-10-19 Ian Lance Taylor <iant@google.com>
4454
4455 PR gold/13163
4456 * script-sections.cc
4457 (Output_section_element_dot_assignment::needs_output_section): New
4458 function.
4459
4460 2011-10-19 Ian Lance Taylor <iant@google.com>
4461
4462 PR gold/13204
4463 * layout.cc (Layout::segment_precedes): Don't assert failure if a
4464 --section-start option was seen.
4465 * options.h (General_options::any_section_start): New function.
4466
4467 2011-10-18 David S. Miller <davem@davemloft.net>
4468
4469 PR binutils/13301
4470 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4471 member to track relocation locations that have moved during TLS
4472 reloc optimizations.
4473 (Target_sparc::Relocate::Relocate): Initialize to NULL.
4474 (Target_sparc::Relocate::relocate): Adjust view down by 4
4475 bytes if it matches reloc_adjust_addr_.
4476 (Target_sparc::Relocate::relocate_tls): Always move the
4477 __tls_get_addr call delay slot instruction forward 4 bytes when
4478 performing relaxation.
4479
4480 2011-10-18 Cary Coutant <ccoutant@google.com>
4481
4482 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4483 (Output_file::map_no_anonymous): Check for non-zero
4484 return code from posix_fallocate.
4485
4486 2011-10-17 Cary Coutant <ccoutant@google.com>
4487
4488 PR gold/13245
4489 * plugin.cc (is_visible_from_outside): Check for symbols
4490 referenced from dynamic objects.
4491 * resolve.cc (Symbol_table::resolve): Don't count references
4492 from dynamic objects as references from real ELF files.
4493 * testsuite/plugin_test_2.sh: Adjust expected result.
4494
4495 2011-10-17 Cary Coutant <ccoutant@google.com>
4496
4497 * gold.cc: Include timer.h.
4498 (queue_middle_tasks): Stamp time.
4499 (queue_final_tasks): Likewise.
4500 * main.cc (main): Store timer in parameters. Print timers
4501 for each pass.
4502 * parameters.cc (Parameters::Parameters): Initialize timer_.
4503 (Parameters::set_timer): New function.
4504 (set_parameters_timer): New function.
4505 * parameters.h (Parameters::set_timer): New function.
4506 (Parameters::timer): New function.
4507 (Parameters::timer_): New data member.
4508 (set_parameters_timer): New function.
4509 * timer.cc (Timer::stamp): New function.
4510 (Timer::get_pass_time): New function.
4511 * timer.h (Timer::stamp): New function.
4512 (Timer::get_pass_time): New function.
4513 (Timer::pass_times_): New data member.
4514
4515 2011-10-17 Cary Coutant <ccoutant@google.com>
4516
4517 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4518 task for members of lib groups.
4519
4520 2011-10-17 Cary Coutant <ccoutant@google.com>
4521
4522 PR gold/13288
4523 * fileread.cc (File_read::find_view): Add assert.
4524 (File_read::make_view): Move bounds check (replace with assert)...
4525 (File_read::find_or_make_view): ... to here.
4526
4527 2011-10-12 Cary Coutant <ccoutant@google.com>
4528
4529 * output.cc (Output_file::open_base_file): Handle case where
4530 ::read returns less than requested size.
4531
4532 2011-10-10 Cary Coutant <ccoutant@google.com>
4533
4534 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4535 Initialize defined_count_.
4536 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4537 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4538 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4539 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4540 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4541 * incremental.h (Sized_relobj_incr::defined_count_): New data
4542 member.
4543 (Sized_incr_dynobj::defined_count_): New data member.
4544 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4545 Return zeroes instead of internal error.
4546
4547 2011-10-10 Cary Coutant <ccoutant@google.com>
4548
4549 PR gold/13249
4550 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4551 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4552 * output.h (class Output_reloc): Add use_plt_offset flag.
4553 (Output_reloc::type_): Adjust size of bit field.
4554 (Output_reloc::use_plt_offset_): New bit field.
4555 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4556 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4557 flag. Adjust all callers.
4558 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4559 creating RELATIVE relocations.
4560
4561 2011-10-10 Nick Clifton <nickc@redhat.com>
4562
4563 * po/es.po: Updated Spanish translation.
4564 * po/fi.po: Updated Finnish translation.
4565
4566 2011-10-03 Diego Novillo <dnovillo@google.com>
4567
4568 * options.cc (parse_uint): Fix dereference of RETVAL.
4569
4570 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4571
4572 * layout.h (section_order_map_): New member.
4573 (get_section_order_map): New member function.
4574 * output.cc (Output_section::add_input_section): Check for patterns
4575 only when --section-ordering-file is specified.
4576 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4577 output_sections have been formed.
4578 * layout.cc (Layout_Layout): Initialize section_order_map_.
4579 * plugin.cc (update_section_order): Store order in order_map. Do not
4580 update the order.
4581 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4582 * testsuite/Makefile.in: Regenerate.
4583 * testsuite/plugin_section_order.c: New file.
4584 * testsuite/plugin_final_layout.cc: New file.
4585 * testsuite/plugin_final_layout.sh: New file.
4586
4587 2011-09-29 Cary Coutant <ccoutant@google.com>
4588
4589 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4590 Check for NULL.
4591 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4592 symbols during incremental update.
4593 (Symbol_table::add_from_dynobj): Likewise.
4594
4595 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4596 Ian Lance Taylor <iant@google.com>
4597
4598 * symtab.cc (Symbol_table::define_special_symbol): Always
4599 canonicalize version string.
4600
4601 2011-09-26 Cary Coutant <ccoutant@google.com>
4602
4603 * gold.cc (queue_initial_tasks): Move option checks ...
4604 * options.cc (General_options::finalize): ... to here. Disable
4605 some options; make others fatal.
4606
4607 2011-09-26 Cary Coutant <ccoutant@google.com>
4608
4609 gcc PR lto/47247
4610 * plugin.cc (get_symbols_v2): New function.
4611 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4612 (is_referenced_from_outside): New function.
4613 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4614 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4615 (get_symbols): Pass version parameter.
4616 (get_symbols_v2): New function.
4617 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4618 parameter.
4619 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4620 (onload): Add LDPT_GET_SYMBOLS_V2.
4621 (all_symbols_read_hook): Use get_symbols_v2; check for
4622 LDPR_PREVAILING_DEF_IRONLY_EXP.
4623 * testsuite/plugin_test_3.sh: Update expected results.
4624
4625 2011-09-23 Simon Baldwin <simonb@google.com>
4626
4627 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4628 configuration options.
4629 * configure: Regenerate.
4630 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4631 * Makefile.in: Regenerate.
4632 * testsuite/Makefile.in: Regenerate.
4633
4634 2011-09-19 Sriraman Tallam <tmsriram@google.com>
4635
4636 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4637
4638 2011-09-19 Cary Coutant <ccoutant@google.com>
4639
4640 * incremental.cc (can_incremental_update): Fix typo in comment.
4641 * incremental.h (can_incremental_update): Likewise.
4642
4643 2011-09-18 Cary Coutant <ccoutant@google.com>
4644
4645 * incremental.cc (can_incremental_update): New function.
4646 * incremental.h (can_incremental_update): New function.
4647 * layout.cc (Layout::init_fixed_output_section): Call it.
4648 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4649 * object.cc (Sized_relobj_file::do_layout): Call
4650 can_incremental_update.
4651
4652 2011-09-13 Cary Coutant <ccoutant@google.com>
4653
4654 * configure.ac: Check for glibc support for gnu_indirect_function
4655 support with static linking, setting automake conditional
4656 IFUNC_STATIC.
4657 * Makefile.in: Regenerate.
4658 * configure: Regenerate.
4659
4660 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4661 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4662 for IFUNC_STATIC.
4663 * testsuite/Makefile.in: Regenerate.
4664
4665 2011-09-13 Cary Coutant <ccoutant@google.com>
4666
4667 * incremental.cc (Sized_relobj_incr::do_layout): Call
4668 report_comdat_group for kept comdat sections.
4669 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4670 * testsuite/Makefile.in: Regenerate.
4671 * testsuite/incr_comdat_test_1.cc: New source file.
4672 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4673 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4674 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4675
4676 2011-09-13 Ian Lance Taylor <iant@google.com>
4677
4678 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4679 variable external_symbols_offset.
4680
4681 2011-09-12 Ian Lance Taylor <iant@google.com>
4682
4683 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4684 triggered if object has no symbols.
4685
4686 2011-09-09 David S. Miller <davem@davemloft.net>
4687
4688 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4689 (Output_fill_debug_line::do_write): Likewise.
4690
4691 2011-08-29 Cary Coutant <ccoutant@google.com>
4692
4693 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4694 casts to match formatting specs.
4695 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4696
4697 2011-08-26 Cary Coutant <ccoutant@google.com>
4698
4699 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4700 remaining hole size when allocating.
4701 (Layout::make_output_section): Set fill methods for debug sections.
4702 * layout.h (Free_list::Free_list_node): Move from private to
4703 public.
4704 (Free_list::set_min_hole_size): New function.
4705 (Free_list::begin, Free_list::end): New functions.
4706 (Free_list::min_hole_): New data member.
4707 * output.cc: Include dwarf.h.
4708 (Output_fill_debug_info::do_minimum_hole_size): New function.
4709 (Output_fill_debug_info::do_write): New function.
4710 (Output_fill_debug_line::do_minimum_hole_size): New function.
4711 (Output_fill_debug_line::do_write): New function.
4712 (Output_section::Output_section): Initialize new data member.
4713 (Output_section::set_final_data_size): Ensure patch space is larger
4714 than minimum hole size.
4715 (Output_section::do_write): Fill holes in debug sections.
4716 * output.h (Output_fill): New class.
4717 (Output_fill_debug_info): New class.
4718 (Output_fill_debug_line): New class.
4719 (Output_section::set_free_space_fill): New function.
4720 (Output_section::free_space_fill_): New data member.
4721 * testsuite/Makefile.am (incremental_test_3): Add
4722 --incremental-patch option.
4723 (incremental_test_4): Likewise.
4724 (incremental_test_5): Likewise.
4725 (incremental_test_6): Likewise.
4726 (incremental_copy_test): Likewise.
4727 (incremental_common_test_1): Likewise.
4728 * testsuite/Makefile.in: Regenerate.
4729
4730 2011-08-26 Nick Clifton <nickc@redhat.com>
4731
4732 * po/es.po: Updated Spanish translation.
4733
4734 2011-08-01 Cary Coutant <ccoutant@google.com>
4735
4736 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4737 * gold/testsuite/Makefile.in: Regenerate.
4738 * gold/testsuite/justsyms_exec.c: New source file.
4739 * gold/testsuite/justsyms_lib.c: New source file.
4740
4741 2011-08-01 Cary Coutant <ccoutant@google.com>
4742
4743 * layout.cc (Layout::set_segment_offsets): Don't realign text
4744 segment if -Ttext was specified.
4745 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4746 file type.
4747 * object.h (Sized_relobj_file::e_type): New function.
4748 (Sized_relobj_file::e_type_): New data member.
4749 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4750 base address for ET_EXEC files.
4751 * target.cc (Target::do_make_elf_object_implementation): Allow
4752 ET_EXEC files with --just-symbols option.
4753
4754 2011-07-28 Cary Coutant <ccoutant@google.com>
4755
4756 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4757 Add thread_number parameter.
4758 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4759 * workqueue-threads.cc
4760 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4761 current thread if its thread number is greater than desired thread
4762 count.
4763 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4764 Add thread_number parameter.
4765 (Workqueue::should_cancel_thread): Likewise.
4766 (Workqueue::find_runnable_or_wait): Pass thread_number to
4767 should_cancel_thread.
4768 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4769 parameter.
4770
4771 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4772
4773 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4774 only after checking if it cannot be forced local.
4775 * symtab.h (is_externally_visible): Check if the symbol is not forced
4776 local.
4777
4778 2011-07-15 Ian Lance Taylor <iant@google.com>
4779
4780 * options.h (class General_options): Add --print-output-format.
4781 Move -EL next to -EB, for better --help output.
4782 * target-select.cc: Include <cstdio>, "options.h", and
4783 "parameters.h".
4784 (Target_selector::do_target_bfd_name): New function.
4785 (print_output_format): New function.
4786 * target-select.h (class Target_selector): Update declarations.
4787 (Target_selector::target_bfd_name): New function.
4788 (print_output_format): Declare.
4789 * main.cc: Include "target-select.h".
4790 (main): Handle --print-output-format.
4791 * gold.cc: Include "target-select.h".
4792 (queue_initial_tasks): Handle --print-output-format when there are
4793 no input files.
4794 * parameters.cc (parameters_force_valid_target): Give a better
4795 error message if -EB/-EL does not match target.
4796 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4797 function.
4798
4799 2011-07-15 Ian Lance Taylor <iant@google.com>
4800
4801 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4802 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4803 (Output_data_plt_i386::do_write): Write address of .dynamic
4804 section to first entry in .got.plt section.
4805 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4806 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4807 Initialize layout_.
4808 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4809 section to first entry in .got.plt section.
4810 * layout.h (Layout::dynamic_section): New function.
4811
4812 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4813
4814 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4815 to claim_file call.
4816 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4817 input_section_position_, and input_section_glob_.
4818 (read_layout_from_file): Call function section_ordering_specified.
4819 * layout.h (is_section_ordering_specified): New function.
4820 (section_ordering_specified): New function.
4821 (section_ordering_specified_): New boolean member.
4822 * main.cc(main): Call load_plugins after layout object is defined.
4823 * output.cc (Output_section::add_input_section): Use
4824 function section_ordering_specified to check if section ordering is
4825 needed.
4826 * output.cc (Output_section::add_relaxed_input_section): Use
4827 function section_ordering_specified to check if section ordering is
4828 needed.
4829 (Output_section::update_section_layout): New function.
4830 (Output_section::sort_attached_input_sections): Check if input section
4831 must be reordered.
4832 * output.h (Output_section::update_section_layout): New function.
4833 * plugin.cc (get_section_count): New function.
4834 (get_section_type): New function.
4835 (get_section_name): New function.
4836 (get_section_contents): New function.
4837 (update_section_order): New function.
4838 (allow_section_ordering): New function.
4839 (Plugin::load): Add the new interfaces to the transfer vector.
4840 (Plugin_manager::load_plugins): New parameter.
4841 (Plugin_manager::all_symbols_read): New parameter.
4842 (Plugin_manager::claim_file): New parameter. Save the elf object for
4843 unclaimed objects.
4844 (Plugin_manager::get_elf_object): New function.
4845 (Plugin_manager::get_view): Change to directly use the bool to check
4846 if get_view is called from claim_file_hook.
4847 * plugin.h (input_objects): New function
4848 (Plugin__manager::load_plugins): New parameter.
4849 (Plugin_manager::claim_file): New parameter.
4850 (Plugin_manager::get_elf_object): New function.
4851 (Plugin_manager::in_claim_file_handler): New function.
4852 (Plugin_manager::in_claim_file_handler_): New member.
4853 (layout): New function.
4854 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4855 handler with an extra parameter. Make the elf object before calling
4856 claim_file handler.
4857 * testsuite/plugin_test.c (get_section_count): New function pointer.
4858 (get_section_type): New function pointer.
4859 (get_section_name): New function pointer.
4860 (get_section_contents): New function pointer.
4861 (update_section_order): New function pointer.
4862 (allow_section_ordering): New function pointer.
4863 (onload): Check if the new interfaces exist.
4864
4865 2011-07-13 Ian Lance Taylor <iant@google.com>
4866
4867 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4868 relro section.
4869 * x86_64.cc (Target_x86_64::got_section): Likewise.
4870 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4871 (relro_now_test_SOURCES): New variable.
4872 (relro_now_test_DEPENDENCIES): New variable.
4873 (relro_now_test_LDFLAGS): New variable.
4874 (relro_now_test_LDADD): New variable.
4875 (relro_now_test.so): New target.
4876 * testsuite/Makefile.in: Rebuild.
4877
4878 2011-07-12 Ian Lance Taylor <iant@google.com>
4879
4880 PR gold/12980
4881 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4882 GLOB_DAT relocation rather than a RELATIVE relocation for a
4883 protected symbol when creating a shared library.
4884 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4885 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4886 * testsuite/protected_main_1.cc (main): Test that protected
4887 function has same address.
4888
4889 2011-07-11 Ian Lance Taylor <iant@google.com>
4890
4891 PR gold/12979
4892 * options.h (class General_options): Add -Bgroup.
4893 * options.cc (General_options::finalize): If -Bgroup is set,
4894 default to --unresolved-symbols=report-all.
4895 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4896 * target-reloc.h (issue_undefined_symbol_error): Handle
4897 --unresolved-symbols=report-all.
4898
4899 2011-07-08 Ian Lance Taylor <iant@google.com>
4900
4901 PR gold/11985
4902 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4903 if linker script discards key sections.
4904 (Layout::create_dynamic_symtab): Likewise.
4905 (Layout::assign_local_dynsym_offsets): Likewise.
4906 (Layout::sized_create_version_sections): Likewise.
4907 (Layout::create_interp): Likewise.
4908 (Layout::finish_dynamic_section): Likewise.
4909 (Layout::set_dynamic_symbol_size): Likewise.
4910
4911 2011-07-08 Ian Lance Taylor <iant@google.com>
4912
4913 PR gold/12386
4914 * options.h (class General_options): Add --unresolved-symbols.
4915 * target-reloc.h (issue_undefined_symbol_error): Check
4916 --unresolved-symbols. Add comments.
4917
4918 2011-07-08 Ian Lance Taylor <iant@google.com>
4919
4920 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4921 expression more complex.
4922
4923 2011-07-08 Ian Lance Taylor <iant@google.com>
4924
4925 PR gold/11317
4926 * target-reloc.h (issue_undefined_symbol_error): New inline
4927 function, broken out of relocate_section.
4928 (relocate_section): Call issue_undefined_symbol_error.
4929 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4930 there is no TLS segment if we are about to issue an undefined
4931 symbol error.
4932 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4933
4934 2011-07-08 Ian Lance Taylor <iant@google.com>
4935
4936 PR gold/12279
4937 * resolve.cc (Symbol_table::should_override): Add fromtype
4938 parameter. Change all callers. Give error when linking together
4939 TLS and non-TLS symbol.
4940 (Symbol_table::should_override_with_special): Add fromtype
4941 parameter. Change all callers.
4942 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4943 there is no TLS segment if we have reported some errors.
4944 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4945
4946 2011-07-08 Ian Lance Taylor <iant@google.com>
4947
4948 PR gold/12372
4949 * target.h (Target::plt_address_for_global): New function.
4950 (Target::plt_address_for_local): New function.
4951 (Target::plt_section_for_global): Remove.
4952 (Target::plt_section_for_local): Remove.
4953 (Target::do_plt_address_for_global): New virtual function.
4954 (Target::do_plt_address_for_local): New virtual function.
4955 (Target::do_plt_section_for_global): Remove.
4956 (Target::do_plt_section_for_local): Remove.
4957 (Target::register_global_plt_entry): Add Symbol_table and Layout
4958 parameters.
4959 * output.cc (Output_data_got::Got_entry::write): Use
4960 plt_address_for_global and plt_address_for_local.
4961 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4962 address of output section.
4963 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4964 got_irelative_, and irelative_count_ fields. Update
4965 declarations.
4966 (Output_data_plt_i386::has_irelative_section): New function.
4967 (Output_data_plt_i386::entry_count): Add irelative_count_.
4968 (Output_data_plt_i386::set_final_data_size): Likewise.
4969 (class Target_i386): Add got_irelative_ and rel_irelative_
4970 fields. Update declarations.
4971 (Target_i386::Target_i386): Initialize new fields.
4972 (Target_i386::do_plt_address_for_global): New function replacing
4973 do_plt_section_for_global.
4974 (Target_i386::do_plt_address_for_local): New function replacing
4975 do_plt_section_for_local.
4976 (Target_i386::got_section): Create got_irelative_.
4977 (Target_i386::rel_irelative_section): New function.
4978 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4979 fields. Don't define __rel_iplt_{start,end}.
4980 (Output_data_plt_i386::add_entry): Add symtab and layout
4981 parameters. Change all callers. Use different PLT and GOT for
4982 IFUNC symbols.
4983 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4984 layout parameters. Change all callers. Use different PLT and
4985 GOT.
4986 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4987 (Output_data_plt_i386::rel_irelative): New function.
4988 (Output_data_plt_i386::address_for_global): New function.
4989 (Output_data_plt_i386::address_for_local): New function.
4990 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4991 IRELATIVE GOT when changing IFUNC GOT entries.
4992 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4993 reloc.
4994 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4995 if we didn't create an IRELATIVE GOT.
4996 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4997 plt_address_for_local.
4998 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4999 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5000 got_irelative_, and irelative_count_ fields. Update
5001 declarations.
5002 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5003 Initialize new fields. Remove symtab parameter. Change all
5004 callers.
5005 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5006 irelative_count_.
5007 (Output_data_plt_x86_64::has_irelative_section): New function.
5008 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5009 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5010 fields. Update declarations.
5011 (Target_x86_64::Target_x86_64): Initialize new fields.
5012 (Target_x86_64::do_plt_address_for_global): New function replacing
5013 do_plt_section_for_global.
5014 (Target_x86_64::do_plt_address_for_local): New function replacing
5015 do_plt_section_for_local.
5016 (Target_x86_64::got_section): Create got_irelative_.
5017 (Target_x86_64::rela_irelative_section): New function.
5018 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5019 all callers. Don't create __rel_iplt_{start,end}.
5020 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5021 parameters. Change all callers. Use different PLT and GOT for
5022 IFUNC symbols.
5023 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5024 layout parameters. Change all callers. Use different PLT and
5025 GOT.
5026 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5027 parameters. Change all callers. Use different PLT and GOT for
5028 IFUNC symbols.
5029 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5030 (Output_data_plt_x86_64::rela_irelative): New function.
5031 (Output_data_plt_x86_64::address_for_global): New function.
5032 (Output_data_plt_x86_64::address_for_local): New function.
5033 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5034 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5035 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5036 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5037 parameters.
5038 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5039 reloc.
5040 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5041 symbols if we didn't create an IRELATIVE GOT.
5042 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5043 plt_address_for_local.
5044 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5045 * testsuite/ifuncvar1.c: New test file.
5046 * testsuite/ifuncvar2.c: New test file.
5047 * testsuite/ifuncvar3.c: New test file.
5048 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5049 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5050 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5051 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5052 * testsuite/Makefile.in: Rebuild.
5053
5054 2011-07-07 Cary Coutant <ccoutant@google.com>
5055
5056 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5057 (two_file_test_1_ndebug.o): Likewise.
5058 (two_file_test_1b_ndebug.o): Likewise.
5059 (two_file_test_2_ndebug.o): Likewise.
5060 (two_file_test_main_ndebug.o): Likewise.
5061 (incremental_test_2): Link with no-debug versions.
5062
5063 2011-07-06 Cary Coutant <ccoutant@google.com>
5064
5065 * gold/incremental.cc
5066 (Output_section_incremental_inputs::write_info_blocks): Check for
5067 hidden and internal symbols.
5068
5069 2011-07-06 Cary Coutant <ccoutant@google.com>
5070
5071 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5072 Check disposition for startup file.
5073 (Incremental_inputs::report_command_line): Ignore
5074 --incremental-startup-unchanged option.
5075 * options.cc (General_options::parse_incremental_startup_unchanged):
5076 New function.
5077 (General_options::General_options): Initialize new data member.
5078 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5079 (General_options): Add --incremental-startup-unchanged option.
5080 (General_options::incremental_startup_disposition): New function.
5081 (General_options::incremental_startup_disposition_): New data member.
5082
5083 2011-07-06 Cary Coutant <ccoutant@google.com>
5084
5085 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5086 input file index to Script_info ctor.
5087 (Sized_incremental_binary::do_file_has_changed): Find the
5088 command-line argument for files named in scripts.
5089 * incremental.h (Script_info::Script_info): New ctor
5090 with input file index.
5091 (Script_info::input_file_index): New function.
5092 (Script_info::input_file_index_): New data member.
5093 (Incremental_binary::get_library): Add const.
5094 (Incremental_binary::get_script_info): Add const.
5095 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5096 * testsuite/Makefile.am (incremental_test_5): New test case.
5097 (incremental_test_6): New test case.
5098 * testsuite/Makefile.in: Regenerate.
5099
5100 2011-07-06 Cary Coutant <ccoutant@google.com>
5101
5102 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5103 debug output when command lines differ.
5104
5105 2011-07-06 Cary Coutant <ccoutant@google.com>
5106
5107 * incremental.cc (Incremental_inputs::report_command_line): Ignore
5108 --incremental-patch option.
5109 * layout.cc (Free_list::allocate): Extend allocation beyond original
5110 end if enabled.
5111 (Layout::make_output_section): Mark sections that should get
5112 patch space.
5113 * options.cc (parse_percent): New function.
5114 * options.h (parse_percent): New function.
5115 (DEFINE_percent): New macro.
5116 (General_options): Add --incremental-patch option.
5117 * output.cc (Output_section::Output_section): Initialize new data
5118 members.
5119 (Output_section::add_input_section): Print section name when out
5120 of patch space.
5121 (Output_section::add_output_section_data): Likewise.
5122 (Output_section::set_final_data_size): Add patch space when
5123 doing --incremental-full.
5124 (Output_section::do_reset_address_and_file_offset): Remove patch
5125 space.
5126 (Output_segment::set_section_list_addresses): Print debug output
5127 only if --incremental-update.
5128 * output.h (Output_section::set_is_patch_space_allowed): New function.
5129 (Output_section::is_patch_space_allowed_): New data member.
5130 (Output_section::patch_space_): New data member.
5131 * parameters.cc (Parameters::incremental_full): New function.
5132 * parameters.h (Parameters::incremental_full): New function
5133 * testsuite/Makefile.am (incremental_test_2): Add test for
5134 --incremental-patch option.
5135 * testsuite/Makefile.in: Regenerate.
5136 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5137 (t18): Remove function body.
5138
5139 2011-07-05 Doug Kwan <dougkwan@google.com>
5140
5141 PR gold/12771
5142 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5143 Arm_Address type for relocation result.
5144 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
5145 overflow check.
5146 (Arm_relocate_functions::abs32): Use unaligned access.
5147 (Arm_relocate_functions::rel32): Ditto.
5148 (Arm_relocate_functions::prel31): Ditto.
5149 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5150 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5151 static data relocations.
5152 * testsuite/Makefile.in: Regnerate.
5153 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5154
5155 2011-07-05 Ian Lance Taylor <iant@google.com>
5156
5157 PR gold/12392
5158 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5159 symbols if necessary.
5160 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5161
5162 2011-07-05 Ian Lance Taylor <iant@google.com>
5163
5164 PR gold/12952
5165 * resolve.cc (Symbol::override_base_with_special): Simply override
5166 version with special symbol version, ignoring previous version.
5167
5168 2011-07-05 Ian Lance Taylor <iant@google.com>
5169
5170 * object.cc (Sized_relobj_file::include_section_group): Add
5171 information to comment about signature location.
5172
5173 2011-07-02 Ian Lance Taylor <iant@google.com>
5174
5175 PR gold/12957
5176 * options.h (class General_options): Add -f and -F.
5177 * options.cc (General_options::finalize): Fatal error if -f/-F
5178 are used without -shared.
5179 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5180
5181 2011-07-02 Ian Lance Taylor <iant@google.com>
5182
5183 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5184
5185 2011-07-01 Ian Lance Taylor <iant@google.com>
5186
5187 PR gold/12525
5188 PR gold/12952
5189 * resolve.cc (Symbol::override_base_with_special): Don't override
5190 the version if the overriding symbol has a different name.
5191 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
5192 all callers. If we give an error about an undefined version,
5193 define the base version if necessary.
5194 * dynobj.h (class Versions): Update declaration.
5195 * testsuite/weak_alias_test_5.cc: New file.
5196 * testsuite/weak_alias_test.script: New file.
5197 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5198 and versioned_alias have the right value, and call t2.
5199 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5200 weak_alias_test_5.so.
5201 (weak_alias_test_LDADD): Likewise.
5202 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5203 * testsuite/Makefile.in: Rebuild.
5204
5205 2011-07-01 Ian Lance Taylor <iant@google.com>
5206
5207 PR gold/12525
5208 * options.h (class General_options): Support -z notext.
5209 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5210 -Wl,-z,notext.
5211 (two_file_shared_nonpic.so): Likewise.
5212 (two_file_shared_mixed.so): Likewise.
5213 (two_file_shared_mixed_1.so): Likewise.
5214 (weak_undef_lib_nonpic.so): Likewise.
5215 (alt/weak_undef_lib_nonpic.so): Likewise.
5216 (tls_test_shared_nonpic.so): Likewise.
5217 * testsuite/Makefile.in: Rebuild.
5218
5219 2011-07-01 Ian Lance Taylor <iant@google.com>
5220
5221 PR gold/12525
5222 * configure.ac: Test whether static linking works, setting
5223 the automake conditional HAVE_STATIC.
5224 * testsuite/Makefile.am: Disable tests using -static if
5225 HAVE_STATIC is not true.
5226 * configure, testsuite/Makefile.in: Rebuild.
5227
5228 2011-07-01 Ian Lance Taylor <iant@google.com>
5229
5230 PR gold/12525
5231 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5232 Assert if we see DW_EH_PE_indirect.
5233 * target.h (Target::ehframe_datarel_base): New function.
5234 (Target::do_ehframe_datarel_base): New target function.
5235 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5236 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5237 function.
5238
5239 2011-07-01 Ian Lance Taylor <iant@google.com>
5240
5241 PR gold/12571
5242 * options.h (class General_options): Add
5243 --ld-generated-unwind-info.
5244 * ehframe.cc (Fde::write): Add address parameter. Change all
5245 callers. If associated with PLT, fill in address and size.
5246 (Cie::set_output_offset): Only add merge mapping if there is an
5247 object.
5248 (Cie::write): Add address parameter. Change all callers.
5249 (Eh_frame::add_ehframe_for_plt): New function.
5250 * ehframe.h (class Fde): Update declarations. Move shndx_ and
5251 input_offset_ fields into union u_, with new plt field.
5252 (Fde::Fde): Adjust for new union field.
5253 (Fde::Fde) [Output_data version]: New constructor.
5254 (Fde::add_mapping): Only add merge mapping if there is an object.
5255 (class Cie): Update declarations.
5256 (class Eh_frame): Declare add_ehframe_for_plt.
5257 * layout.cc (Layout::layout_eh_frame): Break out code into
5258 make_eh_frame_section, and call it.
5259 (Layout::make_eh_frame_section): New function.
5260 (Layout::add_eh_frame_for_plt): New function.
5261 * layout.h (class Layout): Update declarations.
5262 * merge.cc (Merge_map::add_mapping): Add assertion.
5263 * i386.cc: Include "dwarf.h".
5264 (class Output_data_plt_i386): Make first_plt_entry,
5265 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
5266 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5267 and plt_eh_frame_fde.
5268 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5269 boundary. Call add_eh_frame_for_plt if appropriate.
5270 * x86_64.cc: Include "dwarf.h".
5271 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
5272 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
5273 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5274 and plt_eh_frame_fde.
5275 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5276 appropriate.
5277
5278 2011-06-29 Ian Lance Taylor <iant@google.com>
5279
5280 PR gold/12629
5281 * object.cc (Sized_relobj_file::layout_section): Change shdr
5282 parameter to be const.
5283 (Sized_relobj_file::layout_eh_frame_section): New function, broken
5284 out of do_layout.
5285 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5286 appropriate. Call layout_eh_frame_section.
5287 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5288 sections.
5289 * object.h (class Sized_relobj_file): Update declarations.
5290
5291 2011-06-29 Ian Lance Taylor <iant@google.com>
5292
5293 PR gold/12652
5294 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5295 modifier.
5296 (Lex::gather_token): Accept trailing M/m/K/k for integers.
5297
5298 2011-06-29 Ian Lance Taylor <iant@google.com>
5299
5300 PR gold/12675
5301 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5302 SHT_X86_64_UNWIND.
5303 * layout.cc (Layout::layout_eh_frame): Likewise.
5304
5305 2011-06-29 Ian Lance Taylor <iant@google.com>
5306
5307 PR gold/12695
5308 * layout.cc (Layout::symtab_section_shndx): New function.
5309 * layout.h (class Layout): Declare symtab_section_shndx.
5310 * output.cc (Output_section::write_header): Call it.
5311
5312 2011-06-29 Ian Lance Taylor <iant@google.com>
5313
5314 PR gold/12818
5315 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5316 symbols which are not used in a relocation.
5317
5318 2011-06-28 Ian Lance Taylor <iant@google.com>
5319
5320 PR gold/12898
5321 * layout.cc (Layout::segment_precedes): Don't crash if a linker
5322 script create indistinguishable segments.
5323 (Layout::set_segment_offsets): Use stable_sort when sorting
5324 segments. Pass this to Compare_segments constructor.
5325 * layout.h (class Layout): Make segment_precedes non-static.
5326 (class Compare_segments): Change from struct to class. Add
5327 layout_ field. Add constructor.
5328 * script-sections.cc
5329 (Script_sections::attach_sections_using_phdrs_clause): Rename
5330 local orphan to is_orphan. Don't report failure to put empty
5331 section in segment. On attachment failure, report name of
5332 section, and attach to first PT_LOAD segment.
5333
5334 2011-06-28 Ian Lance Taylor <iant@google.com>
5335
5336 PR gold/12934
5337 * target-select.cc (Target_selector::Target_selector): Add
5338 emulation parameter. Change all callers.
5339 (select_target_by_bfd_name): Rename from select_target_by_name.
5340 Change all callers.
5341 (select_target_by_emulation): New function.
5342 (supported_emulation_names): New function.
5343 * target-select.h (class Target_selector): Add emulation_ field.
5344 Update declarations.
5345 (Target_selector::recognize_by_bfd_name): Rename from
5346 recognize_by_name. Change all callers.
5347 (Target_selector::supported_bfd_names): Rename from
5348 supported_names. Change all callers.
5349 (Target_selector::recognize_by_emulation): New function.
5350 (Target_selector::supported_emulations): New function.
5351 (Target_selector::emulation): New function.
5352 (Target_selector::do_recognize_by_bfd_name): Rename from
5353 do_recognize_by_name. Change all callers.
5354 (Target_selector::do_supported_bfd_names): Rename from
5355 do_supported_names. Change all callers.
5356 (Target_selector::do_recognize_by_emulation): New function.
5357 (Target_selector::do_supported_emulations): New function.
5358 (select_target_by_bfd_name): Change name in declaration.
5359 (select_target_by_emulation): Declare.
5360 (supported_emulation_names): Declare.
5361 * parameters.cc (parameters_force_valid_target): Try to find
5362 target based on emulation from -m option.
5363 * options.h (class General_options): Change doc string for -m.
5364 * options.cc (help): Print emulations.
5365 (General_options::parse_V): Likewise.
5366 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5367 Add emulation parameter. Change all callers.
5368
5369 2011-06-28 Ian Lance Taylor <iant@google.com>
5370
5371 * target.h (class Target): Add osabi_ field.
5372 (Target::osabi): New function.
5373 (Target::set_osabi): New function.
5374 (Target::Target): Initialize osabi_.
5375 (Target::do_adjust_elf_header): Make pure virtual.
5376 (Sized_target::do_adjust_elf_header): Declare.
5377 * target.cc (Sized_target::do_adjust_elf_header): New function.
5378 (class Sized_target): Instantiate all versions.
5379 * freebsd.h (class Target_freebsd): Remove.
5380 (Target_selector_freebsd::do_recognize): Call set_osabi on
5381 Target.
5382 (Target_selector_freebsd::do_recognize_by_name): Likewise.
5383 (Target_selector_freebsd::set_osabi): Remove.
5384 * i386.cc (class Target_i386): Inherit from Sized_target rather
5385 than Target_freebsd.
5386 * x86_64.cc (class Target_x86_64): Likewise.
5387
5388 2011-06-28 Ian Lance Taylor <iant@google.com>
5389
5390 * target.h (Target::can_check_for_function_pointers): Rewrite.
5391 Make non-virtual.
5392 (Target::can_icf_inline_merge_sections): Likewise.
5393 (Target::section_may_have_icf_unsafe_poineters): Likewise.
5394 (Target::Target_info): Add can_icf_inline_merge_sections field.
5395 (Target::do_can_check_for_function_pointers): New virtual
5396 function.
5397 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5398 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5399 from can_check_for_function_pointers, move in file.
5400 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5401 section_may_have_icf_unsafe_poineters, move in file.
5402 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5403 * i386.cc (Target_i386::do_can_check_for_function_pointers):
5404 Rename from can_check_for_function_pointers, move in file.
5405 (Target_i386::can_icf_inline_merge_sections): Remove.
5406 (Target_i386::i386_info): Initialize
5407 can_icf_inline_merge_sections.
5408 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5409 Initialize can_icf_inline_merge_sections.
5410 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5411 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5412 Rename from can_check_for_function_pointers, move in file.
5413 (Target_x86_64::can_icf_inline_merge_sections): Remove.
5414 (Target_x86_64::x86_64_info): Initialize
5415 can_icf_inline_merge_sections.
5416 * testsuite/testfile.cc (Target_test::test_target_info):
5417 Likewise.
5418 * icf.cc (get_section_contents): Correct formatting.
5419
5420 2011-06-27 Ian Lance Taylor <iant@google.com>
5421
5422 * symtab.cc (Symbol::versioned_name): New function.
5423 (Symbol_table::add_to_final_symtab): Use versioned_name when
5424 appropriate.
5425 (Symbol_table::sized_write_symbol): Likewise.
5426 * symtab.h (class Symbol): Declare versioned_name.
5427 * stringpool.h (class Stringpool_template): Add variant of add
5428 which takes a std::basic_string.
5429 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5430 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5431 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5432 (ver_test_12.o): New target.
5433 * testsuite/Makefile.in: Rebuild.
5434
5435 2011-06-27 Doug Kwan <dougkwan@google.com>
5436
5437 * arm.cc (Arm_relocate_functions::thm_jump8,
5438 Arm_relocate_functions::thm_jump11): Use a wider signed
5439 type to compute offset.
5440 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5441 arm_thm_jump8.
5442 * testsuite/Makefile.in: Regenerate.
5443 * testsuite/arm_branch_in_range.sh: Check test results of
5444 arm_thm_jump11 and arm_thm_jump8.
5445 * testsuite/arm_thm_jump11.s: New test source file.
5446 * testsuite/arm_thm_jump11.t: New linker script.
5447 * testsuite/arm_thm_jump8.s: New test source file.
5448 * testsuite/arm_thm_jump8.t: New linker script.
5449
5450 2011-06-24 Ian Lance Taylor <iant@google.com>
5451
5452 * layout.cc: Include "object.h".
5453 (ctors_sections_in_init_array): New static variable.
5454 (Layout::is_ctors_in_init_array): New function.
5455 (Layout::layout): Add entry to ctors_sections_in_init_array if
5456 appropriate.
5457 * layout.h (class Layout): Declare is_ctors_in_init_array.
5458 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5459 is_ctors_reverse_view is set.
5460 (Sized_relobj_file::write_sections): Add layout parameter. Change
5461 all callers. Set is_ctors_reverse_view field of View_size.
5462 (Sized_relobj_file::reverse_words): New function.
5463 * object.h (Sized_relobj_file::View_size): Add
5464 is_ctors_reverse_view field.
5465 (class Sized_relobj_file): Update declarations.
5466 * testsuite/initpri3.c: New test.
5467 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5468 initpri3b.
5469 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5470 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5471 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5472 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5473 * testsuite/Makefile.in: Rebuild.
5474
5475 2011-06-24 Cary Coutant <ccoutant@google.com>
5476
5477 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5478 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5479 (debug_msg_cdebug.err): New targets.
5480 * testsuite/Makefile.in: Regenerate.
5481 * testsuite/debug_msg.sh: Check output of link with compressed debug.
5482 Fix checks for link with shared library.
5483
5484 2011-06-24 Doug Kwan <dougkwan@google.com>
5485
5486 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5487 skip empty text sections.
5488 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5489
5490 2011-06-22 Ian Lance Taylor <iant@google.com>
5491
5492 PR gold/12910
5493 * options.h (class General_options): Add --ctors-in-init-array.
5494 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5495 friends as SHT_PROGBITS for merging sections.
5496 (Layout::layout): Remove special handling of .init_array and
5497 friends. Don't sort if doing relocatable link. Sort for .ctors
5498 and .dtors if ctors_in_init_array.
5499 (Layout::make_output_section): Force correct section types for
5500 .init_array and friends. Don't sort if doing relocatable link,
5501 Don't sort .ctors and .dtors if ctors_in_init_array.
5502 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5503 (Layout::output_section_name): Add relobj parameter. Change all
5504 callers. Handle .ctors. and .dtors. in code rather than table.
5505 Handle .ctors and .dtors if ctors_in_init_array.
5506 (Layout::match_file_name): New function, moved from output.cc.
5507 * layout.h (class Layout): Update declarations.
5508 * output.cc: Include "layout.h".
5509 (Input_section_sort_entry::get_priority): New function.
5510 (Input_section_sort_entry::match_file_name): Just call
5511 Layout::match_file_name.
5512 (Output_section::Input_section_sort_init_fini_compare::operator()):
5513 Handle .ctors and .dtors. Sort by explicit priority rather than
5514 by name.
5515 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5516 * testsuite/initpri2.c: New test.
5517 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5518 (check_PROGRAMS): Add initpri2.
5519 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5520 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5521 * configure, testsuite/Makefile.in: Rebuild.
5522
5523 2011-06-19 Ian Lance Taylor <iant@google.com>
5524
5525 PR gold/12880
5526 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5527 .interp section to a PT_INTERP segment even if we have seen a
5528 --dynamic-linker option. Don't do it if we have seen a PHDRS
5529 clause in a linker script.
5530 (Layout::finalize): Don't create a .interp section if we've
5531 already create a PT_INTERP segment.
5532 (Layout::create_interp): Always call choose_output_section (revert
5533 patch of 2011-06-17). Don't create PT_INTERP segment.
5534 * script-sections.cc
5535 (Script_sections::create_note_and_tls_segments): Add a .interp
5536 section to a PT_INTERP segment even if we have seen a
5537 --dynamic-linker option.
5538
5539 2011-06-18 Ian Lance Taylor <iant@google.com>
5540
5541 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5542 merely because a non-PT_LOAD segment has a dynamic reloc.
5543
5544 2011-06-18 Ian Lance Taylor <iant@google.com>
5545
5546 * layout.cc (Layout::finish_dynamic_section): Don't create
5547 DT_FLAGS entry if not needed.
5548
5549 2011-06-18 Ian Lance Taylor <iant@google.com>
5550
5551 PR gold/12745
5552 * layout.cc (Layout::layout_eh_frame): Correct handling of
5553 writable .eh_frame section.
5554
5555 2011-06-17 Ian Lance Taylor <iant@google.com>
5556
5557 PR gold/12893
5558 * resolve.cc (Symbol_table::resolve): Don't give an error if a
5559 symbol is redefined with the exact same object and value.
5560
5561 2011-06-17 Ian Lance Taylor <iant@google.com>
5562
5563 PR gold/12880
5564 * layout.h (class Layout): Add interp_segment_ field.
5565 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5566 (Layout::attach_allocated_section_to_segment): If making shared
5567 library, put .interp section in PT_INTERP segment.
5568 (Layout::finalize): Also call create_interp if -dynamic-linker
5569 option was used.
5570 (Layout::create_interp): Assert that there is no PT_INTERP
5571 segment. If not using a SECTIONS clause, use make_output_section.
5572 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5573 * script-sections.cc
5574 (Script_sections::create_note_and_tls_segments): If making shared
5575 library, put .interp section in PT_INTERP segment.
5576
5577 2011-06-17 Ian Lance Taylor <iant@google.com>
5578
5579 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5580 when making a shared library.
5581
5582 2011-06-17 Ian Lance Taylor <iant@google.com>
5583
5584 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5585 parameter. Change all callers. Don't issue warning about PC32
5586 against locally defined symbol.
5587
5588 2011-06-16 Ian Lance Taylor <iant@google.com>
5589
5590 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5591 occurs in same object.
5592
5593 2011-06-14 Alan Modra <amodra@gmail.com>
5594
5595 * po/POTFILES.in: Regenerate.
5596
5597 2011-06-09 Ian Lance Taylor <iant@google.com>
5598
5599 * script-sections.cc
5600 (Orphan_output_section::set_section_addresses): For a relocatable
5601 link set address to 0.
5602
5603 2011-06-09 Cary Coutant <ccoutant@google.com>
5604
5605 PR gold/12804
5606 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5607 used with --compress-debug-sections.
5608 * gold/object.cc (Sized_relobj_file::do_layout): Report
5609 uncompressed size of compressed input sections.
5610
5611 2011-06-08 Cary Coutant <ccoutant@google.com>
5612
5613 PR gold/12804
5614 * testsuite/two_file_test_2_v1.cc: Change initialization of
5615 v2 to keep it in .data.
5616
5617 2011-06-07 Cary Coutant <ccoutant@google.com>
5618
5619 * common.cc (Symbol_table::do_allocate_commons_list): Call
5620 gold_fallback.
5621 * errors.cc (Errors::fatal): Adjust call to gold_exit.
5622 (Errors::fallback): New function.
5623 (gold_fallback): New function.
5624 * errors.h (Errors::fallback): New function.
5625 * gold.cc (gold_exit): Change status parameter to enum; adjust
5626 all callers.
5627 (queue_initial_tasks): Call gold_fallback.
5628 * gold.h: Include cstdlib.
5629 (Exit_status): New enum type.
5630 (gold_exit): Change status parameter to enum.
5631 (gold_fallback): New function.
5632 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5633 (Layout::create_symtab_sections): Likewise.
5634 (Layout::create_shdrs): Likewise.
5635 * main.cc (main): Adjust call to gold_exit.
5636 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5637 (Output_data_got::add_got_entry_pair): Likewise.
5638 (Output_section::add_input_section): Likewise.
5639 (Output_section::add_output_section_data): Likewise.
5640 (Output_segment::set_section_list_addresses): Likewise.
5641 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5642
5643 2011-06-07 Cary Coutant <ccoutant@google.com>
5644
5645 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5646 for incremental links.
5647 * output.cc (Output_segment::set_section_list_addresses): Remove
5648 FIXME and test for TLS or BSS.
5649
5650 2011-06-07 Cary Coutant <ccoutant@google.com>
5651
5652 * testsuite/Makefile.am: Add incremental_copy_test,
5653 incremental_common_test_1.
5654 * testsuite/Makefile.in: Regenerate.
5655 * testsuite/common_test_1_v1.c: New source file.
5656 * testsuite/common_test_1_v2.c: New source file.
5657 * testsuite/copy_test_v1.cc: New source file.
5658
5659 2011-06-07 Cary Coutant <ccoutant@google.com>
5660
5661 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5662 update, allocate common from bss section's free list.
5663 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5664 linker-defined symbols.
5665 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5666 Skip GOT and PLT entries that are no longer referenced.
5667 (Output_section_incremental_inputs::write_info_blocks): Mark
5668 linker-defined symbols.
5669 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5670 * output.cc (Output_section::allocate): New function.
5671 * output.h (Output_section::allocate): New function.
5672 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5673 linker-defined symbols.
5674 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5675 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5676 (Symbol::init_base_output_data): Likewise.
5677 (Symbol::init_base_output_segment): Likewise.
5678 (Symbol::init_base_constant): Likewise.
5679 (Sized_symbol::init_output_data): Likewise.
5680 (Sized_symbol::init_output_segment): Likewise.
5681 (Sized_symbol::init_constant): Likewise.
5682 (Symbol_table::do_define_in_output_data): Likewise.
5683 (Symbol_table::do_define_in_output_segment): Likewise.
5684 (Symbol_table::do_define_as_constant): Likewise.
5685 * symtab.h (Symbol::is_predefined): New function.
5686 (Symbol::init_base_output_data): Add is_predefined parameter.
5687 (Symbol::init_base_output_segment): Likewise.
5688 (Symbol::init_base_constant): Likewise.
5689 (Symbol::is_predefined_): New data member.
5690 (Sized_symbol::init_output_data): Add is_predefined parameter.
5691 (Sized_symbol::init_output_segment): Likewise.
5692 (Sized_symbol::init_constant): Likewise.
5693 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5694
5695 2011-06-07 Cary Coutant <ccoutant@google.com>
5696
5697 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5698 instead of emit_copy_reloc.
5699 (Copy_relocs::emit_copy_reloc): Refactor.
5700 (Copy_relocs::make_copy_reloc): New function.
5701 (Copy_relocs::add_copy_reloc): Remove.
5702 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5703 section.
5704 (Copy_relocs::make_copy_reloc): New function.
5705 (Copy_relocs::add_copy_reloc): Remove.
5706 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5707 unchanged input files.
5708 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5709 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5710 Reserve BSS space for COPY relocations.
5711 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5712 (Output_section_incremental_inputs::write_info_blocks): Record
5713 whether a symbol is copied from a shared object.
5714 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5715 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5716 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5717 (Incremental_input_entry_reader::get_output_symbol_index): Add
5718 is_copy parameter.
5719 (Incremental_binary::emit_copy_relocs): New function.
5720 (Incremental_binary::do_emit_copy_relocs): New function.
5721 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5722 new data member.
5723 (Sized_incremental_binary::add_copy_reloc): New function.
5724 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5725 (Sized_incremental_binary::Copy_reloc): New struct.
5726 (Sized_incremental_binary::Copy_relocs): New typedef.
5727 (Sized_incremental_binary::copy_relocs_): New data member.
5728 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5729 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5730 * target.h (Sized_target::emit_copy_reloc): New function.
5731 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5732
5733 2011-06-02 Cary Coutant <ccoutant@google.com>
5734
5735 PR gold/12163
5736 * gold/archive.cc (Archive::Archive): Initialize new data member.
5737 (Archive::include_all_members): Return if archive has already been
5738 included.
5739 * gold/archive.h (Archive::include_all_members_): New data member.
5740
5741 2011-06-02 Nick Clifton <nickc@redhat.com>
5742
5743 * dynobj.h: Fix spelling mistake in comment.
5744 * output.cc: Likewise.
5745
5746 2011-05-31 Doug Kwan <dougkwan@google.com>
5747 Asier Llano
5748
5749 PR gold/12826
5750 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5751 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5752 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5753 redundant arm_exidx_test.so.
5754 * testsuite/Makefile.in: Regenerate.
5755 (check_SCRIPTS): Add pr12826.sh
5756 (check_DATA): Add pr12826.stdout
5757 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5758 * testsuite/pr12826.sh: New file.
5759 * testsuite/pr12826_1.s: Ditto.
5760 * testsuite/pr12826_1.s: Ditto.
5761
5762 2011-05-30 Ian Lance Taylor <iant@google.com>
5763
5764 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5765 sections.
5766
5767 2011-05-29 Ian Lance Taylor <iant@google.com>
5768
5769 PR gold/12804
5770 * testsuite/Makefile.am: Use different file name for two_file_test
5771 temporary file for each incremental test.
5772 * testsuite/Makefile.in: Rebuild.
5773
5774 2011-05-29 Ian Lance Taylor <iant@google.com>
5775
5776 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5777 binary input file is empty.
5778
5779 2011-05-27 Ian Lance Taylor <iant@google.com>
5780
5781 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5782 (ver_test_9.so): Likewise.
5783 * testsuite/Makefile.in: Rebuild.
5784
5785 2011-05-26 Cary Coutant <ccoutant@google.com>
5786
5787 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5788 * incremental.cc (Incremental_inputs::report_input_section): Fix
5789 comment, indentation.
5790 (Incremental_inputs::report_comdat_group): New function.
5791 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5792 of data for incremental input file entry.
5793 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5794 group count, COMDAT group signatures.
5795 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5796 an unchanged input file.
5797 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5798 Initialize new data member.
5799 (Incremental_object_entry::add_comdat_group): New function.
5800 (Incremental_object_entry::get_comdat_group_count): New function.
5801 (Incremental_object_entry::get_comdat_signature_key): New function.
5802 (Incremental_object_entry::groups_): New data member.
5803 (Incremental_inputs::report_comdat_group): New function.
5804 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5805 data for incremental input file entry.
5806 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5807 (Incremental_input_entry_reader::get_input_section): Adjust size of
5808 data for incremental input file entry.
5809 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5810 (Incremental_input_entry_reader::get_comdat_group_signature): New
5811 function.
5812 * object.cc (Sized_relobj::include_section_group): Report kept
5813 COMDAT groups for incremental links.
5814
5815 2011-05-24 David Meyer <pdox@google.com>
5816
5817 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5818 with name parameter. Add found_name parameter.
5819 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5820 * dirsearch.h (class Dirsearch): Update declaration.
5821
5822 2011-05-24 Ian Lance Taylor <iant@google.com>
5823
5824 * archive.cc (Library_base::should_include_member): Pull in object
5825 from archive if it defines the entry symbol.
5826 * parameters.cc (Parameters::entry): New function.
5827 * parameters.h (class Parameters): Declare entry.
5828 * output.h (class Output_file_header): Remove entry_ field.
5829 * output.cc (Output_file_header::Output_file_header): Remove entry
5830 parameter. Change all callers.
5831 (Output_file_header::entry): Use parameters->entry.
5832 * gold.cc (queue_middle_tasks): Likewise.
5833 * plugin.cc (Plugin_hook::run): Likewise.
5834
5835 2011-05-24 Cary Coutant <ccoutant@google.com>
5836
5837 * gold.cc (queue_initial_tasks): Pass incremental base filename
5838 to Output_file::open_base_file; don't print error message.
5839 * incremental-dump.cc (main): Adjust call to
5840 Output_file::open_for_modification.
5841 * incremental-dump.cc (main): Likewise.
5842 * incremental.cc (Incremental_inputs::report_command_line):
5843 Ignore --incremental-base option when comparing command lines.
5844 Ignore parameter when given as separate argument.
5845 * options.h (class General_options): Add --incremental-base.
5846 * output.cc (Output_file::Output_file):
5847 (Output_file::open_base_file): Add base_name and writable parameters;
5848 read base file into new file; print error message here.
5849 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5850 callers.
5851 * output.h (Output_file::open_for_modification): Rename to...
5852 (Output_file::open_base_file): ...this; add base_name and
5853 writable parameters; adjust all callers.
5854 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5855 callers.
5856 * testsuite/Makefile.am (incremental_test_4): Test
5857 --incremental-base.
5858 * testsuite/Makefile.in: Regenerate.
5859
5860 2011-05-24 Cary Coutant <ccoutant@google.com>
5861
5862 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5863 incremental_test_4.
5864 * testsuite/Makefile.in: Regenerate.
5865 * testsuite/two_file_test_1_v1.cc: New test source file.
5866 * testsuite/two_file_test_1b_v1.cc: New test source file.
5867 * testsuite/two_file_test_2_v1.cc: New test source file.
5868
5869 2011-05-24 Cary Coutant <ccoutant@google.com>
5870
5871 * dynobj.h (Dynobj::do_dynobj): New function.
5872 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5873 flag and soname for shared objects.
5874 * incremental.cc (Incremental_inputs::report_object): Make
5875 either Incremental_object_entry or Incremental_dynobj_entry; add
5876 soname to string table.
5877 (Incremental_inputs::report_input_section): Add assertion.
5878 (Output_section_incremental_inputs::set_final_data_size): Adjust
5879 type of input file entry for shared libraries; adjust size of
5880 shared library info entry.
5881 (Output_section_incremental_inputs::write_input_files): Write
5882 as_needed flag for shared libraries.
5883 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5884 of input file entry for shared libraries; write soname.
5885 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5886 soname from incremental info.
5887 * incremental.h (enum Incremental_input_flags): Add
5888 INCREMENTAL_INPUT_AS_NEEDED.
5889 (Incremental_input_entry::Incremental_input_entry): Initialize new
5890 data member.
5891 (Incremental_input_entry::set_as_needed): New function.
5892 (Incremental_input_entry::as_needed): New function.
5893 (Incremental_input_entry::do_dynobj_entry): New function.
5894 (Incremental_input_entry::as_needed_): New data member.
5895 (Incremental_object_entry::Incremental_object_entry): Don't check
5896 for shared library.
5897 (Incremental_object_entry::do_type): Likewise.
5898 (class Incremental_dynobj_entry): New class.
5899 (Incremental_input_entry_reader::as_needed): New function.
5900 (Incremental_input_entry_reader::get_soname): New function.
5901 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5902 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5903 size of shared library info entry.
5904 * layout.cc (Layout::finish_dynamic_section): Don't test for
5905 incremental link when adding DT_NEEDED entries.
5906 * object.h (Object::Object): Initialize new data member.
5907 (Object::dynobj): New function.
5908 (Object::set_as_needed): New function.
5909 (Object::as_needed): New function.
5910 (Object::do_dynobj): New function.
5911 (Object::as_needed_): New data member.
5912
5913 2011-05-24 Cary Coutant <ccoutant@google.com>
5914
5915 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5916 info; adjust display of GOT entries.
5917 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5918 vector of input objects; remove file_status_.
5919 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5920 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5921 got_plt reader; call target hooks to reserve GOT entries.
5922 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5923 of input file info header and GOT info entry.
5924 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5925 relocation info.
5926 (Got_plt_view_info::got_descriptor): Remove.
5927 (Got_plt_view_info::sym_index): New data member.
5928 (Got_plt_view_info::input_index): New data member.
5929 (Local_got_offset_visitor::visit): Write input file index.
5930 (Global_got_offset_visitor::visit): Write 0 for input file index.
5931 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5932 with sym_index and input_index.
5933 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5934 incremental info GOT entry; replace got_descriptor with input_index.
5935 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5936 map from input file index to object.
5937 (Sized_relobj_incr::do_layout): Replace direct data member reference
5938 with accessor function.
5939 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5940 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5941 Adjust size of input file info header.
5942 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5943 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5944 (Incremental_input_entry_reader::get_input_section): Adjust size of
5945 input file info header.
5946 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5947 of incremental info GOT entry.
5948 (Incremental_got_plt_reader::get_got_desc): Remove.
5949 (Incremental_got_plt_reader::get_got_symndx): New function.
5950 (Incremental_got_plt_reader::get_got_input_index): New function.
5951 (Sized_incremental_binary::Sized_incremental_binary): Remove
5952 file_status_; add input_objects_.
5953 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5954 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5955 (Sized_incremental_binary::file_is_unchanged): Remove.
5956 (Sized_incremental_binary::set_input_object): New function.
5957 (Sized_incremental_binary::input_object): New function.
5958 (Sized_incremental_binary::file_status_): Remove.
5959 (Sized_incremental_binary::input_objects_): New data member.
5960 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5961 references.
5962 (Sized_relobj_incr::invalid_address): Move to base class.
5963 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5964 class.
5965 (Sized_relobj_incr::do_output_section_offset): Likewise.
5966 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5967 (Sized_relobj_incr::section_offsets_): Likewise.
5968 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5969 function.
5970 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5971 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5972 with accessor function.
5973 (Sized_relobj_file::do_layout): Likewise.
5974 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5975 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5976 (Sized_relobj_file::compute_final_local_value): Replace refs to
5977 section_offsets_ with accessor function.
5978 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5979 * object.h (Relobj::Relobj): Initialize new data members.
5980 (Relobj::add_dyn_reloc): New function.
5981 (Relobj::first_dyn_reloc): New function.
5982 (Relobj::dyn_reloc_count): New function.
5983 (Relobj::first_dyn_reloc_): New data member.
5984 (Relobj::dyn_reloc_count_): New data member.
5985 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5986 references.
5987 (Sized_relobj::Address): New typedef.
5988 (Sized_relobj::invalid_address): Move here from child class.
5989 (Sized_relobj::Sized_relobj): Initialize new data members.
5990 (Sized_relobj::sized_relobj): New function.
5991 (Sized_relobj::is_output_section_offset_invalid): Move here from
5992 child class.
5993 (Sized_relobj::get_output_section_offset): Likewise.
5994 (Sized_relobj::local_has_got_offset): Likewise.
5995 (Sized_relobj::local_got_offset): Likewise.
5996 (Sized_relobj::set_local_got_offset): Likewise.
5997 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5998 (Sized_relobj::clear_got_offsets): New function.
5999 (Sized_relobj::section_offsets): Move here from child class.
6000 (Sized_relobj::do_output_section_offset): Likewise.
6001 (Sized_relobj::do_set_section_offset): Likewise.
6002 (Sized_relobj::Local_got_offsets): Likewise.
6003 (Sized_relobj::local_got_offsets_): Likewise.
6004 (Sized_relobj::section_offsets_): Likewise.
6005 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6006 references.
6007 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6008 class.
6009 (Sized_relobj_file::sized_relobj): New function
6010 (Sized_relobj_file::local_has_got_offset): Move to base class.
6011 (Sized_relobj_file::local_got_offset): Likewise.
6012 (Sized_relobj_file::set_local_got_offset): Likewise.
6013 (Sized_relobj_file::get_output_section_offset): Likewise.
6014 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6015 (Sized_relobj_file::do_output_section_offset): Likewise.
6016 (Sized_relobj_file::do_set_section_offset): Likewise.
6017 (Sized_relobj_file::Local_got_offsets): Likewise.
6018 (Sized_relobj_file::local_got_offsets_): Likewise.
6019 (Sized_relobj_file::section_offsets_): Likewise.
6020 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6021 (all constructors).
6022 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6023 (Output_reloc::get_symbol_index): Likewise.
6024 (Output_reloc::local_section_offset): Likewise.
6025 (Output_reloc::get_address): Likewise.
6026 (Output_reloc::symbol_value): Likewise.
6027 (Output_data_got::reserve_slot): Move to class definition.
6028 (Output_data_got::reserve_local): New function.
6029 (Output_data_got::reserve_slot_for_global): Remove.
6030 (Output_data_got::reserve_global): New function.
6031 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6032 (all constructors, two instantiations).
6033 (Output_reloc::get_relobj): New function (two instantiations).
6034 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6035 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6036 (Output_data_reloc::add_global): Adjust type of relobj.
6037 (Output_data_reloc::add_global_relative): Likewise.
6038 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6039 (Output_data_reloc::add_local): Likewise.
6040 (Output_data_reloc::add_local_relative): Likewise.
6041 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6042 (Output_data_reloc::add_local_section): Likewise.
6043 (Output_data_reloc::add_output_section): Likewise.
6044 (Output_data_reloc::add_absolute): Likewise.
6045 (Output_data_reloc::add_target_specific): Likewise.
6046 (Output_data_got::reserve_slot): Move definition here.
6047 (Output_data_got::reserve_local): New function.
6048 (Output_data_got::reserve_global): New function.
6049 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6050 section_offsets_ with accessor function.
6051 (Sized_relobj_file::write_sections): Likewise.
6052 (Sized_relobj_file::do_relocate_sections): Likewise.
6053 * target.h (Sized_target::reserve_local_got_entry): New function.
6054 (Sized_target::reserve_global_got_entry): New function.
6055 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6056 (Target_x86_64::reserve_global_got_entry): New function.
6057 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6058
6059 2011-05-23 Cary Coutant <ccoutant@google.com>
6060
6061 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6062 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6063 bit when checking got_type.
6064 * incremental.cc (Sized_incremental_binary::setup_readers):
6065 Store symbol table and string table locations; initialize bit vector
6066 of file status flags.
6067 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6068 unchanged files.
6069 (Sized_incremental_binary::do_process_got_plt): New function.
6070 (Sized_incremental_binary::get_symtab_view): Use stored locations.
6071 (Output_section_incremental_inputs::set_final_data_size): Record
6072 file index for each input file.
6073 (Output_section_incremental_inputs::write_got_plt): Store file index
6074 instead of input entry offset for each GOT entry.
6075 * incremental.h
6076 (Incremental_input_entry::Incremental_input_entry): Initialize new
6077 data member.
6078 (Incremental_input_entry::set_offset): Store file index.
6079 (Incremental_input_entry::get_file_index): New function.
6080 (Incremental_input_entry::file_index_): New data member.
6081 (Incremental_binary::process_got_plt): New function.
6082 (Incremental_binary::do_process_got_plt): New function.
6083 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6084 data members.
6085 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6086 (Sized_incremental_binary::set_file_is_unchanged): New function.
6087 (Sized_incremental_binary::file_is_unchanged): New function.
6088 (Sized_incremental_binary::do_process_got_plt): New function.
6089 (Sized_incremental_binary::file_status_): New data member.
6090 (Sized_incremental_binary::main_symtab_loc_): New data member.
6091 (Sized_incremental_binary::main_strtab_loc_): New data member.
6092 * output.cc (Output_data_got::Got_entry::write): Add case
6093 RESERVED_CODE.
6094 (Output_data_got::add_global): Call add_got_entry.
6095 (Output_data_got::add_global_plt): Likewise.
6096 (Output_data_got::add_global_with_rel): Likewise.
6097 (Output_data_got::add_global_with_rela): Likewise.
6098 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6099 (Output_data_got::add_global_pair_with_rela): Likewise.
6100 (Output_data_got::add_local): Call add_got_entry.
6101 (Output_data_got::add_local_plt): Likewise.
6102 (Output_data_got::add_local_with_rel): Likewise.
6103 (Output_data_got::add_local_with_rela): Likewise.
6104 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6105 (Output_data_got::add_local_pair_with_rela): Likewise.
6106 (Output_data_got::reserve_slot): New function.
6107 (Output_data_got::reserve_slot_for_global): New function.
6108 (Output_data_got::add_got_entry): New function.
6109 (Output_data_got::add_got_entry_pair): New function.
6110 (Output_section::add_output_section_data): Edit FIXME.
6111 * output.h
6112 (Output_section_data_build::Output_section_data_build): New
6113 constructor with size parameter.
6114 (Output_data_space::Output_data_space): Likewise.
6115 (Output_data_got::Output_data_got): Initialize new data member; new
6116 constructor with size parameter.
6117 (Output_data_got::add_constant): Call add_got_entry.
6118 (Output_data_got::reserve_slot): New function.
6119 (Output_data_got::reserve_slot_for_global): New function.
6120 (class Output_data_got::Got_entry): Add RESERVED_CODE.
6121 (Output_data_got::add_got_entry): New function.
6122 (Output_data_got::add_got_entry_pair): New function.
6123 (Output_data_got::free_list_): New data member.
6124 * target.h (Sized_target::init_got_plt_for_update): New function.
6125 (Sized_target::register_global_plt_entry): New function.
6126 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6127 Initialize new data member; call init; add constructor with PLT count.
6128 (Output_data_plt_x86_64::init): New function.
6129 (Output_data_plt_x86_64::add_relocation): New function.
6130 (Output_data_plt_x86_64::reserve_slot): New function.
6131 (Output_data_plt_x86_64::free_list_): New data member.
6132 (Target_x86_64::init_got_plt_for_update): New function.
6133 (Target_x86_64::register_global_plt_entry): New function.
6134 (Output_data_plt_x86_64::add_entry): Allocate from free list for
6135 incremental updates.
6136 (Output_data_plt_x86_64::add_relocation): New function.
6137 * testsuite/object_unittest.cc (Object_test): Set default options.
6138
6139 2011-05-16 Ian Lance Taylor <iant@google.com>
6140
6141 * options.h (class General_options): Make -i a synonym for -r.
6142
6143 2011-05-16 Ian Lance Taylor <iant@google.com>
6144
6145 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6146
6147 2011-05-10 Cary Coutant <ccoutant@google.com>
6148
6149 * object.cc (Sized_relobj::do_count_local_symbols): Check for
6150 strip_all (-s).
6151
6152 2011-05-06 Ian Lance Taylor <iant@google.com>
6153
6154 * layout.cc (Layout::layout): If the output section flags change,
6155 update the ordering.
6156
6157 2011-04-25 Cary Coutant <ccoutant@google.com>
6158
6159 * incremental-dump.cc (dump_incremental_inputs): Print local
6160 symbol info for each input file.
6161 * incremental.cc
6162 (Output_section_incremental_inputs::set_final_data_size): Add local
6163 symbol info to input file entries in incremental info.
6164 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6165 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6166 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6167 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6168 implementation.
6169 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6170 (Sized_incr_relobj::do_relocate): Write the local symbols.
6171 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6172 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6173 Adjust size of input file header.
6174 (Incremental_inputs_reader::get_local_symbol_offset): New function.
6175 (Incremental_inputs_reader::get_local_symbol_count): New function.
6176 (Incremental_inputs_reader::get_input_section): Adjust size of input
6177 file header.
6178 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6179 (Sized_incr_relobj::This): New typedef.
6180 (Sized_incr_relobj::sym_size): New const data member.
6181 (Sized_incr_relobj::Local_symbol): New struct.
6182 (Sized_incr_relobj::do_output_local_symbol_count): New function.
6183 (Sized_incr_relobj::do_local_symbol_offset): New function.
6184 (Sized_incr_relobj::local_symbol_count_): New data member.
6185 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6186 (Sized_incr_relobj::local_symbol_index_): New data member.
6187 (Sized_incr_relobj::local_symbol_offset_): New data member.
6188 (Sized_incr_relobj::local_dynsym_offset_): New data member.
6189 (Sized_incr_relobj::local_symbols_): New data member.
6190 * object.h (Relobj::output_local_symbol_count): New function.
6191 (Relobj::local_symbol_offset): New function.
6192 (Relobj::do_output_local_symbol_count): New function.
6193 (Relobj::do_local_symbol_offset): New function.
6194 (Sized_relobj::do_output_local_symbol_count): New function.
6195 (Sized_relobj::do_local_symbol_offset): New function.
6196
6197 2011-04-22 Vladimir Simonov <sv@sw.ru>
6198
6199 * descriptors.cc (set_close_on_exec): New function.
6200 (Descriptors::open): Use set_close_on_exec.
6201 * output.cc (S_ISLNK): Define if not defined.
6202
6203 2011-04-22 Cary Coutant <ccoutant@google.com>
6204
6205 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6206 global symbol map.
6207 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6208 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6209 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6210 relocations.
6211 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6212 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6213 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6214 * incremental.h
6215 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6216 function.
6217 (Incremental_binary::apply_incremental_relocs): New function.
6218 (Incremental_binary::do_apply_incremental_relocs): New function.
6219 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6220 data member.
6221 (Sized_incremental_binary::add_global_symbol): New function.
6222 (Sized_incremental_binary::global_symbol): New function.
6223 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6224 (Sized_incremental_binary::symbol_map_): New data member.
6225 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6226 * target.h (Sized_target::apply_relocation): New function.
6227 * target-reloc.h (apply_relocation): New function.
6228 * x86_64.cc (Target_x86_64::apply_relocation): New function.
6229
6230 2011-04-22 Doug Kwan <dougkwan@google.com>
6231
6232 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6233 flag of a SHT_ARM_EXIDX section.
6234 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6235 * testsuite/Makefile.in: Regenerate.
6236 * testsuite/arm_exidx_test.s: New file.
6237 * testsuite/arm_exidx_test.sh: Same.
6238
6239 2011-04-20 Cary Coutant <ccoutant@google.com>
6240
6241 PR gold/12689
6242 * archive.h (Incremental_archive_entry::Archive_member):
6243 Initialize arg_serial_ (second constructor).
6244
6245 2011-04-17 Ian Lance Taylor <iant@google.com>
6246
6247 * object.cc (Relocate_info::location): Simplify location string.
6248 * errors.cc (Errors::error_at_location): Don't print program
6249 name.
6250 (Errors::warning_at_location): Likewise.
6251 (Errors::undefined_symbol): Likewise.
6252 * testsuite/debug_msg.sh: Update accordingly.
6253
6254 2011-04-14 Cary Coutant <ccoutant@google.com>
6255
6256 * gold/layout.cc (Layout::symtab_section_offset): New function.
6257 * gold/layout.h (Layout::symtab_section_offset): New function.
6258 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6259
6260 2011-04-12 Ian Lance Taylor <iant@google.com>
6261
6262 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
6263 with MREMAP_MAYMOVE.
6264 * output.h (class Output_file): Add map_is_allocated_ field.
6265 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
6266 not available, provide stubs. If mremap is not available, #define
6267 it to gold_mremap.
6268 (MREMAP_MAYMOVE): Define if not defined.
6269 (Output_file::Output_file): Initialize map_is_allocated_.
6270 (Output_file::resize): Check map_is_allocated_.
6271 (Output_file::map_anonymous): If mmap fails, use malloc.
6272 (Output_file::unmap): Don't do anything for an anonymous map.
6273 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
6274 is not available, provide stubs.
6275 (File_read::View::~View): Use free rather than delete[].
6276 (File_read::make_view): Use malloc rather than new[]. If mmap
6277 fails, use malloc.
6278 (File_read::find_or_make_view): Use malloc rather than new[].
6279 * gold.h: Remove HAVE_REMAP code.
6280 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
6281 exists. Rename mremap to gold_mremap. If mmap is not available
6282 don't do anything.
6283 * configure, config.in: Rebuild.
6284
6285 2011-04-11 Ian Lance Taylor <iant@google.com>
6286
6287 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6288 initialize local variable v.
6289
6290 2011-04-11 Cary Coutant <ccoutant@google.com>
6291
6292 * archive.cc (Archive::include_member): Adjust call to
6293 report_object.
6294 (Add_archive_symbols::run): Track argument serial numbers.
6295 (Lib_group::include_member): Likewise.
6296 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6297 * archive.h (Incremental_archive_entry::Archive_member):
6298 Initialize arg_serial_.
6299 (Archive_member::arg_serial_): New data member.
6300 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6301 (Sized_dynobj::do_add_symbols): Track symbols when doing an
6302 incremental link.
6303 (Sized_dynobj::do_for_all_local_got_entries): New function.
6304 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6305 function.
6306 * fileread.cc (get_mtime): New function.
6307 * fileread.h (get_mtime): New function.
6308 * gold.cc (queue_initial_tasks): Check for incremental update.
6309 (process_incremental_input): New function.
6310 (queue_middle_tasks): Don't force valid target for incremental
6311 update.
6312 * incremental-dump.cc (find_input_containing_global): Adjust
6313 size of symbol info entry.
6314 (dump_incremental_inputs): Dump argument serial number and
6315 in_system_directory flag; bias shndx by 1; print symbol names
6316 when dumping per-file symbol lists; use new symbol info readers.
6317 * incremental.cc
6318 (Output_section_incremental_inputs:update_data_size): New function.
6319 (Sized_incremental_binary::setup_readers): Setup input readers
6320 for each input file; build maps for files added from libraries
6321 and scripts.
6322 (Sized_incremental_binary::check_input_args): New function.
6323 (Sized_incremental_binary::do_check_inputs): Build map of argument
6324 serial numbers to input arguments.
6325 (Sized_incremental_binary::do_file_has_changed): Rename
6326 do_file_is_unchanged to this; compare file modification times.
6327 (Sized_incremental_binary::do_init_layout): New function.
6328 (Sized_incremental_binary::do_reserve_layout): New function.
6329 (Sized_incremental_binary::do_get_input_reader): Remove.
6330 (Sized_incremental_binary::get_symtab_view): New function.
6331 (Incremental_checker::can_incrementally_link_output_file): Remove.
6332 (Incremental_inputs::report_command_line): Exclude --debug options.
6333 (Incremental_inputs::report_archive_begin): Add parameter; track
6334 argument serial numbers; don't put input file entry for archive
6335 before archive members.
6336 (Incremental_inputs::report_archive_end): Put input file entry
6337 for archive after archive members.
6338 (Incremental_inputs::report_object): Add parameter; track argument
6339 serial numbers and in_system_directory flag.
6340 (Incremental_inputs::report_script): Add parameter; track argument
6341 serial numbers.
6342 (Output_section_incremental_inputs::set_final_data_size): Adjust
6343 size of symbol info entry; check for forwarding symbols.
6344 (Output_section_incremental_inputs::write_input_files): Write
6345 in_system_directory flag and argument serial number.
6346 (Output_section_incremental_inputs::write_info_blocks): Map section
6347 indices between incremental info and original input file; store
6348 input section index for each symbol.
6349 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6350 change operator() to visit().
6351 (class Global_got_offset_visitor): Likewise.
6352 (class Global_symbol_visitor_got_plt):
6353 (Output_section_incremental_inputs::write_got_plt): Use new visitor
6354 classes.
6355 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6356 (Sized_incr_relobj::do_read_symbols): New function.
6357 (Sized_incr_relobj::do_layout): New function.
6358 (Sized_incr_relobj::do_layout_deferred_sections): New function.
6359 (Sized_incr_relobj::do_add_symbols): New function.
6360 (Sized_incr_relobj::do_should_include_member): New function.
6361 (Sized_incr_relobj::do_for_all_global_symbols): New function.
6362 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6363 (Sized_incr_relobj::do_section_size): New function.
6364 (Sized_incr_relobj::do_section_name): New function.
6365 (Sized_incr_relobj::do_section_contents): New function.
6366 (Sized_incr_relobj::do_section_flags): New function.
6367 (Sized_incr_relobj::do_section_entsize): New function.
6368 (Sized_incr_relobj::do_section_address): New function.
6369 (Sized_incr_relobj::do_section_type): New function.
6370 (Sized_incr_relobj::do_section_link): New function.
6371 (Sized_incr_relobj::do_section_info): New function.
6372 (Sized_incr_relobj::do_section_addralign): New function.
6373 (Sized_incr_relobj::do_initialize_xindex): New function.
6374 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6375 (Sized_incr_relobj::do_read_relocs): New function.
6376 (Sized_incr_relobj::do_gc_process_relocs): New function.
6377 (Sized_incr_relobj::do_scan_relocs): New function.
6378 (Sized_incr_relobj::do_count_local_symbols): New function.
6379 (Sized_incr_relobj::do_finalize_local_symbols): New function.
6380 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6381 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6382 (Sized_incr_relobj::do_relocate): New function.
6383 (Sized_incr_relobj::do_set_section_offset): New function.
6384 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6385 (Sized_incr_dynobj::do_read_symbols): New function.
6386 (Sized_incr_dynobj::do_layout): New function.
6387 (Sized_incr_dynobj::do_add_symbols): New function.
6388 (Sized_incr_dynobj::do_should_include_member): New function.
6389 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6390 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6391 (Sized_incr_dynobj::do_section_size): New function.
6392 (Sized_incr_dynobj::do_section_name): New function.
6393 (Sized_incr_dynobj::do_section_contents): New function.
6394 (Sized_incr_dynobj::do_section_flags): New function.
6395 (Sized_incr_dynobj::do_section_entsize): New function.
6396 (Sized_incr_dynobj::do_section_address): New function.
6397 (Sized_incr_dynobj::do_section_type): New function.
6398 (Sized_incr_dynobj::do_section_link): New function.
6399 (Sized_incr_dynobj::do_section_info): New function.
6400 (Sized_incr_dynobj::do_section_addralign): New function.
6401 (Sized_incr_dynobj::do_initialize_xindex): New function.
6402 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6403 (make_sized_incremental_object): New function.
6404 (Incremental_library::copy_unused_symbols): New function.
6405 (Incremental_library::do_for_all_unused_symbols): New function.
6406 * incremental.h (enum Incremental_input_flags): New type.
6407 (class Incremental_checker): Remove.
6408 (Incremental_input_entry::Incremental_input_entry): Add argument
6409 serial number.
6410 (Incremental_input_entry::arg_serial): New function.
6411 (Incremental_input_entry::set_is_in_system_directory): New function.
6412 (Incremental_input_entry::is_in_system_directory): New function.
6413 (Incremental_input_entry::arg_serial_): New data member.
6414 (Incremental_input_entry::is_in_system_directory_): New data member.
6415 (class Script_info): Move here from script.h.
6416 (Script_info::Script_info): Add filename parameter.
6417 (Script_info::filename): New function.
6418 (Script_info::filename_): New data member.
6419 (Incremental_script_entry::Incremental_script_entry): Add argument
6420 serial number.
6421 (Incremental_object_entry::Incremental_object_entry): Likewise.
6422 (Incremental_object_entry::add_input_section): Build list of input
6423 sections with map to original shndx.
6424 (Incremental_object_entry::get_input_section_index): New function.
6425 (Incremental_object_entry::shndx_): New data member.
6426 (Incremental_object_entry::name_key_): Rename; adjust all refs.
6427 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6428 (Incremental_archive_entry::Incremental_archive_entry): Add argument
6429 serial number.
6430 (Incremental_inputs::report_archive_begin): Likewise.
6431 (Incremental_inputs::report_object): Likewise.
6432 (Incremental_inputs::report_script): Likewise.
6433 (class Incremental_global_symbol_reader): New class.
6434 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6435 and store flags and input file type.
6436 (Incremental_input_entry_reader::arg_serial): New function.
6437 (Incremental_input_entry_reader::type): Extract type from flags.
6438 (Incremental_input_entry_reader::is_in_system_directory): New function.
6439 (Incremental_input_entry_reader::get_input_section_count): Call
6440 accessor function for type.
6441 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6442 function for type; adjust size of global symbol entry.
6443 (Incremental_input_entry_reader::get_global_symbol_count): Call
6444 accessor function for type.
6445 (Incremental_input_entry_reader::get_object_count): Likewise.
6446 (Incremental_input_entry_reader::get_object_offset): Likewise.
6447 (Incremental_input_entry_reader::get_member_count): Likewise.
6448 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6449 (Incremental_input_entry_reader::get_member_offset): Likewise.
6450 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6451 (Incremental_input_entry_reader::Global_symbol_info): Remove.
6452 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6453 (Incremental_input_entry_reader::get_global_symbol_reader): New
6454 function.
6455 (Incremental_input_entry_reader::get_output_symbol_index): New
6456 function.
6457 (Incremental_input_entry_reader::type_): Remove.
6458 (Incremental_input_entry_reader::flags_): New data member.
6459 (Incremental_inputs_reader::input_file_offset): New function.
6460 (Incremental_inputs_reader::input_file_index): New function.
6461 (Incremental_inputs_reader::input_file): Call input_file_offset.
6462 (Incremental_inputs_reader::input_file_at_offset): New function.
6463 (Incremental_relocs_reader::get_r_type): Reformat.
6464 (Incremental_relocs_reader::get_r_shndx): Reformat.
6465 (Incremental_relocs_reader::get_r_offset): Reformat.
6466 (Incremental_relocs_reader::data): New function.
6467 (Incremental_binary::Incremental_binary): Initialize new data members.
6468 (Incremental_binary::check_inputs): Add cmdline parameter.
6469 (Incremental_binary::file_is_unchanged): Remove.
6470 (Input_reader::arg_serial): New function.
6471 (Input_reader::get_unused_symbol_count): New function.
6472 (Input_reader::get_unused_symbol): New function.
6473 (Input_reader::do_arg_serial): New function.
6474 (Input_reader::do_get_unused_symbol_count): New function.
6475 (Input_reader::do_get_unused_symbol): New function.
6476 (Incremental_binary::input_file_count): New function.
6477 (Incremental_binary::get_input_reader): Change signature to use
6478 index instead of filename.
6479 (Incremental_binary::file_has_changed): New function.
6480 (Incremental_binary::get_input_argument): New function.
6481 (Incremental_binary::get_library): New function.
6482 (Incremental_binary::get_script_info): New function.
6483 (Incremental_binary::init_layout): New function.
6484 (Incremental_binary::reserve_layout): New function.
6485 (Incremental_binary::output_file): New function.
6486 (Incremental_binary::do_check_inputs): New function.
6487 (Incremental_binary::do_file_is_unchanged): Remove.
6488 (Incremental_binary::do_file_has_changed): New function.
6489 (Incremental_binary::do_init_layout): New function.
6490 (Incremental_binary::do_reserve_layout): New function.
6491 (Incremental_binary::do_input_file_count): New function.
6492 (Incremental_binary::do_get_input_reader): Change signature.
6493 (Incremental_binary::input_args_map_): New data member.
6494 (Incremental_binary::library_map_): New data member.
6495 (Incremental_binary::script_map_): New data member.
6496 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6497 new data members.
6498 (Sized_incremental_binary::output_section): New function.
6499 (Sized_incremental_binary::inputs_reader): Add const.
6500 (Sized_incremental_binary::symtab_reader): Add const.
6501 (Sized_incremental_binary::relocs_reader): Add const.
6502 (Sized_incremental_binary::got_plt_reader): Add const.
6503 (Sized_incremental_binary::get_symtab_view): New function.
6504 (Sized_incremental_binary::Inputs_reader): New typedef.
6505 (Sized_incremental_binary::Input_entry_reader): New typedef.
6506 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6507 (Sized_incremental_binary::do_file_is_unchanged): Remove.
6508 (Sized_incremental_binary::do_file_has_changed): New function.
6509 (Sized_incremental_binary::do_init_layout): New function.
6510 (Sized_incremental_binary::do_reserve_layout): New function.
6511 (Sized_input_reader::Inputs_reader): Remove.
6512 (Sized_input_reader::Input_entry_reader): Remove.
6513 (Sized_input_reader::do_arg_serial): New function.
6514 (Sized_input_reader::do_get_unused_symbol_count): New function.
6515 (Sized_input_reader::do_get_unused_symbol): New function.
6516 (Sized_incremental_binary::do_input_file_count): New function.
6517 (Sized_incremental_binary::do_get_input_reader): Change signature;
6518 use index instead of filename.
6519 (Sized_incremental_binary::section_map_): New data member.
6520 (Sized_incremental_binary::input_entry_readers_): New data member.
6521 (class Sized_incr_relobj): New class.
6522 (class Sized_incr_dynobj): New class.
6523 (make_sized_incremental_object): New function.
6524 (class Incremental_library): New class.
6525 * layout.cc (Free_list::num_lists): New static data member.
6526 (Free_list::num_nodes): New static data member.
6527 (Free_list::num_removes): New static data member.
6528 (Free_list::num_remove_visits): New static data member.
6529 (Free_list::num_allocates): New static data member.
6530 (Free_list::num_allocate_visits): New static data member.
6531 (Free_list::init): New function.
6532 (Free_list::remove): New function.
6533 (Free_list::allocate): New function.
6534 (Free_list::dump): New function.
6535 (Free_list::print_stats): New function.
6536 (Layout_task_runner::run): Resize output file for incremental updates.
6537 (Layout::Layout): Initialize new data members.
6538 (Layout::set_incremental_base): New function.
6539 (Layout::init_fixed_output_section): New function.
6540 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6541 incremental updates.
6542 (Layout::create_gold_note): Do not create gold note section for
6543 incremental updates.
6544 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6545 for incremental updates.
6546 (Layout::set_section_offsets): For incremental updates, allocate space
6547 from free list.
6548 (Layout::create_symtab_sections): Layout with offsets relative to
6549 start of section; for incremental updates, allocate space from free
6550 list.
6551 (Layout::create_shdrs): For incremental updates, allocate space from
6552 free list.
6553 (Layout::finish_dynamic_section): For incremental updates, do not
6554 check --as-needed (fixed in subsequent patch).
6555 * layout.h (class Free_list): New class.
6556 (Layout::set_incremental_base): New function.
6557 (Layout::incremental_base): New function.
6558 (Layout::init_fixed_output_section): New function.
6559 (Layout::allocate): New function.
6560 (Layout::incremental_base_): New data member.
6561 (Layout::free_list_): New data member.
6562 * main.cc (main): Print Free_list statistics.
6563 * object.cc (Relobj::finalize_incremental_relocs): Add
6564 clear_counts parameter; clear counts only when clear_counts is set.
6565 (Sized_relobj::Sized_relobj): Initialize new base class.
6566 (Sized_relobj::do_layout): Don't report special sections.
6567 (Sized_relobj::do_for_all_local_got_entries): New function.
6568 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6569 symtab_off to all symbol table offsets.
6570 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6571 * object.h (class Got_offset_list): Move to top of file.
6572 (Object::Object): Allow case where input_file == NULL.
6573 (Object::~Object): Likewise.
6574 (Object::input_file): Assert that input_file != NULL.
6575 (Object::lock): Allow case where input_file == NULL.
6576 (Object::unlock): Likewise.
6577 (Object::is_locked): Likewise.
6578 (Object::token): Likewise.
6579 (Object::release): Likewise.
6580 (Object::is_incremental): New function.
6581 (Object::get_mtime): New function.
6582 (Object::for_all_local_got_entries): New function.
6583 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6584 (Object::set_is_in_system_directory): New function.
6585 (Object::is_in_system_directory): New function.
6586 (Object::do_is_incremental): New function.
6587 (Object::do_get_mtime): New function.
6588 (Object::do_for_all_local_got_entries): New function.
6589 (Object::is_in_system_directory_): New data member.
6590 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6591 (class Sized_relobj_base): New class.
6592 (class Sized_relobj): Derive from Sized_relobj_base.
6593 (class Sized_relobj::Symbols): Redeclare from base class.
6594 (class Sized_relobj::local_got_offset_list): Remove.
6595 (class Sized_relobj::Output_sections): Redeclare from base class.
6596 (class Sized_relobj::do_for_all_local_got_entries): New function.
6597 (class Sized_relobj::write_local_symbols): Add offset parameter.
6598 (class Sized_relobj::local_symbol_offset_): Update comment.
6599 (class Sized_relobj::local_dynsym_offset_): Update comment.
6600 * options.cc (Input_arguments::add_file): Remove const.
6601 * options.h (Input_file_argument::Input_file_argument):
6602 Initialize arg_serial_ (all constructors).
6603 (Input_file_argument::set_arg_serial): New function.
6604 (Input_file_argument::arg_serial): New function.
6605 (Input_file_argument::arg_serial_): New data member.
6606 (Input_arguments::Input_arguments): Initialize file_count_.
6607 (Input_arguments::add_file): Remove const.
6608 (Input_arguments::number_of_input_files): New function.
6609 (Input_arguments::file_count_): New data member.
6610 (Command_line::number_of_input_files): Call
6611 Input_arguments::number_of_input_files.
6612 * output.cc (Output_segment_headers::Output_segment_headers):
6613 Set current size.
6614 (Output_section::Input_section::current_data_size): New function.
6615 (Output_section::Output_section): Initialize new data members.
6616 (Output_section::add_input_section): Don't do merge sections for
6617 an incremental link; allocate space from free list for an
6618 incremental update.
6619 (Output_section::add_output_section_data): Allocate space from
6620 free list for an incremental update.
6621 (Output_section::update_data_size): New function.
6622 (Output_section::set_fixed_layout): New function.
6623 (Output_section::reserve): New function.
6624 (Output_segment::set_section_addresses): Remove const.
6625 (Output_segment::set_section_list_addresses): Remove const; allocate
6626 space from free list for an incremental update.
6627 (Output_segment::set_offset): Adjust size of RELRO segment for an
6628 incremental update.
6629 * output.h (Output_data::current_data_size): Move here from
6630 child classes.
6631 (Output_data::pre_finalize_data_size): New function.
6632 (Output_data::update_data_size): New function.
6633 (Output_section_headers::update_data_size): new function.
6634 (Output_section_data_build::current_data_size): Move to Output_data.
6635 (Output_data_strtab::update_data_size): New function.
6636 (Output_section::current_data_size): Move to Output_data.
6637 (Output_section::set_fixed_layout): New function.
6638 (Output_section::has_fixed_layout): New function.
6639 (Output_section::reserve): New function.
6640 (Output_section::update_data_size): New function.
6641 (Output_section::has_fixed_layout_): New data member.
6642 (Output_section::free_list_): New data member.
6643 (Output_segment::set_section_addresses): Remove const.
6644 (Output_segment::set_section_list_addresses): Remove const.
6645 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6646 New function.
6647 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6648 New function.
6649 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6650 parameter when calling Add_symbols constructor; store argument
6651 serial number for members of a lib group.
6652 (Add_symbols::locks): Allow case where token == NULL.
6653 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6654 (Read_member::~Read_member): New function.
6655 (Read_member::is_runnable): New function.
6656 (Read_member::locks): New function.
6657 (Read_member::run): New function.
6658 (Check_script::~Check_script): New function.
6659 (Check_script::is_runnable): New function.
6660 (Check_script::locks): New function.
6661 (Check_script::run): New function.
6662 (Check_library::~Check_library): New function.
6663 (Check_library::is_runnable): New function.
6664 (Check_library::locks): New function.
6665 (Check_library::run): New function.
6666 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6667 (Add_symbols::library_): New data member.
6668 (class Read_member): New class.
6669 (class Check_script): New class.
6670 (class Check_library): New class.
6671 * reloc.cc (Read_relocs::is_runnable): Allow case where
6672 token == NULL.
6673 (Read_relocs::locks): Likewise.
6674 (Scan_relocs::locks): Likewise.
6675 (Relocate_task::locks): Likewise.
6676 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6677 to clear counters.
6678 (Sized_relobj::incremental_relocs_scan): Fix comment.
6679 (Sized_relobj::do_relocate): Pass output file offset to
6680 write_local_symbols.
6681 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6682 from class declaration.
6683 * script.cc (read_input_script): Allocate Script_info; pass
6684 argument serial number to report_script.
6685 * script.h (class Script_info): Move to incremental.h.
6686 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6687 * symtab.h (Symbol_table::add_from_incrobj): New function.
6688 (Symbol_table::set_file_offset): New function.
6689
6690 2011-04-05 Cary Coutant <ccoutant@google.com>
6691
6692 * incremental-dump.cc (dump_incremental_inputs): Change signature
6693 to take a Sized_incremental_binary; change caller. Use readers
6694 in Sized_incremental_binary.
6695 * incremental.cc
6696 (Sized_incremental_binary::find_incremental_inputs_sections):
6697 Rename do_find_incremental_inputs_sections to this.
6698 (Sized_incremental_binary::setup_readers): New function.
6699 (Sized_incremental_binary::do_check_inputs): Check
6700 has_incremental_info_ flag; move setup code to setup_readers;
6701 use input readers.
6702 (Sized_incremental_binary::do_file_is_unchanged): New function.
6703 (Sized_incremental_binary::do_get_input_reader): New function.
6704 * incremental.h (class Incremental_binary): Move to end of file.
6705 (Incremental_binary::file_is_unchanged): New function.
6706 (Incremental_binary::do_file_is_unchanged): New function.
6707 (Incremental_binary::Input_reader): New class.
6708 (Incremental_binary::get_input_reader): New function.
6709 (class Sized_incremental_binary): Move to end of file.
6710 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6711 input section reader classes.
6712 (Sized_incremental_binary::has_incremental_info): New function.
6713 (Sized_incremental_binary::inputs_reader): New function.
6714 (Sized_incremental_binary::symtab_reader): New function.
6715 (Sized_incremental_binary::relocs_reader): New function.
6716 (Sized_incremental_binary::got_plt_reader): New function.
6717 (Sized_incremental_binary::do_file_is_unchanged): New function.
6718 (Sized_incremental_binary::Sized_input_reader): New class.
6719 (Sized_incremental_binary::get_input_reader): New function.
6720 (Sized_incremental_binary::find_incremental_inputs_sections):
6721 Rename do_find_incremental_inputs_sections to this.
6722 (Sized_incremental_binary::setup_readers): New function.
6723 (Sized_incremental_binary::has_incremental_info_): New data member.
6724 (Sized_incremental_binary::inputs_reader_): New data member.
6725 (Sized_incremental_binary::symtab_reader_): New data member.
6726 (Sized_incremental_binary::relocs_reader_): New data member.
6727 (Sized_incremental_binary::got_plt_reader_): New data member.
6728 (Sized_incremental_binary::current_input_file_): New data member.
6729
6730 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6731
6732 PR gold/12640
6733 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6734 violation.
6735
6736 2011-03-30 Cary Coutant <ccoutant@google.com>
6737
6738 * archive.cc (Archive::include_member): Adjust call to report_object.
6739 (Add_archive_symbols::run): Add script_info to call to
6740 report_archive_begin.
6741 (Lib_group::include_member): Adjust call to report_object.
6742 (Add_lib_group_symbols::run): Adjust call to report_object.
6743 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6744 blocks. Add object count for script input files.
6745 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6746 script_info parameter; change all callers.
6747 (Incremental_inputs::report_object): Add script_info parameter;
6748 change all callers.
6749 (Incremental_inputs::report_script): Store backpointer to
6750 incremental info entry.
6751 (Output_section_incremental_inputs::set_final_data_size): Record
6752 additional information for scripts.
6753 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6754 * incremental.h (Incremental_script_entry::add_object): New function.
6755 (Incremental_script_entry::get_object_count): New function.
6756 (Incremental_script_entry::get_object): New function.
6757 (Incremental_script_entry::objects_): New data member; adjust
6758 constructor.
6759 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6760 (Incremental_inputs::report_object): Add script_info parameter.
6761 (Incremental_inputs_reader::get_object_count): New function.
6762 (Incremental_inputs_reader::get_object_offset): New function.
6763 * options.cc (Input_arguments::add_file): Return reference to
6764 new input argument.
6765 * options.h (Input_argument::set_script_info): New function.
6766 (Input_argument::script_info): New function.
6767 (Input_argument::script_info_): New data member; adjust all
6768 constructors.
6769 (Input_file_group::add_file): Return reference to new input argument.
6770 (Input_file_lib::add_file): Likewise.
6771 (Input_arguments::add_file): Likewise.
6772 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6773 * script.cc (Parser_closure::Parser_closure): Add script_info
6774 parameter; adjust all callers.
6775 (Parser_closure::script_info): New function.
6776 (Parser_closure::script_info_): New data member.
6777 (read_input_script): Report scripts earlier to incremental info.
6778 (script_add_file): Set script_info in Input_argument.
6779 (script_add_library): Likewise.
6780 * script.h (Script_options::Script_info): Rewrite class.
6781
6782 2011-03-29 Cary Coutant <ccoutant@google.com>
6783
6784 * archive.cc (Library_base::should_include_member): Move
6785 method here from class Archive.
6786 (Archive::Archive): Initialize base class.
6787 (Archive::should_include_member): Move to base class.
6788 (Archive::do_for_all_unused_symbols): New function.
6789 (Add_archive_symbols::run): Remove redundant access to
6790 incremental_inputs.
6791 (Lib_group::Lib_group): Initialize base class.
6792 (Lib_group::do_filename): New function.
6793 (Lib_group::include_member): Pass pointer to Lib_group to
6794 report_object.
6795 (Lib_group::do_for_all_unused_symbols): New function.
6796 (Add_lib_group_symbols::run): Report archive information for
6797 incremental links.
6798 * archive.h (class Library_base): New base class.
6799 (class Archive): Derive from Library_base.
6800 (Archive::filename): Move to base class.
6801 (Archive::set_incremental_info): Likewise.
6802 (Archive::incremental_info): Likewise.
6803 (Archive::Should_include): Likewise.
6804 (Archive::should_include_member): Likewise.
6805 (Archive::Armap_entry): Remove.
6806 (Archive::Unused_symbol_iterator): Remove.
6807 (Archive::unused_symbols_begin): Remove.
6808 (Archive::unused_symbols_end): Remove.
6809 (Archive::do_filename): New function.
6810 (Archive::do_get_mtime): New function.
6811 (Archive::do_for_all_unused_symbols): New function.
6812 (Archive::task_): Move to base class.
6813 (Archive::incremental_info_): Likewise.
6814 (class Lib_group): Derive from Library_base.
6815 (Lib_group::do_filename): New function.
6816 (Lib_group::do_get_mtime): New function.
6817 (Lib_group::do_for_all_unused_symbols): New function.
6818 (Lib_group::task_): Move to base class.
6819 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6820 function.
6821 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6822 function.
6823 * incremental.cc (Incremental_inputs::report_archive_begin):
6824 Use Library_base; call library's get_mtime; add incremental inputs
6825 entry before members.
6826 (class Unused_symbol_visitor): New class.
6827 (Incremental_inputs::report_archive_end): Use Library_base; use
6828 visitor class to record unused symbols; don't add incremental inputs
6829 entry after members.
6830 (Incremental_inputs::report_object): Use Library_base.
6831 * incremental.h
6832 (Incremental_archive_entry::Incremental_archive_entry): Remove
6833 unused Archive parameter.
6834 (Incremental_inputs::report_archive_begin): Use Library_base.
6835 (Incremental_inputs::report_archive_end): Likewise.
6836 (Incremental_inputs::report_object): Likewise.
6837 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6838 function.
6839 * object.h (Object::for_all_global_symbols): New function.
6840 (Object::do_for_all_global_symbols): New function.
6841 (Sized_relobj::do_for_all_global_symbols): New function.
6842 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6843 function.
6844 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6845 function.
6846
6847 2011-03-27 Ian Lance Taylor <iant@google.com>
6848
6849 * archive.cc (Archive::interpret_header): Return -1 if something
6850 goes wrong. Change callers accordingly.
6851
6852 2011-03-25 Cary Coutant <ccoutant@google.com>
6853
6854 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6855 * testsuite/Makefile.in: Regenerate.
6856
6857 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6858
6859 * plugin.cc (get_view): New.
6860 (Plugin::load): Pass get_view to the plugin.
6861 (Plugin_manager::get_view): New.
6862
6863 2011-03-21 Ian Lance Taylor <iant@google.com>
6864
6865 * testsuite/final_layout.sh: Rewrite to not use dc.
6866 * testsuite/relro_test.sh: Fail if dc is not present.
6867
6868 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6869
6870 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6871 Change == to -eq.
6872 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6873 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6874 Change == to -eq.
6875 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6876 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6877
6878 2011-03-14 Ian Lance Taylor <iant@google.com>
6879
6880 * script-sections.cc (Sort_output_sections::script_compare):
6881 Rename from is_before, change return type.
6882 (Sort_output_sections::operator()): Adjust accordingly.
6883
6884 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6885
6886 PR gold/12572
6887 * testsuite/odr_violation2.cc: Add comment to make all error line
6888 numbers double digits.
6889 * testsuite/debug_msg.sh: Adjust expected errors.
6890
6891 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6892
6893 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6894 but mark earlier ones as non-canonical
6895 (offset_to_iterator): Update search target and example
6896 (do_addr2line): Return extra lines in a vector*
6897 (format_file_lineno): Extract from do_addr2line
6898 (one_addr2line): Add vector* out-param
6899 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6900 when a lineno entry appeared last for its instruction
6901 (Dwarf_line_info): Add vector* out-param
6902 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6903 * symtab.cc (Odr_violation_compare): Include the lineno in the
6904 comparison again.
6905 (linenos_from_loc): New. Combine the canonical line for an
6906 address with its other lines.
6907 (True_if_intersect): New. Helper functor to make
6908 std::set_intersection a query.
6909 (detect_odr_violations): Compare sets of lines instead of just
6910 one line for each function. This became less deterministic, but
6911 has fewer false positives.
6912 * symtab.h: Declarations.
6913 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6914 mix an optimized and non-optimized object in the same binary
6915 (odr_violation2.so): Same.
6916 * testsuite/Makefile.in: Regenerate from Makefile.am.
6917 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6918 * testsuite/debug_msg.sh: Update line numbers and add
6919 assertions.
6920 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6921 non-optimized context.
6922 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6923 isn't inlined, and use OdrDerived in an optimized context.
6924 * testsuite/odr_header1.h: Defines OdrDerived, where
6925 optimization will change the
6926 first-instruction-in-the-destructor's file and line number.
6927 * testsuite/odr_header2.h: Defines OdrBase.
6928
6929 2011-03-09 Ian Lance Taylor <iant@google.com>
6930
6931 * fileread.cc (File_read::clear_views): Don't delete the whole
6932 file view.
6933
6934 2011-03-08 Ian Lance Taylor <iant@google.com>
6935
6936 PR gold/12525
6937 * fileread.cc: #include <climits>.
6938 (GOLD_IOV_MAX): Define.
6939 (File_read::read_multiple): Limit number of entries by iov_max.
6940 * fileread.h (class File_read): Always set max_readv_entries to
6941 128.
6942
6943 2011-03-07 Ian Lance Taylor <iant@google.com>
6944
6945 PR gold/12525
6946 * options.h (class General_options): Add -dy and -dn.
6947
6948 2011-03-02 Cary Coutant <ccoutant@google.com>
6949
6950 * testsuite/script_test_9.t: Add TLS segment.
6951
6952 2011-03-02 Simon Baldwin <simonb@google.com>
6953
6954 * configure.ac: Add check for gnu_indirect_function support in
6955 the toolchain building binutils.
6956 * configure: Rebuild.
6957
6958 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6959
6960 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6961 plugin only symbols.
6962 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6963 in plugin files as not needed in the symbol table.
6964
6965 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6966
6967 * output.cc (Output_section::add_input_section): Delay fill
6968 generation for section ordering.
6969
6970 2011-02-09 Ian Lance Taylor <iant@google.com>
6971
6972 PR gold/12316
6973 * object.h (class Sized_relobj): Remove clear_local_symbols.
6974 * reloc.cc (Sized_relobj::do_relocate): Don't call
6975 clear_local_symbols.
6976
6977 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6978
6979 * plugin.cc (is_visible_from_outside): Return true for symbols
6980 in the -u option.
6981
6982 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6983
6984 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6985 filename.
6986
6987 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6988
6989 * icf.h (is_section_foldable_candidate): Change type of parameter
6990 to std::string.
6991 * icf.cc (Icf::find_identical_sections): Change type of local variable
6992 section_name to be std::string.
6993 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6994
6995 2011-01-25 Ian Lance Taylor <iant@google.com>
6996
6997 * script.cc (script_add_extern): Rewrite to use
6998 add_symbol_reference.
6999
7000 2011-01-25 Doug Kwan <dougkwan@google.com>
7001
7002 * icf.cc (get_section_contents): Always lock section's object.
7003
7004 2011-01-24 Ian Lance Taylor <iant@google.com>
7005
7006 * options.h (class General_options): Accept
7007 --no-detect-odr-violations.
7008
7009 2011-01-24 Ian Lance Taylor <iant@google.com>
7010
7011 * version.cc (version_string): Bump to 1.11.
7012
7013 2011-01-24 Ian Lance Taylor <iant@google.com>
7014
7015 * plugin.cc (class Plugin_rescan): Define new class.
7016 (Plugin_manager::claim_file): Set any_claimed_.
7017 (Plugin_manager::save_archive): New function.
7018 (Plugin_manager::save_input_group): New function.
7019 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7020 necessary.
7021 (Plugin_manager::new_undefined_symbol): New function.
7022 (Plugin_manager::rescan): New function.
7023 (Plugin_manager::rescannable_defines): New function.
7024 (Plugin_manager::add_input_file): Set any_added_.
7025 * plugin.h (class Plugin_manager): define new fields rescannable_,
7026 undefined_symbols_, any_claimed_, and any_added_. Declare
7027 Plugin_rescan as friend. Declare new functions.
7028 (Plugin_manager::Rescannable): Define type.
7029 (Plugin_manager::Rescannable_list): Define type.
7030 (Plugin_manager::Undefined_symbol_list): Define type.
7031 (Plugin_manager::Plugin_manager): Initialize new fields.
7032 * archive.cc (Archive::defines_symbol): New function.
7033 (Add_archive_symbols::run): Pass archive to plugins if any.
7034 * archive.h (class Archive): Declare defines_symbol.
7035 * readsyms.cc (Input_group::~Input_group): New function.
7036 (Finish_group::run): Pass input_group to plugins if any.
7037 * readsyms.h (class Input_group): Declare destructor.
7038 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7039 any.
7040
7041 2011-01-10 Ian Lance Taylor <iant@google.com>
7042
7043 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7044 section as relro.
7045 (Layout::set_segment_offsets): Reset increase_relro before calling
7046 set_section_addresses a second time.
7047
7048 2011-01-04 Cary Coutant <ccoutant@google.com>
7049
7050 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7051 sections before NOBITS sections.
7052
7053 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
7054
7055 * version.cc (print_version): Update copyright to 2011.
7056
7057 2010-12-23 Cary Coutant <ccoutant@google.com>
7058
7059 * output.h (Output_data_reloc::add_output_section): Pass OD instead
7060 of OS to this->add. Add OD parameter to second form of the function.
7061
7062 2010-12-20 Ian Lance Taylor <iant@google.com>
7063
7064 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7065 second of two consecutive entries with same offset.
7066
7067 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7068
7069 * testsuite/Makefile.am (ifuncmain2static_LDADD)
7070 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7071 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7072 to avoid unneeded links against $(LDADD).
7073 * testsuite/Makefile.in: Regenerate.
7074
7075 2010-12-15 Ian Lance Taylor <iant@google.com>
7076
7077 PR gold/12324
7078 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7079 for R_X86_64_32 and R_X86_64_PC32.
7080 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7081 ver_matching_def_pic.o.
7082 (ver_matching_def_pic.o): New target.
7083
7084 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7085
7086 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7087 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7088 Move definition before File_read::View member definitions.
7089 (File_read::View::~View): Initialize and hold lock before
7090 updating current_mapped_bytes.
7091
7092 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7093
7094 * dwarf_reader.cc: Remove outdated comment.
7095 * gold-threads.cc: Fix typo in error message.
7096 * archive.cc: Fix typos in comments.
7097 * archive.h: Likewise.
7098 * arm-reloc-property.cc: Likewise.
7099 * arm-reloc-property.h: Likewise.
7100 * arm-reloc.def: Likewise.
7101 * arm.cc: Likewise.
7102 * attributes.h: Likewise.
7103 * cref.cc: Likewise.
7104 * ehframe.cc: Likewise.
7105 * fileread.h: Likewise.
7106 * gold.h: Likewise.
7107 * i386.cc: Likewise.
7108 * icf.cc: Likewise.
7109 * incremental.h: Likewise.
7110 * int_encoding.cc: Likewise.
7111 * layout.h: Likewise.
7112 * main.cc: Likewise.
7113 * merge.h: Likewise.
7114 * object.cc: Likewise.
7115 * object.h: Likewise.
7116 * options.cc: Likewise.
7117 * readsyms.cc: Likewise.
7118 * reduced_debug_output.cc: Likewise.
7119 * reloc.cc: Likewise.
7120 * script-sections.cc: Likewise.
7121 * sparc.cc: Likewise.
7122 * symtab.h: Likewise.
7123 * target-reloc.h: Likewise.
7124 * target.cc: Likewise.
7125 * target.h: Likewise.
7126 * timer.cc: Likewise.
7127 * timer.h: Likewise.
7128 * x86_64.cc: Likewise.
7129
7130 2010-12-09 Cary Coutant <ccoutant@google.com>
7131
7132 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7133 stack.
7134 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7135 parameter; change all callers.
7136 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7137 * options.h (warn_execstack): New option.
7138
7139 2010-12-07 Doug Kwan <dougkwan@google.com>
7140
7141 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7142 like function call relocations.
7143
7144 2010-12-07 Ian Lance Taylor <iant@google.com>
7145
7146 * archive.cc (Archive::get_elf_object_for_member): Permit
7147 punconfigured to be NULL.
7148 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7149 (Archive::include_member): Pass NULL to get_elf_object_for_member
7150 if we searched for the archive and this is the first included
7151 object.
7152
7153 2010-12-01 Ian Lance Taylor <iant@google.com>
7154
7155 * dwarf_reader.h (class Sized_dwarf_line_info): Add
7156 track_relocs_type_ field.
7157 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7158 Set track_relocs_type_.
7159 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7160 contents when using RELA relocs.
7161 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7162 reloc_map_.
7163 * reloc.cc (Track_relocs::next_addend): New function.
7164 * reloc.h (class Track_relocs): Declare next_addend.
7165
7166 2010-12-01 Ian Lance Taylor <iant@google.com>
7167
7168 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7169 virtual destructor.
7170
7171 2010-12-01 Ian Lance Taylor <iant@google.com>
7172
7173 * README: Update compilers known to work and fail.
7174
7175 2010-11-23 Matthias Klose <doko@ubuntu.com>
7176
7177 * configure.in: For --enable-gold, handle value `default' instead of
7178 `both*'. Always install ld as ld.bfd, install as ld if gold is
7179 not the default.
7180 * configure: Regenerate.
7181
7182 2010-11-18 Doug Kwan <dougkwan@google.com>
7183
7184 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7185 and right_alignment to be zero. Store result alignment only if it is
7186 greater than existing alignment.
7187
7188 2010-11-16 Cary Coutant <ccoutant@google.com>
7189
7190 PR gold/12220
7191 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7192 Check for ".zdebug_line".
7193
7194 2010-11-16 Doug Kwan <dougkwan@google.com>
7195 Cary Coutant <ccoutant@google.com>
7196
7197 * output.h (Output_segment::set_section_addresses): Pass increase_relro
7198 by reference; adjust all callers.
7199 * output.cc (Output_segment::set_section_addresses): Adjust references
7200 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7201 list is empty.
7202 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7203 end at page boundary.
7204
7205 2010-11-16 Cary Coutant <ccoutant@google.com>
7206
7207 PR gold/12220
7208 * layout.cc (Layout::choose_output_section): Transform names of
7209 compressed sections even when using a script with a SECTIONS clause.
7210 (Layout::output_section_name): Remove code to transform
7211 compressed debug section names.
7212 * output.cc (Output_section::add_input_section): Use uncompressed
7213 section size when tracking input sections.
7214
7215 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
7216
7217 * symtab.h (Symbol::NON_PIC_REF): Remove.
7218 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7219 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
7220 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7221 (Symbol::use_plt_offset): Take a flags argument and pass it
7222 directly to needs_dynamic_reloc. Restrict check for undefined
7223 weak symbols to function calls.
7224 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7225 (Target_arm::Scan::global): Use it.
7226 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7227 (Target_arm::Relocate::relocate): Likewise.
7228 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7229 parameter with an r_type parameter. Use get_reference_flags
7230 to get the flags.
7231 (Target_arm::Relocate::relocate): Update accordingly.
7232 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7233 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7234 (Target_i386::Scan::global): Likewise.
7235 (Target_i386::Relocate::relocate): Likewise.
7236 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7237 parameter with an r_type parameter. Use get_reference_flags
7238 to get the flags.
7239 (Target_i386::Relocate::relocate): Update accordingly.
7240 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7241 (Target_powerpc::Scan::global): Use it.
7242 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7243 (Target_powerpc::Relocate::relocate): Likewise.
7244 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7245 (Target_sparc::Scan::global): Use it.
7246 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7247 (Target_sparc::Relocate::relocate): Likewise.
7248 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7249 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7250 (Target_x86_64::Scan::global): Likewise.
7251 (Target_x86_64::Relocate::relocate): Likewise.
7252
7253 2010-11-08 Doug Kwan <dougkwan@google.com>
7254 Cary Coutant <ccoutant@google.com>
7255
7256 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7257 (Arm_exidx_merge_section::section_contents_): New data member.
7258 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7259 (Arm_input_section::~Arm_input_section): De-allocate memory.
7260 (Arm_input_section::original_contents_): New data member.
7261 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7262 in parameters instead of calling Object::section_contents without
7263 locking.
7264 (Arm_output_section::group_section): New parameter TASK. Pass it
7265 to callees that need locking objects.
7266 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
7267 to lock EXIDX input sections. Fix a formatting issue. Call
7268 Arm_exidx_merged_section::build_contents to create merged section
7269 contents.
7270 (Arm_output_section::create_stub_group): New parameter TASK. Use it
7271 to lock object of stub table owner.
7272 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7273 TEXT_SIZE to initialize data member TEXT_SIZE_.
7274 (Arm_exidx_input_section::addralign): Fix typo in comment.
7275 (Arm_exidx_input_section::text_size): New method.
7276 (Target_arm::do_relax): New parameter TASK. Pass it to callees
7277 that require locking objects. Lock objects before scanning for stubs
7278 and updating local symbols.
7279 (Arm_input_section<big_endian>::init): Copy contents of original
7280 input section.
7281 (Arm_input_section<big_endian>::do_write): Use saved contents of
7282 original input section instead of calling Object::section_contents
7283 without locking.
7284 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7285 size without calling Object::section_size().
7286 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7287 for size. Allocate a buffer for merged EXIDX entries.
7288 (Arm_exidx_merged_section::build_contents): New method.
7289 (Arm_exidx_merged_section::do_write): Move merge section contents
7290 building code to Arm_exidx_merged_section::build_contetns. Write
7291 out contetns in buffer instead of building it on the fly.
7292 (Arm_relobj::make_exidx_input_section): Also pass text section size
7293 to Arm_exidx_input_section constructor.
7294 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
7295 (Arm_dynobj::do_read_symbols): Fix memory leak.
7296 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7297 * target.h: (class Task): Add forward declaration.
7298 (Target::relax): Add new parameter TASK and pass it to
7299 Target::do_relax().
7300 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
7301
7302 2010-11-05 Cary Coutant <ccoutant@google.com>
7303
7304 PR gold/10708
7305 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7306 object when reading from the file.
7307 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7308 second layout pass.
7309 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7310 when reading section contents.
7311 (get_section_contents): Likewise.
7312 (icf::find_identical_sections): Likewise.
7313 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7314 object when reading from the file.
7315 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7316 the object when doing deferred section layout.
7317
7318 2010-11-03 Nick Clifton <nickc@redhat.com>
7319
7320 PR gold/12001
7321 * script.h (class Symbol_assignment: name): New member. Returns
7322 the name of the symbol.
7323 * scrfipt.cc (Script_options::is_pending_assignment): New member.
7324 Returns true if the given symbol name is on the list of
7325 assignments wating to be processed.
7326 * archive.cc (should_incldue_member): If the symbol is undefined,
7327 check to see if it is on the list of symbols pending assignment.
7328
7329 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
7330
7331 * script-sections.cc (Script_sections::find_memory_region): Check
7332 for a NULL output section pointer.
7333
7334 2010-10-29 Doug Kwan <dougkwan@google.com>
7335
7336 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7337 Output_section::add_relaxed_input_section.
7338 * output.cc (Output_section::add_relaxed_input_section): Add new
7339 arguments LAYOUT and NAME. Set section order index.
7340 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7341 Copy section order index.
7342 * output.h (Output_section::add_relaxed_input_section): Add new
7343 arguments LAYOUT and NAME.
7344
7345 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7346
7347 * testsuite/Makefile.am: Move gcctestdir/ld rule to
7348 NATIVE_OR_CROSS_LINKER.
7349 * testsuite/Makefile.in: Regenerate.
7350
7351 2010-10-20 Doug Kwan <dougkwan@google.com>
7352
7353 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7354 without SHF_LINK_ORDER flags.
7355 * layout.cc (Layout::choose_output_section): Do not filter
7356 SHF_LINK_ORDER flag in a relocatable link.
7357
7358 2010-10-17 Cary Coutant <ccoutant@google.com>
7359
7360 * output.h (Output_segment::set_section_addresses): Change function
7361 signature. Update all callers.
7362 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7363 sections.
7364 (Output_segment::set_section_addresses): Align after last TLS
7365 section. Add padding before last relro section instead of after.
7366
7367 2010-10-17 Doug Kwan <dougkwan@google.com>
7368
7369 * gold/arm.cc (Target_arm::got_section): Use correct order and set
7370 GOT output section to be writable.
7371
7372 2010-10-14 Cary Coutant <ccoutant@google.com>
7373
7374 * debug.h (DEBUG_INCREMENTAL): New flag.
7375 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7376 * gold.cc (queue_initial_tasks): Check parameters for incremental link
7377 mode.
7378 * incremental.cc (report_command_line): Ignore all forms of
7379 --incremental.
7380 * layout.cc (Layout::Layout): Check parameters for incremental link
7381 mode.
7382 * options.cc (General_options::parse_incremental): New function.
7383 (General_options::parse_no_incremental): New function.
7384 (General_options::parse_incremental_full): New function.
7385 (General_options::parse_incremental_update): New function.
7386 (General_options::incremental_mode_): New data member.
7387 (General_options::finalize): Check incremental_mode_.
7388 * options.h (General_options): Update help text for --incremental.
7389 Add --no-incremental, --incremental-full, --incremental-update.
7390 (General_options::Incremental_mode): New enum type.
7391 (General_options::incremental_mode): New function.
7392 (General_options::incremental_mode_): New data member.
7393 * parameters.cc (Parameters::incremental_mode_): New data member.
7394 (Parameters::set_options): Set incremental_mode_.
7395 (Parameters::set_incremental_full): New function.
7396 (Parameters::incremental): New function.
7397 (Parameters::incremental_update): New function.
7398 (set_parameters_incremental_full): New function.
7399 * parameters.h (Parameters::set_incremental_full): New function.
7400 (Parameters::incremental): New function.
7401 (Parameters::incremental_update): New function.
7402 (Parameters::incremental_mode_): New data member.
7403 (set_parameters_incremental_full): New function.
7404 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7405 incremental link mode.
7406 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7407 (Sized_relobj::do_relocate_sections): Likewise.
7408 * testsuite/Makefile.am (incremental_test): Use --incremental-full
7409 option.
7410 * testsuite/Makefile.in: Regenerate.
7411 * testsuite/incremental_test.sh: Filter all forms of --incremental.
7412
7413 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7414
7415 * script-sections.h (class Script_sections): Make
7416 Sections_elements typedef public.
7417 * script-sections.cc (class Sort_output_sections): Add elements_
7418 field. Add constructor which sets it; change all callers.
7419 (Sort_output_sections::is_before): New function.
7420 (Sort_output_sections::operator()): Call is_before.
7421 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7422 conditional.
7423 * testsuite/script_test_10.sh: New test. Test script section
7424 order.
7425 * testsuite/script_test_10.t: Likewise.
7426 * testsuite/script_test_10.s: Likewise.
7427 * testsuite/Makefile.am: Wrap the cross linker tests and the
7428 common tests into NATIVE_OR_CROSS_LINKER.
7429 (check_SCRIPTS): Add script_test_10.sh.
7430 (check_DATA): Add script_test_10.stdout.
7431 (script_test_10.o, script_test_10): New targets.
7432 (script_test_10.stdout): New target.
7433 * configure, testsuite/Makefile.in: Regenerate.
7434
7435 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7436
7437 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7438 error for the deprecated relocations.
7439 (Target_arm::Scan::global): Likewise.
7440 (Target_arm::Relocate::relocate): Likewise.
7441
7442 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
7443
7444 * fileread.cc (Input_file::find_file): Initialize *found_name
7445 and *namep when using the fallback search for case 4.
7446
7447 2010-10-11 Cary Coutant <ccoutant@google.com>
7448
7449 * options.h (class General_options): Redefine -z lazy as an alias for
7450 the negation of -z now.
7451
7452 2010-10-11 Ian Lance Taylor <iant@google.com>
7453
7454 * resolve.cc (symbol_to_bits): Report the value of the unsupported
7455 binding.
7456
7457 2010-10-06 Nick Clifton <nickc@redhat.com>
7458
7459 * script-sections.cc(class Memory_region): Remove
7460 current_lma_offset_ field. Rename current_vma_offset_ to
7461 current_offset_. Add last_section_ field.
7462 (Memory_region::get_current_vma_address): Rename to
7463 get_current_address.
7464 (Memory_region::get_current_lma_address): Delete.
7465 (Memory_region::increment_vma_offset): Rename to
7466 increment_offset.
7467 (Memory_region::increment_lma_offset): Delete.
7468 (Memory_region::attributes_compatible): New method. Returns
7469 true if the provided section is compatible with the region.
7470 (Memory_region::get_last_section): New method. Returns the last
7471 section to use the region.
7472 (Memory_region::set_last_section): New method. Stores the last
7473 section to use the region.
7474 (Script_sections::block_in_region): New method. Returns true if
7475 a block of memory is contained within a region.
7476 (Script_sections::find_memory_region): New method. Locates a
7477 memory region to be used to set a VMA or LMA address.
7478 (Output_section_definition::set_section_addresses): Add code to
7479 check for addresses set by memory regions.
7480 (Output_segment::set_section_addresses): Remove memory region
7481 walking code.
7482 (Script_sections::create_segment): Add a warning if a header
7483 segment is created outside of any region.
7484 * script-sections.h (class Script_sections): Add prototypes for
7485 find_memory_region and block_in_region methods.
7486 * testsuite/memory_test.s: Use .long instead of .word.
7487 * testsuite/memory_test.t: Add some more output sections.
7488 * testsuite/memory_test.sh: Update expected output.
7489
7490 2010-10-02 Doug Kwan <dougkwan@google.com>
7491
7492 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7493 defintion to symtab.h
7494 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7495 declaration to defintion.
7496
7497 2010-10-01 Nick Clifton <nickc@redhat.com>
7498
7499 * expression.cc (eval): Replace dummy argument with NULL.
7500 (eval_maybe_dot): Check for a NULL result section pointer.
7501 (Symbol_expression::value): Likewise.
7502 (Dot_expression::value): Likewise.
7503 (BINARY_EXPRESSION): Likewise.
7504 (Max_expression::value): Likewise.
7505 (Min_expression::value): Likewise.
7506 (Absolute_expression::value): Likewise.
7507 (Addr_expression::value_from_output_section): Likewise.
7508 (Loaddddr_expression::value_from_output_section): Likewise.
7509 (Segment_start_expression::value): Likewise.
7510 * script-sections.cc
7511 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7512 argument with NULL.
7513 (Sections_elememt_dot_assignment::set_section_addresses):
7514 Likewise.
7515 (Output_data_expression::do_write_to_buffer): Likewise.
7516 (Output_section_definition::finalize_symbols): Likewise.
7517 (Output_section_definition::set_section_addresses): Likewise.
7518
7519 2010-09-30 Doug Kwan <dougkwan@google.com>
7520
7521 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7522
7523 2010-09-28 Sriraman Tallam <tmsriram@google.com>
7524
7525 * target.h (Target::can_icf_inline_merge_sections): New virtual
7526 function.
7527 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7528 virtual function.
7529 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7530 virtual function.
7531 * icf.cc (get_section_contents): Inline merge sections only when
7532 target allows it.
7533
7534 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7535
7536 * configure: Regenerate.
7537
7538 2010-09-17 Ian Lance Taylor <iant@google.com>
7539
7540 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7541 * testsuite/Makefile.am (memory_test.o): New target.
7542 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7543 memory_test.t.
7544 * testsuite/Makefile.in: Rebuild.
7545
7546 2010-09-17 Doug Kwan <dougkwan@google.com>
7547
7548 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7549 defintion if relocation uses GOT entries of the symbol.
7550 * testsuite/icf_safe_test.sh: Fix test.
7551 * testsuite/icf_safe_so_test.sh: Fix test.
7552
7553 2010-09-16 Cary Coutant <ccoutant@google.com>
7554
7555 * script_sections.cc (class Memory_region): Remove "NULL" from
7556 vector initializations.
7557
7558 2010-09-15 Cary Coutant <ccoutant@google.com>
7559
7560 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7561 Resolve forwarding symbols.
7562
7563 2010-09-15 Doug Kwan <dougkwan@google.com>
7564
7565 * gold/testsuite/script_test_3.t: Add ARM special sections.
7566 * gold/testsuite/script_test_4.t: Same.
7567 * gold/testsuite/script_test_5.t: Same.
7568 * gold/testsuite/script_test_6.t: Same.
7569 * gold/testsuite/script_test_7.t: Same.
7570 * gold/testsuite/script_test_7.t: Same.
7571 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7572
7573 2010-09-14 Cary Coutant <ccoutant@google.com>
7574
7575 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7576 (Target_x86_64::Relocate::relocate_tls): Replace check for
7577 saw_tls_block_reloc_ with test for executable section.
7578
7579 2010-09-12 Cary Coutant <ccoutant@google.com>
7580
7581 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7582 position-independent executables to shared libraries need dynamic
7583 relocations.
7584 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7585 position-independent executables.
7586 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7587 * testsuite/Makefile.in: Regenerate.
7588
7589 2010-09-10 Nick Clifton <nickc@redhat.com>
7590
7591 PR gold/11997
7592 * testsuite/memory_test.t: Discard any sections that are not
7593 needed.
7594
7595 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7596
7597 PR gold/11996
7598 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7599 "This::" to work around a bug in gcc 4.2.
7600
7601 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7602
7603 2010-09-09 Rafael Espindola <espindola@google.com>
7604
7605 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7606 sections with different PF_X flags in the same segment.
7607 (Layout::find_first_load_seg): Search all segments to find the first
7608 one.
7609 * options.h (rosegment): New.
7610
7611 2010-09-08 Rafael Espindola <espindola@google.com>
7612
7613 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7614
7615 2010-09-08 Doug Kwan <dougkwan@google.com>
7616
7617 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7618 (Arm_relobj::do_relocate_sections): Add new parameter for output
7619 file to match the parent.
7620 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7621 of local symbols instead of input values. Update code to track
7622 changes in gold::relocate_section.
7623 * object.cc (Sized_relobj::compute_final_local_value): New methods.
7624 (Sized_relobj::compute_final_local_value_internal): New methods.
7625 (Sized_relobj::do_finalize_local_symbols): Move code from loop
7626 body into private version of Sized_relobj::compute_final_local_value.
7627 Call the inline method.
7628 * object.h (Symbol_value::Symbol_value): Define destructor. Free
7629 merged symbol value if there is one.
7630 (Symbol_value::has_output_value): New method defintiion.
7631 (Sized_relobj::Compute_final_local_value_status): New enum type.
7632 (Sized_relobj::compute_final_local_value): New methods.
7633 (Sized_relobj::compute_final_local_value_internal): New methods.
7634 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7635 and arm_cortex_a8.sh.
7636 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7637 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7638 New tests.
7639 * Makefile.in: Regenerate.
7640 * testsuite/arm_bl_out_of_range.s: Update test.
7641 * testsuite/thumb_bl_out_of_range.s: Ditto.
7642 * testsuite/thumb_blx_out_of_range.s: Ditto.
7643 * testsuite/arm_branch_out_of_range.sh: New file.
7644 * testsuite/arm_cortex_a8.sh: Ditto.
7645 * testsuite/arm_cortex_a8_b.s: Ditto.
7646 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7647 * testsuite/arm_cortex_a8_b_local.s: Ditto.
7648 * testsuite/arm_cortex_a8_bl.s: Ditto.
7649 * testsuite/arm_cortex_a8_blx.s: Ditto.
7650 * testsuite/arm_cortex_a8_local.s: Ditto.
7651 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7652 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7653
7654 2010-09-08 Rafael Espindola <espindola@google.com>
7655
7656 * Makefile.am (memory_test.stdout): Run readelf with -W.
7657 * Makefile.in: Regenerate.
7658 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7659 64 bit output.
7660
7661 2010-09-08 Rafael Espindola <espindola@google.com>
7662
7663 * script-sections.cc (Script_sections::add_memory_region): Convert
7664 field precision to int.
7665 * script.cc (script_set_section_region, script_set_section_region):
7666 Convert field precision to int.
7667
7668 2010-09-08 Rafael Espindola <espindola@google.com>
7669
7670 * arm.cc (do_finalize_sections): Create the __exidx_start and
7671 __exdix_end symbols even when the section is missing.
7672
7673 2010-09-08 Nick Clifton <nickc@redhat.com>
7674
7675 * README: Remove claim that MEMORY is not supported.
7676 * expression.cc (script_exp_function_origin)
7677 (script_exp_function_length): Move from here to ...
7678 * script.cc: ... here.
7679 (script_set_section_region, script_add_memory)
7680 (script_parse_memory_attr, script_include_directive): New
7681 functions.
7682 * script-sections.cc
7683 (class Memory_region): New class.
7684 (class Output_section_definition): Add set_memory_region,
7685 set_section_vma, set_section_lma and get_section_name methods.
7686 (class Script_Sections): Add add_memory_region,
7687 find_memory_region, find_memory_region_origin,
7688 find_memory_region_length and set_memory_region methods.
7689 Have set_section_addresses method walk the list of set memory
7690 regions.
7691 Extend the print methos to display memory regions.
7692 * script-sections.h: Add prototypes for new methods.
7693 Add enum for MEMORY region attributes.
7694 * yyscript.y: Add support for parsing MEMORY regions.
7695 * script-c.h: Add prototypes for new functions.
7696 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7697 * testsuite/Makefile.in: Regenerate.
7698 * testsuite/memory_test.sh: New script.
7699 * testsuite/memory_test.s: New assembler source file.
7700 * testsuite/memory_test.t: New linker script.
7701
7702 2010-08-27 Doug Kwan <dougkwan@google.com>
7703
7704 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7705 reference override an existing dynamic weak reference.
7706 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7707 * testsuite/Makefile.in: Regenerate.
7708 * testsuite/dyn_weak_ref.sh: New file.
7709 * testsuite/dyn_weak_ref_1.c: Ditto.
7710 * testsuite/dyn_weak_ref_2.c: Ditto.
7711
7712 2010-08-27 Ian Lance Taylor <iant@google.com>
7713
7714 * incremental.h (class Incremental_input_entry): Add virtual
7715 destructor.
7716
7717 2010-08-27 Ian Lance Taylor <iant@google.com>
7718
7719 * testsuite/start_lib_test_3.c: Mark t3 as used.
7720
7721 2010-08-27 Nick Clifton <nickc@redhat.com>
7722
7723 * options.cc (version_script): Fix small typo in previous
7724 whitespace tidyup.
7725
7726 2010-08-25 Nick Clifton <nickc@redhat.com>
7727
7728 * archive.cc: Formatting fixes: Remove whitespace between
7729 typename and following asterisk. Remove whitespace between
7730 function name and opening parenthesis.
7731 * archive.h: Likewise.
7732 * arm.cc: Likewise.
7733 * attributes.cc: Likewise.
7734 * attributes.h: Likewise.
7735 * common.cc: Likewise.
7736 * copy-relocs.cc: Likewise.
7737 * dirsearch.h: Likewise.
7738 * dynobj.cc: Likewise.
7739 * ehframe.cc: Likewise.
7740 * ehframe.h: Likewise.
7741 * expression.cc: Likewise.
7742 * fileread.cc: Likewise.
7743 * fileread.h: Likewise.
7744 * gc.h: Likewise.
7745 * gold-threads.cc: Likewise.
7746 * gold.cc: Likewise.
7747 * i386.cc: Likewise.
7748 * icf.h: Likewise.
7749 * incremental-dump.cc: Likewise.
7750 * incremental.cc: Likewise.
7751 * layout.cc: Likewise.
7752 * layout.h: Likewise.
7753 * main.cc: Likewise.
7754 * merge.cc: Likewise.
7755 * merge.h: Likewise.
7756 * object.cc: Likewise.
7757 * object.h: Likewise.
7758 * options.cc: Likewise.
7759 * options.h: Likewise.
7760 * output.cc: Likewise.
7761 * output.h: Likewise.
7762 * plugin.cc: Likewise.
7763 * plugin.h: Likewise.
7764 * powerpc.cc: Likewise.
7765 * reloc.cc: Likewise.
7766 * script-c.h: Likewise.
7767 * script-sections.cc: Likewise.
7768 * script.cc: Likewise.
7769 * stringpool.cc: Likewise.
7770 * symtab.cc: Likewise.
7771 * symtab.h: Likewise.
7772 * target.cc: Likewise.
7773 * timer.cc: Likewise.
7774 * timer.h: Likewise.
7775 * version.cc: Likewise.
7776 * x86_64.cc: Likewise.
7777
7778 2010-08-24 Nick Clifton <nickc@redhat.com>
7779
7780 PR 11899
7781 * layout.cc (segment_precedes): Sort segments by their physical
7782 addresses, if they have been set.
7783
7784 2010-08-23 Cary Coutant <ccoutant@google.com>
7785
7786 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7787 symbols data.
7788 (Lib_group::include_member): Unlock object after deleting its
7789 symbols data.
7790 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7791 the bug fixed here.
7792
7793 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7794 Cary Coutant <ccoutant@google.com>
7795
7796 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7797 constructor, and set_blocker.
7798 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7799 readsyms_blocker_.
7800 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7801 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7802 * testsuite/Makefile.am (start_lib_test): New test case.
7803 * testsuite/Makefile.in: Regenerate.
7804 * testsuite/start_lib_test_main.c: New file.
7805 * testsuite/start_lib_test_1.c: New file.
7806 * testsuite/start_lib_test_2.c: New file.
7807 * testsuite/start_lib_test_3.c: New file.
7808
7809 2010-08-19 Ian Lance Taylor <iant@google.com>
7810
7811 * Makefile.in: Rebuild with automake 1.11.1.
7812 * aclocal.m4: Likewise.
7813 * testsuite/Makefile.in: Likewise.
7814
7815 2010-08-19 Ian Lance Taylor <iant@google.com>
7816
7817 PR 10893
7818 * i386.cc (class Output_data_plt_i386): Update declarations.
7819 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7820 local_ifuncs_ fields.
7821 (Target_i386::do_plt_section_for_global): New function.
7822 (Target_i386::do_plt_section_for_local): New function.
7823 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7824 parameter; change all callers. Initialize global_ifuncs_ and
7825 local_ifuncs_. If doing a static link define __rel_iplt_start and
7826 __rel_iplt_end.
7827 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7828 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7829 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7830 symbols.
7831 (Target_i386::make_plt_section): New function, broken out of
7832 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7833 (Target_i386::make_plt_entry): Call make_plt_section.
7834 (Target_i386::make_local_ifunc_plt_entry): New function.
7835 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7836 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7837 R_386_IRELATIVE to switch.
7838 (Target_i386::Scan::global): Likewise.
7839 (Target_i386::Relocate::relocate): Likewise.
7840 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7841 switch.
7842 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7843 (Target_x86_64::do_plt_section_for_global): New function.
7844 (Target_x86_64::do_plt_section_for_local): New function.
7845 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7846 parameter; change all callers. If doing a static link define
7847 __rela_iplt_start and __rela_iplt_end.
7848 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7849 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7850 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7851 to point to .plt.
7852 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7853 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7854 switch.
7855 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7856 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7857 R_X86_64_IRELATIVE to switch.
7858 (Target_x86_64::Scan::global): Likewise.
7859 (Target_x86_64::Relocate::relocate): Likewise.
7860 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7861 switch.
7862 * target.h (class Target): Add plt_section_for_global and
7863 plt_section_for_local functions. Add do_plt_section_for_global
7864 and do_plt_section_for_local virtual functions.
7865 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7866 clarifying comments.
7867 (Symbol::use_plt_offset): Handle IFUNC symbol.
7868 * object.cc (Sized_relobj::Sized_relobj): Initialize
7869 local_plt_offsets_.
7870 (Sized_relobj::local_has_plt_offset): New function.
7871 (Sized_relobj::local_plt_offset): New function.
7872 (Sized_relobj::set_local_plt_offset): New function.
7873 (Sized_relobj::do_count): Handle IFUNC symbol.
7874 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7875 a bit away from input_shndx_ field. Add set_is_func_symbol and
7876 is_ifunc_symbol functions.
7877 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7878 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7879 local_plt_offsets_ field.
7880 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7881 * output.h (class Output_section_data): Add non-const
7882 output_section function.
7883 (class Output_data_got): Update declarations.
7884 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7885 Add use_plt_offset parameter to global and local constructors.
7886 Change all callers. Change local_sym_index_ field to 31 bits.
7887 Change GSYM_CODE and CONSTANT_CODE accordingly.
7888 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7889 doing a static link don't set sh_link field.
7890 (Output_data_got::Got_entry::write): Use PLT offset if
7891 appropriate.
7892 (Output_data_got::add_global_plt): New function.
7893 (Output_data_got::add_local_plt): New function.
7894 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7895 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7896 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7897 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7898 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7899 IFUNC conditional.
7900 * testsuite/ifunc-sel.h: New file.
7901 * testsuite/ifuncmain1.c: New file.
7902 * testsuite/ifuncmain1vis.c: New file.
7903 * testsuite/ifuncmod1.c: New file.
7904 * testsuite/ifuncdep2.c: New file.
7905 * testsuite/ifuncmain2.c: New file.
7906 * testsuite/ifuncmain3.c: New file.
7907 * testsuite/ifuncmod3.c: New file.
7908 * testsuite/ifuncmain4.c: New file.
7909 * testsuite/ifuncmain5.c: New file.
7910 * testsuite/ifuncmod5.c: New file.
7911 * testsuite/ifuncmain6pie.c: New file.
7912 * testsuite/ifuncmod6.c: New file.
7913 * testsuite/ifuncmain7.c: New file.
7914 * configure, testsuite/Makefile.in: Rebuild.
7915
7916 2010-08-18 Ian Lance Taylor <iant@google.com>
7917
7918 * incremental.cc
7919 (Output_section_incremental_inputs::write_input_files): Add cast
7920 to avoid signed/unsigned comparison warning.
7921 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7922
7923 2010-08-12 Cary Coutant <ccoutant@google.com>
7924
7925 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7926
7927 2010-08-13 Ian Lance Taylor <iant@google.com>
7928
7929 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7930
7931 2010-08-12 Cary Coutant <ccoutant@google.com>
7932 Doug Kwan <dougkwan@google.com>
7933
7934 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7935 defintion overrides non-weak undef, remember that the original undef
7936 is not weak.
7937 * symtab.cc (Symbol_table::sized_write_global): For undef without
7938 an original weak binding, set binding to global in output.
7939 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7940 * testsuite/Makefile.in: Regenerate.
7941 * testsuite/strong_ref_weak_def.sh: New file.
7942 * testsuite/strong_ref_weak_def_1.c: Ditto.
7943 * testsuite/strong_ref_weak_def_2.c: Ditto.
7944
7945 2010-08-12 Cary Coutant <ccoutant@google.com>
7946
7947 * testsuite/incremental_test.sh: Rewrite.
7948 * testsuite/incremental_test_1.c: Rewrite.
7949 * testsuite/incremental_test_2.c: Rewrite.
7950
7951 2010-08-12 Cary Coutant <ccoutant@google.com>
7952
7953 * arm.cc (Target_arm::got_size): Add const.
7954 (Target_arm::got_entry_count): New function.
7955 (Target_arm::plt_entry_count): New function.
7956 (Target_arm::first_plt_entry_offset): New function.
7957 (Target_arm::plt_entry_size): New function.
7958 (Output_data_plt_arm::entry_count): New function.
7959 (Output_data_plt_arm::first_plt_entry_offset): New function.
7960 (Output_data_plt_arm::get_plt_entry_size): New function.
7961 * i386.cc (Target_i386::got_size): Add const.
7962 (Target_i386::got_entry_count): New function.
7963 (Target_i386::plt_entry_count): New function.
7964 (Target_i386::first_plt_entry_offset): New function.
7965 (Target_i386::plt_entry_size): New function.
7966 (Output_data_plt_i386::entry_count): New function.
7967 (Output_data_plt_i386::first_plt_entry_offset): New function.
7968 (Output_data_plt_i386::get_plt_entry_size): New function.
7969 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7970 find_incremental_inputs_sections. Dump incremental_got_plt section.
7971 * incremental.cc: Include target.h.
7972 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7973 parameter. Adjust all callers. Find incremental_got_plt section.
7974 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7975 section.
7976 (Output_section_incremental_inputs::set_final_data_size): Calculate
7977 size of incremental_got_plt section.
7978 (Output_section_incremental_inputs::do_write): Write the
7979 incremental_got_plt section.
7980 (Got_plt_view_info): New struct.
7981 (Local_got_offset_visitor): New class.
7982 (Global_got_offset_visitor): New class.
7983 (Global_symbol_visitor_got_plt): New class.
7984 (Output_section_incremental_inputs::write_got_plt): New function.
7985 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7986 Add parameter. Adjust all callers.
7987 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7988 (Incremental_inputs::got_plt_section): New function.
7989 (Incremental_inputs::got_plt_section_): New data member.
7990 (Incremental_got_plt_reader): New class.
7991 * layout.cc (Layout::create_incremental_info_sections): Add the
7992 incremental_got_plt section.
7993 * object.h (Got_offset_list::get_list): New function.
7994 (Got offset_list::for_all_got_offsets): New function.
7995 (Sized_relobj::local_got_offset_list): New function.
7996 * powerpc.cc (Target_powerpc::got_size): Add const.
7997 (Target_powerpc::got_entry_count): New function.
7998 (Target_powerpc::plt_entry_count): New function.
7999 (Target_powerpc::first_plt_entry_offset): New function.
8000 (Target_powerpc::plt_entry_size): New function.
8001 (Output_data_plt_powerpc::entry_count): New function.
8002 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8003 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8004 * sparc.cc (Target_sparc::got_size): Add const.
8005 (Target_sparc::got_entry_count): New function.
8006 (Target_sparc::plt_entry_count): New function.
8007 (Target_sparc::first_plt_entry_offset): New function.
8008 (Target_sparc::plt_entry_size): New function.
8009 (Output_data_plt_sparc::entry_count): New function.
8010 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8011 (Output_data_plt_sparc::get_plt_entry_size): New function.
8012 * symtab.h (Symbol::got_offset_list): New function.
8013 (Symbol_table::for_all_symbols): New function.
8014 * target.h (Sized_target::got_entry_count): New function.
8015 (Sized_target::plt_entry_count): New function.
8016 (Sized_target::plt_entry_size): New function.
8017 * x86_64.cc (Target_x86_64::got_size): Add const.
8018 (Target_x86_64::got_entry_count): New function.
8019 (Target_x86_64::plt_entry_count): New function.
8020 (Target_x86_64::first_plt_entry_offset): New function.
8021 (Target_x86_64::plt_entry_size): New function.
8022 (Output_data_plt_x86_64::entry_count): New function.
8023 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8024 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8025
8026 2010-08-12 Cary Coutant <ccoutant@google.com>
8027
8028 * archive.cc: Include incremental.h.
8029 (Archive::Archive): Initialize incremental_info_.
8030 (Archive::include_member): Record archive members in incremental info.
8031 (Add_archive_symbols::run): Record begin and end of an archive in
8032 incremental info.
8033 (Lib_group::include_member): Record objects in incremental info.
8034 * archive.h (Incremental_archive_entry): Forward declaration.
8035 (Archive::set_incremental_info): New member function.
8036 (Archive::incremental_info): New member function.
8037 (Archive::Unused_symbol_iterator): New class.
8038 (Archive::unused_symbols_begin): New member function.
8039 (Archive::unused_symbols_end): New member function.
8040 (Archive::incremental_info_): New data member.
8041 * incremental-dump.cc (find_input_containing_global): New function.
8042 (dump_incremental_inputs): Dump new incremental info sections.
8043 * incremental.cc: Include symtab.h.
8044 (Output_section_incremental_inputs): New class.
8045 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8046 new incremental info sections.
8047 (Sized_incremental_binary::do_check_inputs): Likewise.
8048 (Incremental_inputs::report_archive): Remove.
8049 (Incremental_inputs::report_archive_begin): New function.
8050 (Incremental_inputs::report_archive_end): New function.
8051 (Incremental_inputs::report_object): New function.
8052 (Incremental_inputs::finalize_inputs): Remove.
8053 (Incremental_inputs::report_input_section): New function.
8054 (Incremental_inputs::report_script): Rewrite.
8055 (Incremental_inputs::finalize): Do nothing but finalize string table.
8056 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8057 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8058 (Incremental_inputs::create_data_sections): New function.
8059 (Incremental_inputs::relocs_entsize): New function.
8060 (Output_section_incremental_inputs::set_final_data_size): New function.
8061 (Output_section_incremental_inputs::do_write): New function.
8062 (Output_section_incremental_inputs::write_header): New function.
8063 (Output_section_incremental_inputs::write_input_files): New function.
8064 (Output_section_incremental_inputs::write_info_blocks): New function.
8065 (Output_section_incremental_inputs::write_symtab): New function.
8066 * incremental.h (Incremental_script_entry): Forward declaration.
8067 (Incremental_object_entry): Forward declaration.
8068 (Incremental_archive_entry): Forward declaration.
8069 (Incremental_inputs): Forward declaration.
8070 (Incremental_inputs_header_data): Remove.
8071 (Incremental_inputs_header): Remove.
8072 (Incremental_inputs_header_write): Remove.
8073 (Incremental_inputs_entry_data): Remove.
8074 (Incremental_inputs_entry): Remove.
8075 (Incremental_inputs_entry_write): Remove.
8076 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8077 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8078 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8079 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8080 Likewise.
8081 (Incremental_input_entry): New class.
8082 (Incremental_script_entry): New class.
8083 (Incremental_object_entry): New class.
8084 (Incremental_archive_entry): New class.
8085 (Incremental_inputs::Incremental_inputs): Initialize new data members.
8086 (Incremental_inputs::report_inputs): Remove.
8087 (Incremental_inputs::report_archive): Remove.
8088 (Incremental_inputs::report_archive_begin): New function.
8089 (Incremental_inputs::report_archive_end): New function.
8090 (Incremental_inputs::report_object): Change prototype.
8091 (Incremental_inputs::report_input_section): New function.
8092 (Incremental_inputs::report_script): Change prototype.
8093 (Incremental_inputs::get_reloc_count): New function.
8094 (Incremental_inputs::set_reloc_count): New function.
8095 (Incremental_inputs::create_data_sections): New function.
8096 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8097 (Incremental_inputs::inputs_section): New function.
8098 (Incremental_inputs::symtab_section): New function.
8099 (Incremental_inputs::relocs_section): New function.
8100 (Incremental_inputs::get_stringpool): Add const.
8101 (Incremental_inputs::command_line): Add const.
8102 (Incremental_inputs::inputs): Remove.
8103 (Incremental_inputs::command_line_key): New function.
8104 (Incremental_inputs::input_file_count): New function.
8105 (Incremental_inputs::input_files): New function.
8106 (Incremental_inputs::relocs_entsize): New function.
8107 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8108 (Incremental_inputs::finalize_inputs): Remove.
8109 (Incremental_inputs::Input_info): Remove.
8110 (Incremental_inputs::lock_): Remove.
8111 (Incremental_inputs::inputs_): Change type.
8112 (Incremental_inputs::inputs_map_): Remove.
8113 (Incremental_inputs::current_object_entry_): New data member.
8114 (Incremental_inputs::inputs_section_): New data member.
8115 (Incremental_inputs::symtab_section_): New data member.
8116 (Incremental_inputs::relocs_section_): New data member.
8117 (Incremental_inputs::reloc_count_): New data member.
8118 (Incremental_inputs_reader): New class.
8119 (Incremental_symtab_reader): New class.
8120 (Incremental_relocs_reader): New class.
8121 * layout.cc (Layout::finalize): Move finalization of incremental info
8122 and creation of incremental info sections to follow finalization of
8123 symbol table. Set offsets for postprocessing sections.
8124 (Layout::create_incremental_info_sections): Call
8125 Incremental_inputs::create_data_sections. Add incremental symtab
8126 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
8127 sections to layout after input sections.
8128 * layout.h (struct Timespec): Forward declaration.
8129 (Layout::incremental_inputs): Add const.
8130 (Layout::create_incremental_info_sections): Add parameter.
8131 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8132 * object.cc: Include incremental.h.
8133 (Relobj::finalize_incremental_relocs): New function.
8134 (Sized_relobj::do_layout): Record input sections in incremental info.
8135 * object.h (Object::output_section): New function.
8136 (Object::output_section_offset): Moved from Relobj.
8137 (Object::get_incremental_reloc_base): New function.
8138 (Object::get_incremental_reloc_count): New function.
8139 (Object::do_output_section): New function.
8140 (Object::do_output_section_offset): Moved from Relobj.
8141 (Object::do_get_incremental_reloc_base): New function.
8142 (Object::do_get_incremental_reloc_count): New function.
8143 (Object::Object): Initialize new data members.
8144 (Relobj::output_section): Renamed do_output_section and moved to
8145 protected.
8146 (Relobj::output_section_offset): Moved to Object.
8147 (Relobj::do_get_incremental_reloc_base): New function.
8148 (Relobj::do_get_incremental_reloc_count): New function.
8149 (Relobj::allocate_incremental_reloc_counts): New function.
8150 (Relobj::count_incremental_reloc): New function.
8151 (Relobj::finalize_incremental_relocs): New function.
8152 (Relobj::next_incremental_reloc_index): New function.
8153 (Relobj::reloc_counts_): New data member.
8154 (Relobj::reloc_bases_): New data member.
8155 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
8156 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
8157 (Sized_relobj::incremental_relocs_scan): New function.
8158 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8159 (Sized_relobj::incremental_relocs_write): New function.
8160 (Sized_relobj::incremental_relocs_write_reltype): New function.
8161 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8162 incremental link.
8163 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8164 archives and object files elsewhere.
8165 (Add_symbols::run): Report object files here.
8166 (Finish_group::run): Report end of archive at end of group.
8167 * reloc.cc: Include layout.h, incremental.h.
8168 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8169 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8170 (Sized_relobj::incremental_relocs_scan): New function.
8171 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8172 (Sized_relobj::do_relocate_sections): Write incremental relocations.
8173 (Sized_relobj::incremental_relocs_write): New function.
8174 (Sized_relobj::incremental_relocs_write_reltype): New function.
8175 * script.cc (read_input_script): Rewrite test for incremental link.
8176 Change call to Incremental_inputs::report_script.
8177 * symtab.h (Symbol_table::first_global_index): New function.
8178 (Symbol_table::output_count): New function.
8179
8180 2010-08-12 Doug Kwan <dougkwan@google.com>
8181
8182 * arm.cc (Target_arm::merge_object_attributes): Check command line
8183 options --no-wchar-size-warning and --no-enum-size-warning.
8184 * options.h (General_options): Add ld-compatible options
8185 --no-enum-size-warning and --no-wchar-size-warning.
8186
8187 2010-08-04 Ian Lance Taylor <iant@google.com>
8188
8189 * x86_64.cc (Target_x86_64::Scan::local): Use
8190 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8191 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8192 (Target_x86_64::Scan::global): Likewise.
8193 (Target_x86_64::Relocate::relocate): Likewise.
8194 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8195 Likewise.
8196
8197 2010-08-03 Cary Coutant <ccoutant@google.com>
8198
8199 * merge.cc (Output_merge_string::do_add_input_section): Count strings
8200 to reserve space in merged_strings vector. Keep total input size
8201 for stats.
8202 (Output_merge_string::do_print_merge_stats): Print total input size.
8203 * merge.h (Output_merge_string): Add input_size_ field.
8204 * stringpool.cc (Stringpool_template::string_length): Move
8205 implementations out of Stringpool_template class and place in
8206 stringpool.h.
8207 * stringpool.h (string_length): Move out of Stringpool_template.
8208
8209 2010-08-03 Ian Lance Taylor <iant@google.com>
8210
8211 PR 11712
8212 * layout.cc (relaxation_loop_body): If address of load segment is
8213 set, adjust address to include headers if possible.
8214
8215 2010-08-03 Ian Lance Taylor <iant@google.com>
8216
8217 * version.cc (version_string): Bump to 1.10.
8218
8219 2010-08-03 Ian Lance Taylor <iant@google.com>
8220
8221 PR 11805
8222 * layout.h (enum Output_section_order): Define.
8223 (class Layout): Update declarations.
8224 * layout.cc (Layout::get_output_section): Add order parameter.
8225 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8226 is_first_non_relro parameters. Change all callers.
8227 (Layout::choose_output_section): Likewise.
8228 (Layout::add_output_section_data): Likewise.
8229 (Layout::make_output_section): Likewise. Set order.
8230 (Layout::default_section_order): New function.
8231 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8232 * output.cc (Output_section::Output_section): Initialize order_.
8233 Don't initialize deleted fields.
8234 (Output_segment::Output_segment): Don't initialize deleted
8235 fields.
8236 (Output_segment::add_output_section_to_load): New function
8237 replacing add_output_section. Change all callers to call this or
8238 add_output_section_to_nonload.
8239 (Output_segment::add_output_section_to_nonload): New function.
8240 (Output_segment::remove_output_section): Rewrite.
8241 (Output_segment::add_initial_output_data): Likewise.
8242 (Output_segment::has_any_data_sections): Likewise.
8243 (Output_segment::is_first_section_relro): Likewise.
8244 (Output_segment::maximum_alignment): Likewise.
8245 (Output_segment::has_dynamic_reloc): New function replacing
8246 dynamic_reloc_count. Change all callers.
8247 (Output_segment::has_dynamic_reloc_list): New function replacing
8248 dynamic_reloc_count_list. Change all callers.
8249 (Output_segment::set_section_addresses): Rewrite.
8250 (Output_segment::set_offset): Rewrite.
8251 (Output_segment::find_first_and_last_list): Remove.
8252 (Output_segment::set_tls_offsets): Rewrite.
8253 (Output_segment::first_section_load_address): Likewise.
8254 (Output_segment::output_section_count): Likewise.
8255 (Output_segment::section_with_lowest_load_address): Likewise.
8256 (Output_segment::write_section_headers): Likewise.
8257 (Output_segment::print_sections_to_map): Likewise.
8258 * output.h (class Output_data): Remove dynamic_reloc_count_
8259 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
8260 (Output_data::add_dynamic_reloc): Rewrite.
8261 (Output_data::has_dynamic_reloc): New function.
8262 (Output_data::dynamic_reloc_count): Remove.
8263 (class Output_section): Add order_ field. Remvoe is_relro_local_,
8264 is_last_relro_, is_first_non_relro_, is_interp_,
8265 is_dynamic_linker_section_ fields. Add order and set_order
8266 functions. Remove is_relro_local, set_is_relro_local,
8267 is_last_relro, set_is_last_relro, is_first_non_relro,
8268 set_is_first_non_relro functions, is_interp, set_is_interp,
8269 is_dynamic_linker_section, and set_is_dynamic_linker_section
8270 functions.
8271 (class Output_segment): Change Output_data_list from std::list to
8272 std:;vector. Add output_lists_ field. Remove output_data_ and
8273 output_bss_ fields. Update declarations.
8274
8275 2010-08-02 Ian Lance Taylor <iant@google.com>
8276
8277 * arm.cc (Target_arm::gc_process_relocs): Use typename.
8278 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8279 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8280
8281 2010-08-02 Ian Lance Taylor <iant@google.com>
8282
8283 PR 11855
8284 * script.cc (Script_options::Script_options): Initialize
8285 symbol_definitions_ and symbol_references_.
8286 (Script_options::add_symbol_assignment): Update
8287 symbol_definitions_ and symbol_references_.
8288 (Script_options::add_symbol_reference): New function.
8289 (script_symbol): New function.
8290 * script.h (class Script_options): Add symbol_definitions_ and
8291 symbol_references_ fields.
8292 (Script_options::referenced_const_iterator): New type.
8293 (Script_options::referenced_begin): New function.
8294 (Script_options::referenced_end): New function.
8295 (Script_options::is_referenced): New function.
8296 (Script_options::any_unreferenced): New function.
8297 * script-c.h (script_symbol): Declare.
8298 * yyscript.y (exp): Call script_symbol.
8299 * symtab.cc: Include "script.h".
8300 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8301 Change all callers. Check symbols referenced by scripts.
8302 (Symbol_table::add_undefined_symbols_from_command_line): Add
8303 layout parameter. Change all callers.
8304 (Symbol_table::do_add_undefined_symbols_from_command_line):
8305 Likewise. Break out loop body. Check symbols referenced by
8306 scripts.
8307 (Symbol_table::add_undefined_symbol_from_command_line): New
8308 function broken out of
8309 do_add_undefined_symbols_from_command_line.
8310 * symtab.h (class Symbol_table): Update declarations.
8311 * archive.cc: Include "layout.h".
8312 (Archive::should_include_member): Add layout parameter. Change
8313 all callers. Check for symbol mentioned in expression.
8314 * archive.h (class Archive): Update declaration.
8315 * object.cc (Sized_relobj::do_should_include_member): Add layout
8316 parameter.
8317 * object.h (Object::should_include_member): Add layout parameter.
8318 Change all callers.
8319 (Object::do_should_include_member): Add layout parameter.
8320 (class Sized_relobj): Update declaration.
8321 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8322 parameter.
8323 * dynobj.h (class Sized_dynobj): Update declaration.
8324 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8325 layout parameter.
8326 * plugin.h (class Sized_pluginobj): Update declaration.
8327
8328 2010-08-02 Ian Lance Taylor <iant@google.com>
8329
8330 PR 11866
8331 * output.cc (Output_segment::set_offset): Search for the first and
8332 last sections rather than assuming that the list is in order.
8333 (Output_segment::find_first_and_last_list): New function.
8334 * output.h (class Output_segment): Update declarations.
8335 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8336 (relro_strip_test_SOURCES): New variable.
8337 (relro_strip_test_DEPENDENCIES): New variable.
8338 (relro_strip_test_LDFLAGS): New variable.
8339 (relro_strip_test_LDADD): New variable.
8340 (relro_strip_test.so): New target.
8341
8342 2010-08-02 Ian Lance Taylor <iant@google.com>
8343
8344 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8345 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8346 (Target_i386::got_tlsdesc_section): New function.
8347 (Target_i386::got_section): Create space for GOT entries for
8348 TLSDESC relocations.
8349 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8350 R_386_TLS_GOTDESC.
8351 (Target_i386::Scan::global): Likewise.
8352 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8353 using TLSDESC GOT.
8354 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8355 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8356 (Target_x86_64::got_tlsdesc_section): New function.
8357 (Target_x86_64::got_section): Create space for GOT entries for
8358 TLSDESC relocations.
8359 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8360 R_386_TLS_GOTDESC.
8361 (Target_x86_64::Scan::global): Likewise.
8362 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8363 using TLSDESC GOT.
8364
8365 2010-08-02 Ian Lance Taylor <iant@google.com>
8366
8367 * testsuite/final_layout.sh: Use dc to convert from hex to
8368 decimal.
8369
8370 2010-07-29 Sriraman Tallam <tmsriram@google.com>
8371
8372 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8373 paramter to the call to gold::gc_process_relocs.
8374 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8375 paramter to the call to gold::gc_process_relocs.
8376 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8377 parameter to the call to gold::gc_process_relocs.
8378 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8379 template parameter to the call to gold::gc_process_relocs.
8380 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8381 paramter to the call to gold::gc_process_relocs.
8382 * gc.h (get_embedded_addend_size): New function.
8383 (gc_process_relocs): Save the size of the reloc for use by ICF.
8384 * icf.cc (get_section_contents): Get the addend from the text section
8385 for SHT_REL relocation sections.
8386 * icf.h (Icf::Reloc_addend_size_info): New typedef.
8387 (Icf::Reloc_info): Add new member reloc_addend_size_info.
8388 * int_encoding.h (read_from_pointer): New overloaded function.
8389 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8390 * testsuite/icf_sht_rel_addend_test.sh: New file.
8391 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8392 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8393
8394 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8395
8396 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8397 * Makefile.in: Regenerate.
8398 * testsuite/Makefile.in: Regenerate.
8399
8400 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
8401
8402 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8403 * gold/testsuite/debug_msg.cc: Likewise.
8404 * gold/testsuite/odr_violation1.cc
8405 * gold/testsuite/odr_violation2.cc
8406
8407 2010-07-21 Cary Coutant <ccoutant@google.com>
8408
8409 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8410 string, and length fields.
8411 (Output_merge_string::Merged_strings_list): New type.
8412 (Output_merge_string::Merged_strings_lists): New typedef.
8413 (Output_merge_string): Replace merged_strings_ with
8414 merged_strings_lists_.
8415 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8416 Merged_strings_list per input object and section. Don't store pointer
8417 to the string. Don't store length with each merged string entry.
8418 (Output_merge_string::finalize_merged_data): Loop over list of merged
8419 strings lists. Recompute length of each merged string.
8420
8421 2010-07-15 Cary Coutant <ccoutant@google.com>
8422
8423 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8424 here.
8425
8426 2010-07-14 Ian Lance Taylor <iant@google.com>
8427
8428 * descriptors.cc (Descriptors::open): Report correct name in error
8429 message.
8430
8431 2010-07-13 Doug Kwan <dougkwan@google.com>
8432
8433 * arm.cc (Arm_input_section::Arm_input_section): For a
8434 SHT_ARM_EXIDX section, always keeps the input sections.
8435 (Arm_input_section::set_exidx_section_link): New method.
8436 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8437 has_errors_ to false.
8438 (Arm_exidx_input_section::has_errors,
8439 Arm_exidx_input_section::set_has_errors): New methods.
8440 (Arm_exidx_input_section::has_errors_): New data member.
8441 (Arm_relobj::get_exidx_shndx_list): New method.
8442 (Arm_output_section::append_text_sections_to_list): Do not skip
8443 section without SHF_EXECINSTR.
8444 (Arm_output_section::fix_exidx_coverage): Skip input sections with
8445 errors.
8446 (Arm_relobj::make_exidx_input_section): Add new parameter for text
8447 section header. Make error messages more verbose. Check for
8448 a non-executable section linked to an EXIDX section.
8449 (Arm_relobj::do_read_symbols): Remove error checking, which has been
8450 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
8451 check that there is no deferred EXIDX section if we exit early.
8452 Instead of not making an EXIDX section in case of an error, make one
8453 and set the has_errors flag of it.
8454 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8455 in a relocatable link.
8456 (Target_arm::do_relax): Look for the EXIDX output section instead of
8457 assuming that it is called .ARM.exidx.
8458 (Target_arm::fix_exidx_coverage): Add a new parameter for input
8459 section list. Do not check for SHF_EXECINSTR section flags but
8460 skip any input section with errors.
8461 * output.cc (Output_section::Output_section): Initialize
8462 always_keeps_input_sections_ to false.
8463 (Output_section::add_input_section): Check for
8464 always_keeps_input_sections_.
8465 * output.h (Output_section::always_keeps_input_sections,
8466 Output_section::set_always_keeps_input_sections): New methods.
8467 (Output_section::always_keeps_input_sections): New data member.
8468
8469 2010-07-13 Rafael Espindola <espindola@google.com>
8470
8471 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8472 * fileread.h (Input_file): Add try_extra_search_path and find_file.
8473
8474 2010-07-13 Philip Herron <herron.philip@googlemail.com>
8475 Ian Lance Taylor <iant@google.com>
8476
8477 * output.h (Output_section_lookup_maps::add_merge_section):
8478 Correct check of whether value was inserted.
8479 (Output_section_lookup_maps::add_merge_input_section): Likewise.
8480 (Output_section_lookup_maps::add_relaxed_input_section):
8481 Likewise.
8482 * arm.cc (Target_arm::got_section): Remove used local os.
8483 * i386.cc (Target_i386::got_section): Likewise.
8484 * x86_64.cc (Target_x86_64::got_section): Likewise.
8485 * sparc.cc (Target_sparc::got_section): Likewise.
8486 (Target_sparc::relocate): Remove unused local have_got_offset.
8487 * powerpc.cc (Target_powerpc::relocate): Likewise.
8488
8489 2010-07-13 Ian Lance Taylor <iant@google.com>
8490
8491 * compressed_output.cc (zlib_decompress): Fix signature in
8492 !HAVE_ZLIB_H case.
8493
8494 * archive.cc (Archive::include_member): Unlock an external member
8495 of a thin archive. Don't bother to delete an object we know is
8496 NULL.
8497
8498 2010-07-12 Cary Coutant <ccoutant@google.com>
8499
8500 * compressed_output.cc (zlib_decompress): New function.
8501 (get_uncompressed_size): New function.
8502 (decompress_input_section): New function.
8503 * compressed_output.h (get_uncompressed_size): New function.
8504 (decompress_input_section): New function.
8505 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8506 Handle compressed debug sections.
8507 * layout.cc (is_compressed_debug_section): New function.
8508 (Layout::output_section_name): Map compressed section names to
8509 canonical names.
8510 * layout.h (is_compressed_debug_section): New function.
8511 (is_debug_info_section): Recognize compressed debug sections.
8512 * merge.cc: Include compressed_output.h.
8513 (Output_merge_data::do_add_input_section): Handle compressed
8514 debug sections.
8515 (Output_merge_string::do_add_input_section): Handle compressed
8516 debug sections.
8517 * object.cc: Include compressed_output.h.
8518 (Sized_relobj::Sized_relobj): Initialize new data members.
8519 (build_compressed_section_map): New function.
8520 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8521 * object.h (Object::section_is_compressed): New method.
8522 (Object::do_section_is_compressed): New method.
8523 (Sized_relobj::Compressed_section_map): New type.
8524 (Sized_relobj::do_section_is_compressed): New method.
8525 (Sized_relobj::compressed_sections_): New data member.
8526 * output.cc (Output_section::add_input_section): Handle compressed
8527 debug sections.
8528 * reloc.cc: Include compressed_output.h.
8529 (Sized_relobj::write_sections): Handle compressed debug sections.
8530
8531 2010-07-08 Cary Coutant <ccoutant@google.com>
8532
8533 * resolve.cc (Symbol_table::resolve): Remember whether undef was
8534 weak when resolving to a dynamic def.
8535 (Symbol_table::should_override): Add adjust_dyndef flag; set it
8536 for weak undef/dynamic def cases. Adjust callers.
8537 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8538 undef_binding_weak_.
8539 (Symbol_table::sized_write_globals): Adjust symbol binding.
8540 (Symbol_table::sized_write_symbol): Add binding parameter.
8541 * symtab.h (Symbol::set_undef_binding): New method.
8542 (Symbol::is_undef_binding_weak): New method.
8543 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8544 (Symbol_table::should_override): Add new parameter.
8545 (Symbol_table::sized_write_symbol): Add new parameter.
8546
8547 * testsuite/weak_undef_file1.cc: Add new test case.
8548 * testsuite/weak_undef_file2.cc: Fix header comment.
8549 * testsuite/weak_undef_test.cc: Add new test case.
8550
8551 2010-06-29 Doug Kwan <dougkwan@google.com>
8552
8553 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8554 Initialize USE_SYMBOL_.
8555 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8556 definition.
8557 (Arm_reloc_property::uses_symbol_): New data member declaration.
8558 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8559 uses symbol value and symbol is undefined but not weakly undefined.
8560
8561 2010-06-28 Rafael Espindola <espindola@google.com>
8562
8563 * plugin.cc (Plugin::load): Use dlerror.
8564
8565 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8566
8567 * symtab.cc (detect_odr_violations): When reporting an ODR
8568 violation, report an object where the symbol is defined.
8569
8570 2010-06-25 Doug Kwan <dougkwan@google.com>
8571
8572 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8573 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8574 definition.
8575 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8576 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8577 target hook to detect function points.
8578 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8579 * icf.h (Icf::check_section_for_function_pointers): Change type of
8580 parameter SECTION_NAME to const reference to std::string. Use
8581 target hook to determine if section may have unsafe pointers.
8582 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8583 method definition.
8584
8585 2010-06-21 Rafael Espindola <espindola@google.com>
8586
8587 * fileread.cc (Input_file::find_fie): New
8588 (Input_file::open): Use Input_file::find_fie.
8589 * fileread.h (Input_file::find_fie): New
8590 * plugin.cc (set_extra_library_path): New.
8591 (Plugin::load): Add set_extra_library_path to the transfer vector.
8592 (Plugin_manager::set_extra_library_path): New.
8593 (Plugin_manager::add_input_file): Use the extra search path if set.
8594 (set_extra_library_path(): New.
8595 * plugin.h (Plugin_manager): Add set_extra_library_path and
8596 extra_search_path_.
8597
8598 2010-06-19 Cary Coutant <ccoutant@google.com>
8599
8600 * layout.cc (gdb_sections): Add .debug_types.
8601 (lines_only_debug_sections): Likewise.
8602
8603 2010-06-18 Rafael Espindola <espindola@google.com>
8604
8605 * plugin.cc (add_input_file,add_input_library)
8606 (Plugin_manager::add_input_file): Make filename arguments const.
8607 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8608 const.
8609
8610 2010-06-16 Doug Kwan <dougkwan@google.com>
8611
8612 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8613 .ARM.attributes section if we have not merged any input
8614 attributes sections.
8615
8616 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8617
8618 * arm.cc: Allow combining objects with no EABI version
8619 information.
8620
8621 2010-06-15 Rafael Espindola <espindola@google.com>
8622
8623 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8624
8625 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8626
8627 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8628 (struct iovec): Correct !HAVE_READV definition.
8629
8630 2010-06-10 Cary Coutant <ccoutant@google.com>
8631
8632 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8633 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8634 reloc sections.
8635 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8636
8637 PR 11683
8638 * symtab.h (Symbol::is_placeholder): New member function.
8639 * target-reloc.h (relocate_section): Check for placeholder symbols.
8640
8641 * testsuite/Makefile.am (plugin_test_8): New test.
8642 (plugin_test_9): New test.
8643 * testsuite/Makefile.in: Regenerate.
8644
8645 2010-06-09 Nick Clifton <nickc@redhat.com>
8646
8647 * yyscript.y (input_list_element): Allow strings prefixed with
8648 the '-' character. Treat these as libraries.
8649 * script.cc (script_add_library): New function. Adds a library
8650 specified by "-l<name>" found in an input script.
8651 * script-c.h: Add prototype for script_add_library.
8652
8653 2010-06-07 Doug Kwan <dougkwan@google.com>
8654
8655 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8656 Restrict stub-group size to be within long conditional branch
8657 range when working around cortex-A8 erratum.
8658
8659 2010-06-07 Damien Diederen <dd@crosstwine.com>
8660
8661 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8662 #ifdef typo.
8663
8664 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8665
8666 PR gold/11658
8667 * output.cc
8668 (Output_section::Input_section_sort_entry::compare_section_ordering):
8669 Change to return non-zero correctly.
8670 (Output_section::Input_section_sort_section_order_index_compare
8671 ::operator()): Change to fix ambiguity in comparisons.
8672
8673 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8674
8675 * gold.h (is_wildcard_string): New function.
8676 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8677 (Layout::layout_eh_frame): Ditto.
8678 (Layout::find_section_order_index): New method.
8679 (Layout::read_layout_from_file): New method.
8680 * layout.h (Layout::find_section_order_index): New method.
8681 (Layout::read_layout_from_file): New method.
8682 (Layout::input_section_position_): New private member.
8683 (Layout::input_section_glob_): New private member.
8684 * main.cc (main): Call read_layout_from_file here.
8685 * options.h (--section-ordering-file): New option.
8686 * output.cc (Output_section::input_section_order_specified_): New
8687 member.
8688 (Output_section::Output_section): Initialize new member.
8689 (Output_section::add_input_section): Add new parameter.
8690 Keep input sections when --section-ordering-file is used.
8691 (Output_section::set_final_data_size): Sort input sections when
8692 section ordering file is specified.
8693 (Output_section::Input_section_sort_entry): Add new parameter.
8694 Check sorting type.
8695 (Output_section::Input_section_sort_entry::compare_section_ordering):
8696 New method.
8697 (Output_section::Input_section_sort_compare::operator()): Change to
8698 consider section_order_index.
8699 (Output_section::Input_section_sort_init_fini_compare::operator()):
8700 Change to consider section_order_index.
8701 (Output_section::Input_section_sort_section_order_index_compare
8702 ::operator()): New method.
8703 (Output_section::sort_attached_input_sections): Change to sort
8704 according to section order when specified.
8705 (Output_section::add_input_section<32, true>): Add new parameter.
8706 (Output_section::add_input_section<64, true>): Add new parameter.
8707 (Output_section::add_input_section<32, false>): Add new parameter.
8708 (Output_section::add_input_section<64, false>): Add new parameter.
8709 * output.h (Output_section::add_input_section): Add new parameter.
8710 (Output_section::input_section_order_specified): New
8711 method.
8712 (Output_section::set_input_section_order_specified): New method.
8713 (Input_section::Input_section): Initialize section_order_index_.
8714 (Input_section::section_order_index): New method.
8715 (Input_section::set_section_order_index): New method.
8716 (Input_section::section_order_index_): New member.
8717 (Input_section::Input_section_sort_section_order_index_compare): New
8718 struct.
8719 (Output_section::input_section_order_specified_): New member.
8720 * script-sections.cc (is_wildcard_string): Delete and move modified
8721 method to gold.h.
8722 (Output_section_element_input::Output_section_element_input): Modify
8723 call to is_wildcard_string.
8724 (Output_section_element_input::Input_section_pattern
8725 ::Input_section_pattern): Ditto.
8726 (Output_section_element_input::Output_section_element_input): Ditto.
8727 * testsuite/Makefile.am (final_layout): New test case.
8728 * testsuite/Makefile.in: Regenerate.
8729 * testsuite/final_layout.cc: New file.
8730 * testsuite/final_layout.sh: New file.
8731
8732 2010-06-01 Rafael Espindola <espindola@google.com>
8733
8734 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8735
8736 2010-06-01 Rafael Espindola <espindola@google.com>
8737
8738 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8739 visibility of symbols.
8740
8741 2010-05-27 Doug Kwan <dougkwan@google.com>
8742
8743 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8744 from start of output section instead of address for a local symbol
8745 in a merged or relaxed section when doing a relocatable link.
8746
8747 2010-05-26 Rafael Espindola <espindola@google.com>
8748
8749 PR 11604
8750 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8751 adding sections the garbage collector removed.
8752 * gold/testsuite/Makefile.am: Add test.
8753 * gold/testsuite/Makefile.in: Regenerate.
8754 * gold/testsuite/plugin_test_7.sh: New.
8755 * gold/testsuite/plugin_test_7_1.c: New.
8756 * gold/testsuite/plugin_test_7_2.c: New.
8757
8758 2010-05-26 Rafael Espindola <espindola@google.com>
8759
8760 * script-sections.cc (Output_section_definition::set_section_addresses):
8761 Check for --section-start.
8762
8763 2010-05-26 Doug Kwan <dougkwan@google.com>
8764
8765 * arm.cc (Arm_scan_relocatable_relocs): New class.
8766 (Target_arm::relocate_special_relocatable): New method.
8767 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8768 (Arm_relocate_functions::thumb_branch_common): Same.
8769 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8770 instead of Default_scan_relocatable_relocs.
8771 * target-reloc.h (relocate_for_relocatable): Let target handle
8772 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8773 * target.h (Sized_target::relocate_special_relocatable): New method.
8774
8775 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8776
8777 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8778
8779 2010-05-23 Doug Kwan <dougkwan@google.com>
8780
8781 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8782 instead of a cast.
8783 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8784 with a direct branch, not a conditional branch, to a stub.
8785 * merge.cc (Output_merge_base::record_input_section): New method
8786 defintion.
8787 (Output_merge_data::do_add_input_section): Record input section if
8788 keeps-input-sections flag is set.
8789 (Output_merge_string::do_add_input_section): Ditto.
8790 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8791 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8792 INPUT_SECTIONS_.
8793 (Output_merge_base::keeps_input_sections,
8794 Output_merge_base::set_keeps_input_sections,
8795 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8796 method definitions.
8797 (Output_merge_base::Input_sections): New type declaration.
8798 (Output_merge_base::input_sections_begin,
8799 Output_merge_base::input_sections_end,
8800 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8801 (Output_merge_base::bool keeps_input_sections_,
8802 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8803 Output_merge_base::input_sections_): New data members.
8804 (Output_merge_data::do_set_keeps_input_sections): New method
8805 defintion.
8806 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8807 * output.cc (Output_section::Input_section::relobj): Move method
8808 defintion from class declaration to here and handle merge sections.
8809 (Output_section::Input_section::shndx): Ditto.
8810 (Output_section::Output_section): Remove initializations of removed
8811 data members and initialize new data member LOOKUP_MAPS_.
8812 (Output_section::add_input_section): Set keeps-input-sections flag
8813 for a newly created merge output section as appropriate. Adjust code
8814 to use Output_section_lookup_maps class.
8815 (Output_section::add_relaxed_input_section): Adjst code for lookup
8816 maps code refactoring.
8817 (Output_section::add_merge_input_section): Add a new parameter
8818 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8819 class. If adding input section to a newly created merge output
8820 section fails, remove the new merge section.
8821 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8822 Adjust code for use of the Output_section_lookup_maps class.
8823 (Output_section::find_merge_section): Ditto.
8824 (Output_section::build_lookup_maps): New method defintion.
8825 (Output_section::find_relaxed_input_section): Adjust code to use
8826 Output_section_lookup_maps class.
8827 (Output_section::get_input_sections): Export merge sections. Adjust
8828 code to use Output_section_lookup_maps class.
8829 (Output_section:::add_script_input_section): Adjust code to use
8830 Output_section_lookup_maps class. Update lookup maps for merge
8831 sections also.
8832 (Output_section::discard_states): Use Output_section_lookup_maps.
8833 (Output_section::restore_states): Same.
8834 * output.h (Merge_section_properties): Move class defintion out of
8835 Output_section.
8836 (Output_section_lookup_maps): New class.
8837 (Output_section::Input_section::is_merge_section): New method
8838 defintion.
8839 (Output_section::Input_section::relobj): Move defintion out of class
8840 defintion. Declare method only.
8841 (Output_section::Input_section::shndx): Ditto.
8842 (Output_section::Input_section::output_merge_base): New method defintion.
8843 (Output_section::Input_section::u2_.pomb): New union field.
8844 (Output_section::Merge_section_by_properties_map,
8845 Output_section::Output_section_data_by_input_section_map,
8846 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8847 Remove types.
8848 (Output_section::add_merge_input_section): Add new parameter
8849 KEEPS_INPUT_SECTIONS.
8850 (Output_section::build_lookup_maps): New method declaration.
8851 (Output_section::merge_section_map_,
8852 Output_section::merge_section_by_properties_map_,
8853 Output_section::relaxed_input_section_map_,
8854 Output_section::is_relaxed_input_section_map_valid_): Remove data
8855 members.
8856 (Output_section::lookup_maps_): New data member.
8857
8858 2010-05-21 Doug Kwan <dougkwan@google.com>
8859
8860 PR gold/11619
8861 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8862 avoid a compilation error.
8863
8864 2010-05-19 Rafael Espindola <espindola@google.com>
8865
8866 * script-sections.cc (Output_section_definition::allocate_to_segment):
8867 Update the phdrs_list even when the output section is NULL.
8868 * testsuite/Makefile.am: Add test.
8869 * testsuite/Makefile.in: Regenerate.
8870 * testsuite/script_test_9.cc: New.
8871 * testsuite/script_test_9.sh: New.
8872 * testsuite/script_test_9.t: New.
8873
8874 2010-05-19 Doug Kwan <dougkwan@google.com>
8875
8876 * arm.cc (Arm_input_section::original_size): New method.
8877 (Arm_input_section::do_addralign): Add a cast.
8878 (Arm_input_section::do_output_offset): Remove static cast.
8879 (Arm_input_section::original_addralign,
8880 Arm_input_section::original_size_): Change type to uint32_t.
8881 (Arm_input_section::init): Add safe casts for section alignment
8882 and size.
8883 (Arm_input_section::set_final_data_size): Do not set address and
8884 offset of stub table.
8885 (Arm_output_section::fix_exidx_coverage): Change use of of
8886 Output_section::Simple_input_section to that of
8887 Output_section::Input_section.
8888 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8889 except for the first pass.
8890 * output.cc (Output_section::get_input_sections): Change type of
8891 input_sections to std::list<Input_section>.
8892 (Output_section::add_script_input_section): Rename from
8893 Output_section::add_simple_input_section. Change type of SIS
8894 parameter from Simple_input_section to Input_section.
8895 * output.h (Output_section::Simple_input_section): Remove class.
8896 (Output_section::Input_section): Change class visibility to public.
8897 (Output_section::Input_section::addralign): Use stored alignments
8898 for special input sections if set.
8899 (Output_section::Input_section::set_addralign): New method.
8900 (Output_section::get_input_sections): Change parameter type from
8901 list of Simple_input_section to list of Input_section.
8902 (Output_section::add_script_input_section): Rename from
8903 Output_section::add_simple_input_section. Change first parameter's
8904 type from Simple_input_section to Input_section and remove the
8905 second and third parameters.
8906 * script-sections.cc (Input_section::Input_section_list): Change
8907 type to list of Output_section::Input_section/
8908 (Input_section_info::Input_section_info): Change parameter type of
8909 INPUT_SECTION to Output_section::Input_section.
8910 (Input_section_info::input_section): Change return type.
8911 (Input_section_info::input_section_): Change type to
8912 Output_section::Input_section.
8913 (Output_section_element_input::set_section_addresses): Adjust code
8914 to use Output_section::Input_section instead of
8915 Output_section::Simple_input_section. Adjust code for renaming
8916 of Output_section::add_simple_input_section.
8917 (Orphan_output_section::set_section_addresses): Ditto.
8918
8919 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8920
8921 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8922 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8923
8924 2010-05-18 Rafael Espindola <espindola@google.com>
8925
8926 * options.cc (General_options::finalize): Handle -nostdlib.
8927 * options.h (nostdlib): New option.
8928 * script.cc (script_add_search_dir): Handle -nostdlib.
8929
8930 2010-05-12 Doug Kwan <dougkwan@google.com>
8931
8932 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8933 attributes section only if there no attributes section after merging.
8934 (Target_arm::merge_object_attributes): Move value of
8935 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8936 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8937 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8938 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8939 and arm_attr_merge_7.stdout.
8940 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8941 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8942 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8943 arm_attr_merge_7b.o): New rules.
8944 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8945 arm_attr_merge_7
8946 * testsuite/Makefile.in: Regenerate.
8947 * testsuite/arm_attr_merge.sh: New file.
8948 * testsuite/arm_attr_merge_[67][ab].s: Same.
8949
8950 2010-05-05 Nick Clifton <nickc@redhat.com>
8951
8952 * po/es.po: Updated Spanish translation.
8953
8954 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8955
8956 * Makefile.am (install-exec-local): Properly install gold as
8957 default cross linker.
8958 * Makefile.in: Regenerated.
8959
8960 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8961 Nick Clifton <nickc@redhat.com>
8962
8963 * configure.ac (install_as_default): Define and set to false
8964 unless --enable-gold or --enable-gold=both/gold has been
8965 specified.
8966 * configure: Regenerate.
8967
8968 * Makefile.am (install-exec-local): Install the executable as
8969 'ld.gold'. If install_as_default is true then also install it as
8970 'ld'.
8971 * Makefile.in: Regenerated.
8972
8973 2010-04-24 Ian Lance Taylor <iant@google.com>
8974
8975 * layout.cc (Layout::layout_reloc): In relocatable link don't
8976 combine reloc sections for grouped sections.
8977
8978 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8979
8980 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8981 sections that are not ordinary to icf.
8982 * icf.cc (get_section_contents): Handle relocation pointing to section
8983 with no object or shndx information.
8984 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8985 * testsuite/Makefile.in: Regenerate.
8986 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8987 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8988
8989 2010-04-22 Ian Lance Taylor <iant@google.com>
8990
8991 * expression.cc (Expression::Expression_eval_info): Add
8992 result_alignment_pointer field.
8993 (Expression::eval_with_dot): Add result_alignment_pointer
8994 parameter. Change all callers.
8995 (Expression::eval_maybe_dot): Likewise.
8996 (class Binary_expression): Add alignment_pointer parameter to
8997 left_value and right_value. Change all callers.
8998 (BINARY_EXPRESSION): Set result alignment.
8999 (class Trinary_expression): Add alignment_pointer parameter to
9000 arg2_value and arg3_value. Change all callers.
9001 (Trinary_cond::value): Set result alignment.
9002 (Max_expression::value, Min_expression::value): Likewise.
9003 (Align_expression::value): Likewise.
9004 * script-sections.cc (class Sections_element): Add dot_alignment
9005 parameter to set_section_addresses virtual function. Update
9006 instantiations.
9007 (class Output_section_element): Likewise.
9008 (Script_sections::create_segments): Add dot_alignment parameter.
9009 Change all callers.
9010 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9011 (Script_sections::set_phdrs_clause_addresses): Likewise.
9012 * script-sections.h: Update declarations.
9013 * script.h: Update declarations.
9014 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9015 min_p_align.
9016 * testsuite/script_test_3.t: Set large alignment.
9017 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9018 segment has expected alignment.
9019
9020 2010-04-22 Nick Clifton <nickc@redhat.com>
9021
9022 * po/gold.pot: Updated by the Translation project.
9023 * po/vi.po: Updated Vietnamese translation.
9024
9025 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9026
9027 * testsuite/Makefile.am (check_PROGRAMS): Add
9028 icf_virtual_function_folding_test.
9029 * testsuite/Makefile.in: Regenerated.
9030
9031 2010-04-15 Andrew Haley <aph@redhat.com>
9032
9033 * options.h (merge_exidx_entries): New option.
9034 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9035 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9036 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9037 (Target_arm::merge_exidx_entries): New function.
9038 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9039 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9040 to Arm_exidx_fixup constructor.
9041 Add new arg, merge_exidx_entries.
9042 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9043 Arm_output_section::fix_exidx_coverage.
9044
9045 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9046
9047 * icf.cc (get_section_contents): Check for preemptible functions.
9048 Ignore addend when appropriate.
9049 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9050 section folded.
9051 (add_from_relobj): Check for section folded.
9052 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9053 * symtab.h (should_add_dynsym_entry): Add new parameter.
9054 * target-reloc.h (scan_relocs): Check for section folded.
9055 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9056 Check reloc types for function pointers in shared objects.
9057 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9058 case.
9059 (icf_preemptible_functions_test): New test case.
9060 (icf_string_merge_test): New test case.
9061 * testsuite.Makefile.in: Regenerate.
9062 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9063 bar_glob. Refactor code.
9064 * testsuite/icf_preemptible_functions_test.cc: New file.
9065 * testsuite/icf_preemptible_functions_test.sh: New file.
9066 * testsuite/icf_string_merge_test.cc: New file.
9067 * testsuite/icf_string_merge_test.sh: New file.
9068 * testsuite/icf_virtual_function_folding_test.cc: New file.
9069 * testsuite/icf_virtual_function_folding_test.sh: New file.
9070
9071 2010-04-14 Doug Kwan <dougkwan@google.com>
9072
9073 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9074 for local symbol recounting if we remove a section due to ICF.
9075 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9076 there are no regular objects in input.
9077
9078 2010-04-13 Doug Kwan <dougkwan@google.com>
9079
9080 * arm.cc (Arm_input_section::set_final_data_size): Compute
9081 accurate final data size instead of using current data size.
9082
9083 2010-04-09 Doug Kwan <dougkwan@google.com>
9084
9085 * layout.cc (Layout::choose_output_section): Handle script section
9086 types.
9087 (Layout::make_output_section_for_script): Add section type parameter.
9088 Handle script section types.
9089 * layout.h (Layout::make_output_section_for_script): Add section
9090 type parameter.
9091 * output.cc (Output_section::Output_section): Initialize data member
9092 is_noload_.
9093 (Output_section::do_reset_address_and_file_offset): Do not set address
9094 to 0 if section is a NOLOAD section.
9095 * output.h (Output_section::is_noload): New method.
9096 (Output_section::set_is_noload): Ditto.
9097 (Output_section::is_noload_): New data member.
9098 * script-c.h (Script_section_type): New enum type.
9099 (struct Parser_output_section_header): Add new file section_type.
9100 * script-sections.cc (Sections_element::output_section_name): Add
9101 parameter for returning script section type.
9102 (Output_section_definition::output_section_name): Ditto.
9103 (Output_section_definition::section_type)P; New method.
9104 (Output_section_definiton::script_section_type_name): Ditto.
9105 (Output_section_definition::script_section_type_): New data member.
9106 (Output_section_definition::Output_section_definition): Initialize
9107 data member Output_section_definition::script_section_type_.
9108 (Output_section_definition::create_sections): Pass script section type
9109 to Layout::make_output_section_for_script.
9110 (Output_section_definition::output_section_name): Return script
9111 section type to caller.
9112 (Output_section_definition::set_section_address): Do not advance
9113 dot value and load address if section type is NOLOAD. Set address
9114 of NOLOAD sections regardless of section flags.
9115 (Output_section_definition::print): Print section type if it is
9116 not SCRIPT_SECTION_TYPE_NONE.
9117 (Output_section_definition::section_type): New method.
9118 (Output_section_definition::script_section_type_name): Ditto.
9119 (Script_sections::output_section_name): Add new parameter
9120 PSECTION_TYPE for returning script section type. Pass it to
9121 section elements. Handle discard sections.
9122 (Sort_output_sections::operator()): Handle NOLOAD sections.
9123 * script-sections.h (Script_sections::Section_type): New enum type.
9124 (Script_sections::output_section_name): Add a new parameter for
9125 returning script section type.
9126 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9127 INFO and NOLOAD.
9128 * yyscript.y (union): Add new field SECTION_TYPE.
9129 (COPY, DSECT, INFO, NOLOAD): New tokens.
9130 (opt_address_and_section_type): Change type to output_section_header.
9131 (section_type): New non-terminal
9132 (section_header): Handle section type.
9133 (opt_address_and_section_type): Return section type value.
9134
9135 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
9136
9137 * testsuite/plugin_common_test_1.c (foo): Add prototype.
9138 * testsuite/plugin_common_test_2.c (foo): Likewise.
9139
9140 2010-04-08 Doug Kwan <dougkwan@google.com>
9141
9142 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9143 Output_merge_data.
9144 * output.cc (Output_section::add_merge_input_section): Simplify
9145 code and return status of Output_merge_base::add_input_section.
9146 Update merge section map only if Output_merge_base::add_input_section
9147 returns true.
9148
9149 2010-04-07 Doug Kwan <dougkwan@google.com>
9150
9151 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9152 if section is marked as containing instructions but has no mapping
9153 symbols.
9154 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9155 correct section index.
9156 (Arm_relobj::find_linked_text_section): Ditto.
9157
9158 2010-04-07 Cary Coutant <ccoutant@google.com>
9159
9160 * archive.cc (include_member): Destroy Read_symbols_data object before
9161 releasing file.
9162 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9163 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9164 (Read_symbols_data::~Read_symbols_data) New destructor.
9165 (Section_relocs::Section_relocs) New constructor.
9166 (Section_relocs::~Section_relocs) New destructor.
9167 (Read_relocs_data::Read_relocs_data) New constructor.
9168 (Read_relocs_data::~Read_relocs_data) New destructor.
9169 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9170 pointers to NULL after deleting.
9171
9172 2010-04-07 Doug Kwan <dougkwan@google.com>
9173
9174 * arm.cc: Replace "endianity" with "endianness" in comments.
9175 (Arm_exidx_cantunwind): Ditto.
9176 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9177 (Arm_relobj::merge_flags_and_attributes): New method.
9178 (Arm_relobj::merge_flags_and_attributes_): New data member.
9179 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9180 (Arm_relobj::scan_sections_for_stubs): Ditto.
9181 (Arm_relobj::do_read_symbols): Check to see if we really want to
9182 merge processor-specific flags and attributes. Exit early if
9183 an object is empty except for section names and the undefined symbol.
9184 (Target_arm::do_finalize_sections): Move check for ELF format to
9185 Arm_relobj::do_read_symbols. Merge processor specific flags and
9186 attributes from a regular object only when we have determined that
9187 it is aapropriate. Do not create an .ARM.attributes section in
9188 output if there is no regular input object.
9189 (Target_arm::merge_processor_specific_flags): Check
9190 --warn-mismatch before printing any error.
9191 (Target_arm::merge_object_attributes): Ditto.
9192 * gold.cc (queue_middle_tasks): Handle the case in which there is
9193 no regular object in input.
9194 * options.cc (General_options::parse_EB): New method.
9195 (General_options::parse_EL): Same.
9196 (General_options::General_options): Initialize endianness_.
9197 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9198 New options.
9199 (General_options::Endianness): New enum.
9200 (General_options::endianness): New method.
9201 (General_options::endianness_): New data member.
9202 * parameters.cc (Parameters::set_options): Check target endianness.
9203 (Parameters::set_target_once): Ditto.
9204 (Parameters::check_target_endianness): New method.
9205 (parameters_force_valid_target): If either -EL or -EB is specified,
9206 use it to define endianness of default target.
9207 * parameters.h (Parameters::check_target_endianness): New method
9208 declaration.
9209 * target.h (class Target): Change "endianity" to "endianness"
9210 in comments.
9211
9212 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9213
9214 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9215 * configure: Regenerate.
9216 * Makefile.in: Regenerate.
9217 * testsuite/Makefile.in: Regenerate.
9218
9219 2010-04-06 Cary Coutant <ccoutant@google.com>
9220
9221 gcc PR lto/42757
9222 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9223 prevailing definitions of common symbols.
9224 * testsuite/plugin_test_6.sh: New test case.
9225 * testsuite/plugin_common_test_1.c: New test case.
9226 * testsuite/plugin_common_test_2.c: New test case.
9227 * testsuite/Makefile.am (plugin_test_6): New test case.
9228 * testsuite/Makefile.in: Regenerate.
9229
9230 2010-04-06 Nick Clifton <nickc@redhat.com>
9231
9232 * po/vi.po: New Vietnamese translation.
9233
9234 2010-03-30 Doug Kwan <dougkwan@google.com>
9235
9236 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9237
9238 2010-03-25 Doug Kwan <dougkwan@google.com>
9239
9240 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9241 to avoid a conversion warning on a 32-bit host.
9242
9243 2010-03-24 Ian Lance Taylor <iant@google.com>
9244
9245 * testsuite/script_test_3.t: Add a TLS segment.
9246 * testsuite/Makefile.am (check_PROGRAMS): Add
9247 tls_phdrs_script_test.
9248 (tls_phdrs_script_test_SOURCES): Define.
9249 (tls_phdrs_script_test_DEPENDENCIES): Define.
9250 (tls_phdrs_script_test_LDFLAGS): Define.
9251 (tls_phdrs_script_test_LDADD): Define.
9252 * testsuite/Makefile.in: Rebuild.
9253
9254 2010-03-23 Cary Coutant <ccoutant@google.com>
9255
9256 * fileread.cc (find_or_make_view): Fix comment.
9257
9258 2010-03-23 Ian Lance Taylor <iant@google.com>
9259
9260 * script-sections.cc (class Orphan_section_placement): Define
9261 PLACE_TLS and PLACE_TLS_BSS.
9262 (Orphan_section_placement::Orphan_section_placement): Initialize
9263 new places.
9264 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9265 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9266 (tls_script_test_SOURCES): Define.
9267 (tls_script_test_DEPENDENCIES): Define.
9268 (tls_script_test_LDFLAGS): Define.
9269 (tls_script_test_LDADD): Define.
9270 * testsuite/Makefile.in: Rebuild.
9271
9272 2010-03-22 Doug Kwan <dougkwan@google.com>
9273
9274 * arm.cc (Arm_relocate_functions::abs8,
9275 Arm_relocate_functions::abs16): Use correct check for overflow
9276 specified in the ARM ELF specs.
9277 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
9278 target of a BLX instruction specially.
9279 (Reloc_stub::stub_type_for_reloc): Ditto.
9280 (Relocate::relocate): Use symbolic names instead of numeric relocation
9281 codes to report error.
9282 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9283 workaround.
9284 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9285 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9286 thumb2_blx_out_of_range.stdout
9287 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9288 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9289 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9290 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9291 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9292 thumb2_blx_in_range, thumb2_blx_in_range.o,
9293 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9294 thumb2_blx_out_of_range.o): New rules.
9295 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9296 thumb2_blx_in_range and thumb2_blx_out_of_range.
9297 * testsuite/Makefile.in: Regenerate.
9298 * arm_branch_in_range.sh: Add tests for THUMB BLX.
9299 * testsuite/thumb_blx_in_range.s: New file.
9300 * testsuite/thumb_blx_out_of_range.s: New file.
9301
9302 2010-03-22 Rafael Espindola <espindola@google.com>
9303
9304 * archive.cc (Should_include): Move to archive.h.
9305 (should_include_member): Make it a member of Archive.
9306 (Lib_group): New.
9307 (Add_lib_group_symbols): New.
9308 * archive.h: Include options.h.
9309 (Archive_member): Moved from Archive.
9310 (Should_include): Moved from archive.cc.
9311 (Lib_group): New.
9312 (Add_lib_group_symbols): New.
9313 * dynobj.cc (do_should_include_member): New.
9314 * dynobj.h (do_should_include_member): New.
9315 * gold.cc (queue_initial_tasks): Update call to queue.
9316 * main.cc (main): Print lib group stats.
9317 * object.cc (do_should_include_member): New.
9318 * object.h: Include archive.h.
9319 (Object::should_include_member): New.
9320 (Object::do_should_include_member): New.
9321 (Sized_relobj::do_should_include_member): New.
9322 * options.cc (General_options::parse_start_lib): New.
9323 (General_options::parse_end_lib): New.
9324 (Input_arguments::add_file): Handle lib groups.
9325 (Input_arguments::start_group): Check we are not in a lib.
9326 (Input_arguments::start_lib): New.
9327 (Input_arguments::end_lib): New.
9328 * options.h (General_options): Add start_lib and end_lib.
9329 (Input_argument::lib_): New.
9330 (Input_argument::lib): New.
9331 (Input_argument::is_lib): New.
9332 (Input_file_lib): New.
9333 (Input_arguments::in_lib_): New.
9334 (Input_arguments::in_lib): New.
9335 (Input_arguments::start_lib): New.
9336 (Input_arguments::end_lib_): New.
9337 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9338 in unused members as preempted.
9339 (Sized_pluginobj::do_should_include_member): New.
9340 * plugin.h (Sized_pluginobj::do_should_include_member): New.
9341 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9342 return the blocker.
9343 (Read_symbols::do_whole_lib_group): New.
9344 (Read_symbols::do_lib_group): New.
9345 (Read_symbols::do_read_symbols): Handle lib groups.
9346 (Read_symbols::get_name): Handle lib groups.
9347 * readsyms.h (Read_symbols): Add an archive member pointer.
9348 (Read_symbols::do_whole_lib_group): New.
9349 (Read_symbols::do_lib_group): New.
9350 (Read_symbols::member_): New.
9351 * script.cc (read_input_script): Update call to queue_soon.
9352
9353 2010-03-19 Doug Kwan <dougkwan@google.com>
9354
9355 * arm.cc (Stub_table::Stub_table): Initialize new data members
9356 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9357 (Stub_table::add_reloc_stub): Assign stub offset and update
9358 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9359 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9360 New data members.
9361 (Stub_table::update_data_size_and_addralign): Use
9362 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9363 instead of going over all reloc stubs.
9364 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9365 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9366 Stringpool_template::offset_ to size of Stringpool_char.
9367 (Stringpool_template::new_key_offset): Remove code to initialize
9368 Stringpool_template::offset_.
9369 * stringpool.h (Stringpool_template::set_no_zero_null): Set
9370 Stringpool_template::offset_ to zero.
9371
9372 2010-03-15 Doug Kwan <dougkwan@google.com>
9373
9374 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9375 offset_.
9376 (Stringpool_template::new_key_offset): New method.
9377 (Stringpool_template::add_string): Assign offsets when adding new
9378 strings.
9379 (Stringpool_template::set_string_offsets): Do not set string offsets
9380 when not optimizing.
9381 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9382 member size_.
9383 (Chunked_vector::clear): Clear size_.
9384 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9385 (Chunked_vector::size): Return size_.
9386 (Chunked_vector::push_back): Use size_ to find insert position.
9387 (Chunked_vector::size_): New data member.
9388 (Stringpool_template::set_no_zero_null): Assert string set is empty.
9389 (Stringpool_template::new_key_offset): New method declaration.
9390 (Stringpool_template::offset_): New data member.
9391
9392 2010-03-15 Rafael Espindola <espindola@google.com>
9393
9394 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9395 Add_symbols' constructor.
9396 * readsyms.h (Add_symbols): Remove the input_group member.
9397
9398 2010-03-10 Ian Lance Taylor <iant@google.com>
9399
9400 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9401 target to ask whether a reference to a symbol requires a stack
9402 split.
9403 * target.h (Target::is_call_to_non_split): New function.
9404 (Target::do_is_call_to_non_split): Declare virtual function.
9405 * target.cc: Include "symtab.h".
9406 (Target::do_is_call_to_non_split): New function.
9407 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9408
9409 2010-03-10 Cary Coutant <ccoutant@google.com>
9410
9411 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9412 (File_read::open[1]): Remove initial mapping of whole_file_view_.
9413 (File_read::open[2]): Add whole_file_view_ to list of views.
9414 (File_read::make_view): Remove test of whole_file_view_.
9415 (File_read::find_or_make_view): Create whole_file_view_ if
9416 necessary.
9417 (File_read::clear_views): Replace bool parameter with enum;
9418 adjust all callers. Don't delete views with permanent data;
9419 do delete cached views and views from archives if
9420 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
9421 if clearing the corresponding view.
9422 * fileread.h (File_read::Clear_views_mode): New enum.
9423 (File_read::View::is_permanent_view): New method.
9424 (File_read::clear_views): Replace bool parameter
9425 with enum; adjust all callers.
9426 * options.h (General_options): Change keep_files_mapped option;
9427 add map_whole_files.
9428 * readsyms.cc (Add_symbols::run): Delete sd_ object before
9429 releasing the file.
9430 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9431 the file.
9432
9433 2010-03-10 David S. Miller <davem@davemloft.net>
9434
9435 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9436
9437 2010-03-09 Sriraman Tallam <tmsriram@google.com>
9438
9439 * icf.cc (get_section_contents): Add '@' marker after processing the
9440 merge reloc.
9441
9442 2010-03-08 Doug Kwan <dougkwan@google.com>
9443
9444 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9445 due to a conversion warning.
9446 (Arm_relobj::update_output_local_symbol_count): Check for local
9447 symbol with unset output index.
9448
9449 2010-03-05 Ian Lance Taylor <iant@google.com>
9450
9451 * options.h (class General_options): Add --spare-dynamic-tags.
9452 * output.cc (Output_data_dynamic::set_final_data_size): Implement
9453 --spare-dynamic-tags.
9454
9455 2010-03-05 Ian Lance Taylor <iant@google.com>
9456
9457 * incremental.cc: Include "libiberty.h".
9458
9459 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
9460
9461 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9462 function, is_info_ member.
9463 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9464 (Versions::Versions): Update caller.
9465 (Versions::define_base_version): Likewise.
9466 (Versions::add_def): Likewise.
9467
9468 2010-03-03 Sriraman Tallam <tmsriram@google.com>
9469
9470 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9471 (Scan::possible_function_pointer_reloc): New function.
9472 (Scan::local_reloc_may_be_function_pointer): Change to call
9473 possible_function_pointer_reloc.
9474 (Scan::global_reloc_may_be_function_pointer): Ditto.
9475 * icf.h (Icf::check_section_for_function_pointers): Change to reject
9476 relocations in ".data.rel.ro._ZTV" section.
9477 * testsuite/icf_safe_so_test.sh: Change to pass i386.
9478 * testsuite/icf_safe_so_test.cc: Ditto.
9479 * testsuite/icf_safe_test.cc: Ditto.
9480 * testsuite/icf_safe_test.sh: Ditto.
9481
9482 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9483 Ian Lance Taylor <iant@google.com>
9484
9485 * target-reloc.h (relocate_section): Check the symbol table index
9486 for -1U before setting the local symbol index.
9487 (scan_relocatable_relocs): If copying the relocation, record that
9488 the local symbol is required.
9489 * object.h (Symbol_value::is_output_symtab_index_set): New
9490 function.
9491 (Symbol_value::may_be_discarded_from_output_symtab): New
9492 function.
9493 (Symbol_value::has_output_symtab_entry): New function.
9494 (Symbol_value::needs_output_symtab_entry): Remove.
9495 (Symbol_value::output_symtab_index): Make sure the symbol index is
9496 set.
9497 (Symbol_value::set_output_symtab_index): Make sure the symbol
9498 index is not set. Make sure the new index is valid.
9499 (Symbol_value::set_must_have_output_symtab_entry): New function.
9500 (Symbol_value::has_output_dynsym_entry): New function.
9501 (Symbol_value::set_output_dynsym_index): Make sure the new index
9502 is valid.
9503 (Sized_relobj::set_must_have_output_symtab_entry): New function.
9504 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9505 local symbol if permitted.
9506 (Sized_relobj::do_finalize_local_symbols): Call
9507 is_output_symtab_index_set rather than needs_output_symtab_entry.
9508 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9509 rather than needs_output_symtab_entry. Call
9510 has_output_dynsym_entry rather than needs_output_dynsym_entry.
9511 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9512 is_output_symtab_index_set rather than needs_output_symtab_entry.
9513 * testsuite/discard_locals_relocatable_test.c: New file.
9514 * testsuite/discard_locals_test.sh: Test -r.
9515 * testsuite/Makefile.am (check_DATA): Add
9516 discard_locals_relocatable_test1.syms,
9517 discard_local_relocatable_test2.syms.
9518 (MOSTLYCLEANFILES): Likewise. Also add
9519 discard_locals_relocatable_test1.lout and
9520 discard_locals_relocatable_test2.out.
9521 (discard_locals_relocatable_test1.syms): New target.
9522 (discard_locals_relocatable_test.o): New target.
9523 (discard_locals_relocatable_test1.out): New target.
9524 (discard_locals_relocatable_test2.syms): New target.
9525 (discard_locals_relocatable_test2.out): New target.
9526 (various): Add missing ../ld-new dependencies.
9527 * testsuite/Makefile.in: Rebuild.
9528
9529 2010-03-03 Nick Clifton <nickc@redhat.com>
9530
9531 * po/fi.po: New Finnish translation.
9532
9533 2010-03-01 Doug Kwan <dougkwan@google.com>
9534
9535 * layout.cc (Layout::Layout): Force section types of .init_array*,
9536 .preinit_array* and .fini_array* sections.
9537 * output.cc (Output_section::Input_section_sort_entry::has_priority):
9538 Fix check of return value of std::string::find.().
9539 (Output_section::Input_section_sort_compare::operator()): Remove
9540 comment about .init_array.
9541 (Output_section::Input_section_sort_init_fini_compare::operator()):
9542 New method.
9543 (Output_section::sort_attached_input_sections): Handle .init_array
9544 and .fini_array specially.
9545 * output.h (Output_section::Inut_section_sort_compare): Update
9546 comment.
9547 (Output_section::Input_section_sort_init_fini_compare): New struct.
9548
9549 2010-02-26 Doug Kwan <dougkwan@google.com>
9550
9551 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9552 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9553 * testsuite/debug_msg.sh: Avoid matching source line number for
9554 use of global variable undef_int.
9555
9556 2010-02-26 Doug Kwan <dougkwan@google.com>
9557
9558 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9559 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9560 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9561 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9562 * options.cc (General_options::General_options): Initialize member
9563 fix_v4bx_.
9564 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9565 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9566 and rm_no_fix_v4bx.stdout
9567 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9568 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9569 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9570 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9571 and arm_no_fix_v4bx.
9572 * Makefile.in: Regenerate.
9573 * testsuite/arm_fix_v4bx.s: New file.
9574 * testsuite/arm_fix_v4bx.sh: Ditto.
9575
9576 2010-02-24 Doug Kwan <dougkwan@google.com>
9577
9578 * arm.cc (Target_arm::got_section): Make the .got section the first
9579 non RELRO section in the data segment.
9580 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9581 suffixes of section names.
9582
9583 2010-02-24 Doug Kwan <dougkwan@google.com>
9584
9585 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9586 flags and attributes merging if an input file is a binary file.
9587 * fileread.cc (Input_file::open): Record format of original file.
9588 * fileread.h (Input_file::Format): New enum type.
9589 (Input_file::Input_file): Initialize data member format_.
9590 (Input_file::format): New method definition.
9591 (Input_file::format_):: New data member.
9592
9593 2010-02-24 Doug Kwan <dougkwan@google.com>
9594
9595 * arm.cc (Arm_output_data_got): New class.
9596 (ARM_TCB_SIZE): New constant
9597 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9598 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9599 If user uses a script with a SECTIONS clause, issue only a warning
9600 for a misplaced EXIDX input section. Otherwise, issue an error.
9601 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9602 garbage collection.
9603 (Target_arm::got_mode_index_entry): Handle static linking.
9604 (Target_arm::Scan::local): Ditto.
9605 (Target_arm::Scan::global): Ditto.
9606 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
9607 all incorrectly implemented relocations.
9608 (Target_arm::fix_exidx_coverage): Pass layout to
9609 Arm_output_section::fix_exidx_coverage.
9610 * layout.cc (Layout::section_name_mapping): Remove trailing dots
9611 from ".ARM.exidx." and ".ARM.extab.".
9612
9613 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9614
9615 * arm.cc (Target_arm::do_finalize_sections): Create attribute
9616 section if it does not already exist.
9617 * attributes.cc (Attributes_section_data::Attributes_section_data):
9618 Don't crash if size is zero.
9619
9620 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9621 Ian Lance Taylor <iant@google.com>
9622
9623 * gold.cc (queue_middle_tasks): If no input files were opened,
9624 exit.
9625 * workqueue.h (Task_function::Task_function): Assert that there is
9626 a blocker.
9627
9628 2010-02-22 Doug Kwan <dougkwan@google.com>
9629
9630 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9631 * icf.cc (get_section_contents): Cast snprintf arguments to long long
9632 types to avoid warnings due to different uint64_t implementations
9633 on different hosts.
9634
9635 2010-02-21 Doug Kwan <dougkwan@google.com>
9636
9637 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9638 handling of the maximum backward branch offset.
9639 (Arm_relocate_functions::thumb_branch_common): Ditto.
9640 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9641 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9642 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9643 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9644 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9645 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9646 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9647 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9648 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9649 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9650 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9651 thumb2_bl_out_of_range.o): New rules.
9652 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9653 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9654 thumb2_bl_out_of_range
9655 * testsuite/Makefile.in: Regenerate.
9656 * testsuite/arm_bl_in_range.s: New file.
9657 * testsuite/arm_bl_out_of_range.s: Ditto.
9658 * testsuite/arm_branch_in_range.sh: Ditto.
9659 * testsuite/arm_branch_range.t: Ditto.
9660 * testsuite/thumb2_branch_range.t: Ditto.
9661 * testsuite/thumb_bl_in_range.s: Ditto.
9662 * testsuite/thumb_bl_out_of_range.s: Ditto.
9663 * testsuite/thumb_branch_range.t: Ditto.
9664
9665 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9666
9667 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9668 Add reloc offset information.
9669 * icf.cc (get_section_contents): Change iterators to point to the new
9670 vectors. Add reloc offset information to the contents.
9671 * icf.h (Icf::Sections_reachable_info): New typedef.
9672 (Icf::Sections_reachable_list): New typedef.
9673 (Icf::Offset_info): New typedef.
9674 (Icf::Reloc_info): New struct typedef.
9675 (Icf::Reloc_info_list): New typedef.
9676 (Icf::symbol_reloc_list): Delete method.
9677 (Icf::addend_reloc_list): Delete method.
9678 (Icf::section_reloc_list): Delete method.
9679 (Icf::reloc_info_list): New method.
9680 (Icf::reloc_info_list_): New member.
9681
9682 2010-02-19 Doug Kwan <dougkwan@google.com>
9683
9684 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9685 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9686 * arm.cc (Arm_relocation_functions): New forward declaration.
9687 (Target_arm::Target_arm): Initialize new data members
9688 got_mod_index_offset_ and tls_base_symbol_defined_.
9689 (Target_arm::Relocate::relocate_tls): New method.
9690 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9691 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9692 New methods.
9693 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9694 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9695 (Target_arm::got_mod_index_offset_,
9696 Target_arm::tls_base_symbol_defined_): New data members.
9697 (Target_arm::Scan::local, Target::Scan::global,
9698 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9699 relocations.
9700
9701 2010-02-18 Doug Kwan <dougkwan@google.com>
9702
9703 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9704 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9705 text section as a parameter becuase some broken tools may not set
9706 the link in section header.
9707 (Target_arm::has_got_section): New method.
9708 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9709 without any mapping symbol as data only. Remove warning.
9710 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9711 link in its section header, try to discover the link by inspecting the
9712 REL31 relocation at the beginning of the section.
9713 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9714 in error message.
9715 (Target_arm::Scan::global): Treat any reference to the symbol
9716 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9717
9718 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9719
9720 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9721 (Scan::global_reloc_may_be_function_pointer): New function.
9722 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9723 (Scan::global_reloc_may_be_function_pointer): New function.
9724 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9725 (Scan::global_reloc_may_be_function_pointer): New function.
9726 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9727 (Scan::global_reloc_may_be_function_pointer): New function.
9728 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9729 (Scan::global_reloc_may_be_function_pointer): New function.
9730 (Scan::possible_function_pointer_reloc): New function.
9731 (Target_x86_64::can_check_for_function_pointers): New function.
9732 * gc.h (gc_process_relocs): Scan relocation types to determine if
9733 function pointers were taken for targets that support it.
9734 * icf.cc (Icf::find_identical_sections): Include functions for
9735 folding in safe ICF whose pointer is not taken.
9736 * icf.h (Secn_fptr_taken_set): New typedef.
9737 (fptr_section_id_): New member.
9738 (section_has_function_pointers): New function.
9739 (set_section_has_function_pointers): New function.
9740 (check_section_for_function_pointers): New function.
9741 * options.h: Fix comment for safe ICF option.
9742 * target.h (can_check_for_function_pointers): New function.
9743 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9744 Modify icf_safe_test for X86-64.
9745 * testsuite/Makefile.in: Regenerate.
9746 * testsuite/icf_safe_so_test.cc: New file.
9747 * testsuite/icf_safe_so_test.sh: New file.
9748 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9749 (main): Change to take pointer to function kept_func_3.
9750 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9751 folding is done correctly for X86-64.
9752
9753 2010-02-12 David S. Miller <davem@davemloft.net>
9754
9755 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9756 is_symbolless parameter.
9757 (Output_reloc<SHT_REL>::is_symbolless): New.
9758 (Output_reloc<SHT_REL>::is_symbolless_): New.
9759 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9760 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9761 (Output_reloc<SHT_RELA>::is_symbolless): New.
9762 (Output_data_reloc::add_global): Handle is_symbolless.
9763 (Output_data_reloc::add_global_relative): Likewise.
9764 (Output_data_reloc::add_local): Likewise.
9765 (Output_data_reloc::add_local_relative): Likewise.
9766 (Output_data_reloc::add_symbolless_global_addend): New.
9767 (Output_data_reloc::add_symbolless_local_addend): New.
9768 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9769 is_symbolless.
9770 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9771 instead of ->is_relative_
9772 (Output_reloc::write): Likewise.
9773 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9774 (Output_reloc::write_rel): Simplify.
9775
9776 * sparc.cc (Target_sparc::Scan::local): Use
9777 ->add_symbolless_local_addend as needed.
9778 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9779 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9780 based upon relocation offset.
9781
9782 2010-02-11 Doug Kwan <dougkwan@google.com>
9783
9784 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9785 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9786 beginning of function.
9787 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9788 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9789 parameter is_32bit in calls to should_apply_static_reloc.
9790 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9791 (check_DATA): Add arm_abs_global.stdout.
9792 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9793 arm_abs_global.stdout): New rules.
9794 (MOSTLLYCLEANFILES): Add arm_abs_global
9795 * Makefile.in: Regenerate.
9796 * testsuite/arm_abs_global.s: New file.
9797 * testsuite/arm_abs_global.sh: Ditto.
9798 * testsuite/arm_abs_lib.s: Ditto.
9799
9800 2010-02-11 Ian Lance Taylor <iant@google.com>
9801
9802 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9803 Read_relocs task.
9804 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9805 Allocate_commons_task first.
9806 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9807 task, rather than symtab_lock_.
9808 (Gc_process_relocs::~Gc_process_relocs): New function.
9809 (Gc_process_relocs::is_runnable): Check this_blocker_.
9810 (Gc_process_relocs::locks): Use next_blocker_ rather than
9811 blocker_.
9812 (Scan_relocs::~Scan_relocs): New function.
9813 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9814 symtab_lock_.
9815 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9816 next_blocker_.
9817 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9818 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9819 constructor accordingly.
9820 (class Gc_process_relocs): Likewise.
9821 (class Scan_relocs): Likewise.
9822 * common.h (class Allocate_commons_task): Remove symtab_lock_
9823 field, and corresponding constructor parameter.
9824 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9825 symtab_lock_.
9826 (Allocate_commons_task::locks): Likewise.
9827
9828 2010-02-11 Ian Lance Taylor <iant@google.com>
9829
9830 * gold-threads.h (class Once): Define.
9831 (class Initialize_lock): Rewrite as child of Once.
9832 * gold-threads.cc (class Once_initialize): Define.
9833 (once_pointer_control): New static variable.
9834 (once_pointer, once_arg): New static variables.
9835 (c_run_once): New static function.
9836 (Once::Once, Once::run_once, Once::internal_run): New functions.
9837 (class Initialize_lock_once): Remove.
9838 (initialize_lock_control): Remove.
9839 (initialize_lock_pointer): Remove.
9840 (initialize_lock_once): Remove.
9841 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9842 (Initialize_lock::initialize): Rewrite.
9843 (Initialize_lock::do_run_once): New function.
9844 * archive.cc (Archive::interpret_header): Only clear name if it is
9845 not already empty.
9846 * fileread.cc: Include "gold-threads.h"
9847 (file_counts_lock): New static variable.
9848 (file_counts_initialize_lock): Likewise.
9849 (File_read::release): Only increment counts when using --stats.
9850 Use a lock around the increment.
9851 * parameters.cc (class Set_parameters_target_once): Define.
9852 (set_parameters_target_once): New static variable.
9853 (Parameters::Parameters): Move here from parameters.h.
9854 (Parameters::set_target): Rewrite.
9855 (Parameters::set_target_once): New function.
9856 (Parameters::clear_target): Move here and rewrite.
9857 * parameters.h (class Parameters): Update declarations. Add
9858 set_parameters_target_once_ field.
9859 (Parameters::Parameters): Move to parameters.cc.
9860 (Parameters::clear_target): Likewise.
9861 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9862 task.
9863 (Start_group::~Start_group): New function.
9864 (Start_group::is_runnable): New function.
9865 (Start_group::locks, Start_group::run): New functions.
9866 (Finish_group::run): Change saw_undefined to size_t.
9867 * readsyms.h (class Start_group): Define.
9868 (class Finish_group): Change saw_undefined_ field to size_t.
9869 (Finish_group::Finish_group): Remove saw_undefined and
9870 this_blocker parameters. Change all callers.
9871 (Finish_group::set_saw_undefined): New function.
9872 (Finish_group::set_blocker): New function.
9873 * symtab.h (class Symbol_table): Change saw_undefined to return
9874 size_t. Change saw_undefined_ field to size_t.
9875 * target-select.cc (Set_target_once::do_run_once): New function.
9876 (Target_selector::Target_selector): Initialize set_target_once_
9877 field. Don't initialize lock_ and initialize_lock_ fields.
9878 (Target_selector::instantiate_target): Rewrite.
9879 (Target_selector::set_target): New function.
9880 * target-select.h (class Set_target_once): Define.
9881 (class Target_selector): Update declarations. Make
9882 Set_target_once a friend. Remove lock_ and initialize_lock_
9883 fields. Add set_target_once_ field.
9884
9885 2010-02-10 Ian Lance Taylor <iant@google.com>
9886
9887 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9888 queueing any tasks.
9889 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9890 (queue_middle_tasks): Add all blockers before queueing any tasks.
9891 (queue_final_tasks): Likewise.
9892 * token.h (Task_token::add_blockers): New function.
9893 * object.h (Input_objects::number_of_relobjs): New function.
9894
9895 2010-02-10 Ian Lance Taylor <iant@google.com>
9896
9897 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9898 shared, not if not position independent.
9899 * x86_64.cc (Relocate::relocate_tls): Likewise.
9900 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9901 (tls_pie_pic_test): New target.
9902 * testsuite/Makefile.in: Rebuild.
9903
9904 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9905 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9906 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9907 * testsuite/Makefile.in: Rebuild.
9908
9909 2010-02-09 David S. Miller <davem@davemloft.net>
9910
9911 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9912 R_SPARC_RELATIVE using ->add_local_relative().
9913 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9914
9915 * output.h (Output_data_dynamic::add_section_size): New method
9916 that takes two Output_data objects.
9917 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9918 entry param. Handle it in initializers.
9919 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9920 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9921 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9922 arg.
9923 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9924 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9925 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9926 for dynrel_includes_plt.
9927 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9928 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9929 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9930 before .rela.plt
9931 (Target_sparc::do_finalize_sections): Update to pass true for
9932 dynrel_includes_plt.
9933 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9934 output before .rela.plt
9935 (Target_powerpc::do_finalize_sections): Update to pass true for
9936 dynrel_includes_plt when 32-bit.
9937
9938 2010-02-08 Doug Kwan <dougkwan@google.com>
9939
9940 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9941 method.
9942 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9943 Arm_relobj::scan_section_for_cortex_a8_stubs,
9944 Arm_relobj::do_relocation_section): Instead of calling
9945 Output_section::output_address, use faster
9946 Arm_relobj::simple_input_section_output_address.
9947
9948 2010-02-08 David S. Miller <davem@davemloft.net>
9949
9950 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9951 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9952 relocation helper function.
9953
9954 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9955 just like R_SPARC_GOT{10,13,22}.
9956 (Target_sparc::Scan::local): Likewise.
9957 (Target_sparc::Relocate:relocate): Likewise.
9958
9959 2010-02-06 Ian Lance Taylor <iant@google.com>
9960
9961 * configure.ac: Rewrite targetobjs duplicate removal code to use
9962 only shell constructs.
9963 * configure: Rebuild.
9964
9965 2010-02-05 Doug Kwan <dougkwan@google.com>
9966
9967 PR 11247
9968 * arm.cc (Arm_relobj::section_is_scannable): New method.
9969 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9970 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9971
9972 2010-02-04 Doug Kwan <dougkwan@google.com>
9973
9974 PR 11247
9975 * arm-reloc-property.cc (cstdio): Include.
9976 * configure.ac (targetobjs): Remove duplicates.
9977 * configure: Regenerate.
9978 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9979 big and little endian version for a given address size.
9980
9981 2010-02-03 Doug Kwan <dougkwan@google.com>
9982
9983 * arm-reloc-property.cc
9984 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9985 definition.
9986 * arm-reloc-property.h
9987 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9988 New method definition.
9989 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9990 declaration.
9991 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9992 overflow to N.
9993 (GOT_PREL): Change implemented to Y.
9994 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9995 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9996 (Arm_relocate_functions::movw_abs_nc): Remove method.
9997 (Arm_relocate_functions::movt_abs): Ditto.
9998 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9999 (Arm_relocate_functions::thm_movt_abs): Ditto.
10000 (Arm_relocate_functions::movw_rel_nc): Ditto.
10001 (Arm_relocate_functions::movw_rel): Ditto.
10002 (Arm_relocate_functions::movt_rel): Ditto.
10003 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10004 (Arm_relocate_functions:thm_movw_rel): Ditto.
10005 (Arm_relocate_functions:thm_movt_rel): Ditto.
10006 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10007 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10008 New method definitions.
10009 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10010 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10011 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10012 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10013 (Target_arm::Relocate::relocate): Check for non-static or
10014 unimplemented relocation code and exit early. Change calls to
10015 Target_arm::reloc_uses_thumb_bit and
10016 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10017 instead. Refactor code to handle similar relocations to increase
10018 code sharing. Remove check for unsupported relocation code in switch
10019 statement.
10020 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10021 relocation property table to find out size. Change error message to
10022 print out the name of a relocation code instead of the numeric value.
10023 (Target_arm::scan_reloc_for_stub): Use relocation property table
10024 instead of calling Target_arm::reloc_uses_thumb_bit().
10025
10026 2010-02-02 Doug Kwan <dougkwan@google.com>
10027
10028 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10029 types of relaxed input section.
10030
10031 2010-02-02 Doug Kwan <dougkwan@google.com>
10032
10033 * Makefile.am (HFILES): Add arm-reloc-property.h.
10034 (DEFFILES): New.
10035 (TARGETSOURCES): Add arm-reloc-property.cc
10036 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10037 (libgold_a_SOURCES): $(DEFFILES)
10038 * Makefile.in: Regenerate.
10039 * arm-reloc-property.cc: New file.
10040 * arm-reloc-property.h: New file.
10041 * arm-reloc.def: New file.
10042 * arm.cc: Update comments.
10043 (arm-reloc-property.h): New included header.
10044 (arm_reloc_property_table): New global variable.
10045 (Target_arm::do_select_as_default_target): New method definition.
10046 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10047 arm-reloc-property to targ_extra_obj.
10048 * parameters.cc (set_parameters_target): Call
10049 Target::select_as_default_target().
10050 * target.h (Target::select_as_default_target): New method definition.
10051 (Target::do_select_as_default_target): Same.
10052
10053 2010-02-01 Doug Kwan <dougkwan@google.com>
10054
10055 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10056 first_output_text_section_.
10057 (Arm_exidx_fixup::first_output_text_section): New method definition.
10058 (Arm_exidx_fixup::first_output_text_section_): New data member.
10059 (Arm_exidx_fixup::process_exidx_section): Record the first text
10060 output section seen.
10061 (Arm_output_section::fix_exidx_coverage): Set correct linked section
10062 and entsize in output section header.
10063
10064 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10065
10066 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10067 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10068 (Arm_relocate_functions::thm_alu11): New Method.
10069 (Arm_relocate_functions::thm_pc8): New Method.
10070 (Arm_relocate_functions::thm_pc12): New Method.
10071 (Target_arm::Scan::local): Handle the relocations.
10072 (Target_arm::Scan::global): Likewise.
10073 (Target_arm::Relocate::relocate): Likewise.
10074 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10075
10076 2010-01-29 Doug Kwan <dougkwan@google.com>
10077
10078 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10079 of relocation types as ld.
10080
10081 2010-01-29 Doug Kwan <dougkwan@google.com>
10082
10083 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10084 to public.
10085 (Arm_relocate_functions::thumb_branch_common): Ditto.
10086 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10087 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10088 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10089 Arm_relocate_functions::jump24): Remove.
10090 (Target_arm::Relocate::relocate): Adjust code to call
10091 Arm_relocation_functions::arm_branch_common and
10092 Arm_relocation_functions::thumb_branch_common instead of their removed
10093 wrappers. Merge switch-cases together to reduce source code size.
10094
10095 2010-01-29 Doug Kwan <dougkwan@google.com>
10096
10097 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10098 output_local_symbol_count_needs_update_.
10099 (Arm_relobj::output_local_symbol_count_needs_update,
10100 Arm_relobj::set_output_local_symbol_count_needs_update,
10101 Arm_relobj::update_output_local_symbol_count): New methods.
10102 (Arm_relobj::output_local_symbol_count_needs_update_): New data
10103 member.
10104 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10105 of pointed function as in a R_ARM_PREL31 relocation.
10106 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10107 for output local symbol count updating.
10108 (Target_arm::do_relax): Update output local symbol counts in objects
10109 if necessary.
10110 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10111
10112 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10113
10114 * arm.cc: Added support for the ARM relocations:
10115 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10116 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10117 (Arm_relocate_functions::movw_rel_nc): Renamed (was
10118 movw_prel_nc).
10119 (Arm_relocate_functions::movw_rel): New method.
10120 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10121 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10122 thm_movw_prel_nc).
10123 (Arm_relocate_functions::thm_movw_rel): New method.
10124 (Arm_relocate_functions::thm_movt_rel): Renamed (was
10125 thm_movt_prel).
10126 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10127 relocations.
10128 (Target_arm::Scan::global): Likewise.
10129 (Target_arm::Relocate::relocate): Likewise.
10130 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10131 Likewise.
10132
10133 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10134
10135 * arm.cc: Added support for ARM group relocations.
10136 (Target_arm::reloc_needs_sym_origin): New method.
10137 (Arm_relocate_functions::calc_grp_kn): New method.
10138 (Arm_relocate_functions::calc_grp_residual): New method.
10139 (Arm_relocate_functions::calc_grp_gn): New method.
10140 (Arm_relocate_functions::arm_grp_alu): New Method.
10141 (Arm_relocate_functions::arm_grp_ldr): New Method.
10142 (Arm_relocate_functions::arm_grp_ldrs): New Method.
10143 (Arm_relocate_functions::arm_grp_ldc): New Method.
10144 (Target_arm::Scan::local): Handle the ARM group relocations.
10145 (Target_arm::Scan::global): Likewise.
10146 (Target_arm::Relocate::relocate): Likewise.
10147 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10148 Likewise.
10149
10150 2010-01-26 Doug Kwan <dougkwan@google.com>
10151
10152 * arm.cc (set): Include.
10153 (class Arm_exidx_fixup): Change type of last_input_section_ to const
10154 pointer type.
10155 (Arm_output_section::Text_section_list): New type.
10156 (Arm_output_section::append_text_sections_to_list): New method.
10157 (Arm_output_section::fix_exidx_coverage): Ditto.
10158 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10159 (Arm_relobj::convert_input_section_to_relaxed_section): Use
10160 Relobj::set_section_offset() instead of
10161 Sized_relobj::invalidate_section_offset().
10162 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10163 parameter for section headers. Ignore relocation sections for
10164 unallocated sections and EXIDX sections.
10165 (Target_arm::fix_exidx_coverage): New method.
10166 (Target_arm::output_section_address_less_than): New type.
10167 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10168 linked text section instead of the EXIDX section.
10169 (Arm_output_section::create_stub_group): Add an assertion to check
10170 that this is not an EXIDX output section.
10171 (Arm_output_section::append_text_sections_to_list): New method.
10172 (Arm_output_section::fix_exidx_coverage): Ditto.
10173 (Arm_relobj::scan_sections_for_stubs): Adjust call to
10174 Arm_relobj::section_needs_reloc_stub_scanning.
10175 (Target_arm::do_relax): Fix EXIDX output section coverage in the
10176 first pass.
10177 (Target_arm::fix_exidx_coverage): New method.
10178 * object.h (Relobj::set_output_section): New method.
10179 (Sized_relobj::invalidate_section_offset): Remove method.
10180 (Sized_relobj::do_invalidate_section_offset): Remove method.
10181 (Sized_relobj::do_set_section_offset): Handle offset value -1.
10182
10183 2010-01-25 Doug Kwan <dougkwan@google.com>
10184
10185 * arm.cc (Arm_exidx_merged_section::do_output_offset):
10186 Fix warning due to signed and unsigned comparison on a 32-bit host.
10187
10188 2010-01-22 Doug Kwan <dougkwan@google.com>
10189
10190 * arm.cc (Target_arm::do_relax): Record an output section for section
10191 offset adjustment it contains any stub table that has changed.
10192 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10193 offsets in an output section if necessary.
10194 * output.cc (Output_section::Output_section): Initialize
10195 section_offsets_need_adjustments_.
10196 (Output_section::add_input_section_for_script): Renamed to
10197 Output_section::add_simple_input_section.
10198 (Output_section::save_states): Add a comment.
10199 (Output_section::discard_states): New method defintion.
10200 (Output_section::adjust_section_offsets): Same.
10201 * output.h (Output_section::add_input_section_for_script): Renamed to
10202 Output_section::add_simple_input_section.
10203 (Output_section::discard_states): New method declaration.
10204 (Output_section::adjust_section_offsets): Same.
10205 (Output_section::section_offsets_need_adjustment,
10206 Output_section::set_section_offsets_need_adjustment): New method
10207 definitions.
10208 (Output_section::section_offsets_need_adjustment_): New data member.
10209 * script-sections.cc
10210 (Output_section_element_input::set_section_address): Adjust code for
10211 renaming of Output_section::add_input_section_for_script.
10212 (Orphan_output_section::set_section_address): Same.
10213
10214 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10215
10216 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10217 Fix_v4bx enum values .
10218 * gold/options.h (General_options): New option definitions.
10219 (General_options::fix_v4bx): New method.
10220 (General_options::Fix_v4bx): New enum.
10221 * gold/options.cc (General_options::parse_fix_v4bx): New method.
10222 (General_options::parse_fix_v4bx_interworking): New method.
10223
10224 2010-01-22 Doug Kwan <dougkwan@google.com>
10225
10226 * arm.cc (Arm_exidx_fixup): New class.
10227
10228 2010-01-21 Doug Kwan <dougkwan@google.com>
10229
10230 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10231 classes.
10232 (Arm_exidx_section_offset_map): New type.
10233
10234 2010-01-21 Doug Kwan <dougkwan@google.com>
10235
10236 * arm.cc (Arm_exidx_input_section): New class.
10237 (Arm_relobj::exidx_input_section_by_link,
10238 Arm_relobj::exidx_input_section_by_shndx,
10239 Arm_relobj::make_exidx_input_section): New methods.
10240 (read_arm_attributes_section): Remove.
10241 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10242 information about them.
10243 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10244 to here.
10245
10246 2010-01-20 Doug Kwan <dougkwan@google.com>
10247
10248 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10249 Input_section_specifier to Section_id.
10250 (Target_arm::new_arm_input_section: Adjust code for change of key
10251 type.
10252 (Target_arm::find_arm_input_section): Ditto.
10253 * gc.h (object.h): Include for Section_id nand Section_id_hash.
10254 (Section_id): Remove.
10255 (Garbage_collection::Section_id_hash): Remove.
10256 * icf.h (object.h): Include for Section_id nand Section_id_hash.
10257 (Section_id): Remove.
10258 (Icf::Section_id_hash): Remove.
10259 * object.h (Section_id, Const_section_id, Section_id_hash,
10260 Const_section_id_hash): New type definitions.
10261 * output.cc (Output_section::add_relaxed_input_section): Change to
10262 use Const_section_id instead of Input_section_specifier as key type.
10263 (Output_section::add_merge_input_section): Ditto.
10264 (Output_section::build_relaxation_map): Change to use Section_id
10265 instead of Input_section_specifier as key type.
10266 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10267 Ditto.
10268 (Output_section::convert_input_sections_to_relaxed_sections): Change
10269 to use Const_section_id instead of Input_section_specifier as key type.
10270 (Output_section::find_merge_section): Ditto.
10271 (Output_section::find_relaxed_input_section): Ditto.
10272 * output.h (Input_section_specifier): Remove class.
10273 (Output_section::Output_section_data_by_input_section_map): Change
10274 key type to Const_section_id.
10275 (Output_section::Output_relaxed_input_section_by_input_section_map):
10276 Ditto.
10277 (Output_section::Relaxation_map): Change key type to Section_id.
10278
10279 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10280
10281 * gold/arm.cc: Added support for R_ARM_V4BX relocation
10282 (class Arm_v4bx_stub): New class.
10283 (DEF_STUBS): Updated definition to support v4_veneer_bx.
10284 (Stub_factory::make_arm_v4bx_stub): New method.
10285 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10286 (Stub_table::empty): Handle v4bx stubs.
10287 (Stub_table::add_arm_v4bx_stub): New method.
10288 (Stub_table::find_arm_v4bx_stub): New method.
10289 (Arm_relocate_functions::v4bx): New method.
10290 (Target_arm::fix_v4bx): New method.
10291 (Target_arm::Target_arm): Handle R_ARM_V4BX.
10292 (Stub_table::relocate_stubs): Likewise.
10293 (Stub_table::do_write): Likewise.
10294 (Stub_table::update_data_size_and_addralign): Likewise.
10295 (Stub_table::finalize_stubs): Likewise.
10296 (Target_arm::Scan::local): Likewise.
10297 (Target_arm::Scan::global): Likewise.
10298 (Target_arm::do_finalize_sections): Likewise.
10299 (Target_arm::Relocate::relocate): Likewise.
10300 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10301 Likewise.
10302 (Target_arm::scan_reloc_for_stub): Likewise.
10303 (Target_arm::scan_reloc_section_for_stubs): Likewise.
10304
10305 2010-01-19 Ian Lance Taylor <iant@google.com>
10306
10307 * output.cc (Output_section_headers::do_sized_write): Write large
10308 segment count to sh_info field.
10309 (Output_file_header::do_sized_write): For large segment count,
10310 write PN_XNUM to e_phnum field.
10311
10312 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10313
10314 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10315 (Arm_relocate_functions::thm_jump8): New function.
10316 (Arm_relocate_functions::thm_jump11): New function.
10317 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10318 R_ARM_THM_JUMP11.
10319 (Target_arm::Scan::global): Likewise.
10320 (Target_arm::Relocate::relocate): Likewise.
10321 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10322 Likewise.
10323
10324 2010-01-14 Doug Kwan <dougkwan@google.com>
10325
10326 * arm.cc (map, utility): Include headers.
10327 (Target_arm::apply_cortex_a8_workaround): New method.
10328 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10329 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10330 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10331 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10332 the --[no-]fix-cortex-a8 command line options.
10333 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10334 (Target_arm::relocate_stub): Use addend in instruction template.
10335 * options.h (DEFINE_bool): Set the user-set flag.
10336 (General_options): Add --[no-]-fix-cortex options.
10337 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10338 : Update fast look-up map after conversion.
10339
10340 2010-01-14 Sriraman Tallam <tmsriram@google.com>
10341
10342 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10343 in the first pass of do_layout.
10344
10345 2010-01-13 Doug Kwan <dougkwan@google.com>
10346
10347 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10348 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10349 apparent compiler problem of not folding static constant integral
10350 data members of elfcpp::Elf_sizes<32>.
10351
10352 2010-01-13 Doug Kwan <dougkwan@google.com>
10353
10354 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10355 Arm_relobj::section_needs_cortex_a8_stub_scanning,
10356 Arm_relobj::scan_section_for_cortex_a8_erratum,
10357 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10358 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10359 sections to scan for relocation stubs into a new method
10360 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
10361 relocation and Cortex-A8 stub scanning.
10362 (Target_arm::do_relax): Force stubs to be after stubbed sections
10363 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
10364 the beginning of a new relaxation pass. Update a comment.
10365 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10366
10367 2010-01-12 Ian Lance Taylor <iant@google.com>
10368
10369 * target-reloc.h (visibility_error): New inline function.
10370 (relocate_section): Call visibility_error.
10371 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10372 (MOSTLYCLEANFILES): Likewise.
10373 (protected_4_pic.o, protected_3.err): New targets.
10374 * testsuite/protected_4.cc: New file.
10375
10376 2010-01-12 Doug Kwan <dougkwan@google.com>
10377
10378 * arm.cc (Cortex_a8_reloc): New class.
10379 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10380 and cortex_a8_relocs_info_.
10381 (Target_arm::fix_cortex_a8): New method definition.
10382 (Target_arm::Cortex_a8_relocs_info): New type.
10383 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10384 New data member declarations.
10385 (Target_arm::scan_reloc_for_stub): Record information about
10386 relocations for THUMB branches that might be exempted from the
10387 Cortex-A8 workaround.
10388 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10389 at the beginning of a relaxation pass.
10390
10391 2010-01-12 Doug Kwan <dougkwan@google.com>
10392
10393 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10394 (Arm_relobj::Mapping_symbol_position,
10395 Arm_reloj::Mapping_symbol_position_less,
10396 Arm_relobj::Mapping_symbols_info): New types.
10397 (Target_arm::is_mapping_symbol_name): New method definition.
10398 (Arm_relobj::do_count_local_symbols): Save information about mapping
10399 symbols.
10400
10401 2010-01-11 Doug Kwan <dougkwan@google.com>
10402
10403 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10404 Arm_relocate_functions::thumb32_branch_upper,
10405 Arm_relocate_functions::thumb32_branch_lower,
10406 Arm_relocate_functions::thumb32_cond_branch_offset,
10407 Arm_relocate_functions::thumb32_cond_branch_upper,
10408 Arm_relocate_functions::thumb32_cond_branch_lower,
10409 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10410 branch offset encoding.
10411 (Arm_relocate_functions::thumb_branch_common): Use new branch
10412 offset encoding methods to avoid code duplication.
10413 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10414 (Stub_addend_reader::operator()): Use new branch encoding method
10415 to avoid code duplication.
10416
10417 2010-01-11 Doug Kwan <dougkwan@google.com>
10418
10419 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10420 (Target_arm::do_finalize_sections): Define special EXIDX section
10421 symbols only if referenced.
10422 * gc.h (Garbage_collection::add_reference): New method.
10423 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10424 code duplication.
10425
10426 2010-01-11 Ian Lance Taylor <iant@google.com>
10427
10428 * script.cc (Version_script_info::build_expression_list_lookup):
10429 Change complaing about duplicate wildcard match from error to
10430 warning.
10431
10432 * script.cc (class Lazy_demangler): Recreate--revert part of patch
10433 of 2009-12-30.
10434 (Version_script_info::Version_script_info): Initialize globs_,
10435 default_version_, default_is_global_, and exact_. Don't
10436 initialize globals_ or locals_.
10437 (Version_script_info::build_lookup_tables): Build local symbols
10438 first.
10439 (Version_script_info::unquote): New function.
10440 (Version_script_info::add_exact_match): New function.
10441 (Version_script_info::build_expression_list_lookup): Remove lookup
10442 parameter. Add is_global parameter. Change all callers. Handle
10443 wildcard pattern specially. Unquote pattern. Call
10444 add_exact_match.
10445 (Version_script_info::get_name_to_match): New function.
10446 (Version_script_info::get_symbol_version): New function.
10447 (Version_script_info::get_symbol_version_helper): Remove.
10448 (Version_script_info::check_unmatched_names): Call unquote.
10449 * script.h (class Version_script_info): Change get_symbol_version
10450 to be non-inline and add is_global parameter; change all callers.
10451 Rewrite symbol_is_local. Update declarations. Define struct
10452 Version_tree_match, Exact, Globs. Don't define struct Lookup.
10453 Remove globals_ and locals_ members. Add exact_, globs_,
10454 default_version_, is_global_.
10455 (Version_script_info::Glob): Remove pattern, add expression and
10456 is_global. Update constructor. Change all callers.
10457 * dynobj.cc (Versions::finalize): Mark the version symbol as the
10458 default version.
10459 (Versions::symbol_section_contents): If a symbol is undefined, or
10460 defined in a dynamic object, set the version index to
10461 VER_NDX_LOCAL.
10462 * symtab.cc (Symbol_table::add_from_relobj): Don't call
10463 symbol_is_local.
10464 (Symbol_table::add_from_pluginobj): Likewise.
10465 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10466
10467 2010-01-11 Doug Kwan <dougkwan@google.com>
10468
10469 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10470 (incremental_dump_LDADD): Add linking option for libintl.
10471 * Makefile.in: Regenerate.
10472
10473 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
10474
10475 PR gold/11144
10476 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10477 instead of -Ds.
10478 * testsuite/Makefile.in: Regenerated.
10479
10480 2010-01-10 Doug Kwan <dougkwan@google.com>
10481
10482 * options.h (DEFINE_var): Use parentheses around argument varname__
10483 in macro body to avoid any unintended subsequent substitutions.
10484
10485 2010-01-10 Ian Lance Taylor <iant@google.com>
10486
10487 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10488 candidates before doing symbol resolution.
10489
10490 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10491 ODR candidates if only one is weak.
10492
10493 2010-01-08 Ian Lance Taylor <iant@google.com>
10494
10495 * script.cc (Version_script_info::build_expression_list_lookup):
10496 Don't warn about ambiguous version, just record the ambiguity.
10497 (Version_script_info::get_symbol_version_helper): Give error if
10498 version is ambiguous.
10499
10500 2010-01-08 Doug Kwan <dougkwan@google.com>
10501
10502 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10503 prev_data_size_ and prev_addralign_. Remove initializer for
10504 deleted data member has_been_changed_.
10505 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10506 to determine if the table is empty.
10507 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10508 Remove.
10509 (Stub_table::add_reloc_stub): Define method in class definition
10510 instead of just declaring it there.
10511 (Stub_table::add_cortex_a8_stub): New method definition.
10512 (Stub_table::update_data_size_and_addralign): Ditto.
10513 (Stub_table::finalize_stubs): Ditto.
10514 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10515 (Stub_table::do_addralign_): Return address alignment in the
10516 (Stub_table::do_reset_address_and_file_offset): Define method in
10517 class definition instead of declaring it there. Set current data
10518 size to be the data size of the previous pass.
10519 (Stub_table::set_final_data_size): Use current data size as the
10520 final data size.
10521 (Stub_table::relocate_stub): Change parameter type of stub from
10522 Reloc_stub pointer to Stub pointer.
10523 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10524 (Stub_table::Cortex_a8_stub_list): New typedef.
10525 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10526 Stub_table::prev_addralign_): New data member.
10527 (Arm_relobj::Arm_relobj): Initialize data member
10528 section_has_cortex_a8_workaround_.
10529 (Arm_relobj::section_has_cortex_a8_workaround,
10530 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10531 definitions.
10532 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10533 declarations.
10534 (Target_arm::relocate_stub): Change parameter type of stub from
10535 Reloc_stub pointer to Stub pointer.
10536 (Insn_template::size, Insn_template::alignment): Handle
10537 THUMB16_SPECIAL_TYPE.
10538 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10539 Stub_table::update_data_size_and_addralign,
10540 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10541 definitions.
10542 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10543 (Stub_table::do_write): Ditto.
10544 (Target_arm::do_relax): Adjust code for changes in Stub_table.
10545
10546 2010-01-08 Ian Lance Taylor <iant@google.com>
10547
10548 PR 11108
10549 * symtab.h (class Symbol): Remove fields is_target_special_ and
10550 has_plt_offset_. Add field is_defined_in_discarded_section_.
10551 (Symbol::is_defined_in_discarded_section): New function.
10552 (Symbol::set_is_defined_in_discarded_section): New function.
10553 (Symbol::has_plt_offset): Rewrite.
10554 (Symbol::set_plt_offset): Verify that new offset is not -1U.
10555 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10556 Don't initialize is_target_special_ or has_plt_offset_.
10557 Initialize is_defined_in_discarded_section_.
10558 (Symbol_table::add_from_relobj): If appropriate, set
10559 is_defined_in_discarded_section.
10560 * resolve.cc (Symbol::override_base_with_special): Don't test
10561 is_target_special_. Change has_plt_offset_ to has_plt_offset().
10562 * target-reloc.h (relocate_section): Do special handling for
10563 symbols defined in discarded sections for global symbols as well
10564 as local symbols.
10565
10566 2010-01-08 Ian Lance Taylor <iant@google.com>
10567
10568 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10569 the SHT_SYMTAB case.
10570
10571 2010-01-08 Ian Lance Taylor <iant@google.com>
10572
10573 * object.cc (Sized_relobj::do_layout): Don't get confused if
10574 layout_eh_frame returns NULL.
10575
10576 2010-01-08 Ian Lance Taylor <iant@google.com>
10577
10578 PR 11084
10579 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10580 dynamic symbol table, use the normal symbol table.
10581 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10582 symbol table.
10583
10584 2010-01-08 Ian Lance Taylor <iant@google.com>
10585
10586 PR 11072
10587 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10588 sections.
10589
10590 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10591
10592 * version.cc (print_version): Change to "Copyright 2010".
10593
10594 2010-01-08 Ian Lance Taylor <iant@google.com>
10595
10596 PR 10287
10597 PR 11063
10598 * i386.cc (class Target_i386): Change return type of plt_section
10599 to be non-const.
10600 (class Output_data_plt_i386): Add tls_desc_rel_ field.
10601 (Output_data_plt_i386::Output_data_plt_i386): Initialize
10602 tls_desc_rel_ field.
10603 (Output_data_plt_i386::rel_tls_desc): New function.
10604 (Target_i386::rel_tls_desc_section): New function.
10605 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10606 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10607 R_386_TLS_DESC reloc in rel_tls_desc_section.
10608 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10609 Define struct Tlsdesc_info.
10610 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10611 (Target_x86_64::do_reloc_symbol_index): New function.
10612 (Target_x86_64::add_tlsdesc_info): New function.
10613 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10614 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10615 tlsdesc_rel_ field.
10616 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
10617 all callers.
10618 (Output_data_plt_x86_64::rela_tlsdesc): New function.
10619 (Target_x86_64::rela_tlsdesc_section): New function.
10620 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10621 handling.
10622 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10623 (Target_x86_64::do_reloc_addend): New function.
10624 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10625 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10626 declarations. Define TARGET_CODE. Add arg field to u1_ union.
10627 (Output_reloc::type): New function.
10628 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10629 (Output_reloc::is_target_specific): New function.
10630 (Output_reloc::target_arg): New function.
10631 (class Output_reloc) [SHT_RELA]: Add four new constructors for
10632 absolute relocs and target specific relocs.
10633 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10634 add_target_specific.
10635 (class Output_data_reloc) [SHT_RELA]: Likewise.
10636 * output.cc (Output_reloc::Output_reloc): Add four new versions
10637 for absolute relocs and target specific relocs.
10638 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10639 (Output_reloc::get_symbol_index): Likewise.
10640 (Output_reloc::local_section_offset): Check that local_sym_index_
10641 is not TARGET_CODE or 0.
10642 (Output_reloc::symbol_value): Likewise.
10643 (Output_reloc::write) [SHT_RELA]: Call target for target specific
10644 reloc.
10645 * target.h (class Target): Add reloc_symbol_index and reloc_addend
10646 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
10647 functions.
10648 * layout.cc (add_target_dynamic_tags): Use output section for
10649 DT_PLTRELSZ and DT_JMPREL.
10650
10651 2010-01-07 Ian Lance Taylor <iant@google.com>
10652
10653 PR 11061
10654 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10655 function.
10656 (class Output_data_reloc_generic): Define.
10657 (class Output_data_reloc_base): Change base class to
10658 Output_data_reloc_generic. Change add() method to call
10659 bump_relative_reloc_count for a relative reloc. Remove
10660 sort_relocs_ field.
10661 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10662 to sort_relocs().
10663 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10664 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10665 appropriate.
10666 * layout.h (class Layout): Update declaration.
10667
10668 2010-01-07 Ian Lance Taylor <iant@google.com>
10669
10670 * output.h (class Output_data): Add const version of
10671 output_section and do_output_section.
10672 (class Output_section_data): Add const version of
10673 do_output_section.
10674 (class Output_section): Likewise.
10675 * layout.cc (Layout::add_target_dynamic_tags): New function.
10676 * layout.h (class Layout): Update declarations.
10677 * arm.cc (Target_arm::do_finalize_sections): Use
10678 add_target_dynamic_tags.
10679 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10680 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10681 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10682 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10683
10684 2010-01-07 Ian Lance Taylor <iant@google.com>
10685
10686 PR 11042
10687 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10688 object as needed.
10689
10690 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10691 Ian Lance Taylor <iant@google.com>
10692
10693 PR 11019
10694 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10695 Xindex::read_symtab_xindex.
10696
10697 2010-01-07 Doug Kwan <dougkwan@google.com>
10698
10699 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10700 (Insn_template::thumb16_bcond_insn): New method declaration.
10701 (Insn_template): Fix spelling.
10702 (Stub::thumb16_special): New method declaration.
10703 (Stub::do_write): Define virtual method which was previously pure
10704 virtual.
10705 (Stub::do_thumb16_special): New method declaration.
10706 (Stub::do_fixed_endian_write): New template member.
10707 (Reloc_stub::do_write): Remove.
10708 (Reloc_stub::do_fixed_endian_write): Remove.
10709 (Cortex_a8_stub): New class definition.
10710 (Stub_factory::make_cortex_a8_stub): New method definition.
10711 (Stub_factory::Stub_factory): Add missing static storage class
10712 qualifier for elf32_arm_stub_a8_veneer_blx.
10713
10714 2010-01-07 Ian Lance Taylor <iant@google.com>
10715
10716 PR 10980
10717 * options.h (class General_options): Add --warn-unresolved-symbols
10718 and --error-unresolved-symbols.
10719 * errors.cc (Errors::undefined_symbol): Implement
10720 --warn-unresolved-symbols.
10721
10722 * options.h (class General_options): Add -z text and -z textoff.
10723 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10724
10725 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10726
10727 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10728 (Garbage_collection::cident_sections): New function.
10729 (Garbage_collection::add_cident_section): New function.
10730 (Garbage_collection::cident_sections_): New member.
10731 (gc_process_relocs): Add references to sections whose names are C
10732 identifiers.
10733 * gold.h (cident_section_start_prefix): New constant.
10734 (cident_section_stop_prefix): New constant.
10735 (is_cident): New function.
10736 * layout.cc (Layout::define_section_symbols): Replace string constants
10737 with the newly defined constants.
10738 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10739 C identifiers.
10740 * testsuite/Makefile.am: Add gc_orphan_section_test.
10741 * testsuite/Makefile.in: Regenerate.
10742 * testsuite/gc_orphan_section_test.cc: New file.
10743 * testsuite/gc_orphan_section_test.sh: New file.
10744
10745 2010-01-06 Ian Lance Taylor <iant@google.com>
10746
10747 PR 10980
10748 * options.h (class General_options): Add --warn-shared-textrel.
10749 * layout.cc (Layout::finish_dynamic_section): Implement
10750 --warn-shared-textrel.
10751
10752 PR 10980
10753 * options.h (class General_options): Add --warn-multiple-gp.
10754
10755 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10756
10757 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10758 $(THREADSLIB) and $(LIBDL).
10759 * Makefile.in: Rebuild.
10760
10761 2010-01-06 Ian Lance Taylor <iant@google.com>
10762
10763 PR 10980
10764 * options.cc (General_options::parse_section_start): New function.
10765 (General_options::section_start): New function.
10766 (General_options::General_options): Initialize all members.
10767 * options.h: Include <map>
10768 (class General_options): Add --section-start. Add section_starts_
10769 member.
10770 * layout.cc (Layout::attach_allocated_section_to_segment): If
10771 --section-start was used, set the address of the segment. Remove
10772 local sort_sections.
10773 (Layout::relaxation_loop_body): If the address of the load segment
10774 has been set by --section-start, don't use it.
10775 * output.h (Output_segment::update_flags_for_output_section): New
10776 function.
10777 * output.cc (Output_segment::add_output_section): Call
10778 update_flags_for_output_section.
10779
10780 2010-01-05 Ian Lance Taylor <iant@google.com>
10781
10782 PR 10980
10783 * options.h (class General_options): Add --undefined-version.
10784 * script.cc (struct Version_expression): Add was_matched_by_symbol
10785 field.
10786 (Version_script_info::matched_symbol): New function.
10787 (Version_script_info::get_symbol_version_helper): Call
10788 matched_symbol.
10789 (Version_script_info::check_unmatched_names): New function.
10790 * script.h (class Version_script_info): Update declarations.
10791 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10792
10793 * options.h (class General_options): Use DEFINE_bool_alias for
10794 allow_multiple_definition.
10795 * resolve.cc (Symbol_table::should_override): Don't test
10796 allow_multiple_definition.
10797
10798 PR 10980
10799 * options.h (class General_options): Add --cref.
10800 * main.cc (main): Print cref table if --cref. Don't close mapfile
10801 until after printing cref table.
10802 * cref.cc: Include "symtab.h".
10803 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10804 (Cref_table_compare::operator()): New function.
10805 (Cref_inputs::gather_cref): New function.
10806 (filecol): New static const.
10807 (Cref_inputs::print_cref): New function.
10808 (Cref::print_cref): New function.
10809 * cref.h: Include <cstdio>.
10810 (class Cref): Update declarations.
10811 * mapfile.h (Mapfile::file): New function.
10812 * object.h (class Object): Define Symbols. Declare virtual
10813 do_get_global_symbols.
10814 (Object::get_global_symbols): New function.
10815 * object.cc (Input_objects::add_object): Pass object to cref_ if
10816 --cref.
10817 (Input_objects::archive_start): Likewise.
10818 (Input_objects::archive_stop): Likewise.
10819 (Input_objects::print_cref): New function.
10820 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10821 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10822 --cref.
10823 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10824 function.
10825 * plugin.h (class Sized_pluginobj): Update declarations.
10826
10827 2010-01-05 Ian Lance Taylor <iant@google.com>
10828
10829 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10830 to is_default_version. Rename insdef to insdefault.
10831 (Symbol_table::add_from_relobj): Rename def to is_default_version
10832 and local to is_forced_local.
10833 (Symbol_table::add_from_pluginobj): Likewise.
10834 (Symbol_table::add_from_dynobj): Likewise.
10835 (Symbol_table::define_special_symbol): Rename insdef to
10836 insdefault.
10837
10838 2010-01-04 Ian Lance Taylor <iant@google.com>
10839
10840 PR 10980
10841 * options.h (class General_options): Add
10842 --allow-multiple-definition and -z muldefs.
10843 * resolve.cc (Symbol_table::should_override): Don't warn about a
10844 multiple symbol definition if --allow-multiple-definition or -z
10845 muldefs.
10846
10847 PR 10980
10848 * options.h (class General_options): Add --add-needed and
10849 --copy-dt-needed-entries. Tweak --as-needed help entry.
10850 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10851 error if --copy-dt-needed-entries aka --add-needed is used and
10852 would cause a change in behaviour.
10853
10854 PR 10980
10855 * options.h (class General_options): Add -G as a short version of
10856 --shared. Add no-op options -assert, -g, and -i.
10857
10858 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10859
10860 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10861 check for .text or .gnu.linkonce.t sections.
10862 * icf.cc (Icf::find_identical_sections): Ditto.
10863 Change the detection for mangled function name within the section
10864 name.
10865 * icf.h (is_section_foldable_candidate): New function.
10866
10867 2009-12-30 Ian Lance Taylor <iant@google.com>
10868
10869 PR 10980
10870 * options.h (class General_options): Permit two dashes with
10871 --retain-symbols-file.
10872
10873 2009-12-30 Ian Lance Taylor <iant@google.com>
10874
10875 PR 10979
10876 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10877 don't put the file header and segment headers in the text
10878 segment.
10879
10880 PR 10979
10881 * common.cc (Sort_commons::operator()): Stabilize sort when both
10882 entries are NULL.
10883 (Symbol_table::do_allocate_commons_list): When allocating common
10884 symbols, skip a symbol which is no longer common.
10885 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10886 an object before checking its type.
10887 * testsuite/common_test_2.c: New file.
10888 * testsuite/common_test_3.c: New file.
10889 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10890 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10891 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10892 (common_test_2_pic.o, common_test_2.so): New targets.
10893 (common_test_3_pic.o, common_test_3.so): New targets.
10894 * testsuite/Makefile.in: Rebuild.
10895
10896 PR 10979
10897 * script.cc (read_input_script): If we see a new SECTIONS clause,
10898 and we have added an input section, give an error.
10899 * layout.h (class Layout): Add have_added_input_section function.
10900 Add have_added_input_section_ field.
10901 * layout.cc (Layout::Layout): Initialize
10902 have_added_input_section_.
10903 (Layout::layout): Set have_added_input_section_.
10904 (Layout::layout_eh_frame): Likewise.
10905
10906 2009-12-30 Ian Lance Taylor <iant@google.com>
10907
10908 PR 10931
10909 * options.h (class General_options): Add --sort-common option.
10910 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10911 * common.cc (Sort_common): Add sort_order parameter to
10912 constructor. Add sort_order_ field.
10913 (Sort_commons::operator): Check sort_order_.
10914 (Symbol_table::allocate_commons): Determine the sort order.
10915 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10916 Change all callers.
10917 (Symbol_table::do_allocate_commons_list): Likewise.
10918
10919 2009-12-30 Ian Lance Taylor <iant@google.com>
10920
10921 PR 10916
10922 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10923 symbols from this object, don't change the visibility of an
10924 undefined symbol.
10925 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10926
10927 2009-12-30 Ian Lance Taylor <iant@google.com>
10928
10929 PR 10861
10930 * script.h (class Version_script_info): Define Language enum.
10931 Update declarations. Define Glob, Exact, and Lookup types. Add
10932 new fields globals_, locals_, and is_finalized_.
10933 * script.cc: Various formatting fixes.
10934 (class Parser_closure): Change language_stack_ from a vector of
10935 std::string to one of Version_script_info::Language. Adjust all
10936 uses accordingly.
10937 (class Lazy_demangler): Remove.
10938 (struct Version_expression): Change language from std::string to
10939 Version_script_info::Language.
10940 (Version_script_info::Version_script_info): New function.
10941 (Version_script_info::~Version_script_info): Don't call clear.
10942 (Version_script_info::finalize): New function.
10943 (Version_script_info::build_lookup_tables): New function.
10944 (Version_script_info::build_expression_list_lookup): New
10945 function.
10946 (Version_script_info::get_symbol_version_helper): Rewrite to use
10947 lookup tables.
10948 (Version_script_info::print_expression_list): Adjust to use
10949 Version_script_info::Language.
10950 (script_push_lex_into_version_mode): Check that the version script
10951 has not been finalized.
10952 (version_script_push_lang): Change language string to
10953 Version_script_info::Language.
10954 * options.cc (Command_line::version_script): New function.
10955 * options.h (class General_options): Add finalize_dynamic_list
10956 function. Change version_script from declaration to definition.
10957 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10958 * testsuite/version_script.map: Remove duplicate def of foo.
10959 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10960 version_script.map.
10961 * testsuite/Makefile.in: Rebuild.
10962
10963 2009-12-30 Ian Lance Taylor <iant@google.com>
10964
10965 PR 10843
10966 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10967 if the input symbol index is 0, make the output symbol index 0.
10968
10969 2009-12-30 Ian Lance Taylor <iant@google.com>
10970
10971 PR 10670
10972 * options.h (class General_options): Add -x/--discard-all.
10973 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10974 --discard-all. If the local symbol needs a dynamic entry, check
10975 that before handling --discard-locals.
10976
10977 2009-12-30 Ian Lance Taylor <iant@google.com>
10978
10979 PR 10450
10980 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10981 flags to PF_R.
10982 (Output_segment::add_output_section): Don't change the flags if
10983 the type is PT_TLS.
10984
10985 PR 10450
10986 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10987 GNU hash table if they need a dynamic value. Otherwise, don't add
10988 them if they are defined in a dynamic object or are forced local.
10989
10990 2009-12-29 Ian Lance Taylor <iant@google.com>
10991
10992 PR 10450
10993 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10994 .gnu.hash table for a 32-bit target.
10995
10996 PR 10450
10997 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10998 regular and a dynamic object only needs a dynamic symbol table
10999 entry if it is externally visible.
11000
11001 PR 10450
11002 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11003 constructor. Add global_offset_table_ field.
11004 (Target_i386::got_section): Set global_offset_table_.
11005 (Target_i386::do_finalize_sections): Set global_offset_table_
11006 size.
11007 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11008 in constructor. Add global_offset_table_ field.
11009 (Target_x86_64::got_section): Set global_offset_table_.
11010 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11011 size.
11012
11013 * layout.cc (Layout::Layout): Initialize increase_relro_.
11014 (Layout::get_output_section): Add is_relro, is_last_relro, and
11015 is_first_non_relro parameters. Change all callers.
11016 (Layout::choose_output_section): Likewise.
11017 (Layout::add_output_section_data): Likewise.
11018 (Layout::make_output_section): Likewise.
11019 (Layout::set_segment_offsets): Clear increase_relro when using a
11020 linker script.
11021 * layout.h (class Layout): Add increase_relro method. Add
11022 increase_relro_ field. Update declarations.
11023 * output.cc (Output_section::Output_section): Initialize
11024 is_last_relro_ and is_first_non_relro_.
11025 (Output_segment::add_output_section): Group relro sections is
11026 do_sort is true. Handle is_last_relro and is_first_non_relro.
11027 (Output_segment::maximum_alignment): Remove relro handling.
11028 (Output_segment::set_section_addresses): Add increase_relro
11029 parameter. Change all callers. Add initial alignment to align
11030 relro sections on separate page. Remove old relro handling.
11031 (Output_segment::set_section_list_addresses): Remove in_relro
11032 parameter. Change all callers.
11033 (Output_segment::set_offset): Add increase parameter. Change all
11034 callers. Remove old relro handling.
11035 * output.h (class Output_section): Add new methods: is_last_relro,
11036 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11037 Add is_last_relro_ and is_first_non_relro_ fields.
11038 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11039 Create separate .got.plt section. Call increase_relro.
11040 * x86_64.cc (Target_x86_64::got_section): Likewise.
11041 * testsuite/relro_script_test.t: Add .got.plt.
11042
11043 PR 10450
11044 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11045 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11046 (Layout::finalize): Call set_dynamic_symbol_size.
11047 (Layout::set_dynamic_symbol_size): New function.
11048 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11049 set_dynamic_symbol_size.
11050
11051 PR 10450
11052 * output.h (class Output_section): Add is_entsize_zero_ field.
11053 * output.cc (Output_section::Output_section): Initialize
11054 is_entsize_zero_.
11055 (Output_section::set_entsize): If two different entsizes are
11056 requested, force it to zero.
11057 (Output_section::add_input_section): Set flags for .debug_str
11058 before updating section flags. Set entsize.
11059 (Output_section::update_flags_for_input_section): Set SHF_MERGE
11060 and SHF_STRING if all input sections have those flags.
11061
11062 2009-12-29 Rafael Espindola <espindola@google.com>
11063
11064 * main.cc (main): Fix the sys time reporting.
11065 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11066 reporting.
11067
11068 2009-12-29 Sriraman Tallam <tmsriram@google.com>
11069
11070 * options.cc (General_options::parse_version): Allow -v to exit
11071 without an error if there is nothing to link.
11072
11073 2009-12-29 Ian Lance Taylor <iant@google.com>
11074
11075 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11076 using a version of gcc before 4.1.
11077 * configure: Rebuild.
11078
11079 2009-12-28 Chris Demetriou <cgd@google.com>
11080
11081 * attributes.cc (Output_attributes_section_data::do_write): Use
11082 std::vector::front rather than std::vector::data.
11083
11084 2009-12-28 Ian Lance Taylor <iant@google.com>
11085
11086 * symtab.h (class Symbol_table): Add enum Defined.
11087 * resolve.cc (Symbol_table::should_override): Add defined
11088 parameter. Change all callers. Test whether object is NULL
11089 before calling a method on it.
11090 (Symbol_table::report_resolve_problem): Add defined parameter.
11091 Change all callers.
11092 (Symbol_table::should_override_with_special): Likewise.
11093 * symtab.cc (Symbol_table::define_in_output_data): Add defined
11094 parameter. Change all callers.
11095 (Symbol_table::do_define_in_output_data): Likewise.
11096 (Symbol_table::define_in_output_segment): Likewise.
11097 (Symbol_table::do_define_in_output_segment): Likewise.
11098 (Symbol_table::define_as_constant): Likewise.
11099 (Symbol_table::do_define_as_constant): Likewise.
11100 * script.h (class Symbol_assignment): Add is_defsym parameter to
11101 constructor; change all callers.
11102 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11103 parameter. Change all callers. Add is_defsym_ field.
11104 (class Parser_closure): Add parsing_defsym parameter to
11105 constructor; change all callers. Add parsing_defsym accessor
11106 function. Add parsing_defsym_ field.
11107
11108 2009-12-28 Ian Lance Taylor <iant@google.com>
11109
11110 * gold.cc (queue_middle_tasks): Fix formatting.
11111 * object.cc (Relobj::is_section_name_included): Likewise.
11112
11113 2009-12-23 Ian Lance Taylor <iant@google.com>
11114
11115 * i386.cc (Target_i386::do_calls_non_split): Recognize
11116 -fsplit-stack prologue for a function with a static chain.
11117 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11118 -fsplit-stack prologue when using %r11.
11119
11120 2009-12-21 Sriraman Tallam <tmsriram@google.com>
11121
11122 * options.cc (General_options::parse_version): Make -v continue and do
11123 the link like GNU ld does.
11124
11125 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
11126
11127 * Makefile.am (CCFILES): Add timer.cc.
11128 (HFILES): Add timer.h.
11129 * configure.ac: Check for sysconf and times.
11130 * main.cc: include timer.h.
11131 (main): Use Timer instead of get_run_time.
11132 * timer.cc: New.
11133 * timer.h: New.
11134 * workqueue.cc: include timer.h.
11135 (Workqueue::find_and_run_task):
11136 Report user, sys and wall time.
11137 * Makefile.in: Regenerate.
11138 * config.in: Regenerate.
11139 * configure: Regenerate.
11140
11141 2009-12-16 Doug Kwan <dougkwan@google.com>
11142
11143 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11144 sections.
11145 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11146 relaxed input sections.
11147 * output.cc (Output_section::find_relaxed_input_section): Change
11148 return type to Output_relaxed_input_section pointer. Adjust code
11149 for new type of relaxed_input_section_map_.
11150 * output.h (Output_section::find_relaxed_input_section): Change
11151 return type to Output_relaxed_input_section pointer.
11152 (Output_section::Output_relaxed_input_section_by_input_section_map):
11153 New type.
11154 (Output_section::relaxed_input_section_map_): Change type to
11155 Output_section::Output_relaxed_input_section_by_input_section_map.
11156 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11157 input section.
11158
11159 2009-12-15 Ian Lance Taylor <iant@google.com>
11160
11161 * layout.cc (Layout::create_shstrtab): Only write out after input
11162 sections if we are compressing debug sections.
11163
11164 2009-12-15 Ian Lance Taylor <iant@google.com>
11165
11166 * archive.cc (Archive::add_symbols): Only look up a symbol without
11167 a version if there is, in fact, a version.
11168
11169 2009-12-14 Ian Lance Taylor <iant@google.com>
11170
11171 Revert -Wshadow changes, all changes from:
11172 2009-12-11 Doug Kwan <dougkwan@google.com>
11173 2009-12-11 Nick Clifton <nickc@redhat.com>
11174 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11175
11176 2009-12-11 Doug Kwan <dougkwan@google.com>
11177
11178 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11179 due to -Wshadow.
11180 * attributes.cc (Object_attribute::size): Ditto.
11181 (Attributes_section_data::size): Ditto.
11182 (Attributes_section_data::Attributes_section_data): Ditto.
11183 (Output_attributes_section_data::do_write): Ditto.
11184 * attributes.h (Object_attribute::set_type): Ditto.
11185 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11186
11187 2009-12-11 Nick Clifton <nickc@redhat.com>
11188
11189 * archive.cc: Fix shadowed variable warnings.
11190 * arm.cc: Likewise.
11191 * compressed_output.cc: Likewise.
11192 * compressed_output.h: Likewise.
11193 * configure: Likewise.
11194 * dwarf_reader.cc: Likewise.
11195 * dynobj.cc: Likewise.
11196 * dynobj.h: Likewise.
11197 * ehframe.cc: Likewise.
11198 * ehframe.h: Likewise.
11199 * errors.cc: Likewise.
11200 * expression.cc: Likewise.
11201 * fileread.cc: Likewise.
11202 * fileread.h: Likewise.
11203 * freebsd.h: Likewise.
11204 * i386.cc: Likewise.
11205 * icf.cc: Likewise.
11206 * incremental.h: Likewise.
11207 * layout.cc: Likewise.
11208 * layout.h: Likewise.
11209 * mapfile.cc: Likewise.
11210 * merge.cc: Likewise.
11211 * merge.h: Likewise.
11212 * object.cc: Likewise.
11213 * object.h: Likewise.
11214 * options.h: Likewise.
11215 * output.cc: Likewise.
11216 * output.h: Likewise.
11217 * parameters.cc: Likewise.
11218 * plugin.cc: Likewise.
11219 * powerpc.cc: Likewise.
11220 * reduced_debug_output.cc: Likewise.
11221 * reduced_debug_output.h: Likewise.
11222 * reloc.cc: Likewise.
11223 * reloc.h: Likewise.
11224 * resolve.cc: Likewise.
11225 * script-sections.cc: Likewise.
11226 * script.cc: Likewise.
11227 * script.h: Likewise.
11228 * sparc.cc: Likewise.
11229 * symtab.cc: Likewise.
11230 * symtab.h: Likewise.
11231 * target-select.cc: Likewise.
11232 * target-select.h: Likewise.
11233 * token.h: Likewise.
11234 * workqueue.cc: Likewise.
11235 * workqueue.h: Likewise.
11236 * x86_64.cc: Likewise.
11237
11238 2009-12-10 Doug Kwan <dougkwan@google.com>
11239
11240 * arm.cc (attributes.h): New include.
11241 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11242 (Arm_relobj::~Arm_relobj): Delete object pointed by
11243 attributes_section_data_.
11244 (Arm_relobj::attributes_section_data): New method definition.
11245 (Arm_relobj::attributes_section_data_): New data member declaration.
11246 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11247 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11248 attributes_section_data_.
11249 (Arm_dynobj::attributes_section_data): New method definition.
11250 (Arm_dynobj::attributes_section_data_): New data member declaration.
11251 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
11252 initialization value of may_use_blx_ to false.
11253 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11254 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11255 object attributes to compute results instead of hard-coding.
11256 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11257 Target_arm::get_secondary_compatible_arch,
11258 Target_arm::set_secondary_compatible_arch
11259 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11260 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11261 New method declarations.
11262 (Target_arm::get_aeabi_object_attribute): New method definition.
11263 (Target_arm::attributes_section_data_): New data member declaration.
11264 (read_arm_attributes_section): New template definition.
11265 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11266 (Arm_dynobj::do_read_symbols): Ditto.
11267 (Target_arm::do_finalize_sections): Merge attributes sections from
11268 input. Check for BLX use after attributes section merging.
11269 Fix __exidx_start and __exidx_end visibility. Create an
11270 .ARM.attributes section if necessary.
11271 (Target_arm::get_secondary_compatible_arch,
11272 Target_arm::set_secondary_compatible_arch,
11273 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11274 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11275 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11276 New method definitions.
11277
11278 2009-12-09 Ian Lance Taylor <iant@google.com>
11279
11280 * plugin.cc (Plugin::load): Don't cast from void* to a function
11281 pointer.
11282
11283 2009-12-09 Ian Lance Taylor <iant@google.com>
11284
11285 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11286 information fields.
11287
11288 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
11289
11290 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11291 Replace two_file_shared_1.so with two_file_shared_2.so.
11292 * testsuite/Makefile.in: Regenerated.
11293
11294 2009-12-08 Doug Kwan <dougkwan@google.com>
11295
11296 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11297 (HFILES): Add attributes.h and int_encoding.h.
11298 * Makefile.in: Regenerate.
11299 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11300 function definitions to int_encoding.cc
11301 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11302 prototypes to int_encoding.h
11303 * reduced_debug_output.cc (int_encoding.h): New include.
11304 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11305 function definitions to int_encoding.cc
11306 (insert_into_vector, read_from_pointer): Move template definitions to
11307 int_encoding.h
11308 * attributes.cc: New file.
11309 * attributes.h: New file.
11310 * int_encoding.cc: New file.
11311 * int_encoding.h: New file.
11312
11313 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
11314
11315 PR gold/11055
11316 * incremental-dump.cc (dump_incremental_inputs): New.
11317 (main): Use dump_incremental_inputs.
11318
11319 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
11320
11321 PR gold/10893
11322 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11323 checking elfcpp::STT_FUNC.
11324 (Target_i386::Relocate::relocate): Likewise.
11325 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11326
11327 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11328 symbols from shared libraries into normal FUNC symbols.
11329
11330 * symtab.h (Symbol): Add is_func and use it.
11331
11332 2009-12-05 Doug Kwan <dougkwan@google.com>
11333
11334 * arm.cc (Target_arm::arm_info): Initialize new fields
11335 attributes_section and attributes_vendor.
11336 * i386.cc (Target_i386::i386_info): Same.
11337 * object.cc (Sized_relobj::do_layout): Skip attribute section.
11338 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11339 fields attributes_section and attributes_vendor.
11340 * sparc.cc (Target_sparc::sparc_info): Same.
11341 * target.h (Target::attributes_section, Target::attributes_vendor,
11342 Target::is_attributes_section, Target::attribute_arg_type,
11343 Target::attributes_order): New method definitions.
11344 (Target::Target_info::attributes_section,
11345 Target::Target_info::attributes_vendor): New fields.
11346 (Target::do_attribute_arg_type, Target::do_attributes_order): New
11347 virtual method definitions.
11348 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11349 attributes_section and attributes_vendor.
11350 * testsuite/testfile.cc (Target_test::test_target_info): Same.
11351
11352 2009-12-05 Doug Kwan <dougkwan@google.com>
11353
11354 * arm.cc: Update comments about interworking and stub generation.
11355 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11356 considered as non-PIC.
11357 (Arm_relocate_functions::base_abs): Fix formatting.
11358 (Arm_relocate_functions::got_prel): Fix comment. Change interface
11359 of function to use GOT entry address instead of offset.
11360 (Target_arm::Scan::global): Issue an error if a symbol would need a
11361 PLT does not get one because it is untyped. Remove code to create
11362 dynamic symbols for relative branches.
11363 (Target_arm::Relocate::relocate: Use 0 instead of false since function
11364 takes unsigned integer instead of boolean.
11365
11366 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
11367
11368 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11369 (two_file_test_LDADD): Likewise.
11370 (common_test_1_LDADD): Likewise.
11371 (exception_test_LDADD) Likewise.
11372 (weak_test_LDADD): Likewise.
11373 (many_sections_test_LDADD): Likewise.
11374 (initpri1_LDADD): Likewise.
11375 (script_test_1_LDADD): Likewise.
11376 (script_test_2_LDADD): Likewise.
11377 (justsyms_LDADD): Likewise.
11378 (binary_test_LDADD): Likewise.
11379 (large_LDADD): Likewise.
11380 * testsuite/Makefile.in: Regenerated.
11381
11382 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
11383
11384 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11385 (Symbol_table::override_with_special): Likewise.
11386 (Symbol_table::add_from_object): Likewise.
11387
11388 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11389
11390 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11391 Don't set the data_offset twice.
11392
11393 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11394
11395 * testsuite/Makefile.in: Regenerate.
11396
11397 2009-12-03 Doug Kwan <dougkwan@google.com>
11398
11399 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11400 (Target_arm::do_finalize_sections): Add parameter for symbol table
11401 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
11402 * i386.cc (Target_i386::do_finalize_sections): Add an additional
11403 parameter for symbol table pointer.
11404 * layout.cc (Layout::finalize): Call Target::finalize_sections with
11405 an additional parameter for a pointer to symbol table.
11406 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11407 parameter for a symbol table pointer.
11408 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11409 * target.h (Target::finalize_sections, Target::do_finalize_sections):
11410 Ditto.
11411 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11412 parameter for a symbol table pointer.
11413
11414 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
11415
11416 * incremental.cc (Incremental_inputs_header)
11417 (Incremental_inputs_header_write, Incremental_inputs_entry)
11418 (Incremental_inputs_entry_write): Move ...
11419 * incremental.h (Incremental_inputs_header)
11420 (Incremental_inputs_header_write, Incremental_inputs_entry)
11421 (Incremental_inputs_entry_write): here.
11422
11423 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11424
11425 * incremental.cc (make_sized_incremental_binary): Set the target.
11426 Error if it is incompatible.
11427 * output.h (Output_file): Add filename method.
11428
11429 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11430
11431 * incremental.cc (Incremental_inputs_entry): Remove unused argument
11432 from the get_* methods.
11433
11434 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11435
11436 * incremental-dump.cc (main): Check that the offeset of a script is 0.
11437 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11438 Write 0 for the data_offset of scripts.
11439
11440 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11441
11442 * testsuite/Makefile.am: Add the incremental_test.sh test.
11443 * testsuite/incremental_test.sh: New.
11444 * testsuite/incremental_test_1.c: New.
11445 * testsuite/incremental_test_2.c: New.
11446
11447 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
11448
11449 * incremental-dump.cc (main): Fix typos.
11450
11451 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
11452
11453 PR gold/11025
11454 * incremental-dump.cc (main): Use llu to print 64 bit values.
11455
11456 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
11457 H.J. Lu <hongjiu.lu@intel.com>
11458
11459 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11460 $(LIBDL).
11461 (incremental_dump_LDADD): Likewise.
11462 * Makefile.in: Regenerated.
11463
11464 2009-11-25 Doug Kwan <dougkwan@google.com>
11465
11466 Revert:
11467
11468 2009-11-25 Doug Kwan <dougkwan@google.com>
11469
11470 * arm.cc (Target_arm::Target_arm): Move method definition
11471 outside of class definition. Add code to handle
11472 --target1-rel, --target1-abs and --target2= options.
11473 (Target_arm::get_reloc_reloc_type): Change method to be
11474 non-static and const.
11475 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11476 New data member declaration.
11477 (Target_arm::Scan::local, Target_arm::Scan::global,
11478 Target_arm::Relocate::relocate,
11479 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11480 Adjust call to Target_arm::get_real_reloc_type.
11481 (Target_arm::get_real_reloc_type): Use command line options
11482 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11483 * options.h (--target1-rel, --target1-abs, --target2): New
11484 ARM-only options.
11485
11486 2009-11-25 Doug Kwan <dougkwan@google.com>
11487
11488 * arm.cc (Target_arm::Target_arm): Move method definition outside of
11489 class definition. Add code to handle --target1-rel, --target1-abs
11490 and --target2= options.
11491 (Target_arm::get_reloc_reloc_type): Change method to be non-static
11492 and const.
11493 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11494 member declaration.
11495 (Target_arm::Scan::local, Target_arm::Scan::global,
11496 Target_arm::Relocate::relocate,
11497 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11498 call to Target_arm::get_real_reloc_type.
11499 (Target_arm::get_real_reloc_type): Use command line options to
11500 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11501 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11502 options.
11503
11504 2009-11-25 Doug Kwan <dougkwan@google.com>
11505
11506 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11507 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11508 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11509 formatting.
11510 (Arm_relocate_functions::thm_call): Replace body with a call to
11511 Arm_relocate_functions::thumb_branch_common.
11512 (Arm_relocate_functions::thm_jump24,
11513 Arm_relocate_functions::thm_xpc22): New method definitions.
11514 (Arm_relocate_functions::thumb_branch_common): New method definition.
11515 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11516 operator.
11517 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11518 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11519
11520 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11521
11522 * Makefile.am: Build incremental-dump
11523 * Makefile.in: Regenerate.
11524 * incremental-dump.cc: New.
11525 * incremental.cc (Incremental_inputs_header_data,
11526 Incremental_inputs_entry_data): Move to incremental.h
11527 * incremental.h: (Incremental_inputs_header_data,
11528 Incremental_inputs_entry_data): Move from incremental.cc
11529
11530 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11531
11532 * incremental.cc (Incremental_inputs_header,
11533 Incremental_inputs_header_write, Incremental_inputs_entry,
11534 Incremental_inputs_entry_write): Add a typedef with the data type.
11535
11536 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11537
11538 * incremental.cc (Incremental_inputs_header,
11539 Incremental_inputs_header_write, Incremental_inputs_entry,
11540 Incremental_inputs_entry_write): Update comment about which
11541 type has the filed descriptions.
11542
11543 2009-11-15 Doug Kwan <dougkwan@google.com>
11544
11545 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11546 (Arm_relocate_functions::arm_branch_common): Change method defintion
11547 in class definition to a method declaration and update list of formal
11548 parameters.
11549 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11550 Arm_relocation_functions::jump24): Adjust call to
11551 Arm_relocate_functions::arm_branch_common. Update list of formal
11552 parameters.
11553 (Arm_relocate_functions::xpc25): New method definition.
11554 (Arm_relocate_functions::arm_branch_common): Move method defintion
11555 out from class definition. Use stubs for mode-switching and extending
11556 branch ranges.
11557 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11558 specially. Change code to enable use of stubs in ARM branches.
11559
11560 2009-11-10 Doug Kwan <dougkwan@google.com>
11561
11562 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11563 in method declaration.
11564 (Target_arm::relocate_stub): New method declaration.
11565 (Target_arm::default_target): Change to return a pointer instead of
11566 a const reference.
11567 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11568 Target_arm::default_target.
11569 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11570 method definition.
11571 (Target_arm::relocate_section): Adjust view.
11572 (Target_arm::relocate_stub): New method definition.
11573
11574 2009-11-10 Doug Kwan <dougkwan@google.com>
11575
11576 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11577 a format warning.
11578 * incremental.cc (open_incremental_binary): Initialized local
11579 variables to avoid warnings.
11580 * object.cc (make_elf_object): Ditto.
11581 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11582 a format warning.
11583
11584 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11585
11586 PR gold/10930
11587 * testsuite/plugin_test.c: Include "config.h".
11588
11589 2009-11-09 Doug Kwan <dougkwan@google.com>
11590
11591 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11592 (arm_symbol_value): Remove.
11593 (Arm_relocate_functions::arm_branch_common,
11594 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11595 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11596 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11597 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11598 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11599 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11600 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11601 Arm_relocate_functions::thm_mobw_abs_nc,
11602 Arm_relocate_functions::thm_mov_abs,
11603 Arm_relocate_functions::movw_prel_nc,
11604 Arm_relocate_functions::thm_movt_abs,
11605 Arm_relocate_functions::movt_prel,
11606 Arm_relocate_functions::thm_movw_prel_nc,
11607 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11608 (Target_arm::Relocate::relocate): Only decompose address into two
11609 parts if relocation type uses the thumb-bit and pass the actual
11610 bit instead of a flag indicating that the thumb-bit is used. Adjust
11611 calls to methods in Arm_relocate_functions for this change.
11612
11613 2009-11-08 Ian Lance Taylor <iant@google.com>
11614
11615 PR 10925
11616 * reloc.cc: Instantiate
11617 Sized_relobj::initialize_input_to_output_maps and
11618 Sized_relobj:free_input_to_output_maps.
11619
11620 2009-11-06 Ian Lance Taylor <iant@google.com>
11621
11622 PR 10876
11623 * defstd.cc (in_segment): Set only_if_ref true for "end".
11624
11625 2009-11-06 Doug Kwan <dougkwan@google.com>
11626
11627 * arm.cc (class Reloc_stub): Correct a comment.
11628 (Target_arm::Target_arm): Initialize arm_input_section_map_.
11629 (Target_arm::scan_section_for_stubs): New method declaration.
11630 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11631 Change methods from private to protected.
11632 (Target_arm::do_may_relax): New method definition.
11633 (Target_arm::do_relax, Target_arm::group_sections,
11634 Target_arm::scan_reloc_for_stub,
11635 Target_arm::scan_reloc_section_for_stubs): New method declarations.
11636 (Target_arm::arm_input_section_map_): New data member declaration.
11637 (Target_arm::scan_reloc_for_stub,
11638 Target_arm::scan_reloc_section_for_stubs,
11639 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11640 Target_arm::do_relax): New method definitions.
11641
11642 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
11643
11644 * configure.ac: Check for (struct stat)::st_mtim
11645 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11646 * config.in: Regenerate.
11647 * configure: Regenerate.
11648
11649 2009-11-05 Ian Lance Taylor <iant@google.com>
11650
11651 PR 10910
11652 * output.cc (Output_segment::add_output_section): Add missing
11653 return statement.
11654
11655 2009-11-04 Ian Lance Taylor <iant@google.com>
11656
11657 PR 10880
11658 * object.h (class Object): Add is_needed and set_is_needed
11659 methods. Add is_needed_ field. Make bool fields into bitfields.
11660 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11661 defined in a dynamic object and referenced by a regular object,
11662 set is_needed for the dynamic object.
11663 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11664 if the file is marked with as_needed and it is not needed.
11665
11666 2009-11-04 Ian Lance Taylor <iant@google.com>
11667
11668 PR 10887
11669 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11670 tags if data is discarded by linker script.
11671 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11672 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11673 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11674 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11675
11676 2009-11-04 Ian Lance Taylor <iant@google.com>
11677
11678 * layout.cc (Layout::get_output_section): Add is_interp and
11679 is_dynamic_linker_section parameters. Change all callers.
11680 (Layout::choose_output_section): Likewise.
11681 (Layout::make_output_section): Likewise.
11682 (Layout::add_output_section_data): Add is_dynamic_linker_section
11683 parameter. Change all callers.
11684 * layout.h (class Layout): Update declarations.
11685 * output.h (class Output_section): Add is_interp, set_is_interp,
11686 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11687 Add is_interp_, is_dynamic_linker_section_ fields. Change
11688 generate_code_fills_at_write_ to a bitfield.
11689 * output.cc (Output_section::Output_sections): Initialize new
11690 fields.
11691 (Output_segment::add_output_section): Add do_sort parameter.
11692 Change all callers.
11693
11694 2009-11-03 Ian Lance Taylor <iant@google.com>
11695
11696 PR 10860
11697 * options.h (class General_options): Add --warn-common.
11698 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11699 merging two common symbols.
11700 (Symbol_table::should_override): Handle --warn-common when merging
11701 a common symbol with a defined symbol. Use report_resolve_problem
11702 for multiple definitions.
11703 (Symbol_table::report_resolve_problem): New function.
11704 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11705
11706 2009-11-03 Doug Kwan <dougkwan@google.com>
11707
11708 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11709 stub_factory_.
11710 (Target_arm::stub_factory): New method definition.
11711 (Target_arm::new_arm_input_section,
11712 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11713 Target_arm::reloc_uses_thumb_bit): New method declarations.
11714 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11715 New type definitions.
11716 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11717 member declarations.
11718 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11719 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11720 New method definitions.
11721
11722 2009-11-03 Ian Lance Taylor <iant@google.com>
11723
11724 * options.h (class General_options): Add --warn_constructors.
11725
11726 2009-11-03 Ian Lance Taylor <iant@google.com>
11727
11728 PR 10893
11729 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11730 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11731
11732 2009-11-03 Ian Lance Taylor <iant@google.com>
11733
11734 PR 10895
11735 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11736 --msgid-bugs-address.
11737 (install-pdf): New target.
11738 (install-data_yes): Look up one directory to find mkinstalldirs.
11739
11740 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11741
11742 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11743 tree.
11744
11745 2009-10-30 Doug Kwan <dougkwan@google.com>
11746
11747 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11748
11749 2009-10-30 Doug Kwan <dougkwan@google.com>
11750
11751 * arm.cc (Stub_addend_reader): New struct template definition
11752 and partial specializations.
11753 (Stub_addend_reader::operator()): New method definition for a
11754 partially specialized template.
11755
11756 2009-10-30 Doug Kwan <dougkwan@google.com>
11757
11758 * arm.cc (Arm_relobj::processor_specific_flags): New method
11759 definition.
11760 (Arm_relobj::do_read_symbols): New method declaration.
11761 (Arm_relobj::processor_specific_flags_): New data member declaration.
11762 (Arm_dynobj): New class definition.
11763 (Target_arm::do_finalize_sections): Add input_objects parameter.
11764 (Target_arm::do_adjust_elf_header): New method declaration.
11765 (Target_arm::are_eabi_versions_compatible,
11766 (Target_arm::merge_processor_specific_flags): New method declaration.
11767 (Target_arm::do_make_elf_object): New overloaded method definitions
11768 and declaration.
11769 (Arm_relobj::do_read_symbols): New method definition.
11770 (Arm_dynobj::do_read_symbols): Ditto.
11771 (Target_arm::do_finalize_sections): Add input_objects parameters.
11772 Merge processor-specific flags from all input objects.
11773 (Target_arm::are_eabi_versions_compatible,
11774 Target_arm::merge_processor_specific_flags,
11775 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11776 New method definitions.
11777 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11778 Input_objects pointer type parameter.
11779 * layout.cc (Layout::finalize): Pass input objects to target's.
11780 finalize_sections function.
11781 * output.cc (Output_file_header::do_sized_write): Set ELF file
11782 header's processor-specific flags.
11783 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11784 Input_objects pointer type parameter.
11785 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11786 * target.h (Input_objects): New forward class declaration.
11787 (Target::processor_specific_flags,
11788 Target::are_processor_specific_flags_sect): New method definitions.
11789 (Target::finalize_sections): Add input_objects parameter.
11790 (Target::Target): Initialize processor_specific_flags_ and
11791 are_processor_specific_flags_set_.
11792 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11793 parameter.
11794 (Target::set_processor_specific_flags): New method definition.
11795 (Target::processor_specific_flags_,
11796 Target::are_processor_specific_flags_set_): New data member
11797 declarations.
11798 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11799 Input_objects pointer type parameter.
11800
11801 2009-10-30 Doug Kwan <dougkwan@google.com>
11802
11803 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11804
11805 2009-10-28 Ian Lance Taylor <iant@google.com>
11806
11807 * object.h (class Relobj): Drop options parameter from
11808 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11809 do_scan_relocs, do_relocate. Change all callers.
11810 (class Sized_relobj): Drop options parameters from
11811 do_gc_process_relocs, do_scan_relocs, do_relocate,
11812 do_relocate_sections, relocate_sections, emit_relocs_scan,
11813 emit_relocs_scan_reltype. Change all callers.
11814 (struct Relocate_info): Remove options field and all references to
11815 it.
11816 * reloc.h (class Read_relocs): Remove options constructor
11817 parameter and options_ field. Change all callers.
11818 (class Gc_process_relocs, class Scan_relocs): Likewise.
11819 (class Relocate_task): Likewise.
11820 * target-reloc.h (scan_relocs): Remove options parameter. Change
11821 all callers.
11822 (scan_relocatable_relocs): Likewise.
11823 * target.h (class Sized_target): Remove options parameter from
11824 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11825 all callers.
11826 * gc.h (gc_process_relocs): Remove options parameter. Change all
11827 callers.
11828 * arm.cc: Update functions to remove options parameters.
11829 * i386.cc: Likewise.
11830 * powerpc.cc: Likewise.
11831 * sparc.cc: Likewise.
11832 * x86_64.cc: Likewise.
11833 * testsuite/testfile.cc: Likewise.
11834
11835 2009-10-28 Doug Kwan <dougkwan@google.com>
11836
11837 * arm.cc (Arm_relobj): New class definition.
11838 (Arm_relobj::scan_sections_for_stubs,
11839 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11840 New method definitions.
11841
11842 2009-10-28 Cary Coutant <ccoutant@google.com>
11843
11844 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11845 (Plugin::cleanup_done_): New member.
11846 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11847 (Plugin_manager::cleanup_done_): Remove.
11848 (Plugin_manager::add_input_file): Edit error message.
11849 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11850 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11851
11852 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11853
11854 * fileread.cc: (File_read::View::~View): Use the new
11855 data_ownership_ filed.
11856 (File_read::~File_read): Dispose the new whole_file_view_.
11857 (File_read::open): Mmap the whole file if needed.
11858 (File_read::open): Use whole_file_view_ instead of contents_.
11859 (File_read::find_view): Use whole_file_view_ if applicable.
11860 (File_read::do_read): Use whole_file_view_ instead of contents_.
11861 (File_read::make_view): Use whole_file_view_ instead of contents_,
11862 update File_read::View::View call.
11863 (File_read::find_or_make_view): Update File_read::View::View
11864 call.
11865 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11866 remove contents_
11867 (File_read::View::Data_ownership): New enum.
11868 (File_read::View::View): Replace bool mapped_ with Data_ownership
11869 argument.
11870 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11871 (File_read::View::data_ownership_): New field.
11872 (File_read::contents_): Remove (replaced by whole_file_view_).
11873 (File_read::whole_file_view_): New field.
11874 * options.h (class General_options): Add --keep-files-mapped.
11875
11876 2009-10-27 Cary Coutant <ccoutant@google.com>
11877
11878 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11879 * testsuite/Makefile.am (plugin_test_5): New test case.
11880 * testsuite/Makefile.in: Regenerate.
11881
11882 2009-10-25 Doug Kwan <dougkwan@google.com>
11883
11884 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11885 from private to protected to allow access by child class.
11886 (Sized_relobj::do_relocate_sections): New method declaration.
11887 (Sized_relobj::relocate_sections): Virtualize.
11888 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11889 Sized_relobj::relocate_sections. Instantiate template explicitly
11890 for different target sizes and endianity.
11891
11892 2009-10-24 Doug Kwan <dougkwan@google.com>
11893
11894 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11895 (Arm_input_section::as_arm_input_section): New method.
11896 (Arm_output_section): New class definition.
11897 (Arm_output_section::create_stub_group,
11898 Arm_output_section::group_sections): New method definitions.
11899
11900 2009-10-22 Doug Kwan <dougkwan@google.com>
11901
11902 * arm.cc (Arm_input_section): New class definition.
11903 (Arm_input_section::init, Arm_input_section:do_write,
11904 Arm_input_section::set_final_data_size,
11905 Arm_input_section::do_reset_address_and_file_offset): New method
11906 definitions.
11907
11908 2009-10-21 Doug Kwan <dougkwan@google.com>
11909
11910 * arm.cc (Stub_table, Arm_input_section): New forward class
11911 declarations.
11912 (Stub_table): New class defintion.
11913 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11914 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11915 New method definition.
11916
11917 2009-10-21 Doug Kwan <dougkwan@google.com>
11918
11919 * arm.cc: Update copyright comments.
11920 (Target_arm): New forward class template declaration.
11921 (Arm_address): New type.
11922 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11923 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11924 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11925 constants.
11926 (Insn_template): Same.
11927 (DEF_STUBS): New macro.
11928 (Stub_type): New enum type.
11929 (Stub_template): New class definition.
11930 (Stub): Same.
11931 (Reloc_stub): Same.
11932 (Stub_factory): Same.
11933 (Target_arm::Target_arm): Initialize may_use_blx_ and
11934 should_force_pic_veneer_.
11935 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11936 Target_arm::should_force_pic_veneer,
11937 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11938 Target_arm::using_thumb_only, Target_arm:;default_target): New
11939 method defintions.
11940 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11941 New data member declarations.
11942 (Insn_template::size, Insn_template::alignment): New method defintions.
11943 (Stub_template::Stub_template): New method definition.
11944 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11945 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11946 (Stub_factory::Stub_factory): New method definition.
11947 * gold.h (string_hash): New template.
11948 * output.h (Input_section_specifier::hash_value): Use
11949 gold::string_hash.
11950 (Input_section_specifier::string_hash): Remove.
11951 * stringpool.cc (Stringpool_template::string_hash): Use
11952 gold::string_hash.
11953
11954 2009-10-20 Doug Kwan <dougkwan@google.com>
11955
11956 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11957 symbols of relaxed input sections.
11958 * output.h (Output_section::find_relaxed_input_section): Make
11959 method public.
11960
11961 2009-10-16 Doug Kwan <dougkwan@google.com>
11962
11963 * dynobj.cc (Versions::Versions): Initialize version_script_.
11964 Only insert base version symbol definition for a shared object
11965 if version script defines any version versions.
11966 (Versions::define_base_version): New method definition.
11967 (Versions::add_def): Check that base version is not needed.
11968 (Versions::add_need): Define base version lazily.
11969 * dynobj.h (Versions::define_base_version): New method declaration.
11970 (Versions::needs_base_version_): New data member declaration.
11971 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11972 (check_DATA): Add no_version_test.stdout.
11973 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11974 New make rules.
11975 * testsuite/Makefile.in: Regenerate.
11976 * testsuite/no_version_test.c: New file.
11977 * testsuite/no_version_test.sh: Ditto.
11978
11979 2009-10-16 Doug Kwan <dougkwan@google.com>
11980
11981 * expression.cc (class Segment_start_expression): New class definition.
11982 (Segment_start_expression::value): New method definition.
11983 (script_exp_function_segment_start): Return a new
11984 Segment_start_expression.
11985 * gold/script-c.h (script_saw_segment_start_expression): New function
11986 prototype.
11987 * script-sections.cc (Script_sections::Script_sections): Initialize
11988 SAW_SEGMENT_START_EXPRESSION_ to false.
11989 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11990 and -Tbbs options to specify section addresses if given in
11991 command line and no SEGMENT_START expression is seen in a script.
11992 * script-sections.h (Script_sections::saw_segment_start_expression,
11993 Script_sections::set_saw_segment_start_expression): New method
11994 definition.
11995 (Script_sections::saw_segment_start_expression_): New data member
11996 declaration.
11997 * script.cc (script_saw_segment_start_expression): New function.
11998 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11999 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12000 script_test_7.sh and script_test_8.sh.
12001 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12002 script_test_8.stdout.
12003 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12004 (script_test_6, script_test_6.stdout, script_test_7,
12005 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12006 * Makefile.in: Regenerate.
12007 * testsuite/script_test_6.sh: New file.
12008 * testsuite/script_test_6.t: Same.
12009 * testsuite/script_test_7.sh: Same.
12010 * testsuite/script_test_7.t: Same.
12011 * testsuite/script_test_8.sh: Same.
12012
12013 2009-10-16 Doug Kwan <dougkwan@google.com>
12014
12015 * output.cc (Output_segment::set_section_list_address): Cast
12016 expressions to unsigned long long type to avoid format warnings.
12017
12018 2009-10-15 Ian Lance Taylor <iant@google.com>
12019
12020 * script.cc (Script_options::add_symbol_assignment): Always add a
12021 dot assignment to script_sections_.
12022 * script-sections.cc (Script_sections::add_dot_assignment):
12023 Initialize if necessary.
12024
12025 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12026 program headers with no load segment if there is a linker script.
12027
12028 * layout.cc (Layout::set_segment_offsets): Align the file offset
12029 to the segment aligment for -N or -n with no load segment.
12030 * output.cc (Output_segment::add_output_section): Don't crash if
12031 the first section is a TLS section.
12032 (Output_segment::set_section_list_addresses): Print an error
12033 message if the address moves backward in a linker script.
12034 * script-sections.cc
12035 (Output_section_element_input::set_section_addresses): Don't
12036 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12037 (Orphan_output_section::set_section_addresses): Likewise.
12038
12039 2009-10-15 Doug Kwan <dougkwan@google.com>
12040
12041 * layout.cc (Layout::finish_dynamic_section): Generate tags
12042 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12043 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12044 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12045
12046 2009-10-14 Ian Lance Taylor <iant@google.com>
12047
12048 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12049 fields.
12050 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12051 data_shdr fields of relinfo.
12052 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12053 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12054 R_386_TLS_LDO_32, adjust based on section flags.
12055 (Target_i386::Relocate::fix_up_ldo): Remove.
12056
12057 2009-10-13 Ian Lance Taylor <iant@google.com>
12058
12059 Add support for -pie.
12060 * options.h (class General_options): Add -pie and
12061 --pic-executable.
12062 (General_options::output_is_position_independent): Test -pie.
12063 (General_options::output_is_executable): Return true if not shared
12064 and not relocatable.
12065 (General_options::output_is_pie): Remove.
12066 * options.cc (General_options::finalize): Reject incompatible uses
12067 of -pie.
12068 * gold.cc (queue_middle_tasks): A -pie link is not static.
12069 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12070 * symtab.cc (Symbol::final_value_is_known): Return false if
12071 output_is_position_independent.
12072 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12073 output_is_position_independent.
12074 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12075 output_is_position_independent.
12076 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12077 output_is_position_independent.
12078 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12079 two_file_pie_test.
12080 (basic_pie_test.o, basic_pie_test): New targets.
12081 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12082 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12083 (two_file_pie_test): New target.
12084 * testsuite/Makefile.in: Rebuild.
12085 * README: Remove note saying that -pie is not supported.
12086
12087 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
12088
12089 * options.h (class General_options): Add -init and -fini.
12090 * layout.cc (Layout::finish_dynamic_section): Emit
12091 given init and fini functions.
12092
12093 2009-10-13 Sriraman Tallam <tmsriram@google.com>
12094
12095 * gc.h (gc_process_relocs): Check if icf is enabled using new
12096 function.
12097 * gold.cc (queue_initial_tasks): Likewise.
12098 (queue_middle_tasks): Likewise.
12099 * object.cc (do_layout): Likewise.
12100 * symtab.cc (is_section_folded): Likewise.
12101 * main.cc (main): Likewise.
12102 * reloc.cc (Read_relocs::run): Likewise.
12103 (Sized_relobj::do_scan_relocs): Likewise.
12104 * icf.cc (is_function_ctor_or_dtor): New function.
12105 (Icf::find_identical_sections): Check if function is ctor or dtor when
12106 safe icf is chosen.
12107 * options.h (General_options::icf): Change option to be an enum.
12108 (Icf_status): New enum.
12109 (icf_enabled): New method.
12110 (icf_safe_folding): New method.
12111 (set_icf_status): New method.
12112 (icf_status_): New variable.
12113 * (options.cc) (General_options::finalize): Set icf_status_.
12114 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12115 icf_test and icf_keep_unique_test to use the --icf enum flag.
12116 * testsuite/icf_safe_test.sh: New file.
12117 * testsuite/icf_safe_test.cc: New file.
12118
12119 2009-10-12 Sriraman Tallam <tmsriram@google.com>
12120
12121 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12122 includes to gc.h and icf.h.
12123 * arm.cc: Include gc.h.
12124 * gold.cc: Likewise.
12125 * i386.cc: Likewise.
12126 * powerpc.cc: Likewise.
12127 * sparc.cc: Likewise.
12128 * x86_64.cc: Likewise.
12129 * gc.h: Include icf.h.
12130
12131 2009-10-11 Ian Lance Taylor <iant@google.com>
12132
12133 * plugin.cc: Include "gold.h" before other header files.
12134
12135 2009-10-10 Chris Demetriou <cgd@google.com>
12136
12137 * options.h (Input_file_argument::Input_file_type): New enum.
12138 (Input_file_argument::is_lib_): Replace with...
12139 (Input_file_argument::type_): New member.
12140 (Input_file_argument::Input_file_argument): Take Input_file_type
12141 'type' rather than boolean 'is_lib' as second argument.
12142 (Input_file_argument::is_lib): Use type_.
12143 (Input_file_argument::is_searched_file): New function.
12144 (Input_file_argument::may_need_search): Handle is_searched_file.
12145 * options.cc (General_options::parse_library): Support -l:filename.
12146 (General_options::parse_just_symbols): Update for Input_file_argument
12147 changes.
12148 (Command_line::process): Likewise.
12149 * archive.cc (Archive::get_file_and_offset): Likewise.
12150 * plugin.cc (Plugin_manager::release_input_file): Likewise.
12151 * script.cc (read_script_file, script_add_file): Likewise.
12152 * fileread.cc (Input_file::Input_file): Likewise.
12153 (Input_file::will_search_for): Handle is_searched_file.
12154 (Input_file::open): Likewise.
12155 * readsyms.cc (Read_symbols::get_name): Likewise.
12156 * testsuite/Makefile.am (searched_file_test): New test.
12157 * testsuite/Makefile.in: Regenerate.
12158 * testsuite/searched_file_test.cc: New file.
12159 * testsuite/searched_file_test_lib.cc: New file.
12160
12161 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12162 Ian Lance Taylor <iant@google.com>
12163
12164 * descriptor.cc: Include <cstdio> and "binary-io.h".
12165 (Descriptors::open): Open the files in binary mode always.
12166 * script.cc (Lex::get_token): Treat \r as whitespace.
12167
12168 2009-10-09 Ian Lance Taylor <iant@google.com>
12169
12170 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12171
12172 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12173 Ian Lance Taylor <iant@google.com>
12174
12175 * configure.ac: Check for readv function also.
12176 * fileread.cc (readv): Define if not HAVE_READV.
12177 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12178 does not exist.
12179 * config.in: Regenerate.
12180 * configure: Regenerate.
12181
12182 2009-10-09 Doug Kwan <dougkwan@google.com>
12183
12184 * layout.cc (Layout::make_output_section): Call target hook to make
12185 ordinary output section.
12186 (Layout::finalize): Adjust parameter list of call the
12187 Target::may_relax().
12188 * layout.h (class Layout::section_list): New method.
12189 * merge.h (Output_merge_base::entsize): Change visibility to public.
12190 (Output_merge_base::is_string, Output_merge_base::do_is_string):
12191 New methods.
12192 (Output_merge_string::do_is_string): New method.
12193 * object.cc (Sized_relobj::do_setup): renamed from
12194 Sized_relobj::set_up.
12195 * object.h (Sized_relobj::adjust_shndx,
12196 Sized_relobj::initializ_input_to_output_maps,
12197 Sized_relobj::free_input_to_output_maps): Change visibilities to
12198 protected.
12199 (Sized_relobj::setup): Virtualize.
12200 (Sized_relobj::do_setup): New method declaration.
12201 (Sized_relobj::invalidate_section_offset,
12202 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12203 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12204 * options.cc (parse_int): New function.
12205 * options.h (parse_int): New declaration.
12206 (DEFINE_int): New macro.
12207 (stub_group_size): New option.
12208 * output.cc (Output_section::Output_section): Initialize memebers
12209 merge_section_map_, merge_section_by_properties_map_,
12210 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12211 (Output_section::add_input_section): Handled deferred code-fill
12212 generation and remove an old comment.
12213 (Output_section::add_relaxed_input_section): New method definition.
12214 (Output_section::add_merge_input_section): Use merge section by
12215 properties map to speed to search. Update merge section maps
12216 as appropriate.
12217 (Output_section::build_relaxation_map): New method definition.
12218 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12219 Same.
12220 (Output_section::relax_input_section): Renamed to
12221 Output_section::convert_input_sections_to_relaxed_sections and change
12222 interface to take a vector of pointers to relaxed sections.
12223 (Output_section::find_merge_section,
12224 Output_section::find_relaxed_input_section): New method definitions.
12225 (Output_section::is_input_address_mapped,
12226 Output_section::output_offset, Output_section::output_address):
12227 Use output section data maps to speed up searching.
12228 (Output_section::find_starting_output_address): Add comments.
12229 (Output_section::do_write,
12230 Output_section::write_to_postprocessing_buffer): Do code-fill
12231 generation as appropriate.
12232 (Output_section::get_input_sections): Invalidate relaxed input section
12233 map.
12234 (Output_section::restore_states): Adjust type of checkpoint .
12235 Invalidate relaxed input section map.
12236 * output.h (Output_merge_base): New class declaration.
12237 (Input_section_specifier): New class defintion.
12238 (class Output_relaxed_input_section) Change base class to
12239 Output_section_data_build.
12240 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12241 base class initializer.
12242 (Output_section::add_relaxed_input_section): New method declaration.
12243 (Output_section::Input_section): Change visibility to protected.
12244 (Output_section::Input_section::relobj,
12245 Output_section::Input_section::shndx): Handle relaxed input sections.
12246 Output_section::input_sections) Change visibility to protected. Also
12247 define overload to return a non-const pointer.
12248 (Output_section::Merge_section_properties): New class defintion.
12249 (Output_section::Merge_section_by_properties_map,
12250 Output_section::Output_section_data_by_input_section_map,
12251 Output_section::Relaxation_map): New types.
12252 (Output_section::relax_input_section): Rename method to
12253 Output_section::convert_input_sections_to_relaxed_sections and change
12254 interface to take a vector of relaxed section pointers.
12255 (Output_section::find_merge_section,
12256 Output_section::find_relaxed_input_section,
12257 Output_section::build_relaxation_map,
12258 Output_section::convert_input_sections_in_list_to_relaxed_sections):
12259 New method declarations.
12260 (Output_section::merge_section_map_
12261 Output_section::merge_section_by_properties_map_,
12262 Output_section::relaxed_input_section_map_,
12263 Output_section::is_relaxed_input_section_map_valid_,
12264 Output_section::generate_code_fills_at_write_): New data members.
12265 * script-sections.cc
12266 (Output_section_element_input::set_section_addresses): Call
12267 current_data_size and addralign methods of relaxed input sections.
12268 (Orphan_output_section::set_section_addresses): Call current_data_size
12269 and addralign methods of relaxed input sections.
12270 * symtab.cc (Symbol_table::compute_final_value): Extract template
12271 from the body of Symbol_table::sized_finalize_symbol.
12272 (Symbol_table::sized_finalized_symbol): Call
12273 Symbol_table::compute_final_value.
12274 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12275 (Symbol_table::compute_final_value): New templated method declaration.
12276 * target.cc (Target::do_make_output_section): New method defintion.
12277 * target.h (Target::make_output_section): New method declaration.
12278 (Target::relax): Add more parameters for input objects, symbol table
12279 and layout. Adjust call to do_relax.
12280 (Target::do_make_output_section): New method declaration.
12281 (Target::do_relax): Add parameters for input objects, symbol table
12282 and layout.
12283
12284 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12285
12286 * pread.c: Include stdio.h.
12287
12288 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12289
12290 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12291 defined.
12292
12293 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12294
12295 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12296 Change read_shndx type to unsigned int.
12297 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12298 int.
12299 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12300 * dwarf_reader.h (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 * layout.cc (Layout::create_symtab_sections): Cast the result of
12306 local_symcount * symsize to off_t in the gold_assert.
12307
12308 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12309
12310 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12311 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12312 R_ARM_BASE_ABS.
12313 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12314 (Arm_relocate_functions::thm_abs5): New function.
12315 (Arm_relocate_functions::abs12): New function.
12316 (Arm_relocate_functions::abs16): New function.
12317 (Arm_relocate_functions::base_abs): New function.
12318 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12319 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
12320 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12321 R_ARM_BASE_ABS.
12322 (Scan::global): Likewise.
12323 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12324 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12325 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12326 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12327 R_ARM_BASE_ABS.
12328
12329 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12330
12331 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12332 (Arm_relocate_functions::movt_prel): New function.
12333 (Arm_relocate_functions::thm_movw_prel_nc): New function.
12334 (Arm_relocate_functions::thm_movt_prel): New function.
12335 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12336 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12337 (Scan::global, Relocate::relocate): Likewise.
12338 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12339
12340 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12341
12342 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12343 Incremental_checker.
12344 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12345 unsigned int.
12346 (class Incremental_inputs_header): New class.
12347 (Incremental_inputs_header_writer): Edit comment.
12348 (Incremental_inputs_entry): New class.
12349 (Incremental_inputs_entry_writer): Edit comment.
12350 (Sized_incremental_binary::do_find_incremental_inputs_section):
12351 Add *strtab_shndx parameter, fill it.
12352 (Sized_incremental_binary::do_check_inputs): New method.
12353 (Incremental_checker::can_incrementally_link_output_file): Use
12354 Sized_incremental_binary::check_inputs.
12355 (Incremental_inputs::report_command_line): Save command line in
12356 command_line_.
12357 * incremental.h:
12358 (Incremental_binary::find_incremental_inputs_section): New
12359 method.
12360 (Incremental_binary::do_find_incremental_inputs_section): Add
12361 strtab_shndx parameter.
12362 (Incremental_binary::do_check_inputs): New pure virtual method.
12363 (Sized_incremental_binary::do_check_inputs): Declare.
12364 (Incremental_checker::Incremental_checker): Add incremental_inputs
12365 parameter, use it to initialize incremental_inputs_.
12366 (Incremental_checker::incremental_inputs_): New field.
12367 (Incremental_checker::command_line): New method.
12368 (Incremental_checker::inputs): New method.
12369 (Incremental_checker::command_line_): New field.
12370
12371 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12372
12373 * incremental.cc: Include <cstdarg> and "target-select.h".
12374 (vexplain_no_incremental): New function.
12375 (explain_no_incremental): New function.
12376 (Incremental_binary::error): New method.
12377 (Sized_incremental_binary::do_find_incremental_inputs_section): New
12378 method.
12379 (make_sized_incremental_binary): New function.
12380 (open_incremental_binary): New function.
12381 (can_incrementally_link_file): Add checks if output is ELF and has
12382 inputs section.
12383 * incremental.h: Include "elfcpp_file.h" and "output.h".
12384 (Incremental_binary): New class.
12385 (Sized_incremental_binary): New class.
12386 (open_incremental_binary): Declare.
12387 * object.cc (is_elf_object): Use
12388 elfcpp::Elf_recognizer::is_elf_file.
12389 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12390 * output.h (Output_file::filesize): New method.
12391
12392 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12393
12394 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12395 New function.
12396 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12397 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12398 function.
12399 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12400 function.
12401 (Arm_relocate_functions::movw_abs_nc): New function.
12402 (Arm_relocate_functions::movt_abs): New function.
12403 (Arm_relocate_functions::thm_movw_abs_nc): New function.
12404 (Arm_relocate_functions::thm_movt_abs): New function.
12405 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12406 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12407 (Scan::global): Likewise.
12408 (Relocate::relocate): Likewise.
12409 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12410
12411 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12412
12413 * arm.cc (Arm_relocate_functions::got_prel) New function.
12414 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12415 (Relocate::relocate): Likewise.
12416 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12417
12418 2009-10-06 Ian Lance Taylor <iant@google.com>
12419
12420 * options.h (class General_options): Define
12421 split_stack_adjust_size parameter.
12422 * object.h (class Object): Add uses_split_stack_ and
12423 has_no_split_stack_ fields. Add uses_split_stack and
12424 has_no_split_stack accessor functions. Declare
12425 handle_split_stack_section.
12426 (class Reloc_symbol_changes): Define.
12427 (class Sized_relobj): Define Function_offsets. Declare
12428 split_stack_adjust, split_stack_adjust_reltype, and
12429 find_functions.
12430 * object.cc (Object::handle_split_stack_section): New function.
12431 (Sized_relobj::do_layout): Call handle_split_stack_section.
12432 * dynobj.cc (Sized_dynobj::do_layout): Call
12433 handle_split_stack_section.
12434 * reloc.cc (Sized_relobj::relocate_sections): Call
12435 split_stack_adjust for executable sections in split_stack
12436 objects. Pass reloc_map to relocate_section.
12437 (Sized_relobj::split_stack_adjust): New function.
12438 (Sized_relobj::split_stack_adjust_reltype): New function.
12439 (Sized_relobj::find_functions): New function.
12440 * target-reloc.h: Include "object.h".
12441 (relocate_section): Add reloc_symbol_changes parameter. Change
12442 all callers.
12443 * target.h (class Target): Add calls_non_split method. Declare
12444 do_calls_non_split virtual method. Declare match_view and
12445 set_view_to_nop.
12446 * target.cc: Include "elfcpp.h".
12447 (Target::do_calls_non_split): New function.
12448 (Target::match_view): New function.
12449 (Target::set_view_to_nop): New function.
12450 * gold.cc (queue_middle_tasks): Give an error if mixing
12451 split-stack and non-split-stack objects with -r.
12452 * i386.cc (Target_i386::relocate_section): Add
12453 reloc_symbol_changes parameter.
12454 (Target_i386::do_calls_non_split): New function.
12455 * x86_64.cc (Target_x86_64::relocate_section): Add
12456 reloc_symbol_changes parameter.
12457 (Target_x86_64::do_calls_non_split): New function.
12458 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12459 parameter.
12460 * powerpc.cc (Target_powerpc::relocate_section): Add
12461 reloc_symbol_changes parameter.
12462 * sparc.cc (Target_sparc::relocate_section): Add
12463 reloc_symbol_changes parameter.
12464 * configure.ac: Call AM_CONDITIONAL for the default target.
12465 * configure: Rebuild.
12466 * testsuite/Makefile.am (TEST_AS): New variable.
12467 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12468 (check_DATA): Add split_i386 and split_x86_64 files.
12469 (SPLIT_DEFSYMS): Define.
12470 (split_i386_[1234n].o): New targets.
12471 (split_i386_[124]): New targets.
12472 (split_i386_[1234r].stdout): New targets.
12473 (split_x86_64_[1234n].o): New targets.
12474 (split_x86_64_[124]): New targets.
12475 (split_x86_64_[1234r].stdout): New targets.
12476 (MOSTLYCLEANFILES): Add new executables.
12477 * testsuite/split_i386.sh: New file.
12478 * testsuite/split_x86_64.sh: New file.
12479 * testsuite/split_i386_1.s: New file.
12480 * testsuite/split_i386_2.s: New file.
12481 * testsuite/split_i386_3.s: New file.
12482 * testsuite/split_i386_4.s: New file.
12483 * testsuite/split_i386_n.s: New file.
12484 * testsuite/split_x86_64_1.s: New file.
12485 * testsuite/split_x86_64_2.s: New file.
12486 * testsuite/split_x86_64_3.s: New file.
12487 * testsuite/split_x86_64_4.s: New file.
12488 * testsuite/split_x86_64_n.s: New file.
12489 * testsuite/testfile.cc (Target_test): Update relocation_section
12490 function.
12491 * testsuite/Makefile.in: Rebuild.
12492
12493 2009-10-06 Ian Lance Taylor <iant@google.com>
12494
12495 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12496 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12497 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
12498 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12499 the address on ldo_addrs_.
12500 (Target_i386::Relocate::fix_up_ldo): New function.
12501
12502 2009-10-06 Rafael Espindola <espindola@google.com>
12503
12504 * plugin.cc (add_input_library): New.
12505 (Plugin::load): Add add_input_library to tv.
12506 (Plugin_manager::add_input_file): Add the is_lib argument.
12507 (add_input_file): Update call to Plugin_manager::add_input_file.
12508 (add_input_library): New.
12509 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12510
12511 2009-09-30 Doug Kwan <dougkwan@google.com>
12512
12513 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12514 symbol and call Symbol::may_need_copy_reloc to determine if
12515 a copy reloc is needed.
12516 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12517 nocopyreloc is given in command line.
12518 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12519 given in command line.
12520 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12521 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12522 of the removed Target_i386::may_need_copy_reloc.
12523 * options.h (copyreloc): New option with default value false.
12524 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12525 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12526 instead of the removed Target_powerpc::may_need_copy_reloc.
12527 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12528 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12529 instead of the removed Target_sparc::may_need_copy_reloc.
12530 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12531 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12532 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12533 instead of the removed Target_x86_64::may_need_copy_reloc.
12534
12535 2009-09-30 Ian Lance Taylor <iant@google.com>
12536
12537 * object.h (class Object): Remove target_ field, and target,
12538 sized_target, and set_target methods.
12539 (Object::sized_target): Remove.
12540 (class Sized_relobj): Update declarations. Remove sized_target.
12541 * object.cc (Sized_relobj::setup): Remove target parameter.
12542 Change all callers.
12543 (Input_objects::add_object): Don't do anything with the target.
12544 (make_elf_sized_object): Add punconfigured parameter. Change all
12545 callers. Set or test parameter target.
12546 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12547 Change all callers.
12548 * parameters.cc (Parameters::set_target): Change parameter type to
12549 be non-const.
12550 (Parameters::default_target): Remove.
12551 (set_parameters_target): Change parameter type to be non-const.
12552 (parameters_force_valid_target): New function.
12553 (parameters_clear_target): New function.
12554 * parameters.h (class Parameters): Update declarations. Remove
12555 default_target method. Add sized_target and clear_target
12556 methods. Change target_ to be non-const.
12557 (set_parameters_target): Update declaration.
12558 (parameters_force_valid_target): Declare.
12559 (parameters_clear_target): Declare.
12560 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12561 as NULL if we aren't searching.
12562 (Add_symbols::run): Don't check for compatible target.
12563 * fileread.cc (Input_file::open_binary): Call
12564 parameters_force_valid_target.
12565 * gold.cc (queue_middle_tasks): Likewise.
12566 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12567 set_target on object.
12568 * dynobj.h (class Sized_dynobj): Update declarations.
12569 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12570 make_elf_object returns NULL.
12571 (Archive::include_member): Don't check whether object target is
12572 compatible.
12573 * output.cc (Output_section::add_input_section): Get target from
12574 parameters.
12575 (Output_section::relax_input_section): Likewise.
12576 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12577 parameters.
12578 (Sized_relobj::do_scan_relocs): Likewise.
12579 (Sized_relobj::relocate_sections): Likewise.
12580 * resolve.cc (Symbol_table::resolve): Likewise.
12581 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12582 parameter. Change all callers.
12583 (Symbol_table::add_from_object): Get target from parameters.
12584 (Symbol_table::add_from_relobj): Don't check object target.
12585 (Symbol_table::add_from_dynobj): Likewise.
12586 (Symbol_table::define_special_symbol): Get target from
12587 parameters.
12588 * symtab.h (class Symbol_table): Update declaration.
12589 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12590 parameter. Change all callers. Clear parameter target.
12591 (Binary_test): Test target here.
12592 * testsuite/object_unittest.cc (gold_testsuite): Remove
12593 target_test_pointer parameter. Change all callers.
12594 (Object_test): Test target here.
12595
12596 2009-09-26 Ian Lance Taylor <iant@google.com>
12597
12598 * testsuite/initpri1.c: Don't try to use constructor priorities if
12599 compiling with gcc before 4.3.
12600
12601 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
12602
12603 * testsuite/retain_symbols_file_test.sh (check_present): Change
12604 output file name to retain_symbols_file_test.stdout.
12605 (check_absent): Likewise.
12606
12607 2009-09-18 Craig Silverstein <csilvers@google.com>
12608
12609 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12610 * options.cc: Include <cerrno> and <fstream>.
12611 (General_options::finalize): Parse -retain-symbols-file tag.
12612 * options.h: New flag.
12613 (General_options): New method should_retain_symbol, new
12614 variable symbols_to_retain.
12615 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12616 should_retain_symbol map.
12617 * testsuite/Makefile.am (retain_symbols_file_test): New test.
12618 * testsuite/Makefile.in: Regenerate.
12619 * testsuite/retain_symbols_file_test.sh: New file.
12620
12621 2009-09-18 Nick Clifton <nickc@redhat.com>
12622
12623 * po/es.po: Updated Spanish translation.
12624
12625 2009-09-17 Doug Kwan <dougkwan@google.com>
12626
12627 * debug.h (DEBUG_RELAXATION): New constant.
12628 (DEBUG_ALL): Add DEBUG_RELAXATION.
12629 (debug_string_to_enum): Add relaxation debug option.
12630 * layout.cc
12631 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12632 Layout::Relaxation_debug_check::read_sections,
12633 Layout::Relaxation_debug_check::read_sections): New method definitions.
12634 (Layout::Layout): Initialize data members
12635 record_output_section_data_from_scrips_,
12636 script_output_section_data_list_ and relaxation_debug_check_.
12637 (Layout::save_segments, Layout::restore_segments,
12638 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12639 Layout::relaxation_loop_body): New method definitions.
12640 (Layout::finalize): Support relaxation. Move section layout code to
12641 Layout::relaxation_loop_body.
12642 (Layout::set_asection_address_from_script): Move code for orphan
12643 section placement out.
12644 (Layout::place_orphan_sections_in_script): New method definition.
12645 * layout.h (Output_segment_headers, Output_file_header):
12646 New forward class declarations.
12647 (Layout::~Layout): Define.
12648 (Layout::new_output_section_data_from_script): New method definition.
12649 (Layout::place_orphan_sections_in_script): New method declaration.
12650 (Layout::Segment_states): New type declaration.
12651 (Layout::save_segments, Layout::restore_segments,
12652 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12653 Layout::relaxation_loop_body): New method declarations.
12654 (Layout::Output_section_data_list): New type declaration.
12655 (Layout::Relaxation_debug_check): New class definition.
12656 (Layout::record_output_section_data_from_script_,
12657 Layout::script_output_section_data_list_, Layout::segment_states_,
12658 Layout::relaxation_debug_check_): New data members.
12659 * output.cc: (Output_section_headers::do_size): New method definition.
12660 (Output_section_headers::Output_section_headers): Move size
12661 computation to Output_section_headers::do_size.
12662 (Output_segment_headers::do_size): New method definition.
12663 (Output_file_header::Output_file_header): Move size computation to
12664 Output_file_header::do_size and call it.
12665 (Output_file_header::do_size): New method definition.
12666 (Output_data_group::Output_data_group): Adjust call to
12667 Output_section_data.
12668 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12669 (Output_symtab_xindex::do_write): Add array bound check.
12670 (Output_section::Input_section::print_to_mapfile): Handle
12671 RELAXED_INPUT_SECTION_CODE.
12672 (Output_section::Output_section): Initialize data member checkpoint_.
12673 (Output_section::~Output_section): Delete checkpoint object pointed
12674 by checkpoint_.
12675 (Output_section::add_input_section): Always add an Input_section if
12676 relaxing.
12677 (Output_section::add_merge_input_section): Add assert.
12678 (Output_section::relax_input_section): New method definition.
12679 (Output_section::set_final_data_size): Set load address to zero for
12680 an unallocated section.
12681 (Output_section::do_address_and_file_offset_have_reset_values):
12682 New method definition.
12683 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12684 Handle relaxed input section.
12685 (Output_section::sort_attached_input_sections): Checkpoint input
12686 section list lazily.
12687 (Output_section::get_input_sections): Change type of input_sections to
12688 list of Simple_input_section pointers. Checkpoint input section list
12689 lazily. Also handle relaxed input sections.
12690 (Output_section::add_input_section_for_script): Take a reference to
12691 a Simple_input_section object instead of Relobj pointer and section
12692 index as parameter. Handle relaxed input sections.
12693 (Output_section::save_states, Output_section::restore_states): New
12694 method definitions.
12695 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12696 (Output_data::is_data_size_fixed): New method definition.
12697 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12698 if it is fixed.
12699 (Output_data::address_and_file_offset_have_reset_values): New method
12700 definition.
12701 (Output_data::do_address_and_file_offset_have_reset_values): New method
12702 definition.
12703 (Output_data::set_data_size): Check that data size is not fixed.
12704 (Output_data::fix_data_size): New method definition.
12705 (Output_data::is_data_size_fixed_): New data member.
12706 (Output_section_headers::set_final_data_size): New method definition.
12707 (Output_section_headers::do_size): New method declaration.
12708 (Output_segment_headers::set_final_data_size): New method definition.
12709 (Output_segment_headers::do_size): New method declaration.
12710 (Output_file_header::set_final_data_size)::New method definition.
12711 (Output_file_header::do_size)::New method declaration.
12712 (Output_section_data::Output_section_data): Add new parameter
12713 is_data_size_fixed and use it to fix data size.
12714 (Output_data_const::Output_data_const): Adjust call to base class
12715 constructor and fix data size.
12716 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12717 base class constructor and fix data size.
12718 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12719 base class constructor and fix data size.
12720 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12721 class constructor and fix data size.
12722 (Output_data_group::set_final_data_size): New method definition.
12723 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12724 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12725 class constructor and fix data size.
12726 (Output_relaxed_input_section): New class definition.
12727 (Output_section::Simple_input_section): New class definition.
12728 (Output_section::get_input_sections): Adjust parameter list.
12729 (Output_section::add_input_section_for_script): Same.
12730 (Output_section::save_states, Output_section::restore_states,
12731 Output_section::do_address_and_file_offset_have_reset_values,
12732 (Output_section::Input_section::Input_section): Handle
12733 RELAXED_INPUT_SECTION_CODE. Add new overload for
12734 Output_relaxed_input_section.
12735 (Output_section::Input_section::is_input_section,
12736 Output_section::Input_section::set_output_section): Handle relaxed
12737 input section.
12738 (Output_section::Input_section::is_relaxed_input_section,
12739 Output_section::Input_section::output_section_data,
12740 Output_section::Input_section::relaxed_input_section): New method
12741 definitions.
12742 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12743 value.
12744 (Output_section::Input_section::u1_): Update comments.
12745 (Output_section::Input_section::u2_): Add new union member poris.
12746 (Output_section::Checkpoint_output_section): New classs definition.
12747 (Output_section::relax_input_section): New method declaration.
12748 (Output_section::checkpoint_): New data member.
12749 (Output_segment): Update comments.
12750 (Output_segment::Output_segment): Un-privatize copy constructor.
12751 (Output_segment::operator=): Un-privatize.
12752 * script-sections.cc (Output_section_element::Input_section_list):
12753 Change element type to Output_section::Simple_input_section.
12754 (Output_section_element_dot_assignment::set_section_addresses):
12755 Register output section data for relaxation clean up.
12756 (Output_data_exression::Output_data_expression): Adjust call to base
12757 constructor to fix data size.
12758 (Output_section_element_data::set_section_addresses): Register
12759 Output_data_expression object for relaxation clean up.
12760 (struct Input_section_info): Replace Relobj pointer and section index
12761 pair with Output_section::Simple_input_section and Convert struct to a
12762 class.
12763 (Input_section_sorter::operator()): Adjust access to
12764 Input_section_info data member to use accessors.
12765 (Output_section_element_input::set_section_addresses): Use layout
12766 parameter. Adjust code to use Output_section::Simple_input_section
12767 and Input_secction_info classes. Register filler for relaxation
12768 clean up.
12769 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12770 and section index pair with Output_section::Simple_input_section
12771 class. Adjust code accordingly.
12772 (Phdrs_element::release_segment): New method definition.
12773 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12774 segment list.
12775 (Script_sections::release_segments): New method definition.
12776 * gold/script-sections.h (Script_sections::release_segments): New
12777 method declaration.
12778 * gold/target.h (Target::may_relax, Target::relax,
12779 Target::do_may_relax, Target::do_relax): New method definitions.
12780
12781 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12782
12783 * arm.cc (has_signed_unsigned_overflow): New function.
12784 (Arm_relocate_functions::abs8): New function.
12785 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12786 (Target_arm::Scan::global): Likewise.
12787 (Target_arm::relocate::relocate): Likewise.
12788 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12789 Likewise.
12790
12791 2009-09-16 Cary Coutant <ccoutant@google.com>
12792
12793 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12794 * testsuite/Makefile.in: Regenerate.
12795
12796 2009-09-11 Nick Clifton <nickc@redhat.com>
12797
12798 * po/gold.pot: Updated by the Translation project.
12799
12800 2009-09-08 Cary Coutant <ccoutant@google.com>
12801
12802 * output.cc (Output_file::open): Add execute permission to empty file.
12803 * testsuite/Makefile.am (permission_test): New test.
12804 * testsuite/Makefile.in: Regenerate.
12805
12806 2009-09-02 Ian Lance Taylor <iant@google.com>
12807
12808 * output.cc (Output_file::resize): Call map_no_anonymous rather
12809 than map.
12810
12811 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12812
12813 * gold.cc: Include "incremental.h".
12814 (queue_initial_tasks): Call Incremental_checker methods.
12815 * incremental.cc: Include "output.h".
12816 (Incremental_checker::can_incrementally_link_output_file): New
12817 method.
12818 * incremental.h (Incremental_checker): New class.
12819
12820 * output.cc (Output_file::open_for_modification): New method.
12821 (Output_file::map_anonymous): Changed return type to bool. Record
12822 map in base_ field.
12823 (Output_file::map_no_anonymous): New method, broken out of map.
12824 (Output_file::map): Use map_no_anonymous and map_anonymous.
12825 * output.h (class Output_file): Update declarations.
12826
12827 2009-08-24 Cary Coutant <ccoutant@google.com>
12828
12829 * options.h (Command_line::Pre_options): New class.
12830 (Command_line::pre_options): New member.
12831 * options.cc (gold::options::ready_to_register): New variable.
12832 (One_option::register_option): Do nothing if not registering options.
12833 Assert if same short option registered twice.
12834 (General_options::General_options): Turn off option registration when
12835 done constructing.
12836 (Command_line::Pre_options::Pre_options): New constructor.
12837
12838 2009-08-24 Cary Coutant <ccoutant@google.com>
12839
12840 * options.h (General_options::no_keep_memory): Remove incorrect
12841 short option.
12842
12843 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12844
12845 * Makefile.am (am__skiplex, am__skipyacc): New.
12846 * Makefile.in: Regenerate.
12847
12848 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12849
12850 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12851 (INCLUDES): ... this.
12852 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12853 (AM_CPPFLAGS): Renamed from ...
12854 (INCLUDE): ... this.
12855 * Makefile.in, testsuite/Makefile.in: Regenerate.
12856
12857 * Makefile.in: Regenerate.
12858 * aclocal.m4: Likewise.
12859 * config.in: Likewise.
12860 * configure: Likewise.
12861 * testsuite/Makefile.in: Likewise.
12862
12863 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12864 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12865 * Makefile.in: Regenerate.
12866 * testsuite/Makefile.in: Regenerate.
12867
12868 2009-08-19 Cary Coutant <ccoutant@google.com>
12869
12870 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12871 symbols in shared libraries overridden by hidden or internal symbols
12872 in the main program.
12873
12874 2009-08-19 Chris Demetriou <cgd@google.com>
12875
12876 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12877 checking source file names in error messages.
12878
12879 2009-08-18 Doug Kwan <dougkwan@google.com>
12880
12881 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12882 an elcpp::Ehdr as parameter. Adjust call to set_target.
12883 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12884 an elfcpp::Ehdr as parameter.
12885 * object.cc (Object::set_target): Remove the version that looks up
12886 a target and sets it.
12887 (Sized_relobj::setup): Take a Target object instead of
12888 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12889 (make_elf_sized_object): Find target and ask target to
12890 make an ELF object.
12891 * object.h: (Object::set_target): Remove the version that looks up
12892 a target and sets it.
12893 (Sized_relobj::setup): Take a Target object instead of
12894 an elfcpp:Ehdr as parameter.
12895 * target.cc: Include dynobj.h.
12896 (Target::do_make_elf_object_implementation): New.
12897 (Target::do_make_elf_object): New.
12898 * target.h (Target::make_elf_object): New template declaration.
12899 (Target::do_make_elf_object): New method declarations.
12900 (Target::do_make_elf_object_implementation): New template declaration.
12901
12902 2009-08-14 Ian Lance Taylor <iant@google.com>
12903
12904 * gold.h (FUNCTION_NAME): Define.
12905 (gold_unreachable): Use FUNCTION_NAME.
12906
12907 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12908
12909 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12910 symbol in the --keep-unique list is not found.
12911
12912 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12913
12914 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12915 been maked as --keep-unique.
12916 (Icf::unfold_section): New function.
12917 * icf.h (Icf::unfold_section): New function.
12918 * options.h (General_options::keep_unique): New option.
12919 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12920 * testsuite/Makefile.in: Regenerate.
12921 * testsuite/icf_keep_unique_test.sh: New file.
12922 * testsuite/icf_keep_unique_test.cc: New file.
12923
12924 2009-08-12 Cary Coutant <ccoutant@google.com>
12925
12926 PR 10471
12927 * resolve.cc (Symbol_table::resolve): Check for references from
12928 dynamic objects to hidden and internal symbols.
12929 * testsuite/Makefile.am (hidden_test.sh): New test.
12930 * testsuite/Makefile.in: Regenerate.
12931 * testsuite/hidden_test.sh: New script.
12932 * testsuite/hidden_test_1.c: New test source.
12933 * testsuite/hidden_test_main.c: New test source.
12934
12935 2009-08-11 Doug Kwan <dougkwan@google.com>
12936
12937 * arm.cc: Update comments.
12938 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12939 segment to locate the .ARM.exidx section if present.
12940
12941 2009-08-09 Doug Kwan <dougkwan@google.com>
12942
12943 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12944 patch.
12945
12946 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12947 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12948 compiler warnings.
12949
12950 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12951
12952 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12953 valid tls_segment only for non-debug-section relocations.
12954 * testsuite/Makefile.am: Add gc_tls_test.
12955 * testsuite/Makefile.in: Regenerate.
12956 * testsuite/gc_tls_test.cc: New file.
12957 * testsuite/gc_tls_test.sh: New file.
12958
12959 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12960
12961 * icf.cc: New file.
12962 * icf.h: New file.
12963 * Makefile.am (CCFILES): Add icf.cc.
12964 (HFILES): Add icf.h
12965 * Makefile.in: Regenerate.
12966 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12967 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12968 section, symbol and addend information for the relocs.
12969 * gold.cc (queue_middle_tasks): Call identical code folding.
12970 * gold.h: Add defines for multimap.
12971 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12972 to the call of finalize_local_symbols.
12973 * main.cc (main): Create object of class Icf.
12974 * object.cc (Sized_relobj::do_layout): Allow this function to be
12975 called twice during icf.
12976 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12977 to sections marked as identical by icf.
12978 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12979 when available.
12980 (Sized_relobj::do_section_entsize): New function.
12981 * object.h (Object::section_entsize): New function.
12982 (Object::do_section_entsize): New pure virtual function.
12983 (Relobj::finalize_local_symbols): Add new parameter.
12984 (Relobj::do_section_entsize): New function.
12985 * options.h (General_options::icf): New option.
12986 (General_options::icf_iterations): New option.
12987 (General_options::print_icf_sections): New option.
12988 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12989 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12990 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12991 icf.
12992 * symtab.cc (Symbol_table::is_section_folded): New function.
12993 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12994 to sections marked as identical by icf.
12995 * symtab.h (Symbol_table::set_icf): New function.
12996 (Symbol_table::icf): New function.
12997 (Symbol_table::is_section_folded): New function.
12998 (Symbol_table::icf_): New data member.
12999 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13000 * testsuite/Makefile.am: Add commands to build icf_test.
13001 * testsuite/Makefile.in: Regenerate.
13002 * testsuite/icf_test.sh: New file.
13003 * testsuite/icf_test.cc: New file.
13004
13005 2009-07-24 Chris Demetriou <cgd@google.com>
13006
13007 * layout.cc (is_compressible_debug_section): Fix incorrect
13008 comment about compressed section names.
13009
13010 2009-07-20 Ian Lance Taylor <ian@airs.com>
13011
13012 PR 10419
13013 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13014
13015 2009-07-16 Ian Lance Taylor <iant@google.com>
13016
13017 PR 10400
13018 * layout.h: #include <map>.
13019 (class Kept_section): Change from struct to class. Add accessors
13020 and setters. Add section size to Comdat_group mapping. Change
13021 Comdat_group to std::map. Add is_comdat_ field. Add
13022 linkonce_size field in union.
13023 (class Layout): Update declaration of find_or_add_kept_section.
13024 Don't declare find_kept_object.
13025 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13026 parameter. Add object, shndx, is_comdat, and is_group_name
13027 parameters. Change all callers. Adjust for new Kept_section.
13028 (Layout::find_kept_object): Remove.
13029 * object.cc (Sized_relobj::include_section_group): Update use of
13030 Kept_section. Rename secnum to shndx. Only record
13031 Kept_comdat_section if sections are the same size.
13032 (Sized_relobj::include_linkonce_section): Update use of
13033 Kept_section. Only record Kept_comdat_section if sections are the
13034 same size. Set size of linkonce section.
13035 (Sized_relobj::map_to_kept_section): Update call to
13036 get_kept_comdat_section.
13037 * object.h (class Sized_relobj): Rename fields in
13038 Kept_comdat_section to drop trailing underscores; change object
13039 field to Relobj*. Change Kept_comdat_section_table to store
13040 struct rather than pointer.
13041 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13042 Add kept_object and kept_shndx parameters. Change all callers.
13043 (Sized_relobj::get_kept_comdat_section): Change return type to
13044 bool. Add kept_object and kept_shndx parameters. Change all
13045 callers.
13046 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13047 Layout::find_or_add_kept_section.
13048
13049 2009-07-09 Ian Lance Taylor <iant@google.com>
13050
13051 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13052 Reserve space in the hash table.
13053
13054 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
13055
13056 * fileread.cc (File_read::get_mtime): New method.
13057 * fileread.h (Timespec): New structure.
13058 (File_read::get_mtime): New method.
13059 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13060 Renamed from timestamp_nsec.
13061 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13062 Elf_Xword.
13063 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13064 timestamp_nsec.
13065 (Incremental_inputs::report_archive): Save mtime; style fix.
13066 (Incremental_inputs::report_obejct): Save mtime; style fix.
13067 (Incremental_inputs::report_script): Save mtime; style fix.
13068 (Incremental_inputs::finalize_inputs): Style fix.
13069 (Incremental_inputs::finalize): Style fix.
13070 (Incremental_inputs::create_input_section_data): Store inputs
13071 mtime.
13072 * incremental.h (Incremental_inputs::report_script): Add mtime
13073 argument.
13074 (Incremental_inputs::Input_info::Input_info): Intialize only one
13075 union member.
13076 (Incremental_inputs::Input_info::archive): Move to nameless
13077 union.
13078 (Incremental_inputs::Input_info::obejct): Move to nameless union.
13079 (Incremental_inputs::Input_info::script): Move to nameless union.
13080 (Incremental_inputs::mtime): New field.
13081 * script.cc (read_input_script): Pass file mtime to
13082 Incremental_input.
13083 * script.h (Script_info::inputs): Style fix.
13084
13085 2009-07-01 Ian Lance Taylor <ian@airs.com>
13086
13087 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13088 instead of 32.
13089
13090 2009-06-24 Ian Lance Taylor <iant@google.com>
13091
13092 PR 10156
13093 * layout.cc (Layout::choose_output_section): If we find an
13094 existing section, update the flags.
13095 (Layout::create_notes): New function, broken out of
13096 Layout::finalize.
13097 (Layout::finalize): Don't create note sections.
13098 (Layout::create_note): Don't crash if linker script discards
13099 section.
13100 (Layout::create_gold_note): Likewise.
13101 (Layout::create_build_id): Likewise. Don't set
13102 after_input_sections on the section.
13103 (Layout::create_executable_stack_info): Remove target parameter.
13104 Change caller.
13105 * layout.h (class Layout): Declare create_notes. Update
13106 declaration of create_executable_stack_info.
13107 * gold.cc (queue_middle_tasks): Call create_notes.
13108 * output.cc (Output_section::update_flags_for_input_section): Move
13109 here from output.h. If SHF_ALLOC flag is newly set, mark address
13110 invalid.
13111 * output.h (Output_data::mark_address_invalid): New function.
13112 (class Output_section): Only declare, not define,
13113 update_flags_for_input_section. Remove set_flags.
13114
13115 2009-06-24 Ian Lance Taylor <iant@google.com>
13116
13117 * script-sections.cc (Output_section_definition::
13118 set_section_addresses): Rename shadowing local load_address to
13119 laddr.
13120
13121 2009-06-24 Ian Lance Taylor <iant@google.com>
13122
13123 PR 10244
13124 * reloc.cc (relocate_sections): Skip empty relocation sections.
13125
13126 2009-06-23 Ian Lance Taylor <iant@google.com>
13127
13128 PR 10156
13129 * layout.cc (Layout::create_note): Use choose_output_section
13130 rather than make_output_section.
13131
13132 2009-06-23 Ian Lance Taylor <iant@google.com>
13133
13134 PR 10237
13135 * options.cc (General_options::parse_V): Set printed_version_.
13136 (General_options::General_options): Initialize printed_version_.
13137 * options.h (class General_options): Add printed_version_ field.
13138 * gold.cc (queue_initial_tasks): If there are no input files,
13139 don't give a fatal error if we printed the version information.
13140 (queue_middle_tasks): If using -r with a shared object, give a
13141 fatal error rather than an ordinary error.
13142
13143 2009-06-23 Ian Lance Taylor <iant@google.com>
13144
13145 PR 10219
13146 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13147 (Layout::make_output_section): Set have_stabstr_section_ if we see
13148 a .stab*str section.
13149 (Layout::finalize): Call link_stabs_sections.
13150 (Layout::link_stabs_sections): New file.
13151 * layout.h (class Layout): Add have_stabstr_section_ field.
13152 Declare link_stabs_sections.
13153
13154 2009-06-23 Doug Kwan <dougkwan@google.com>
13155
13156 * Makefile.am (libgold_a_LIBADD): New.
13157 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13158 * Makefile.in: Regenerate.
13159 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13160 * configure: Regenerate.
13161 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13162 * fileread.cc: Include sys/state.h
13163 * gold.h: Declare memmem and strndup if found missing.
13164 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13165
13166 2009-06-23 Ian Lance Taylor <iant@google.com>
13167
13168 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13169 * configure: Rebuild.
13170
13171 2009-06-23 Ian Lance Taylor <iant@google.com>
13172
13173 PR 10147
13174 * object.cc (Object::section_contents): Don't try to get a view if
13175 the section has length zero.
13176 (Object::handle_gnu_warning_section): If the section is empty, use
13177 the name of the section as the warning.
13178
13179 2009-06-23 Ian Lance Taylor <iant@google.com>
13180
13181 PR 10133
13182 * stringpool.h (class Stringpool_template): Add optimize_ field.
13183 (Stringpool_template::set_optimize): New function.
13184 * stringpool.cc (Stringpool_template::Stringpool_template):
13185 Initialize optimize_ field.
13186 (Stringpool_template::set_string_offsets): Test local optimize
13187 fild rather than parameter.
13188 * layout.cc (Layout::Layout): Call set_optimize on the section
13189 name stringpool.
13190
13191 2009-06-22 Ian Lance Taylor <iant@google.com>
13192
13193 PR 10030
13194 * yyscript.y: Parse TARGET.
13195 * script.cc (script_set_target): New function.
13196 * script-c.h (script_set_target): Declare.
13197 * options.cc (General_options::string_to_object_format): Rename
13198 from string_to_object_format in anonymous namespace. Change
13199 callers.
13200 * options.h (class General_options): Declare
13201 string_to_object_format.
13202
13203 2009-06-22 Ian Lance Taylor <iant@google.com>
13204
13205 * script-sections.cc (Script_sections::create_segments): Don't put
13206 program headers in a PT_LOAD segment if -n or -N.
13207
13208 2009-06-22 Ian Lance Taylor <iant@google.com>
13209
13210 PR 10141
13211 * options.h (class General_options): Add -z lazy and -z now. Sort
13212 -z options into alphabetical order.
13213 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13214
13215 2009-06-21 Ian Lance Taylor <iant@google.com>
13216
13217 * layout.cc (Layout::make_output_section): Call
13218 Target::new_output_section.
13219 (Layout::attach_allocated_section_to_segment): Put large section
13220 sections in a separate load segment with the large segment flag
13221 set.
13222 (Layout::segment_precedes): Sort large data segments after other
13223 load segments.
13224 (align_file_offset): New static function.
13225 (Layout::set_segment_offsets): Use align_file_offset.
13226 * output.h (class Output_section): Add is_small_section_ and
13227 is_large_section_ fields.
13228 (Output_section::is_small_section): New function.
13229 (Output_section::set_is_small_section): New function.
13230 (Output_section::is_large_section): New function.
13231 (Output_section::set_is_large_section): New function.
13232 (Output_section::is_large_data_section): New function.
13233 (class Output_segment): Add is_large_data_segment_ field.
13234 (Output_segment::is_large_data_segment): New function.
13235 (Output_segment::set_is_large_data_segment): New function.
13236 * output.cc (Output_section::Output_section): Initialize new
13237 fields.
13238 (Output_segment::Output_segment): Likewise.
13239 (Output_segment::add_output_section): Add assertion that large
13240 data sections always go in large data segments. Force small data
13241 sections to the end of the list of data sections. Force small BSS
13242 sections to the start of the list of BSS sections. For large BSS
13243 sections to the end of the list of BSS sections.
13244 * symtab.h (class Symbol): Declare is_common_shndx.
13245 (Symbol::is_defined): Check Symbol::is_common_shndx.
13246 (Symbol::is_common): Likewise.
13247 (class Symbol_table): Define enum Commons_section_type. Update
13248 declarations. Add small_commons_ and large_commons_ fields.
13249 * symtab.cc (Symbol::is_common_shndx): New function.
13250 (Symbol_table::Symbol_table): Initialize new fields.
13251 (Symbol_table::add_from_object): Put small and large common
13252 symbols in the right list.
13253 (Symbol_table::sized_finalized_symbol): Check
13254 Symbol::is_common_shndx.
13255 (Symbol_table::sized_write_globals): Likewise.
13256 * common.cc (Symbol_table::do_allocate_commons): Allocate new
13257 common symbol lists. Don't call do_allocate_commons_list if the
13258 list is empty.
13259 (Symbol_table::do_allocate_commons_list): Remove is_tls
13260 parameter. Add comons_section_type parameter. Change all
13261 callers. Handle small and large common symbols.
13262 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13263 Symbol::is_common_shndx.
13264 * resolve.cc (symbol_to_bits): Likewise.
13265 * target.h (Target::small_common_shndx): New function.
13266 (Target::small_common_section_flags): New function.
13267 (Target::large_common_shndx): New function.
13268 (Target::large_common_section_flags): New function.
13269 (Target::new_output_section): New function.
13270 (Target::Target_info): Add small_common_shndx, large_common_shndx,
13271 small_common_section_flags, and large_common_section_flags
13272 fields.
13273 (Target::do_new_output_section): New virtual function.
13274 * arm.cc (Target_arm::arm_info): Initialize new fields.
13275 * i386.cc (Target_i386::i386_info): Likewise.
13276 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13277 Likewise.
13278 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13279 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13280 (Target_x86_64::do_new_output_section): New function.
13281 * configure.ac: Define conditional MCMODEL_MEDIUM.
13282 * testsuite/Makefile.am (check_PROGRAMS): Add large.
13283 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13284 (large_LDFLAGS): Define.
13285 * testsuite/large.c: New file.
13286 * testsuite/testfile.cc (Target_test::test_target_info):
13287 Initialize new fields.
13288 * configure, testsuite/Makefile.in: Rebuild.
13289
13290 2009-06-05 Doug Kwan <dougkwan@google.com>
13291
13292 * Makefile.am (CCFILES): Add target.cc.
13293 * Makefile.in: Regenerate.
13294 * i386.cc (class Target_i386): Define new virtual method to
13295 override do_is_local_label_name in parent.
13296 * object.cc (Sized_relobj::do_count_local_symbols): Discard
13297 local symbols if --discard-locals or -X is given.
13298 * options.h (class General_options): Declare new options
13299 '--discard-locals' and '-X' for discarding locals.
13300 * target.h (class Target): Define new methods is_local_label_name.
13301 Declare new virtual method do_is_local_label_name.
13302 * target.cc: New file.
13303 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13304 (check_SCRIPTS): Add discard_locals_test.sh.
13305 (check_DATA): Add discard_local_tests.syms.
13306 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13307 (discard_local_tests.syms, discard_locals_test.o): New make rules.
13308 * testsuite/Makefile.in: Regenerate.
13309 * testsuite/discard_locals_test.c: New file.
13310 * testsuite/discard_locals_test.sh: Same.
13311
13312 2009-06-05 Doug Kwan <dougkwan@google.com>
13313
13314 * object.cc (Sized_relobj::Sized_relobj): Initialize
13315 discarded_eh_frame_shndx_ to -1U.
13316 (Sized_relobj::do_layout): Record index of a discard .eh_frame
13317 section.
13318 (Sized_relobj::do_count_local_symbols): Skip local symbols in
13319 a discarded .eh_frame section.
13320 (Sized_relobj::do_finalize_local_symbols): Ditto.
13321 * object.h (class Sized_relobj): Declare new member
13322 discarded_eh_frame_shndx_.
13323 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13324 (local_labels_test.o, local_labels_test): New rules.
13325 * testsuite/Makefile.in: Regenerate.
13326
13327 2009-06-04 Doug Kwan <dougkwan@google.com>
13328
13329 * layout.cc (Layout::section_name_mapping): Add mapping for
13330 special ARM sections.
13331
13332 2009-06-03 Doug Kwan <dougkwan@google.com>
13333
13334 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13335 (utils::has_overflow): Same.
13336
13337 2009-06-03 Ian Lance Taylor <iant@google.com>
13338
13339 * layout.cc (Layout::section_name_mapping): New array, replacing
13340 Layout::linkonce_mapping.
13341 (Layout::section_name_mapping_count): New variable, replacing
13342 Layout::linkonce_mapping_count.
13343 (Layout::linkonce_output_name): Remove.
13344 (Layout::output_section_name): Rewrite.
13345 * layout.h (class Layout): Rename Linkonce_mapping to
13346 Section_name_mapping, linkonce_mapping to section_name_mapping,
13347 linkonce_mapping_count to section_name_mapping_count. Don't
13348 declare linkonce_output_name.
13349
13350 2009-06-03 Doug Kwan <dougkwan@google.com>
13351
13352 * gold/arm.cc (namespace utils): New.
13353 (Target_arm::reloc_is_non_pic): Define new method.
13354 (class Arm_relocate_functions): New.
13355 (Target_arm::Relocate::relocate): Handle relocation types used by
13356 Android.
13357
13358 2009-06-03 Ian Lance Taylor <iant@google.com>
13359
13360 * arm.cc (Target_arm::scan::global): Use || instead of |.
13361
13362 2009-06-02 Doug Kwan <dougkwan@google.com>
13363
13364 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
13365 issued_non_pic_error_.
13366 (class Target_arm::Scan): Declare new method check_non_pic.
13367 Define new method symbol_needs_plt_entry.
13368 Declare new data member issued_non_pic_error_.
13369 (class Target_arm::Relocate): Declare new method
13370 should_apply_static_reloc.
13371 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13372 (Target_arm::Scan::check_non_pic): Define new method.
13373 (Target_arm::Scan::local): Handle a small subset of reloc types used
13374 by Android.
13375 (Target_arm::Scan::local): Same.
13376 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13377
13378 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
13379
13380 * incremental.cc (Incremental_inputs::report_command_line): Filter
13381 out --incremental-* options.
13382
13383 2009-05-29 Doug Kwan <dougkwan@google.com>
13384
13385 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13386 template class.
13387 (class Target_arm): Update comment.
13388 (Target_arm::Target_arm): Initialize new data members GOT_,
13389 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13390 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13391 and Target_arm::rel_dyn_section.
13392 Declare new_enum Target_arm::Got_type.
13393 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13394 and DYNBSS_.
13395 Update commments for member do_dynsym_value.
13396 (Target_arm::got_size, Target_arm::plt_section,
13397 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13398 new methods inside class defintion.
13399 (Target_arm::got_section): Define new method.
13400 (Target_arm::rel_dyn_section): Same.
13401 (Output_data_plt_arm): New template class.
13402 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13403 (Output_data_plt_arm:do_adjust_output_section): Define new method.
13404 (Output_data_plt_arm::add_entry): Same.
13405 (Output_data_plt_arm::first_plt_entry): Define new
13406 static data member for PLT instruction template.
13407 (Output_data_plt_arm::plt_entry): Same.
13408 (Output_data_plt_arm::do_write): Define new method.
13409 (Target_arm::make_plt_entry): Same.
13410 (Target_arm::do_finalize_sections): Same.
13411 (Target_arm::do_dynsym_value): Same.
13412
13413 2009-05-28 Doug Kwan <dougkwan@google.com>
13414
13415 * Makefile.am (TARGETSOURCES): Add arm.cc.
13416 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13417 * Makefile.in: Regenerate.
13418 * arm.cc: New file.
13419 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13420
13421 2009-05-26 Doug Kwan <dougkwan@google.com>
13422
13423 * options.cc (General_options::parse_exclude_libs). Fix a comment.
13424 (General_options::check_excluded_libs): Strip off directories in
13425 archive name before matching like GNU ld does.
13426 * testsuite/Makefile.am (MOSTLYCLEANFILES,
13427 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13428 (exclude_libs_test_LDFLAGS): Add linker option
13429 -Wl,--exclude-libs,libexclude_libs_test_3
13430 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13431 an explicit archive without using -l.
13432 (alt/libexclude_libs_test_3.a): New make rule.
13433 * testsuite/Makefile.in: Regenerate.
13434 * testsuite/exclude_libs_test.c : Declare lib3_default().
13435 (main): Call it.
13436 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13437 * exclude_libs_test_3.c: New file.
13438
13439 2009-05-26 Nick Clifton <nickc@redhat.com>
13440
13441 * po/id.po: New Indonesian translation.
13442 * po/gold.pot: Updated template file.
13443
13444 2009-05-22 Sriraman Tallam <tmsriram@google.com>
13445
13446 * testsuite/Makefile.am: Add -ffunction-sections to compile
13447 gc_comdat_test files. Add -Wl,--gc-sections to build
13448 gc_comdat_test.
13449 * testsuite/Makefile.in: Regenerate.
13450 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13451
13452 2009-05-21 Sriraman Tallam <tmsriram@google.com>
13453
13454 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13455 kept comdat section was garbage collected.
13456 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13457 * testsuite/Makefile.in: Regenerate.
13458 * testsuite/gc_comdat_test.sh: New file.
13459 * testsuite/gc_comdat_test_1.cc: New file.
13460 * testsuite/gc_comdat_test_2.cc: New file.
13461
13462 2009-05-19 Doug Kwan <dougkwan@google.com>
13463
13464 * archive.cc (Archive::Archive): Move constructor from archive.h
13465 to here. Initialize no_export_.
13466 (Archive::get_elf_object_for_member): Set no_export flag of object.
13467 * archive.h (Archive::Archive): Move constructor body to
13468 archive.cc.
13469 (Archive::no_export): New method.
13470 (Archive::no_export_): New field.
13471 * object.h (Object::Object): Initialize no_export_ to false.
13472 (Object::no_export, Object::set_no_export): New methods.
13473 (Object::no_export_): New field.
13474 * options.cc (General_options::parse_exclude_libs): New method.
13475 (General_options::check_excluded_libs) Same.
13476 * options.h (exclude_libs): New option.
13477 (General_options::check_excluded_libs): New method declaration.
13478 (General_options::excluded_libs_): New field.
13479 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13480 default or protected visibility if an object has no-export flag set.
13481 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13482 (check_SCRIPTS): Add exclude_libs_test.sh.
13483 (check_DATA): Add exclude_libs_test.syms.
13484 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13485 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13486 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13487 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13488 (exclude_libs_test.syms, libexclude_libs_test_1.a,
13489 libexclude_libs_test_2.a): New rules.
13490 * testsuite/Makefile.in: Regenerate.
13491 * testsuite/exclude_libs_test.c: New file.
13492 * testsuite/exclude_libs_test.sh: Ditto.
13493 * testsuite/exclude_libs_test_1.c: Ditto.
13494 * testsuite/exclude_libs_test_2.c: Ditto.
13495
13496 2009-05-15 Ian Lance Taylor <iant@google.com>
13497
13498 * configure.ac: Check for declarations for cases where libiberty.h
13499 checks HAVE_DECL_xxx.
13500 * configure, config.in: Rebuild.
13501
13502 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
13503
13504 * gold.h (Incremental_argument_list): Remove (invalid) forward
13505 declaration.
13506 * incremental.cc (Incremental_inputs::report_achive): New method.
13507 (Incremental_inputs::report_object): New method.
13508 (Incremental_inputs::report_script): New method.
13509 (Incremental_inputs::finalize_inputs): New method.
13510 (Incremental_inputs::finalize): Call finalize_inputs().
13511 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13512 Create inputs entries.
13513 * incremental.h (Incremental_input_type): New enum.
13514 (Incremental_inputs::Incremental_input): Initialize new fields.
13515 (Incremental_inputs::report_inputs): New method.
13516 (Incremental_inputs::report_achive): New method.
13517 (Incremental_inputs::report_object): New method.
13518 (Incremental_inputs::report_script): New method.
13519 (Incremental_inputs::finalize_inputs): New method.
13520 (Incremental_inputs::Input_info): New struct.
13521 (Incremental_inputs::Input_info_map): New typedef.
13522 (Incremental_inputs::lock_): New field.
13523 (Incremental_inputs::Inputs_): New field.
13524 (Incremental_inputs::Inputs_map): New field.
13525 * main.cc (main): Call Incremental_input::report_inputs.
13526 * options.h (Input_argument_list): Typedef moved from
13527 Input_arguments.
13528 (Input_file_group::Files): Remove, use ::Input_argument_list.
13529 (Input_file_group::Input_argument_list): Remove, use
13530 ::Input_argument_list.
13531 * plugin.cc (Plugin_manager::add_input_file): Add error in
13532 incremental build.
13533 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13534 functions.
13535 * script.cc (read_input_script): Call
13536 Incremental_input::report_script.
13537 * script.h (Script_info): New class.
13538
13539 2009-04-27 Ian Lance Taylor <iant@google.com>
13540
13541 * x86_64.cc (do_adjust_output_section): Set entsize to
13542 plt_entry_size.
13543
13544 2009-04-23 Elliott Hughes <enh@google.com>
13545
13546 * output.cc (Output_file::close): After short writes, continue
13547 writing from the correct offset in the buffer being written.
13548
13549 2009-04-23 Chris Demetriou <cgd@google.com>
13550
13551 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13552 * configure: Regenerate.
13553 * config.in: Regenerate.
13554 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13555 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13556
13557 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
13558
13559 * incremental.cc (Incremental_inputs_header_data): Renamed from
13560 Incremental_input_header_data.
13561 (Incremental_inputs_header_data::data_size): New field.
13562 (Incremental_inputs_header_data::put_input_file_count): Renamed
13563 from input_file_count.
13564 (Incremental_inputs_header_data::put_command_line_offset): Renamed
13565 from command_line_offset.
13566 (Incremental_inputs_header_data::put_reserved): Renamed from
13567 put_reserved.
13568 (Incremental_inputs_entry_data): Renamed from
13569 Incremental_input_entry_data.
13570 (Incremental_inputs_entry_data::data_size): New field.
13571 (Incremental_inputs::report_command_line): New method.
13572 (Incremental_inputs::finalize): New method.
13573 (Incremental_inputs::create_incremental_inputs_data): New method.
13574 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13575 * incremental.h: New file.
13576 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13577 (Layout::finalize): Create incremental inputs section in
13578 incremental builds.
13579 (Layout::create_incremental_info_sections): New method.
13580 * layout.h (Layout::incremental_inputs): New method.
13581 (Layout::create_incremental_info_sections): New method.
13582 (Layout::incremental_inputs_): New field.
13583 * main.cc (main): Notify Incremental_input of the command line.
13584
13585 2009-04-01 Ian Lance Taylor <iant@google.com>
13586 Mikolaj Zalewski <mikolajz@google.com>
13587
13588 * gold.h (reserve_unordered_map): Define, three versions, one for
13589 each version of Unordered_map.
13590 * layout.cc (Layout::Layout): Remove options parameter. Add
13591 number_of_input_files parameter. Don't initialize options_.
13592 Initialize number_of_input_files_ and resized_signatures_. Move
13593 sections_are_attached_.
13594 (Layout::layout_group): Reserve space for group_signatures_.
13595 (Layout::find_or_add_kept_section): Change name parameter to be a
13596 reference. Resize signatures_ map when it gets large enough.
13597 (Layout::layout_eh_frame): Use parameters->options() instead of
13598 this->options_.
13599 (Layout::make_output_section): Likewise.
13600 (Layout::attach_allocated_section_to_segment): Likewise.
13601 (Layout::finalize, Layout::create_executable_stack): Likewise.
13602 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13603 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13604 * layout.h (class Layout): Update declarations. Remove options_
13605 field. Add number_of_input_files_ and resized_signatures_
13606 fields. Move sections_are_attached_ field.
13607 * main.cc (main): Pass number of input files to Layout
13608 constructor. Don't pass options.
13609
13610 2009-03-30 Ian Lance Taylor <iant@google.com>
13611
13612 * ffsll.c (ffsll): Correct implementation.
13613
13614 2009-03-27 Ian Lance Taylor <iant@google.com>
13615
13616 * ffsll.c: New file.
13617 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13618 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13619 * ftruncate.c (ftruncate): Declare before definition.
13620 * mremap.c (mremap): Likewise.
13621 * pread.c (pread): Likewise.
13622 * configure, Makefile.in, config.in: Rebuild.
13623
13624 * mremap.c: New file.
13625 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13626 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13627 (mremap): Declare if HAVE_MREMAP is not defined.
13628 * configure, Makefile.in, config.in: Rebuild.
13629
13630 2009-03-27 Cary Coutant <ccoutant@google.com>
13631
13632 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13633 position independent.
13634 * sparc.cc (Target_sparc::check_non_pic): Likewise.
13635 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13636
13637 2009-03-24 Cary Coutant <ccoutant@google.com>
13638
13639 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13640 an executable.
13641 (needs_dynamic_reloc): Likewise.
13642
13643 2009-03-24 Ian Lance Taylor <iant@google.com>
13644
13645 * yyscript.y (file_cmd): Recognize EXTERN.
13646 (extern_name_list, extern_name_list_body): New nonterminals.
13647 * script.cc (script_add_extern): Define.
13648 * script-c.h (script_add_extern): Declare.
13649
13650 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13651
13652 * object.cc (is_elf_object): Define.
13653 * object.h (is_elf_object): Declare.
13654 * archive.cc (Archive::get_elf_object_for_member): Call
13655 is_elf_object.
13656 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13657
13658 2009-03-24 Elliott Hughes <enh@google.com>
13659
13660 * output.cc (Output_file::map_anonymous): Define.
13661 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13662 try an anonymous one. Report the size if the mmap fails.
13663 * output.h (class Output_file): Declare map_anonymous.
13664
13665 2009-03-24 Ian Lance Taylor <iant@google.com>
13666
13667 * target-select.cc (instantiate_target): Don't acquire the lock if
13668 the instantiated_target_ field has already been set.
13669
13670 2009-03-23 Ian Lance Taylor <iant@google.com>
13671
13672 * gold-threads.h (class Initialize_lock): Define.
13673 * gold-threads.cc (class Initialize_lock_once): Define.
13674 (initialize_lock_control): New static variable.
13675 (initialize_lock_pointer): New static variable.
13676 (initialize_lock_once): New static function.
13677 (Initialize_lock::Initialize_lock): Define.
13678 (Initialize_lock::initialize): Define.
13679 * target-select.h: Include "gold-threads.h".
13680 (class Target_selector): Add lock_ and initialize_lock_ fields.
13681 Don't define instantiate_target, just declare it.
13682 * target-select.cc (Target_selector::Target_selector): Initialize
13683 new fields.
13684 (Target_selector::instantiate_target): Define.
13685 * descriptors.h: Include "gold-threads.h".
13686 (class Descriptors): Add initialize_lock_ field.
13687 * descriptors.cc (Descriptors::Descriptors): Initialize new
13688 field.
13689 (Descriptors::open): Use initialize_lock_ field
13690 * errors.h (class Errors): Add initialize_lock_ field.
13691 * errors.cc (Errors::Errors): Initialize new field.
13692 (Errors::initialize_lock): Use initialize_lock_ field.
13693 * powerpc.cc (class Target_selector_powerpc): Remove
13694 instantiated_target_ field. In do_recognize call
13695 instantiate_target rather than do_instantiate_target. In
13696 do_instantiate_target just allocate a new target.
13697 * sparc.cc (class Target_selector_sparc): Likewise.
13698
13699 * freebsd.h: New file.
13700 * i386.cc: Include "freebsd.h".
13701 (Target_i386): Derive from Target_freebsd rather than
13702 Sized_target.
13703 (Target_selector_i386): Derive from Target_selector_freebsd rather
13704 than Target_selector.
13705 * x86_64.cc: Include "freebsd.h".
13706 (Target_x86_64): Derive from Target_freebsd rather than
13707 Sized_target.
13708 (Target_selector_x86_64): Derive from Target_selector_freebsd
13709 rather than Target_selector.
13710 * target.h (class Target): Add adjust_elf_header and
13711 do_adjust_elf_header.
13712 * output.cc (Output_file_header:: do_sized_write): Call target
13713 adjust_elf_header routine.
13714 * configure.tgt: Set targ_osabi.
13715 * configure.ac: Define GOLD_DEFAULT_OSABI.
13716 * parameters.cc (Parameters::default_target): Pass
13717 GOLD_DEFAULT_OSABI to select_target.
13718 * target-select.h (class Target_selector): Make instantiate_target
13719 protected rather than private.
13720 * Makefile.am (HFILES): Add freebsd.h.
13721 * configure, Makefile.in, config.in: Rebuild.
13722
13723 * merge.cc (do_add_input_section): Correct pend value. Change
13724 message about last entry not being null terminated from error to
13725 warning.
13726
13727 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13728
13729 * incremental.cc: New file.
13730 * Makefile.am (CCFILES): Add incremental.cc.
13731 * Makefile.in: Rebuild.
13732
13733 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13734
13735 * layout.cc (Layout::output_section_name): Preserve names
13736 of '.note.' sections.
13737
13738 2009-03-19 Ian Lance Taylor <iant@google.com>
13739
13740 * descriptors.cc (Descriptors::open): Check that the options are
13741 valid before using them.
13742
13743 2009-03-18 Ian Lance Taylor <iant@google.com>
13744
13745 * script-sections.h: Include <list>.
13746 (class Script_sections): Change Sections_elements from std::vector
13747 to std::list. Typedef public Elements_iterator. Add
13748 orphan_section_placement_, data_segment_align_start_, and
13749 saw_data_segment_align_ fields. Remove data_segment_align_index_
13750 field.
13751 * script-sections.cc (class Orphan_section_placement): New class.
13752 (class Sections_element): Add virtual functions is_relro and
13753 orphan_section_init. Remove virtual function place_orphan_here.
13754 (class Output_section_definition): Add is_relro and
13755 orphan_section_init. Remove place_orphan_here.
13756 (class Orphan_output_section): Likewise.
13757 (Script_sections::Script_sections): Update for field changes.
13758 (Script_sections::data_segment_align): Set saw_data_segment_align_
13759 and data_segment_align_start_, not data_segment_align_index.
13760 (Script_sections::data_segment_relro_end): Check
13761 saw_data_segment_align_. Use data_segment_align_start_ rather
13762 than data_segment_align_index_.
13763 (Script_sections::place_orphan): Rewrite to use
13764 Orphan_section_placement.
13765
13766 2009-03-17 Ian Lance Taylor <iant@google.com>
13767
13768 * archive.cc (Archive::add_symbols): Check for a version attached
13769 to the symbol name in the archive map.
13770 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13771 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13772 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13773 (ver_test_11.a): New target.
13774 * testsuite/Makefile.in: Rebuild.
13775
13776 * configure.ac: Check for chsize and posix_fallocate. Replace
13777 ftruncate.
13778 * ftruncate.c: New file, from gnulib.
13779 * output.cc (posix_fallocate): Define dummy version if not
13780 HAVE_POSIX_FALLOCATE.
13781 (Output_file::map): Call posix_fallocate rather than lseek and
13782 write.
13783 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13784 * configure, Makefile.in, config.in: Rebuild.
13785
13786 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13787
13788 * layout.h (Layout::create_note): Add section_name parameter.
13789 * layout.cc (Layout::create_note): Likewise.
13790 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13791
13792 2009-03-17 Ian Lance Taylor <iant@google.com>
13793
13794 * descriptors.cc: Include "options.h".
13795 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13796 (Descriptors::open): Always use O_CLOEXEC when opening a new
13797 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13798 then set FD_CLOEXEC.
13799
13800 * sparc.cc (class Target_sparc): Add has_got_section.
13801 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13802 make sure we have a GOT section.
13803
13804 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13805 (Target_sparc::Scan::local): Likewise.
13806 (Target_sparc::Scan::global): Likewise.
13807 (Target_sparc::Relocate::relocate): Likewise.
13808 (Target_sparc::Relocate::relocate_tls): Likewise.
13809
13810 * symtab.cc (Symbol_table::define_default_version): New function,
13811 broken out of add_from_object.
13812 (Symbol_table::add_from_object): Call define_default_version.
13813 (Symbol_table::define_special_symbol): Add resolve_oldsym
13814 parameter. Change all callers. If the version for a symbol comes
13815 from a version script, resolve it with the symbol with the same
13816 name with no version. Also add the symbol without a version if
13817 appropriate.
13818 (do_define_in_output_data): If resolving with oldsym, don't delete
13819 sym.
13820 (do_define_in_output_segment): Likewise.
13821 (do_define_as_constant): Likewise.
13822 * symtab.h (class Symbol_table): Update declarations.
13823
13824 2009-03-13 Ian Lance Taylor <iant@google.com>
13825
13826 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13827 (Read_symbols::requeue): New function.
13828 (Read_symbols::do_read_symbols): If make_elf_object fails because
13829 the target type is not configured, and the file was searched for,
13830 issue a warning and retry with the next directory.
13831 (Add_symbols::run): If the file has an incompatible format, and
13832 it was searched for, requeue the Read_symbols task. On error,
13833 release the object.
13834 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13835 dirindex parameter to constructor. Change all callers. Declare
13836 incompatible_warning and requeue.
13837 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13838 input_argument_ and input_group_ fields. Add them to
13839 constructor. Change all callers.
13840 (class Read_script): Add dirindex_ field. Add it to constructor.
13841 Change all callers.
13842 * archive.cc (Archive::setup): Remove input_objects parameter.
13843 Change all callers.
13844 (Archive::get_file_and_offset): Likewise.
13845 (Archive::read_all_symbols): Likewise.
13846 (Archive::read_symbols): Likewise.
13847 (Archive::get_elf_object_for_member): Remove input_objects
13848 parameter. Add punconfigured parameter. Change all callers.
13849 (Archive::add_symbols): Change return type to bool. Check return
13850 value of include_member.
13851 (Archive::include_all_members): Likewise.
13852 (Archive::include_member): Change return type to bool. Return
13853 false if first included object has incompatible target. Set
13854 included_member_ field.
13855 (Add_archive_symbols::run): If add_symbols returns false, requeue
13856 Read_symbols task.
13857 * archive.h (class Archive): Add included_member_ field.
13858 Initialize it in constructor. Add input_file and searched_for
13859 methods. Update declarations.
13860 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13861 input_argument_ fields. Add them to constructor. Change all
13862 callers.
13863 * script.cc: Include "target-select.h".
13864 (class Parser_closure): Add skip_on_incompatible_target_ and
13865 found_incompatible_target_ fields. Add
13866 skip_on_incompatible_target parameter to constructor. Change all
13867 callers. Add methods skip_on_incompatible_target,
13868 clear_skip_on_incompatible_target, found_incompatible_target, and
13869 set_found_incompatible_target.
13870 (read_input_script): Add dirindex parameter. Change all callers.
13871 If parser finds an incompatible target, requeue Read_symbols
13872 task.
13873 (script_set_symbol): Clear skip_on_incompatible_target in
13874 closure.
13875 (script_add_assertion, script_parse_option): Likewise.
13876 (script_start_sections, script_add_phdr): Likewise.
13877 (script_check_output_format): New function.
13878 * script.h (read_input_script): Update declaration.
13879 * script-c.h (script_check_output_format): Declare.
13880 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13881 (ignore_cmd): Remove OUTPUT_FORMAT.
13882 * fileread.cc (Input_file::Input_file): Add explicit this.
13883 (Input_file::will_search_for): New function.
13884 (Input_file::open): Add pindex parameter. Change all callers.
13885 * fileread.h (class Input_file): Add input_file_argument method.
13886 Declare will_search_for. Update declarations.
13887 * object.cc (make_elf_object): Add punconfigured parameter.
13888 Change all callers.
13889 * object.h (class Object): Make input_file public. Add
13890 searched_for method.
13891 (make_elf_object): Update declaration.
13892 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13893 restart search.
13894 * dirsearch.h (class Dirsearch): Update declaration.
13895 * options.h (class General_options): Add --warn-search-mismatch.
13896 * parameters.cc (Parameters::is_compatible_target): New function.
13897 * parameters.h (class Parameters): Declare is_compatible_target.
13898 * workqueue.cc (Workqueue::add_blocker): New function.
13899 * workqueue.h (class Workqueue): Declare add_blocker.
13900
13901 * fileread.cc (Input_file::open): Remove options parameter.
13902 Change all callers.
13903 (Input_file::open_binary): Likewise.
13904 * script.cc (read_input_script): Likewise.
13905 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13906 options parameter from constructor. Change all callers.
13907 (class Read_script): Likewise.
13908 * fileread.h (class Input_file): Update declarations.
13909 * script.h (read_input_script): Update declaration.
13910
13911 2009-03-10 Nick Clifton <nickc@redhat.com>
13912
13913 * po/es.po: New Spanish translation.
13914
13915 2009-03-06 Cary Coutant <ccoutant@google.com>
13916
13917 * options.cc (parse_short_option): Keep dash_z from registering itself.
13918
13919 2009-03-03 Ian Lance Taylor <iant@google.com>
13920
13921 PR 9918
13922 * target-reloc.h (relocate_section): Pass output_section to
13923 relocate.
13924 * i386.cc (Target_i386::should_apply_static_reloc): Add
13925 output_section parameter. Change all callers.
13926 (Target_i386::Relocate::relocate): Add output_section parameter.
13927 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13928 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13929 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13930 * testsuite/two_file_shared.sh: New script.
13931 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13932 (check_DATA): Add two_file_shared.dbg.
13933 (two_file_shared.dbg): New target.
13934 * testsuite/Makefile.in: Rebuild.
13935
13936 2009-03-01 Ian Lance Taylor <iant@google.com>
13937
13938 * configure.ac: Check for byteswap.h.
13939 * configure: Rebuild.
13940 * config.in: Rebuild.
13941
13942 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13943
13944 * layout.cc (Layout::find_or_add_kept_section): New function.
13945 (Layout::add_comdat): Removed.
13946 * layout.h (struct Kept_section): Move out of class Layout.
13947 Remove trailing underscores from field names. Add group_sections
13948 field. Rename group_ field to is_group. Change all uses.
13949 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13950 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13951 comdat_groups_ field.
13952 (Sized_relobj::include_section_group): Use
13953 find_or_add_kept_section and Kept_section::group_sections.
13954 (Sized_relobj::include_linkonce_section): Likewise.
13955 * object.cc (class Sized_relobj): Don't define Comdat_group or
13956 Comdat_group_table. Remove find_comdat_group and
13957 add_comdat_group. Remove comdat_groups_ field.
13958 * plugin.cc (include_comdat_group): Use
13959 Layout::find_or_add_kept_section.
13960
13961 2009-02-28 Ian Lance Taylor <iant@google.com>
13962
13963 * README: --gc-sections and map files are now supported. Document
13964 some build requirements.
13965
13966 PR 6992
13967 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13968 relocatable link set the value of the section symbol to zero.
13969 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13970 relocatable link don't include the section address in the local
13971 symbol value.
13972
13973 2009-02-27 Ian Lance Taylor <iant@google.com>
13974
13975 PR 6811
13976 * options.h (class Search_directory): Add is_system_directory.
13977 (class General_options): Declare is_in_system_directory.
13978 * options.cc (get_relative_sysroot): Make static.
13979 (get_default_sysroot): Make static.
13980 (General_optoins::is_in_system_directory): New function.
13981 * fileread.cc (Input_file::is_in_system_directory): New function.
13982 * fileread.h (class Input_file): Declare is_in_system_directory.
13983 * object.h (class Object): Add is_in_system_directory.
13984 (class Input_objects): Remove system_library_directory_ field.
13985 * object.cc (Input_objects::add_object): Don't set
13986 system_library_directory_.
13987 (input_objects::found_in_system_library_directory): Remove.
13988 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13989 parameter. Change all callers.
13990 (Symbol_table::sized_write_globals): Likewise.
13991 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13992 Call Object::is_in_system_directory.
13993 * symtab.h (class Symbol_table): Update declarations.
13994
13995 PR 5990
13996 * descriptors.h (Open_descriptor): Add is_on_stack field.
13997 * descriptors.cc (Descriptors::open): If the descriptor is on the
13998 top of the stack, remove it. Initialize is_on_stack field.
13999 (Descriptors::release): Only add pod to stack if it is not on the
14000 stack already.
14001 (Descriptors::close_some_descriptor): Clear stack_next and
14002 is_on_stack fields.
14003
14004 PR 7091
14005 * output.cc (Output_section::find_starting_output_address): Rename
14006 from starting_output_address; add PADDR parameter; change return
14007 type.
14008 * output.h (class Output_section): Declare
14009 find_starting_output_address instead of starting_output_address.
14010 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14011 section symbol for which we can't find a merge section.
14012
14013 PR 9836
14014 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14015 hidden or internal, force the symbol to be local.
14016 * resolve.cc (Symbol::override_visibility): Define.
14017 (Symbol::override_base): Use override_visibility.
14018 (Symbol_table::resolve): Likewise.
14019 (Symbol::override_base_with_special): Likewise.
14020 (Symbol_table::override_with_special): If the visibility is hidden
14021 or internal, force the symbol to be local.
14022 * symtab.h (class Symbol): Add set_visibility and
14023 override_visibility.
14024 * testsuite/ver_test_1.sh: New file.
14025 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14026 (check_DATA): Add ver_test_1.syms.
14027 (ver_test_1.syms): New target.
14028 * testsuite/Makefile.in: Rebuild.
14029
14030 2009-02-25 Cary Coutant <ccoutant@google.com>
14031
14032 * layout.cc (Layout::choose_output_section): Don't rename sections
14033 when using a linker script that has a SECTIONS clause.
14034 * Makefile.in: Regenerate.
14035
14036 * testsuite/Makefile.am (script_test_5.sh): New test case.
14037 * testsuite/Makefile.in: Regenerate.
14038 * testsuite/script_test_5.cc: New file.
14039 * testsuite/script_test_5.sh: New file.
14040 * testsuite/script_test_5.t: New file.
14041
14042 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14043
14044 * archive.cc (Archive::include_member): Update calls to add_symbols.
14045 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14046 the Layout argument.
14047 * dynobj.h (do_add_symbols): Add the Layout argument.
14048 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14049 Layout argument.
14050 * object.h (Object::add_symbols): Add the Layout argument.
14051 (Object::do_add_symbols): Add the Layout argument.
14052 (Sized_relobj::do_add_symbols): Add the Layout argument.
14053 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14054 Unify the two versions.
14055 (Add_plugin_symbols): Remove.
14056 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14057 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14058 (Add_plugin_symbols): Remove.
14059 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14060 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14061 (Add_symbols::run): Make it work with Pulginobj.
14062
14063 2009-02-06 Ian Lance Taylor <iant@google.com>
14064
14065 * object.cc (Sized_relobj::do_layout): Make info message start
14066 with lower case letter.
14067
14068 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
14069
14070 * binary.cc: Fix file comment.
14071
14072 * options.h (enum Incremental_disposition): Define.
14073 (class General_options): Add new options: --incremental,
14074 --incremental_changed, --incremental_unchanged,
14075 --incremental_unknown. Add incremental_disposition_ and
14076 implicit_incremental_ fields.
14077 (General_options::incremental_disposition): New function.
14078 (class Position_dependent_options): Add incremental_disposition
14079 option.
14080 (Position_dependent_options::copy_from_options): Set incremental
14081 dispositions.
14082 * options.cc (General_options::parse_incremental_changed): New
14083 function.
14084 (General_options::parse_incremental_unchanged): New function.
14085 (General_options::parse_incremental_unknown): New function.
14086 (General_options::General_options): Initialize new fields
14087 incremental_disposition_ and implicit_incremental_.
14088 (General_options::finalize): Check for uasge of --incremental-*
14089 without --incremental.
14090
14091 2009-02-06 Chris Demetriou <cgd@google.com>
14092
14093 * gold.h (gold_undefined_symbol): Change to take only a Symbol
14094 pointer and to report location as the file name associated with
14095 the symbol.
14096 (gold_undefined_symbol_at_location): New function to replace the
14097 old gold_undefined_symbol functionality.
14098 * target-reloc.h (relocate_section): Update to use
14099 gold_undefined_symbol_at_location.
14100 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14101 Call gold_undefined_symbol function rather than gold_error.
14102 * errors.h (Errors::undefined_symbol): Take location as a
14103 string, rather than calculating it from a relocation.
14104 * errors.cc (Errors::fatal): Print "fatal error:" before the
14105 formatted message.
14106 (Errors::error, Errors::error_at_location): Print "error: "
14107 before the formatted message.
14108 (Errors::undefined_symbol): Take location as a string, rather
14109 than calculating it from a relocation.
14110 (gold_undefined_symbol_at_location): New function akin to
14111 old gold_undefined_symbol, calculates location from relocation.
14112 (gold_undefined_symbol): Change to take only a Symbol pointer
14113 and to report location as the file name associated with the symbol.
14114 * testsuite/debug_msg.sh: Update for changed error messages.
14115 * testsuite/undef_symbol.sh: Likewise.
14116
14117 2009-02-04 Duncan Sands <baldrick@free.fr>
14118
14119 PR 9812
14120 * reduced_debug_output.h
14121 (Output_reduced_debug_abbrev_section::failed): Use format for
14122 gold_warning.
14123 (Output_reduced_debug_info_section::faild): Likewise.
14124
14125 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
14126
14127 * script.cc (Lazy_demangler): New class.
14128 (Version_script_info::get_symbol_version_helper): Demangle a
14129 symbol only once.
14130
14131 2009-01-29 Cary Coutant <ccoutant@google.com>
14132
14133 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14134 to __tls_get_addr.
14135 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14136
14137 2009-01-28 Ian Lance Taylor <iant@google.com>
14138
14139 * version.cc (version_string): Bump to 1.9.
14140
14141 * gold.h: Include <cstring> and <stdint.h>.
14142 * version.cc: Include <cstdio>.
14143 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14144 warning.
14145 * reduced_debug_output.cc (insert_into_vector): Rename from
14146 Insert_into_vector; change all callers. Use Swap_unaligned to
14147 avoid aliasing issue; remove union since it is unnecessary.
14148
14149 2009-01-27 Sriraman Tallam <tmsriram@google.com>
14150
14151 * Makefile.am (CCFILES): Add gc.cc.
14152 (HFILES): Add gc.h.
14153 * Makefile.in: Regenerate.
14154 * gold.cc (Gc_runner): New class.
14155 (queue_initial_tasks): Call garbage collection related tasks
14156 when corresponding options are invoked.
14157 (queue_middle_gc_tasks): New function.
14158 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14159 processed early before laying out sections during garbage collection.
14160 * gold.h (queue_middle_gc_tasks): New function.
14161 (is_prefix_of): Move from "layout.cc".
14162 * i386.cc (Target_i386::gc_process_relocs): New function.
14163 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14164 * main.cc (main): Create object of class "Garbage_collection".
14165 * object.cc (Relobj::copy_symbols_data): New function.
14166 (Relobj::is_section_name_included): New function.
14167 (Sized_relobj::do_layout): Allow this function to be called twice
14168 during garbage collection and defer layout of section during the
14169 first call.
14170 * object.h (Relobj::get_symbols_data): New function.
14171 (Relobj::is_section_name_included): New function.
14172 (Relobj::copy_symbols_data): New function.
14173 (Relobj::set_symbols_data): New function.
14174 (Relobj::get_relocs_data): New function.
14175 (Relobj::set_relocs_data): New function.
14176 (Relobj::is_output_section_offset_invalid): New pure virtual function.
14177 (Relobj::gc_process_relocs): New function.
14178 (Relobj::do_gc_process_relocs): New pure virtual function.
14179 (Relobj::sd_): New data member.
14180 (Sized_relobj::is_output_section_offset_invalid): New function.
14181 (Sized_relobj::do_gc_process_relocs): New function.
14182 * options.h (General_options::gc_sections): Modify to not be a no-op.
14183 (General_options::print_gc_sections): New option.
14184 * plugin.cc (Plugin_finish::run): Remove function call to
14185 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
14186 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14187 * reloc.cc (Read_relocs::run): Add task to process relocs and
14188 determine unreferenced sections when doing garbage collection.
14189 (Gc_process_relocs): New class.
14190 (Sized_relobj::do_gc_process_relocs): New function.
14191 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14192 sections that are garbage collected.
14193 * reloc.h (Gc_process_relocs): New class.
14194 * sparc.cc (Target_sparc::gc_process_relocs): New function.
14195 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14196 symbols whose corresponding sections are garbage collected.
14197 (Symbol_table::Symbol_table): Add new parameter for the garbage
14198 collection object.
14199 (Symbol_table::gc_mark_undef_symbols): New function.
14200 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14201 (Symbol_table::gc_mark_dyn_syms): New function.
14202 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14203 as garbage.
14204 (Symbol_table::add_from_object): Likewise.
14205 (Symbol_table::add_from_relobj): When building shared objects, do not
14206 treat externally visible symbols as garbage.
14207 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14208 table information for static and relocatable links.
14209 * symtab.h (Symbol_table::set_gc): New function.
14210 (Symbol_table::gc): New function.
14211 (Symbol_table::gc_mark_undef_symbols): New function.
14212 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14213 (Symbol_table::gc_mark_dyn_syms): New function.
14214 (Symbol_table::gc_): New data member.
14215 * target.h (Sized_target::gc_process_relocs): New pure virtual
14216 function.
14217 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14218 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14219
14220 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
14221
14222 * options.h (General_options::gc_sections): Define as a no-op for now.
14223 (General_options::no_keep_memory): Ditto.
14224 (General_options::Bshareable): Define.
14225 * options.cc (General_options::finalize): Honor -Bshareable.
14226
14227 2009-01-20 Andreas Schwab <schwab@suse.de>
14228
14229 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14230 read the value in the contents, since we don't use it. Use the
14231 template endianness when writing.
14232 (Relocate::relocate): Use it for R_PPC_REL16_HA.
14233
14234 2009-01-19 Andreas Schwab <schwab@suse.de>
14235
14236 * configure.tgt (powerpc64-*): Fix targ_obj.
14237
14238 2009-01-15 Ian Lance Taylor <iant@google.com>
14239
14240 * object.cc (Sized_relobj::write_local_symbols): Don't write out
14241 local symbols when stripping all symbols.
14242
14243 2009-01-14 Cary Coutant <ccoutant@google.com>
14244
14245 * output.cc (Output_reloc): Add explicit instantiations.
14246
14247 2009-01-14 Cary Coutant <ccoutant@google.com>
14248
14249 * archive.cc (Archive::get_elf_object_for_member): Remove call
14250 to File_read::claim_for_plugin.
14251 * descriptors.cc (Descriptors::open): Remove reference to
14252 is_claimed.
14253 (Descriptors::claim_for_plugin): Remove.
14254 * descriptors.h (Descriptors::claim_for_plugin): Remove.
14255 (Descriptors::is_claimed): Remove.
14256 (claim_descriptor_for_plugin): Remove.
14257 * fileread.cc (File_read::claim_for_plugin): Remove.
14258 * fileread.h (File_read::claim_for_plugin): Remove.
14259 (File_read::descriptor): Reopen descriptor if necessary.
14260 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
14261 (Plugin_manager::all_symbols_read): Add task parameter. Change
14262 all callers.
14263 (Plugin_manager::get_input_file): New function.
14264 (Plugin_manager::release_input_file): New function.
14265 (Pluginobj::Pluginobj): Add filesize parameter and initialize
14266 corresponding data member.
14267 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14268 and pass to base constructor. Change all callers.
14269 (get_input_file, release_input_file): New functions.
14270 (make_sized_plugin_object): Add filesize parameter. Change all callers.
14271 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14272 (Plugin_manager::all_symbols_read): Add task parameter.
14273 (Plugin_manager::get_input_file): New function.
14274 (Plugin_manager::release_input_file): New function.
14275 (Plugin_manager::task_): New data member.
14276 (Pluginobj::Pluginobj): Add filesize parameter.
14277 (Pluginobj::filename): New function.
14278 (Pluginobj::descriptor): New function.
14279 (Pluginobj::filesize): New function.
14280 (Pluginobj::filesize_): New data member.
14281 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14282 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14283 File_read::claim_for_plugin; use Object::unlock to unlock the file.
14284
14285 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14286 with archive libraries.
14287 * testsuite/Makefile.in: Regenerate.
14288 * testsuite/plugin_test.c (struct sym_info): New type.
14289 (get_input_file, release_input_file): New static variables.
14290 (onload): Capture new transfer vector entries.
14291 (claim_file_hook): Stop reading at end of file according to filesize.
14292 Factor out parsing of readelf output into separate function.
14293 (all_symbols_read_hook): Exercise get_input_file and release_input_file
14294 APIs and get the source file name from the symbol table. Convert
14295 source file name to corresponding object file name. Print info
14296 message when adding new input files.
14297 (parse_readelf_line): New function.
14298 * testsuite/plugin_test_1.sh: Add checks for new info messages.
14299 * testsuite/plugin_test_2.sh: Likewise.
14300 * testsuite/plugin_test_3.sh: Likewise.
14301 * testsuite/plugin_test_4.sh: New test case.
14302
14303 2009-01-07 Ian Lance Taylor <iant@google.com>
14304
14305 * version.cc (version_string): Bump to 1.8.
14306
14307 2008-12-23 Cary Coutant <ccoutant@google.com>
14308
14309 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14310 * plugin.cc (Plugin_manager::finish): Rename as
14311 layout_deferred_objects. Move cleanup to separate function.
14312 (Plugin_manager::cleanup): New function.
14313 (Plugin_finish::run): Call layout_deferred_objects and cleanup
14314 separately.
14315 * plugin.h (Plugin_manager::finish): Rename as
14316 layout_deferred_objects.
14317 (Plugin_manager::cleanup): New function.
14318 (Plugin_manager::cleanup_done): New field.
14319
14320 2008-12-23 Cary Coutant <ccoutant@google.com>
14321
14322 * plugin.cc (is_visible_from_outside): New function.
14323 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14324 so we don't return "IR only" status for exported symbols or -r links.
14325
14326 * testsuite/Makefile.am (plugin_test_3): New test case.
14327 * testsuite/Makefile.in: Regenerate.
14328 * testsuite/plugin_test_3.sh: New file.
14329
14330 2008-12-22 Cary Coutant <ccoutant@google.com>
14331
14332 * object.cc (Sized_relobj::layout_section): New function.
14333 (Sized_relobj::do_layout): Defer layout of input sections until after
14334 plugin has provided replacement files.
14335 (Sized_relobj::do_layout_deferred_sections): New function.
14336 * object.h (Relobj::set_section_offset): Remove virtual keyword.
14337 (Relobj::layout_deferred_sections): New function.
14338 (Relobj::do_layout_deferred_sections): New function.
14339 (Sized_relobj::do_layout_deferred_sections): New function.
14340 (Sized_relobj::layout_section): New function.
14341 (Sized_relobj::Deferred_layout): New structure.
14342 (Sized_relobj::deferred_layout_): New field.
14343 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14344 Change all callers. Layout deferred sections.
14345 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
14346 references.
14347 (Plugin_hook::run): Move code from do_plugin_hook inline.
14348 (Plugin_hook::do_plugin_hook): Remove.
14349 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14350 (Plugin_manager::finish): Renamed, was cleanup.
14351 (Plugin_manager::should_defer_layout): New function.
14352 (Plugin_manager::add_deferred_layout_object): New function.
14353 (Plugin_manager::Deferred_layout_list): New type.
14354 (Plugin_manager::deferred_layout_objects_): New field.
14355 (Plugin_hook::do_plugin_hook): Remove.
14356
14357 2008-12-17 Ian Lance Taylor <iant@google.com>
14358
14359 * options.h (class General_options): Add --no case for
14360 --export-dynamic.
14361
14362 2008-12-16 Cary Coutant <ccoutant@google.com>
14363
14364 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14365 vector.
14366 (Plugin_manager::claim_file): Create plugin object even if
14367 plugin did not call the add_symbols callback.
14368 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14369 asking for more symbols than were added.
14370 * testsuite/Makefile.am (plugin_test_1): Add test case with
14371 no global symbols.
14372 (empty.syms): New target.
14373 * testsuite/Makefile.in: Regenerate.
14374 * testsuite/plugin_test.c (claim_file_hook): Add new debug
14375 message. Don't call add_symbols if no globals.
14376 (all_symbols_read_hook): Don't provide replacement for empty
14377 claimed file.
14378
14379 2008-12-12 Ian Lance Taylor <iant@google.com>
14380
14381 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14382 r_type == 0 for a local symbol with r_sym == 0.
14383 (scan_relocatable_relocs): Pass r_sym to
14384 local_non_section_strategy.
14385 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14386 r_sym parameter.
14387
14388 * configure.ac: Update test for TLS descriptors: they are
14389 supported as of glibc 2.9.
14390 * configure: Rebuild.
14391
14392 2008-12-11 Ian Lance Taylor <iant@google.com>
14393
14394 PR 7091
14395 * target-reloc.h (Default_scan_relocatable_relocs): For each
14396 function, map r_type == 0 to RELOC_DISCARD.
14397
14398 2008-12-10 Cary Coutant <ccoutant@google.com>
14399
14400 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14401 object to override a kept COMDAT group from a plugin object.
14402
14403 2008-12-09 Ian Lance Taylor <iant@google.com>
14404
14405 PR 7088
14406 * yyscript.y (file_cmd): Handle INPUT.
14407
14408 * testsuite/initpri1.c: Change all declarations to be full
14409 prototypes by adding void, to avoid compiler warnings.
14410
14411 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
14412
14413 * options.cc (General_options::parse_plugin_opt): New.
14414 (General_options::add_plugin): The argument now is just the filename.
14415 (General_options::add_plugin_option): New.
14416 * options.h (plugin_opt): New.
14417 (add_plugin): Change argument name.
14418 (add_plugin_option): New.
14419 * plugin.cc (Plugin::load): Don't parse the plugin option.
14420 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14421 (Plugin::add_option): New.
14422 (Plugin::args_): Change type.
14423 (Plugin::filename_): New.
14424 (Plugin_manager::add_plugin_option): New.
14425 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14426 * testsuite/Makefile.in: Regenerate.
14427
14428 2008-12-05 Cary Coutant <ccoutant@google.com>
14429
14430 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14431 Handle --strip-lto-sections option.
14432 * options.h (strip_lto_sections): New option.
14433
14434 2008-12-01 Cary Coutant <ccoutant@google.com>
14435
14436 * plugin.cc (ld_plugin_message): Change format parameter to const.
14437 Fix mismatch between new[] and delete.
14438
14439 2008-11-14 Cary Coutant <ccoutant@google.com>
14440
14441 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14442 instead of -1U.
14443
14444 2008-11-05 Craig Silverstein <csilvers@google.com>
14445
14446 * options.cc (General_options::parse_dynamic_list): New function.
14447 * options.h (General_options): New flags dynamic_list,
14448 dynamic_list_data, dynamic_list_cpp_new, and
14449 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
14450 (General_options::in_dynamic_list): New function.
14451 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14452 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14453 (Lex::can_continue_name): Likewise.
14454 (yylex): Likewise.
14455 (read_script_file): New parameter script_options.
14456 (read_dynamic_list): New function.
14457 (Script_options::define_dynamic_list): New function.
14458 (dynamic_list_keyword_parsecodes): New variable.
14459 (dynamic_list_keywords): New variable.
14460 * script.h (Script_options::define_dynamic_list): New function
14461 prototype.
14462 (read_dynamic_list): New function prototype.
14463 * symtab.cc (strprefix): New macro.
14464 (Symbol::should_add_dynsym_entry): Support dynamic_list,
14465 dynamic_list_data, dynamic_list_cpp_new, and
14466 dynamic_list_cpp_typeinfo.
14467 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14468 (dynamic_list_expr): New rule.
14469 (dynamic_list_nodes): Likewise.
14470 (dynamic_list_node): Likewise.
14471 * testsuite/Makefile.am (dynamic_list): New test.
14472 * testsuite/Makefile.in: Regenerated.
14473 * testsuite/dynamic_list.t: New file.
14474 * testsuite/dynamic_list.sh: New file.
14475
14476 2008-11-05 Craig Silverstein <csilvers@google.com>
14477
14478 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14479 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14480 (t11_last): Likewise.
14481 * testsuite/ver_test_6.c (main): Likewise.
14482
14483 2008-10-07 Cary Coutant <ccoutant@google.com>
14484
14485 * options.c (General_options::finalize): Add check for -static and
14486 -shared.
14487 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14488 is not empty.
14489
14490 2008-10-02 Cary Coutant <ccoutant@google.com>
14491
14492 * plugin.cc (make_sized_plugin_object): Fix conditional
14493 compilation to work when not all targets are enabled.
14494
14495 2008-09-29 Cary Coutant <ccoutant@google.com>
14496
14497 * archive.cc (Archive::get_file_and_offset): Use filename instead
14498 of name to get library path.
14499 (Archive::include_member): Unlock external member of a thin archive.
14500
14501 * testsuite/Makefile.am (TEST_AR): New variable.
14502 (thin_archive_test_1): New test.
14503 (thin_archive_test_2): New test.
14504 * testsuite/Makefile.in: Regenerate.
14505 * testsuite/thin_archive_main.cc: New file.
14506 * testsuite/thin_archive_test_1.cc: New file.
14507 * testsuite/thin_archive_test_2.cc: New file.
14508 * testsuite/thin_archive_test_3.cc: New file.
14509 * testsuite/thin_archive_test_4.cc: New file.
14510
14511 2008-09-29 Cary Coutant <ccoutant@google.com>
14512
14513 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14514 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14515 instead of -1U.
14516 (Sized_relobj::do_finalize_local_symbols): Likewise.
14517 (Sized_relobj::map_to_kept_section): Likewise.
14518 * object.h (Sized_relobj::invalid_address): New constant.
14519 (Sized_relobj::do_output_section_offset): Check for invalid_address
14520 and return -1ULL.
14521 * output.cc (Output_reloc::local_section_offset): Use constant
14522 invalid_address instead of -1U.
14523 (Output_reloc::get_address): Likewise.
14524 (Output_section::output_address): Change -1U to -1ULL.
14525 * output.h (Output_reloc::invalid_address): New constant.
14526 * reloc.cc (Sized_relobj::write_sections): Use constant
14527 invalid_address instead of -1U.
14528 (Sized_relobj::relocate_sections): Likewise.
14529 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14530 values for merge sections.
14531 * target-reloc.h (relocate_for_relocatable): Use constant
14532 invalid_address instead of -1U.
14533
14534 2008-09-19 Cary Coutant <ccoutant@google.com>
14535
14536 Add plugin functionality for link-time optimization (LTO).
14537 * configure.ac (plugins): Add --enable-plugins option.
14538 * configure: Regenerate.
14539 * config.in: Regenerate.
14540 * Makefile.am (LIBDL): New variable.
14541 (CCFILES): Add plugin.cc.
14542 (HFILES): Add plugin.h.
14543 (ldadd_var): Add LIBDL.
14544 * Makefile.in: Regenerate.
14545
14546 * archive.cc: Include "plugin.h".
14547 (Archive::setup): Don't preread archive symbols when using a plugin.
14548 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
14549 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14550 files.
14551 (Archive::include_member): Add symbols from plugin objects.
14552 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14553 * descriptors.cc (Descriptors::open): Check for file descriptors
14554 abandoned by plugins.
14555 (Descriptors::claim_for_plugin): New function.
14556 * descriptors.h (Descriptors::claim_for_plugin): New function.
14557 (Open_descriptor::is_claimed): New field.
14558 (claim_descriptor_for_plugin): New function.
14559 * fileread.cc (File_read::claim_for_plugin): New function.
14560 * fileread.h (File_read::claim_for_plugin): New function.
14561 (File_read::descriptor): New function.
14562 * gold.cc: Include "plugin.h".
14563 (queue_initial_tasks): Add task to call plugin hooks for generating
14564 new object files.
14565 * main.cc: Include "plugin.h".
14566 (main): Load plugin libraries.
14567 * object.h (Pluginobj): Declare.
14568 (Object::pluginobj): New function.
14569 (Object::do_pluginobj): New function.
14570 (Object::set_target): New function.
14571 * options.cc: Include "plugin.h".
14572 (General_options::parse_plugin): New function.
14573 (General_options::General_options): Initialize plugins_ field.
14574 (General_options::add_plugin): New function.
14575 * options.h (Plugin_manager): Declare.
14576 (General_options): Add --plugin option.
14577 (General_options::has_plugins): New function.
14578 (General_options::plugins): New function.
14579 (General_options::add_plugin): New function.
14580 (General_options::plugins_): New field.
14581 * plugin.cc: New file.
14582 * plugin.h: New file.
14583 * readsyms.cc: Include "plugin.h".
14584 (Read_symbols::do_read_symbols): Check for archive before checking
14585 for ELF file. Call plugin hooks to claim files.
14586 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14587 from a real object file; force override when processing replacement
14588 files.
14589 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14590 (Symbol::init_base_object): Likewise.
14591 (Symbol::init_base_output_data): Likewise.
14592 (Symbol::init_base_output_segment): Likewise.
14593 (Symbol::init_base_constant): Likewise.
14594 (Symbol::init_base_undefined): Likewise.
14595 (Symbol::output_section): Assert that object is not a plugin.
14596 (Symbol_table::add_from_pluginobj): New function.
14597 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14598 undefined.
14599 (Symbol_table::sized_write_globals): Likewise.
14600 (Symbol_table::add_from_pluginobj): Instantiate template.
14601 * symtab.h (Sized_pluginobj): Declare.
14602 (Symbol::in_real_elf): New function.
14603 (Symbol::set_in_real_elf): New function.
14604 (Symbol::in_real_elf_): New field.
14605 (Symbol_table::add_from_pluginobj): New function.
14606
14607 * testsuite/Makefile.am (AM_CFLAGS): New variable.
14608 (LIBDL): New variable.
14609 (LDADD): Add LIBDL.
14610 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14611 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14612 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14613 (MOSTLYCLEANFILES): Likewise.
14614 * testsuite/Makefile.in: Regenerate.
14615 * testsuite/plugin_test.c: New file.
14616 * testsuite/plugin_test_1.sh: New file.
14617 * testsuite/plugin_test_2.sh: New file.
14618
14619 2008-09-16 Ian Lance Taylor <iant@google.com>
14620
14621 * target-reloc.h (relocate_section): Check whether a symbol is
14622 defined by the ABI before reporting an undefined symbol error.
14623 * target.h (Target::is_defined_by_abi): Make parameter const.
14624 (Target::do_is_defined_by_abi): Likewise.
14625 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14626 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14627 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14628 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14629 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14630 * testsuite/Makefile.in: Rebuild.
14631
14632 * fileread.cc (make_view): Add casts to avoid warning.
14633
14634 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14635
14636 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14637 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14638
14639 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14640
14641 * options.h (General_options::output_is_executable): New.
14642 (General_options::output_is_pie): New.
14643 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14644 for shared libraries.
14645 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14646
14647 2008-09-11 Chris Demetriou <cgd@google.com>
14648
14649 * options.h (origin): New -z option.
14650 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14651 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14652 in DT_FLAGS_1.
14653
14654 2008-09-05 Cary Coutant <ccoutant@google.com>
14655
14656 * fileread.cc (File_read::make_view): Add check for attempt to map
14657 beyond end of file.
14658
14659 2008-09-05 Cary Coutant <ccoutant@google.com>
14660
14661 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14662 explicit instantiations.
14663
14664 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14665
14666 PR gold/6858
14667 * options.cc (General_options::finalize): Allow undefined symbols
14668 in shlibs if linking -shared.
14669
14670 PR gold/6859
14671 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14672 symbols as not needing a dynsym entry.
14673
14674 2008-08-20 Craig Silverstein <csilvers@google.com>
14675
14676 * fileread.cc (File_read::open): Do not lock the file unless it
14677 was successfully opened.
14678
14679 2008-08-14 Cary Coutant <ccoutant@google.com>
14680
14681 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14682 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14683 * testsuite/tls_test.cc (struct int128): 128-bit struct
14684 for testing TLS relocs with non-zero addend.
14685 (v12): New TLS variable.
14686 (t12): New test.
14687 (t_last): Add check for v12.
14688 * testsuite/tls_test.h (t12): New function.
14689 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14690
14691 2008-08-13 Ian Lance Taylor <iant@google.com>
14692
14693 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14694 set tls_segment_ or relro_segment_.
14695 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14696 when appropriate.
14697 * output.h (Output_section::clear_is_relro): New function.
14698 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14699 sections specially even when output_data_ is empty.
14700 (Output_segment::maximum_alignment): When first section is relro,
14701 only force alignment for PT_LOAD segments.
14702 * script.cc (script_data_segment_align): New function.
14703 (script_data_segment_relro_end): New function.
14704 * script-c.h (script_data_segment_align): Declare.
14705 (script_data_segment_relro_end): Declare.
14706 * script-sections.h (class Script_sections): Declare
14707 data_segment_align and data_segment_relro_end. Add fields
14708 segment_align_index_ and saw_relro_end_.
14709 * script-sections.cc (class Sections_element): Add set_is_relro
14710 virtual function. Add new bool* parameter to place_orphan_here.
14711 Add get_output_section virtual function.
14712 (class Output_section_definition): Add set_is_relro. Add new
14713 bool* parameter to place_orphan_here. Add get_output_section.
14714 Add is_relro_ field.
14715 (Output_section_definition::Output_section_definition): Initialize
14716 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14717 and is_relro_ fields.
14718 (Output_section_definition::place_orphan_here): Add is_relro
14719 parameter.
14720 (Output_section_definition::set_section_addresses): Set relro for
14721 output section.
14722 (Output_section_definition::alternate_constraint): Likewise.
14723 (class Orphan_output_section): Add new bool* parameter to
14724 place_orphan_here. Add get_output_section.
14725 (Orphan_output_section::place_orphan_here): Add is_relro
14726 parameter.
14727 (Script_sections::Script_sections): Initialize
14728 data_segment_align_index_ and saw_relro_end_.
14729 (Script_sections::data_segment_align): New function.
14730 (Script_sections::data_segment_relro_end): New function.
14731 (Script_sections::place_orphan): Set or clear is_relro.
14732 (Script_sections::set_section_addresses): Force alignment of first
14733 TLS section.
14734 * yyscript.y (exp): Call script_data_segment_align and
14735 script_data_segment_relro_end.
14736 * testsuite/relro_script_test.t: New file.
14737 * testsuite/relro_test.cc (using_script): Declare.
14738 (t1, t2): Test using_script.
14739 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14740 (relro_script_test_SOURCES): Define.
14741 (relro_script_test_DEPENDENCIES): Define.
14742 (relro_script_test_LDFLAGS): Define.
14743 (relro_script_test_LDADD): Define.
14744 (relro_script_test.so): New target.
14745 * testsuite/Makefile.in: Rebuild.
14746
14747 2008-08-06 Cary Coutant <ccoutant@google.com>
14748
14749 * archive.cc (Archive::total_archives, Archive::total_members)
14750 (Archive::total_members_loaded): New variables.
14751 (Archive::setup): Add parameter. Add option to preread
14752 archive symbols.
14753 (Archive::read_armap): Add counter.
14754 (Archive::get_file_and_offset): New function.
14755 (Archive::get_elf_object_for_member): New function.
14756 (Archive::read_all_symbols): New function.
14757 (Archive::read_symbols): New function.
14758 (Archive::add_symbols): Add counters.
14759 (Archive::include_all_members): Use armap to find members if it's
14760 already built.
14761 (Archive::include_member): Skip reading symbols if already read.
14762 Factored code into Archive::get_file_and_offset and
14763 Archive::get_elf_object_for_member. Changed call to
14764 Mapfile::report_include_archive_member.
14765 (Archive::print_stats): New function.
14766 * archive.h: Declare Object and Read_symbols_data classes.
14767 (Archive::Archive): Add initializers for new members.
14768 (Archive::setup): Add parameter.
14769 (Archive::print_stats): New function.
14770 (Archive::total_archives, Archive::total_members)
14771 (Archive::total_members_loaded): New variables.
14772 (Archive::get_file_and_offset): New function.
14773 (Archive::get_elf_object_for_member): New function.
14774 (Archive::read_all_symbols): New function.
14775 (Archive::read_symbols): New function.
14776 (Archive::Archive_member): New class.
14777 (Archive::members_): New member.
14778 (Archive::num_members_): New member.
14779 * main.cc: Include archive.h.
14780 (main): Call Archive::print_stats.
14781 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14782 archive parameter; member_name is now the fully-decorated name.
14783 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14784 * options.h: (General_options): Add --preread-archive-symbols option.
14785 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14786 Archive::setup.
14787
14788 2008-08-04 Ian Lance Taylor <iant@google.com>
14789
14790 * symtab.h (Symbol::use_plt_offset): New function.
14791 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14792 * powerpc.cc (Relocate::relocate): Likewise.
14793 * sparc.cc (Relocate::relocate): Likewise.
14794 * x86_64.cc (Relocate::relocate): Likewise.
14795 * testsuite/weak_plt.sh: New test.
14796 * testsuite/weak_plt_main.cc: New test.
14797 * testsuite/weak_plt_shared.cc: New test.
14798 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14799 (check_PROGRAMS): Add weak_plt.
14800 (check_DATA): Add weak_plt_shared.so.
14801 (weak_plt_main_pic.o, weak_plt): New targets.
14802 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14803 * testsuite/Makefile.in: Rebuild.
14804
14805 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14806 gcctestdir/ld.
14807 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14808 * testsuite/Makefile.in: Rebuild.
14809
14810 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14811
14812 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14813 * Makefile.in: Regenerate.
14814 * po/POTFILES.in: Regenerate.
14815
14816 2008-07-29 Ian Lance Taylor <iant@google.com>
14817
14818 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14819 symbols before other symbols.
14820 * testsuite/script_test_2.cc (test_addr): Declare.
14821 (test_addr_alias): Declare.
14822 (main): Check that test_addr and test_addr_alias have the right
14823 values.
14824 * testsuite/script_test_2.t: Define test_addr_alias and
14825 test_addr.
14826
14827 2008-07-24 Ian Lance Taylor <iant@google.com>
14828
14829 PR 5990
14830 * descriptors.cc: New file.
14831 * descriptors.h: New file.
14832 * gold-threads.h (class Hold_optional_lock): New class.
14833 * fileread.cc: Include "descriptors.h".
14834 (File_read::~File_read): Release descriptor rather than closing
14835 it.
14836 (File_read::open) [file]: Call open_descriptor rather than open.
14837 Set is_descriptor_opened_.
14838 (File_read::open) [memory]: Assert that descriptor is not open.
14839 (File_read::reopen_descriptor): New function.
14840 (File_read::release): Release descriptor.
14841 (File_read::do_read): Make non-const. Reopen descriptor.
14842 (File_read::read): Make non-const.
14843 (File_read::make_view): Reopen descriptor.
14844 (File_read::do_readv): Likewise.
14845 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14846 Update declarations.
14847 * layout.cc: Include "descriptors.h".
14848 (Layout::create_build_id): Use open_descriptor rather than open.
14849 * output.cc: Include "descriptors.h".
14850 (Output_file::open): Use open_descriptor rather than open.
14851 * archive.cc (Archive::const_iterator): Change Archive to be
14852 non-const.
14853 (Archive::begin, Archive::end): Make non-const.
14854 (Archive::count_members): Likewise.
14855 * archive.h (class Archive): Update declarations.
14856 * object.h (Object::read): Make non-const.
14857 * Makefile.am (CCFILES): Add descriptors.cc.
14858 (HFILES): Add descriptors.h.
14859 * Makefile.in: Rebuild.
14860
14861 PR 6716
14862 * gold.h: Always include <clocale>. Add Solaris workarounds
14863 following code in binutils/sysdep.h.
14864
14865 PR 6048
14866 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14867 this->eh_frame_hdr_ is NULL before using it.
14868
14869 * dynobj.cc (Versions::Versions): Update comment.
14870
14871 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14872 the base version name.
14873
14874 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14875 array size plus one.
14876 (Stringpool_template::set_string_offsets): Subtract one from key
14877 before using it as an array index.
14878 (Stringpool_template::get_offset_with_length): Likewise.
14879 (Stringpool_template::write_to_buffer): Likewise.
14880 * stringpool.h (Stringpool_template::get_offset_from_key):
14881 Likewise.
14882
14883 2008-07-23 Ian Lance Taylor <iant@google.com>
14884
14885 PR 6658
14886 * object.h (Merged_symbol_value::value): Do our best to handle a
14887 negative addend.
14888
14889 PR 6647
14890 * script.cc (Version_script_info::get_versions): Don't add empty
14891 version tag to return value.
14892 (Version_script_info::get_symbol_version_helper): Change return
14893 type to bool. Add pversion parameter. Change all callers.
14894 (script_register_vers_node): Don't require a non-NULL tag.
14895 * script.h (class Version_script_info): Update declarations.
14896 (Version_script_info::get_symbol_version): Change return type to
14897 bool. Add version parameter. Change all callers.
14898 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14899 handling. Handle an empty version from a version script.
14900 (Symbol_table::define_special_symbol): Likewise.
14901 * testsuite/ver_test_10.script: New file.
14902 * testsuite/ver_test_10.sh: New file.
14903 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14904 (check_DATA): Add ver_test_10.syms.
14905 (ver_test_10.syms, ver_test_10.so): New target.
14906 * testsuite/Makefile.in: Rebuild.
14907
14908 2008-07-23 Simon Baldwin <simonb@google.com>
14909
14910 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14911 to zero for undefined symbols from dynamic libraries.
14912
14913 2008-07-23 Ian Lance Taylor <iant@google.com>
14914
14915 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14916 Change all callers.
14917 * symtab.h (class Symbol_table): Update declaration.
14918 * testsuite/ver_test_9.cc: New file.
14919 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14920 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14921 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14922 (ver_test_9.so, ver_test_9.o): New targets.
14923 * testsuite/Makefile.in: Rebuild.
14924
14925 2008-07-22 Ian Lance Taylor <iant@google.com>
14926
14927 * options.h (class General_options): Define --check-sections.
14928 * layout.cc (Layout::set_segment_offsets): Handle
14929 --check-sections.
14930
14931 * options.h (class General_options): Define -n/--nmagic and
14932 -N/--omagic.
14933 * options.cc (General_options::finalize): For -n/--nmagic or
14934 -N/--omagic, set -static.
14935 * layout.cc (Layout::attach_allocated_section_to_segment): If
14936 -N/--omagic, don't put read-only and read-write sections in
14937 different segments.
14938 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14939 finding a read-only segment.
14940 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14941 don't set the minimum segment alignment to the common page size,
14942 and don't set the file offset to the address modulo the page size.
14943 * script-sections.cc (Script_sections::create_segments): If
14944 -n/--omagic, don't put read-only and read-write sections in
14945 different segments.
14946
14947 * cref.cc: New file.
14948 * cref.h: New file.
14949 * options.h (class General_options): Add --print-symbol-counts.
14950 * main.cc (main): Issue defined symbol report if requested.
14951 * archive.cc (Archive::interpret_header): Make into a const member
14952 function.
14953 (Archive::add_symbols): Call Input_objects::archive_start and
14954 archive_stop.
14955 (Archive::const_iterator): Define new class.
14956 (Archive::begin, Archive::end): New functions.
14957 (Archive::include_all_members): Rewrite to use iterator.
14958 (Archive::count_members): New function.
14959 * archive.h (class Archive): Update declarations.
14960 (Archive::filename): New function.
14961 * object.cc: Include "cref.h".
14962 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14963 (Sized_relobj::do_get_global_symbol_counts): New function.
14964 (Input_objects::add_object): Add object to cross-referencer.
14965 (Input_objects::archive_start): New function.
14966 (Input_objects::archive_stop): New function.
14967 (Input_objects::print_symbol_counts): New function.
14968 * object.h: Declare Cref and Archive.
14969 (Object::get_global_symbol_counts): New function.
14970 (Object::do_get_global_symbol_counts): New pure virtual function.
14971 (class Sized_relobj): Add defined_count_ field. Update
14972 declarations.
14973 (class Input_objects): Add cref_ field. Update constructor.
14974 Update declarations.
14975 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14976 defined_count_.
14977 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14978 symbol counts.
14979 (Sized_dynobj::do_get_global_symbol_counts): New function.
14980 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14981 defined_count_. Update declarations. Define Symbols typedef.
14982 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14983 parameter. Change all callers.
14984 (Symbol_table::add_from_dynobj): Add sympointers and defined
14985 parameters. Change all callers.
14986 * symtab.h (class Symbol_table): Update declarations.
14987 * Makefile.am (CCFILES): Add cref.cc.
14988 (HFILES): Add cref.h.
14989 * Makefile.in: Rebuild.
14990
14991 2008-07-22 Simon Baldwin <simonb@google.com>
14992
14993 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14994 to zero when writing undefined symbols.
14995
14996 2008-07-22 Ian Lance Taylor <iant@google.com>
14997
14998 * output.cc (Output_section::add_input_section): Don't try to
14999 merge empty merge sections.
15000
15001 2008-07-21 Craig Silverstein <csilvers@google.com>
15002
15003 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15004 Include symbol version in error message.
15005
15006 2008-07-20 Chris Demetriou <cgd@google.com>
15007
15008 * configure.ac (gold_cv_c_random_seed): New configured variable.
15009 (RANDOM_SEED_CFLAGS): New substituted variable.
15010 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15011 * configure: Rebuild.
15012 * Makefile.in: Likewise.
15013 * testsuite/Makefile.in: Likewise.
15014
15015 2008-07-18 Ian Lance Taylor <iant@google.com>
15016
15017 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15018 where we see NAME/NULL and NAME/VERSION as separate symbols.
15019 * testsuite/ver_test_main.cc (main): Call t4.
15020 (t4, t4_2a): Define.
15021 * testsuite/ver_test_2.cc (t4_2): Define.
15022 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15023 * testsuite/ver_test_4.cc (t4_2a): Define.
15024 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15025 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15026
15027 2008-07-17 Ian Lance Taylor <iant@google.com>
15028
15029 * dynobj.cc (Versions::add_def): If we give an error about a
15030 missing version, go ahead and create the version anyhow.
15031
15032 2008-07-10 Ian Lance Taylor <iant@google.com>
15033
15034 Handle output sections with more than 0x7fffffff bytes.
15035 * object.h (class Relobj): Change map_to_output_ to
15036 output_sections_, and just keep a section pointer. Change all
15037 uses. Move comdat group support to Sized_relobj.
15038 (Relobj::is_section_specially_mapped): Remove.
15039 (Relobj::output_section): Remove poff parameter. Change all
15040 callers.
15041 (Relobj::output_section_offset): New function.
15042 (Relobj::set_section_offset): Rewrite.
15043 (Relobj::map_to_output): Remove.
15044 (Relobj::output_sections): New function.
15045 (Relobj::do_output_section_offset): New pure virtual function.
15046 (Relobj::do_set_section_offset): Likewise.
15047 (class Sized_relobj): Add section_offsets_ field. Add comdat
15048 group support from Relobj. Update declarations.
15049 (Sized_relobj::get_output_section_offset): New function.
15050 (Sized_relobj::do_output_section_offset): New function.
15051 (Sized_relobj::do_set_section_offset): New function.
15052 * object.cc (Relobj::output_section_address): Remove.
15053 (Sized_relobj::Sized_relobj): Initialize new fields.
15054 (Sized_relobj::include_section_group): Cast find_kept_object to
15055 Sized_relobj.
15056 (Sized_relobj::include_linkonce_section): Likewise.
15057 (Sized_relobj::do_layout): Use separate arrays for output section
15058 and output offset.
15059 (Sized_relobj::do_count_local_symbols): Change map_to_output to
15060 output_sections.
15061 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15062 output_sections and section_offsets.
15063 (Sized_relobj::write_local_symbols): Likewise.
15064 (map_to_kept_section): Compute output address directly.
15065 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15066 output_sections and section_offsets.
15067 (Sized_relobj::write_sections): Likewise.
15068 (Sized_relobj::relocate_sections): Likewise.
15069 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15070 * output.h (class Output_reloc): Update declarations. Change
15071 u2_.relobj to Sized_relobj*.
15072 (class Output_data_reloc): Change add functions to use
15073 Sized_relobj*.
15074 * output.cc (Output_reloc::Output_reloc): Change relobj to
15075 Sized_relobj*.
15076 (Output_reloc::local_section_offset): Change return type to
15077 Elf_Addr. Use get_output_section_offset.
15078 (Output_reloc::get_address): Likewise.
15079 (Output_section::is_input_address_mapped): Don't call
15080 is_section_specially_mapped.
15081 (Output_section::output_offset): Likewise.
15082 (Output_section::output_address): Likewise.
15083 (Output_section::starting_output_address): Likewise.
15084 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15085 parameter to Sized_relobj*.
15086 (Copy_relocs::need_copy_reloc): Likewise.
15087 (Copy_relocs::save): Likewise.
15088 * copy-relocs.h (class Copy_relocs): Update declarations.
15089 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15090 Sized_relobj*. Change relobj_ field to Sized_relobj*.
15091 * target-reloc.h (relocate_for_relocatable): Change
15092 offset_in_output_section type to Elf_Addr. Change code that uses
15093 it as well.
15094 * layout.cc (Layout::layout): Always set *off.
15095 * mapfile.cc (Mapfile::print_input_section): Use
15096 output_section_offset.
15097 * i386.cc (Target_i386::copy_reloc): Change object parameter to
15098 Sized_relobj*.
15099 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15100 * sparc.cc (Target_sparc::copy_reloc): Likewise.
15101 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15102
15103 2008-07-03 Ian Lance Taylor <iant@google.com>
15104
15105 * layout.cc (Layout::include_section): Do not discard unrecognized
15106 SHT_STRTAB sections.
15107
15108 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
15109
15110 * script.cc (Lex::can_continue_name): Make '?' allowable in
15111 version-script names.
15112 * testsuite/version_script.map: Change glob pattern to use '?'
15113
15114 2008-06-30 Manish Singh <yosh@gimp.org>
15115
15116 PR 6585
15117 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15118 Correct typo.
15119
15120 2008-06-30 Ian Lance Taylor <iant@google.com>
15121
15122 PR 6660
15123 PR 6682
15124 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15125 versions]: Don't try to read the value in the contents, since we
15126 don't use it. Use the template endianness when writing.
15127
15128 2008-06-25 Cary Coutant <ccoutant@google.com>
15129
15130 * fileread.cc (File_read::make_view): Assert on zero-length view.
15131 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15132 symbol table when there are no symbols to read.
15133
15134 2008-06-23 Craig Silverstein <csilvers@google.com>
15135
15136 * version.cc (version_string): Bump to 1.7
15137
15138 2008-06-18 Craig Silverstein <csilvers@google.com>
15139
15140 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15141 constant 0xFFFF to type Valtype.
15142 (Powerpc_relocate_functions::rel16_ha): Likewise.
15143
15144 2008-06-17 Ian Lance Taylor <iant@google.com>
15145
15146 * output.h (Output_section::Input_section): Initialize p2align_ to
15147 zero for Output_section_data constructors.
15148 (Output_section::Input_section::addralign): If not an input
15149 section, return the alignment of the Output_section_data.
15150 * testsuite/copy_test.cc: New file.
15151 * testsuite/copy_test_1.cc: New file.
15152 * testsuite/copy_test_2.cc: New file.
15153 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15154 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15155 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15156 (copy_test_1_pic.o, copy_test_1.so): New targets.
15157 (copy_test_2_pic.o, copy_test_2.so): New targets.
15158 * testsuite/Makefile.in: Rebuild.
15159
15160 * script-sections.cc (Script_sections::place_orphan): Initialize
15161 local variable exact.
15162
15163 2008-06-13 David Edelsohn <edelsohn@gnu.org>
15164
15165 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15166
15167 2008-06-12 David Edelsohn <edelsohn@gnu.org>
15168 David S. Miller <davem@davemloft.net>
15169
15170 * powerpc.cc: New file.
15171 * Makefile.am (TARGETSOURCES): Add powerpc.cc
15172 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15173 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15174 * Makefile.in: Rebuild.
15175
15176 2008-06-09 Ian Lance Taylor <iant@google.com>
15177
15178 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15179 <exception>.
15180 (throwing, orig_terminate): New static variables.
15181 (terminate_handler): New static function.
15182 (t2): Set terminate handler.
15183
15184 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
15185
15186 PR 6584
15187 * binary.cc (Binary_to_elf::sized_convert): Fix .data
15188 alignment.
15189
15190 2008-05-30 Cary Coutant <ccoutant@google.com>
15191
15192 * archive.cc (Archive::include_all_members) Correct to step
15193 over symbol table and extended name table in thin archives.
15194
15195 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
15196
15197 PR 6407
15198 * target-reloc.h (relocate_for_relocatable): Fix new_offset
15199 calculation.
15200
15201 2008-05-28 Caleb Howe <cshowe@google.com>
15202
15203 * reduced_debug_output.cc: New file.
15204 * reduced_debug_output.h: New file.
15205 * options.h (class General_options): Add --strip-debug-non-line.
15206 * options.cc (General_options::finalize): Add strip_debug_non_line
15207 to the strip heirarchy.
15208 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15209 fields.
15210 * layout.cc: Include "reduced_debug_output.h".
15211 (Layout::Layout): Initialize new fields.
15212 (line_only_debug_sections): New static array.
15213 (is_lines_only_debug_sections): New static inline function.
15214 (Layout::include_section): Handle --strip-debug-non-line.
15215 (Layout::make_output_section): If --strip-debug-non-line, build
15216 new output sections for .debug_abbrev and .debug_info.
15217 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15218 gold. Warn about possible overflow.
15219 (read_signed_LEB_128): Likewise.
15220 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15221 (read_signed_LEB_128): Declare.
15222 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15223 (HFILES): Add reduced_debug_output.h.
15224 * Makefile.in: Rebuild.
15225
15226 2008-05-21 Ian Lance Taylor <iant@google.com>
15227
15228 * mapfile.cc: New file.
15229 * mapfile.h: New file.
15230 * options.h (class General_options): Add -M/--print-map and -Map.
15231 * options.cc (General_options::finalize): Make -M equivalent to
15232 -Map -.
15233 * main.cc: Include <cstdio> and "mapfile.h".
15234 (main): Open mapfile if requested.
15235 * gold.cc (class Middle_runner): Add mapfile_ field. Update
15236 constructor. Change caller.
15237 (queue_initial_tasks): Add mapfile parameter. Change caller.
15238 (queue_middle_tasks): Likewise.
15239 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15240 declarations.
15241 * archive.cc: Include "mapfile.h".
15242 (Archive::add_symbols): Add mapfile parameter. Change all
15243 callers. Pass mapfile, symbol, and reason to include_member.
15244 (Archive::include_all_members): Add mapfile parameter. Change all
15245 callers.
15246 (Archive::include_member): Add mapfile, sym, and why parameters.
15247 Change all callers. Report inclusion to map file.
15248 * archive.h: Include "fileread.h".
15249 (class Archive): Update declarations.
15250 (Archive::file): New const method.
15251 (class Add_archive_symbols): Add mapfile_ field. Update
15252 constructor. Change all callers.
15253 * readsyms.h (class Read_symbols): Likewise.
15254 (class Finish_group): Likewise.
15255 (class Read_script): Likewise.
15256 * common.cc: Include "mapfile.h".
15257 (Symbol_table::allocate_commons): Add mapfile parameter. Change
15258 all callers.
15259 (Symbol_table::do_allocate_commons): Likewise.
15260 (Symbol_table::do_allocate_commons_list): Likewise. Report common
15261 symbol allocation to mapfile.
15262 * common.h (class Allocate_commons_task): Add mapfile_ field.
15263 Update constructor. Change all callers.
15264 * symtab.h (class Symbol_table): Update declarations.
15265 * layout.cc: Include "mapfile.h".
15266 (Layout_task_runner::run): Print information to mapfile.
15267 (Layout::create_gold_note): Change Output_data_fixed_space to
15268 Output_data_zero_fill.
15269 (Layout::create_build_id): Likewise.
15270 (Layout::print_to_mapfile): New function.
15271 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
15272 constructor. Change caller.
15273 (class Layout): Declare print_to_mapfile.
15274 * output.cc (Output_section::Input_section::print_to_mapfile): New
15275 function.
15276 (Output_section::add_input_section): If producing a map, always
15277 add to input_sections_ list.
15278 (Output_section::do_print_to_mapfile): New function.
15279 (Output_segment::print_sections_to_mapfile): New function.
15280 (Output_segment::print_section_list_to_mapfile): New function.
15281 * output.h: Include "mapfile.h".
15282 (Output_data::print_to_mapfile): New function.
15283 (Output_data::do_print_to_mapfile): New virtual function.
15284 (Output_segment_headers::do_print_to_mapfile): New function.
15285 (Output_file_header::do_print_to_mapfile): New function.
15286 (Output_data_const::do_print_to_mapfile): New function.
15287 (class Output_data_const_buffer): Add map_name_ field. Update
15288 constructor. Change all callers. Add do_print_to_mapfile
15289 function.
15290 (class Output_data_fixed_space): Likewise.
15291 (class Output_data_space): Likewise.
15292 (class Output_data_zero_fill): New class.
15293 (Output_data_strtab::do_print_to_mapfile): New function.
15294 (Output_data_reloc_base::do_print_to_mapfile): New function.
15295 (Output_relocatable_relocs::do_print_to_mapfile): New function.
15296 (Output_data_group::do_print_to_mapfile): New function.
15297 (Output_data_got::do_print_to_mapfile): New function.
15298 (Output_data_dynamic::do_print_to_mapfile): New function.
15299 (Output_symtab_xindex::do_print_to_mapfile): New function.
15300 (class Output_section): Declare do_print_to_mapflie. Declare
15301 print_to_mapfile in Input_section.
15302 (class Output_segment): Declare new functions.
15303 * object.h (Sized_relobj::symbol_count): New function.
15304 * script-sections.cc
15305 (Output_section_element_dot_assignment::set_section_addresses):
15306 Change Output_data_fixed_space to Output_data_zero_fill.
15307 (Output_data_expression::do_print_to_mapfile): New function.
15308 * script.cc (read_input_script): Add mapfile parameter. Change
15309 all callers.
15310 * script.h (read_input_script): Update declaration.
15311 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15312 (Eh_frame::do_print_to_mapfile): New function.
15313 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15314 (Output_merge_string::do_print_to_mapfile): New function.
15315 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15316 function.
15317 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15318 function.
15319 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15320 function.
15321 * Makefile.am (CCFILES): Add mapfile.cc.
15322 (HFILES): Add mapfile.h.
15323 * Makefile.in: Rebuild.
15324
15325 2008-05-19 Ian Lance Taylor <iant@google.com>
15326
15327 * options.h (class General_options): Add -z relro.
15328 * layout.cc (Layout::Layout): Initialize relro_segment_.
15329 (Layout::add_output_section_data): Return the output section.
15330 (Layout::make_output_section): Rcognize relro sections and mark
15331 them appropriately.
15332 (Layout::attach_allocated_section_to_segment): Put relro sections
15333 in a PT_GNU_RELRO segment.
15334 (Layout::create_initial_dynamic_sections): Mark the .dynamic
15335 section as relro.
15336 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15337 PT_TLS segments.
15338 (Layout::linkonce_mapping): Map d.rel.ro.local to
15339 .data.rel.ro.local.
15340 (Layout::output_section_name): Us .data.rel.ro.local for any
15341 section which begins with that.
15342 * layout.h (class Layout): Update add_output_section_data
15343 declaration. Add relro_segment_ field.
15344 * output.cc (Output_section::Output_section): Initialize is_relro_
15345 and is_relro_local_ fields.
15346 (Output_segment::add_output_section): Group relro sections.
15347 (Output_segment::is_first_section_relro): New function.
15348 (Output_segment::maximum_alignment): If there is a relro section,
15349 align the segment to the common page size.
15350 (Output_segment::set_section_addresses): Track whether we are
15351 looking at relro sections. If the last section is a relro
15352 section, align to the common page size.
15353 (Output_segment::set_section_list_addresses): Add in_relro
15354 parameter. Change all callers. Align to the page size when
15355 moving from relro to non-relro section.
15356 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15357 segment.
15358 * output.h (class Output_section): Add is_relro_ and
15359 is_relro_local_ fields.
15360 (Output_section::is_relro): New function.
15361 (Output_section::set_is_relro): New function.
15362 (Output_section::is_relro_local): New function.
15363 (Output_section::set_is_relro_local): New function.
15364 (class Output_segment): Update declarations.
15365 * i386.cc (Target_i386::got_section): Mark .got section as relro.
15366 * sparc.cc (Target_sparc::got_section): Likewise.
15367 * x86_64.cc (Target_x86_64::got_section): Likewise.
15368 * testsuite/relro_test_main.cc: New file.
15369 * testsuite/relro_test.cc: New file.
15370 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15371 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15372 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15373 (relro_test.so, relro_test_pic.o): New targets.
15374 * testsuite/Makefile.in: Rebuild.
15375
15376 2008-05-16 Ian Lance Taylor <iant@google.com>
15377
15378 * output.cc (Output_segment::add_output_section): Remove front
15379 parameter.
15380 * output.h (class Output_segment): Remove
15381 add_initial_output_section and overloaded add_output_section.
15382 Update declaration of remaining add_output_section.
15383 * layout.cc (Layout::create_interp): Call add_output_section
15384 rather than add_initial_output_section.
15385 (Layout::finish_dynamic_section): Likewise.
15386
15387 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15388 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
15389 know the dynamic type.
15390 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15391 field. Initialize it in constructor.
15392 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15393 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15394 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15395 reloc.
15396
15397 * output.cc (Output_reloc::get_address): Change return type to
15398 Elf_Addr.
15399 * output.h (class Output_reloc): Update get_address declaration.
15400 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15401 for section addresses.
15402
15403 2008-05-09 Ian Lance Taylor <iant@google.com>
15404
15405 PR 6493
15406 * gold.cc (gold_nomem): Use return value of write.
15407
15408 2008-05-08 Ian Lance Taylor <iant@google.com>
15409
15410 * symtab.c (Symbol::init_base_output_data): Add version
15411 parameter. Change all callers.
15412 (Symbol::init_base_output_segment): Likewise.
15413 (Symbol::init_base_constant): Likewise.
15414 (Symbol::init_base_undefined): Likewise.
15415 (Sized_symbol::init_output_data): Likewise.
15416 (Sized_symbol::init_output_segment): Likewise.
15417 (Sized_symbol::init_constant): Likewise.
15418 (Sized_symbol::init_undefined): Likewise.
15419 (Symbol_table::do_define_in_output_data): If the new symbol has a
15420 version, mark it as the default.
15421 (Symbol_table::do_define_in_output_segment): Likewise.
15422 (Symbol_table::do_define_as_constant): Likewise.
15423 * symtab.h (class Symbol): Update declarations.
15424 (class Sized_symbol): Likewise.
15425 * resolve.cc (Symbol::override_version): New function.
15426 (Symbol::override_base): Call override_version.
15427 (Symbol::override_base_with_special): Likewise.
15428 * testsuite/ver_script_8.script: New file.
15429 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15430 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15431 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15432 (ver_test_8_1.so, ver_test_8_2.so): New targets.
15433
15434 2008-05-06 Ian Lance Taylor <iant@google.com>
15435
15436 PR 6049
15437 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15438 functions.
15439 (class General_options): Remove existing --undefined, and add
15440 --no-undefined instead. Add new --undefined as synonym for -u.
15441 * archive.cc (Archive::add_symbols): Check whether symbol was
15442 named with -u.
15443 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15444 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15445 all uses. Add IS_UNDEFINED. Update declarations to split
15446 different versions of init_base. Declare init_base_undefined.
15447 (Symbol::is_defined): Handle IS_UNDEFINED.
15448 (Symbol::is_undefined): Likewise.
15449 (Symbol::is_weak_undefined): Call is_undefined.
15450 (Symbol::is_absolute): Handle IS_CONSTANT.
15451 (class Sized_symbol): Update declarations to split different
15452 versions of init. Declare init_undefined.
15453 (class Symbol_table): Declare new functions.
15454 * symtab.cc (Symbol::init_base_object): Rename from init_base.
15455 Change all callers.
15456 (Symbol::init_base_output_data): Likewise.
15457 (Symbol::init_base_output_segment): Likewise.
15458 (Symbol::init_base_constant): Likewise.
15459 (Symbol::init_base_undefined): New function.
15460 (Sized_symbol::init_object): Rename from init. Change all
15461 callers.
15462 (Sized_symbol::init_output_data): Likewise.
15463 (Sized_symbol::init_output_segment): Likewise.
15464 (Sized_symbol::init_constant): Likewise.
15465 (Sized_symbol::init_undefined): New function.
15466 (Symbol_table::add_undefined_symbols_from_command_line): New
15467 function.
15468 (Symbol_table::do_add_undefined_symbols_from_command_line): New
15469 function.
15470 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15471 (Symbol::output_section): Likewise.
15472 (Symbol::set_output_section): Likewise.
15473 (Symbol_table::sized_finalize_symbol): Likewise.
15474 (Symbol_table::sized_write_globals): Likewise.
15475 * resolve.cc (Symbol_table::should_override): Likewise.
15476 (Symbol::override_base_with_special): Likewise.
15477
15478 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15479 symbol, change it to have default visibility.
15480 * testsuite/protected_1.cc: New file.
15481 * testsuite/protected_2.cc: New file.
15482 * testsuite/protected_3.cc: New file.
15483 * testsuite/protected_main_1.cc: New file.
15484 * testsuite/protected_main_2.cc: New file.
15485 * testsuite/protected_main_3.cc: New file.
15486 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15487 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15488 (protected_1_LDFLAGS, protected_1_LDADD): Define.
15489 (protected_1.so): New target.
15490 (protected_1_pic.o, protected_2_pic.o): New targets.
15491 (protected_3_pic.o): New target.
15492 (check_PROGRAMS): Add protected_2.
15493 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15494 (protected_2_LDFLAGS, protected_2_LDADD): Define.
15495 * testsuite/Makefile.in: Rebuild.
15496
15497 * options.h (DEFINE_var): Add set_user_set_##varname__.
15498 (DEFINE_bool_alias): New macro.
15499 (class General_options): Define -Bstatic using DEFINE_bool_alias
15500 rather than DEFINE_special. Add --undefined as an alias for -z
15501 defs.
15502 * options.cc (General_options::parse_Bstatic): Remove.
15503
15504 * options.h (class General_options): Add --fatal-warnings.
15505 * main.cc (main): Implement --fatal-warnings.
15506 * errors.h (Errors::warning_count): New function.
15507
15508 * options.h (class General_options): Add -Bsymbolic-functions.
15509 * symtab.h (Symbol::is_preemptible): Check for
15510 -Bsymbolic-functions.
15511
15512 2008-05-05 Ian Lance Taylor <iant@google.com>
15513
15514 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15515 as noVARNAME rather than no-VARNAME.
15516 (class General_options): Add option -z combreloc.
15517 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15518 get_address.
15519 (Output_reloc::sort_before) [SHT_REL]: New function.
15520 (Output_reloc::sort_before) [SHT_RELA]: New function.
15521 (class Output_data_reloc_base): Add sort_relocs_ field. Define
15522 Sort_relocs_comparison.
15523 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15524 parameter. Change all callers.
15525 (Output_data_reloc::Output_data_reloc) [both versions]: Add
15526 sort_relocs parameter. Change all callers.
15527 * output.cc (Output_reloc::get_address): New function, broken out
15528 of write_rel.
15529 (Output_reloc::write_rel): Call it.
15530 (Output_reloc::compare): New function.
15531 (Output_data_reloc_base::do_write): Optionally sort relocs.
15532
15533 * configure.ac: If targ_extra_obj is set, link it in.
15534 * configure.tgt: Initialize all variables.
15535 (x86_64*): Set targ_extra_obj and targ_extra_size.
15536 * configure: Rebuild.
15537
15538 * object.cc (Sized_relobj::include_section_group): Adjust section
15539 indexes read from group data. Build vector to pass to
15540 layout_group.
15541 * layout.cc (Layout::layout_group): Add flags and shndxes
15542 parameters. Remove contents parameter. Change caller. Update
15543 explicit instantiations.
15544 * layout.h (class Layout): Update layout_group declaration.
15545 * output.cc (Output_data_group::Output_data_group): Add flags and
15546 input_shndxes parameters. Remove contents parameter. Change
15547 caller.
15548 (Output_data_group::do_write): Change input_sections_ to
15549 input_shndxes_.
15550 * output.h (class Output_data_group): Update constructor
15551 declaration. Rename input_sections_ to input_shndxes_.
15552 * testsuite/many_sections_test.cc: Add template.
15553
15554 2008-04-30 Cary Coutant <ccoutant@google.com>
15555
15556 * target-reloc.h (relocate_section): Fix dead-pointer bug.
15557
15558 * layout.cc (Layout::include_section): Refactored check for debug
15559 info section.
15560 (Layout::add_comdat): Add new parameters. Change type
15561 of signature parameter. Add object and shndx to signatures table.
15562 (Layout::find_kept_object): New function.
15563 * layout.h: Include <cstring>.
15564 (Layout::is_debug_info_section): New function.
15565 (Layout::add_comdat): Add new parameters.
15566 (Layout::find_kept_object): New function.
15567 (Layout::Kept_section): New struct.
15568 (Layout::Signatures): Change type of map range.
15569 * object.cc (Relobj::output_section_address): New function.
15570 (Sized_relobj::include_section_group): Add new parameters. Change
15571 calls to Layout::add_comdat. Change to build table of kept comdat
15572 groups and table mapping discarded sections to kept sections.
15573 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15574 (Sized_relobj::do_layout): Change calls to include_section_group and
15575 include_linkonce_section.
15576 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15577 value to zero when section is discarded.
15578 (Sized_relobj::map_to_kept_section): New function.
15579 * object.h (Relobj::output_section_address): New function.
15580 (Relobj::Comdat_group): New type.
15581 (Relobj::find_comdat_group): New function.
15582 (Relobj::Comdat_group_table): New type.
15583 (Relobj::Kept_comdat_section): New type.
15584 (Relobj::Kept_comdat_section_table): New type.
15585 (Relobj::add_comdat_group): New function.
15586 (Relobj::set_kept_comdat_section): New function.
15587 (Relobj::get_kept_comdat_section): New function.
15588 (Relobj::comdat_groups_): New field.
15589 (Relobj::kept_comdat_sections_): New field.
15590 (Symbol_value::input_value): Update comment.
15591 (Sized_relobj::map_to_kept_section) New function.
15592 (Sized_relobj::include_linkonce_section): Add new parameter.
15593 * target-reloc.h (Comdat_behavior): New type.
15594 (get_comdat_behavior): New function.
15595 (relocate_section): Add code to map a discarded section to the
15596 corresponding kept section when applying a relocation.
15597
15598 2008-04-30 Craig Silverstein <csilvers@google.com>
15599
15600 * dwarf_reader.cc (next_generation_count): New static var.
15601 (Addr2line_cache_entry): New struct.
15602 (addr2line_cache): New static var.
15603 (Dwarf_line_info::one_addr2line): Added caching.
15604 (Dwarf_line_info::clear_addr2line_cache): New function.
15605 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15606 cache-size parameter.
15607 (Dwarf_line_info::one_addr2line_cache): New function.
15608 * symtab.cc (Symbol_table::detect_odr_violations): Pass
15609 new cache-size argument to one_addr2line(), and clear cache.
15610
15611 2008-04-28 Cary Coutant <ccoutant@google.com>
15612
15613 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15614 R_386_PC8 relocations.
15615
15616 2008-04-23 Ian Lance Taylor <iant@google.com>
15617
15618 * object.cc (Sized_relobj::include_section_group): Check for
15619 invalid section group.
15620
15621 * object.cc (make_elf_object): Correct test for 64-bit ELF file
15622 header size.
15623
15624 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15625 than read for file header.
15626 * archive.cc (Archive::include_member): Likewise.
15627
15628 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
15629
15630 * aclocal.m4: Regenerate.
15631 * configure: Regenerate.
15632
15633 2008-04-19 Ian Lance Taylor <iant@google.com>
15634
15635 * version.cc (version_string): Bump to 1.6.
15636
15637 * testsuite/Makefile.am (many_sections_r_test): New target.
15638 (many_sections_r_test_SOURCES): Remove.
15639 (many_sections_r_test_DEPENDENCIES): Remove.
15640 (many_sections_r_test_LDFLAGS): Remove.
15641 (many_sections_r_test_LDADD): Remove.
15642
15643 * object.cc (Sized_relobj::do_add_symbols): Always pass
15644 local_symbol_count_ to add_from_relobj.
15645
15646 * testsuite/Makefile.am (many_sections_check.h): Only check one in
15647 every thousand variables.
15648 * testsuite/Makefile.in: Rebuild.
15649
15650 * object.cc (Xindex::initialize_symtab_xindex): New function.
15651 (Xindex::read_symtab_xindex): New function.
15652 (Xindex::sym_xindex_to_shndx): New function.
15653 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15654 available.
15655 (Sized_relobj::do_initialize_xindex): New function.
15656 (Sized_relobj::do_read_symbols): Adjust section links.
15657 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15658 parameter. Change all callers.
15659 (Sized_relobj::include_section_group): Adjust section links and
15660 symbol section indexes.
15661 (Sized_relobj::do_layout): Adjust section links.
15662 (Sized_relobj::do_count_local_symbols): Adjust section links and
15663 symbol section indexes.
15664 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15665 ordinary and special symbols.
15666 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15667 dynsym_xindex parameters. Change all callers. Adjust section
15668 links. Use SHN_XINDEX when needed.
15669 (Sized_relobj::get_symbol_location_info): Adjust section links.
15670 Don't get fooled by special symbols.
15671 * object.h (class Xindex): Define.
15672 (class Object): Add xindex_ parameter. Declare virtual functoin
15673 do_initialize_xindex.
15674 (Object::adjust_sym_shndx): New function.
15675 (Object::set_xindex): New protected function.
15676 (class Symbol_value): Add is_ordinary_shndx_ field.
15677 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15678 (Symbol_value::value): Assert ordinary section.
15679 (Symbol_value::initialize_input_to_output_map): Likewise.
15680 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15681 Change all callers.
15682 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15683 all callers.
15684 (class Sized_relobj): Update declarations.
15685 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15686 parameter. Change all callers.
15687 (Sized_relobj::adjust_shndx): New function.
15688 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15689 field.
15690 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15691 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15692 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15693 (Sized_dynobj::read_dynsym_section): Adjust section links.
15694 (Sized_dynobj::read_dynamic): Likewise.
15695 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15696 section links.
15697 (Sized_dynobj::do_initialize_xindex): New function.
15698 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15699 do_initialize_xindex.
15700 (Sized_dynobj::adjust_shndx): New function.
15701 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15702 dynsym_xindex_ fields.
15703 (Layout::finalize): Add a call to set_section_indexes before
15704 creating the symtab sections.
15705 (Layout::set_section_indexes): Don't do anything if the section
15706 already has a section index.
15707 (Layout::create_symtab_sections): Add shnum parameter. Change
15708 caller. Create .symtab_shndx section if needed.
15709 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15710 caller.
15711 (Layout::allocated_output_section_count): New function.
15712 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15713 needed.
15714 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15715 fields. Update declarations.
15716 (Layout::symtab_xindex): New function.
15717 (Layout::dynsym_xindex): New function.
15718 (class Write_symbols_task): Add layout_ field.
15719 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15720 Change caller.
15721 * output.cc (Output_section_headers::Output_section_headers): Add
15722 shstrtab_section parameter. Change all callers.
15723 (Output_section_headers::do_sized_write): Store overflow values
15724 for section count and section string table section index in
15725 section header zero.
15726 (Output_file_header::do_sized_write): Check for overflow of
15727 section count and section string table section index.
15728 (Output_symtab_xindex::do_write): New function.
15729 (Output_symtab_xindex::endian_do_write): New function.
15730 * output.h (class Output_section_headers): Add shstrtab_section_.
15731 Update declarations.
15732 (class Output_symtab_xindex): Define.
15733 (Output_section::has_out_shndx): New function.
15734 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15735 field.
15736 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15737 Change all callers.
15738 (Sized_symbol::init): Likewise.
15739 (Symbol::output_section): Check for ordinary symbol.
15740 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15741 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15742 callers.
15743 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15744 Change all callers. Simplify handling of symbols from sections
15745 not included in the link.
15746 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15747 distinction.
15748 (Weak_alias_sorter::operator()): Assert that symbols are
15749 ordinary.
15750 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15751 distinction.
15752 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15753 parameters. Change all callers.
15754 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15755 symbol distinction. Use SHN_XINDEX when needed.
15756 (Symbol_table::write_section_symbol): Add symtab_xindex
15757 parameter. Change all callers.
15758 (Symbol_table::sized_write_section_symbol): Likewise. Use
15759 SHN_XINDEX when needed.
15760 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15761 declarations.
15762 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15763 (Symbol::is_defined): Check is_ordinary.
15764 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15765 (Symbol::is_absolute, Symbol::is_common): Likewise.
15766 (class Sized_symbol): Update declarations.
15767 (class Symbol_table): Update declarations.
15768 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15769 parameters. Change all callers.
15770 (Sized_symbol::override): Likewise.
15771 (Symbol_table::override): Likewise.
15772 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15773 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15774 is_ordinary, and orig_st_shndx parameters. Change all callers.
15775 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15776 to be in an ordinary section.
15777 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15778 object and is_ordinary parameters. Change all callers.
15779 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15780 Change all callers. Don't add undefined or non-ordinary symbols
15781 to reloc_map_.
15782 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15783 Change all callers.
15784 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15785 declarations.
15786 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15787 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15788 (Sized_relobj::relocate_sections): Likewise.
15789 * target-reloc.h (scan_relocs): Adjust section symbol index.
15790 (scan_relocatable_relocs): Likewise.
15791 * i386.cc (Scan::local): Check for ordinary symbols.
15792 * sparc.cc (Scan::local): Likewise.
15793 * x86_64.cc (Scan::local): Likewise.
15794 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15795 to symbol_section_and_value.
15796 * testsuite/many_sections_test.cc: New file.
15797 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15798 (check_PROGRAMS): Add many_sections_test.
15799 (many_sections_test_SOURCES): Define.
15800 (many_sections_test_DEPENDENCIES): Define.
15801 (many_sections_test_LDFLAGS): Define.
15802 (BUILT_SOURCES): Add many_sections_define.h.
15803 (many_sections_define.h): New target.
15804 (BUILT_SOURCES): Add many_sections_check.h.
15805 (many_sections_check.h): New target.
15806 (check_PROGRAMS): Add many_sections_r_test.
15807 (many_sections_r_test_SOURCES): Define.
15808 (many_sections_r_test_DEPENDENCIES): Define.
15809 (many_sections_r_test_LDFLAGS): Define.
15810 (many_sections_r_test_LDADD): Define.
15811 (many_sections_r_test.o): New target.
15812 * testsuite/Makefile.in: Rebuild.
15813
15814 2008-04-17 Cary Coutant <ccoutant@google.com>
15815
15816 * errors.cc (Errors::info): New function.
15817 (gold_info): New function.
15818 * errors.h (Errors::info): New function.
15819 * gold.h (gold_info): New function.
15820 * object.cc (Input_objects::add_object): Print trace output.
15821 * options.cc (options::parse_set): New function.
15822 (General_options::parse_wrap): Deleted.
15823 (General_options::General_options): Deleted initializer.
15824 * options.h (options::String_set): New typedef.
15825 (options::parse_set): New function.
15826 (DEFINE_set): New macro.
15827 (General_options::wrap): Changed to use DEFINE_set. Changed
15828 callers of any_wrap_symbols and is_wrap_symbol.
15829 (General_options::trace, General_options::trace_symbol):
15830 New options.
15831 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15832 (General_options::wrap_symbols_): Deleted.
15833 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15834
15835 2008-04-17 David S. Miller <davem@davemloft.net>
15836
15837 * options.cc (General_options::parse_V): New function.
15838 * options.h: Add entries for -V and -Qy.
15839
15840 2008-04-17 Ian Lance Taylor <iant@google.com>
15841
15842 * common.cc (Symbol_table::allocate_commons): Remove options
15843 parameter. Change caller.
15844 (Symbol_table::do_allocate_commons): Remove options parameter.
15845 Change caller. Just call do_allocate_commons_list twice.
15846 (Symbol_table::do_allocate_commons_list): New function, broken out
15847 of do_allocate_commons.
15848 * common.h (class Allocate_commons_task): Remove options_ field.
15849 Update constructor.
15850 * symtab.cc (Symbol_table::Symbol_table): Initialize
15851 tls_commons_.
15852 (Symbol_table::add_from_object): Put TLS common symbols on
15853 tls_commons_ list.
15854 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15855 which are IN_OUTPUT_DATA.
15856 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15857 allocate_commons and do_allocate_commons declarations. Declare
15858 do_allocate_commons_list.
15859 * gold.cc (queue_middle_tasks): Update creation of
15860 Allocate_commons_task to not pass options.
15861 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15862 (TLS_TEST_C_FLAGS): New variable.
15863 (tls_test_c_pic.o): New target.
15864 (tls_test_shared.so): Link in tls_test_c_pic.o.
15865 (tls_test_c_pic_ie.o): New target.
15866 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15867 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15868 (tls_test_c.o): New target.
15869 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15870 (tls_pic_test_LDADD): Likewise.
15871 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15872 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15873 (tls_test_c_gnu2.o): New target.
15874 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15875 tls_test_c_gnu2.o.
15876 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15877 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15878 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15879 * testsuite/tls_test.cc: Include "config.h".
15880 (t_last): Call t11_last.
15881 * testsuite/tls_test.h (t11, t11_last): Declare.
15882 * testsuite/tls_test_c.c: New file.
15883 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15884 * configure.ac: Check for OpenMP support.
15885 * configure, config.in, Makefile.in: Rebuild.
15886 * testsuite/Makefile.in: Rebuild.
15887
15888 2008-04-16 Cary Coutant <ccoutant@google.com>
15889
15890 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15891 (Target_i386::tls_base_symbol_defined_): New field.
15892 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15893 (Target_i386::Scan::global): Likewise.
15894 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15895 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15896 (Target_x86_64::tls_base_symbol_defined_): New field.
15897 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15898 (Target_x86_64::Scan::global): Likewise.
15899
15900 2008-04-16 Cary Coutant <ccoutant@google.com>
15901
15902 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15903 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15904 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15905 building shared libraries.
15906 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15907 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15908 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15909 * testsuite/Makefile.in: Rebuild.
15910 * testsuite/weak_undef.h: New file.
15911 * testsuite/weak_undef_file1.cc: Add extra test cases.
15912 * testsuite/weak_undef_file2.cc: Likewise.
15913 * testsuite/weak_undef_test.cc: Likewise.
15914
15915 2008-04-16 David S. Miller <davem@davemloft.net>
15916
15917 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15918 Add issued_non_pic_error_ field. Declare check_non_pic.
15919 (Target_sparc::Scan::check_non_pic): New function.
15920 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15921 (Target_sparc::Scan::global): Likewise.
15922
15923 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15924 * configure: Rebuild.
15925
15926 * options.h (DEFINE_enable): New macro.
15927 (new_dtags): New enable option.
15928 (initfirst, interpose, loadfltr, nodefaultlib,
15929 nodelete, nodlopen, nodump): New -z options.
15930 * layout.cc (Layout:finish_dynamic_section): If new
15931 dtags enabled, emit DT_RUNPATH. Also, emit a
15932 DT_FLAGS_1 containing any specified -z flags.
15933
15934 2008-04-16 Ian Lance Taylor <iant@google.com>
15935
15936 * copy-relocs.cc: New file.
15937 * copy-relocs.h: New file.
15938 * reloc.cc: Remove Copy_relocs code.
15939 * reloc.h: Likewise.
15940 * reloc-types.h (struct Reloc_types) [both versions]: Add
15941 get_reloc_addend_noerror.
15942 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15943 variants of add_global which take an addend which must be zero.
15944 * i386.cc: Include "copy-relocs.h".
15945 (class Target_i386): Change type of copy_relocs_ to variable,
15946 update initializer.
15947 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15948 Change all callers.
15949 (Target_i386::do_finalize_sections): Change handling of
15950 copy_relocs_.
15951 * sparc.cc: Include "copy-relocs.h".
15952 (class Target_sparc): Change type of copy_relocs_ to variable,
15953 update initializer.
15954 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15955 Change all callers.
15956 (Target_sparc::do_finalize_sections): Change handling of
15957 copy_relocs_.
15958 * x86_64.cc: Include "copy-relocs.h".
15959 (class Target_x86_64): Change type of copy_relocs_ to variable,
15960 update initializer.
15961 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15962 class. Change all callers.
15963 (Target_x86_64::do_finalize_sections): Change handling of
15964 copy_relocs_.
15965 * Makefile.am (CCFILES): Add copy-relocs.cc.
15966 (HFILES): Add copy-relocs.h.
15967
15968 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15969
15970 * testsuite/script_test_4.sh: Permit leading zeroes.
15971
15972 2008-04-15 Ian Lance Taylor <iant@google.com>
15973
15974 * script-sections.cc (Script_sections::create_segments): Use
15975 header_size_adjustment even when there is enough room for the
15976 headers.
15977 * testsuite/script_test_4.sh: New file.
15978 * testsuite/script_test_4.t: New file.
15979 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15980 (check_DATA): Add script_test_4.stdout.
15981 (MOSTLYCLEANFILES): Likewise.
15982 (script_test_4): New target.
15983 (script_test_4.stdout): New target.
15984 * testsuite/Makefile.in: Rebuild.
15985
15986 * sparc.cc: Add definitions for Output_data_plt_sparc class
15987 constants.
15988
15989 2008-04-14 David S. Miller <davem@davemloft.net>
15990
15991 * sparc.cc: New file.
15992 * Makefile.am (TARGETSOURCES): Add sparc.cc
15993 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15994 * configure.tgt: Document targ_extra_size and
15995 targ_extra_big_endian. Add entries for sparc-* and
15996 sparc64-*.
15997 * configure.ac: Handle targ_extra_size and
15998 targ_extra_big_endian.
15999 * Makefile.in: Rebuild.
16000 * configure: Likewise.
16001 * po/POTFILES.in: Likewise.
16002 * po/gold.pot: Likewise.
16003
16004 2008-04-14 Ian Lance Taylor <iant@google.com>
16005
16006 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16007 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16008 in the name/type/flags to section mapping. Don't call
16009 allocate_output_section.
16010 (Layout::choose_output_section): Change parameter from adjust_name
16011 to is_input_section. Don't permit input sections after sections
16012 are attached to segments. Don't call allocate_output_section.
16013 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16014 not write_enable_output_section.
16015 (Layout::make_output_section): Don't push to
16016 unattached_section_list_ nor call attach_to_segment. Call
16017 attach_section_to_segment if sections are attached.
16018 (Layout::attach_sections_to_segments): New function.
16019 (Layout::attach_section_to_segment): New function.
16020 (Layout::attach_allocated_section_to_segment): Rename from
16021 attach_to_segment. Remove flags parameter.
16022 (Layout::allocate_output_section): Remove function.
16023 (Layout::write_enable_output_section): Remove function.
16024 * layout.h (class Layout): Update for above changes. Add new
16025 field sections_are_attached_.
16026 * output.h (Output_section::update_flags_for_input_section): New
16027 function.
16028 * output.cc (Output_section::add_input_section): Call
16029 update_flags_for_input_section.
16030 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16031
16032 2008-04-11 Cary Coutant <ccoutant@google.com>
16033
16034 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16035 thought unnecessary.
16036 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16037
16038 2008-04-11 Ian Lance Taylor <iant@google.com>
16039
16040 * output.h (class Output_section_data): Remove inline definition
16041 of set_addralign.
16042 * output.cc (Output_section_data::set_addralign): New function.
16043
16044 2008-04-11 Cary Coutant <ccoutant@google.com>
16045
16046 Add support for TLS descriptors for i386 and x86_64.
16047 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16048 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16049 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16050 GOT_TYPE_TLS_DESC.
16051 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16052 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16053 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16054 relocations.
16055 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16056 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16057 Fix problem with initial-exec relocations.
16058 (Target_i386::Relocate::relocate_tls): Likewise.
16059 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16060 relaxation.
16061 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16062 support for section-plus-offset dynamic table entries.
16063 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16064 (Output_data_dynamic::Dynamic_entry): Add support for
16065 section-plus-offset dynamic table entries.
16066 (Output_data_dynamic::Classification): Likewise.
16067 (Output_data_dynamic::classification_): Renamed offset_.
16068 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16069 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16070 (Target_x86_64::make_plt_section): New function.
16071 (Target_x86_64::reserve_tlsdesc_entries): New function.
16072 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16073 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16074 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16075 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16076 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16077 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16078 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16079 add extra PLT entry for TLS descriptors.
16080 (Output_data_plt_x86_64::got_): New field.
16081 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16082 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16083 fields.
16084 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16085 descriptors.
16086 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16087 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16088 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16089 R_386_TLS_DESC_CALL relocations.
16090 (Target_x86_64::Scan::global): Likewise.
16091 (Target_x86_64::do_finalize_sections): Add dynamic table entries
16092 for TLS descriptors.
16093 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16094 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16095 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16096 GD-to-IE relaxation.
16097 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16098 and TLS_DESCRIPTORS.
16099 * Makefile.in: Rebuild.
16100 * configure: Rebuild.
16101 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16102 (tls_test_shared2.so): New target.
16103 (tls_shared_gd_to_ie_test_SOURCES): New variable.
16104 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16105 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16106 (tls_shared_gd_to_ie_test_LDADD): New variable.
16107 (tls_shared_gnu2_gd_to_ie_test): New target.
16108 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16109 New targets.
16110 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16111 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16112 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16113 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16114 (tls_shared_gnu2_test): New target.
16115 (tls_test_gnu2_shared.so): New target.
16116 (tls_shared_gnu2_test_SOURCES): New variable.
16117 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16118 (tls_shared_gnu2_test_LDFLAGS): New variable.
16119 (tls_shared_gnu2_test_LDADD): New variable.
16120 * testsuite/Makefile.in: Rebuild.
16121 * testsuite/Makefile.
16122
16123 2008-04-11 Ian Lance Taylor <iant@google.com>
16124
16125 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16126 justsyms.t.
16127 * testsuite/Makefile.in: Rebuild.
16128
16129 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16130 long.
16131 * testsuite/script_test_2.cc (main): Adjust test.
16132
16133 2008-04-11 David S. Miller <davem@davemloft.net>
16134 Ian Lance Taylor <iant@google.com>
16135
16136 * options.h (General_options): Add entries for '-Y' and
16137 '-relax'.
16138 * options.cc (General_options:finalize): If -Y was used, add those
16139 entries to the library path instead of the default "/lib" and
16140 "/usr/lib".
16141
16142 2008-04-11 David S. Miller <davem@davemloft.net>
16143
16144 * testsuite/justsyms.t: Start at 0x100.
16145 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16146 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16147 long.
16148 * testsuite/script_test_2.cc: Adjust string and section length
16149 checks.
16150
16151 2008-04-09 Ian Lance Taylor <iant@google.com>
16152
16153 PR gold/5996
16154 * script-sections.cc (Sections_element::allocate_to_segment): Add
16155 orphan parameter.
16156 (Output_section_definition::allocate_to_segment): Likewise.
16157 (Orphan_output_section::allocate_to_segment): Likewise.
16158 (Script_sections::attach_sections_using_phdrs_clause): Don't
16159 propagate non-PT_LOAD segments to orphan sections.
16160 * testsuite/Makefile.am (script_test_3.stdout): Generate using
16161 readelf rather than objdump.
16162 * testsuite/script_test_3.sh: Adjust accordingly. Test that
16163 .interp section and PT_INTERP segment are the same size.
16164 * testsuite/Makefile.in: Rebuild.
16165
16166 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16167 aliases for symbols defined in the same object.
16168 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16169 (weak_alias_test_SOURCES): New variable.
16170 (weak_alias_test_DEPENDENCIES): New variable.
16171 (weak_alias_test_LDFLAGS): New variable.
16172 (weak_alias_test_LDADD): New variable.
16173 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16174 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16175 (weak_alias_test_3.o): New target.
16176 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16177 * testsuite/weak_alias_test_main.cc: New file.
16178 * testsuite/weak_alias_test_1.cc: New file.
16179 * testsuite/weak_alias_test_2.cc: New file.
16180 * testsuite/weak_alias_test_3.cc: New file.
16181
16182 2008-04-08 Ian Lance Taylor <iant@google.com>
16183
16184 * options.h (class General_options): Add --noinhibit-exec option.
16185 * main.cc (main): Check --noinhibit-exec.
16186
16187 * options.h (class General_options): Define --wrap as a special
16188 option. Add wrap_symbols_ field.
16189 (General_options::any_wrap_symbols): New function.
16190 (General_options::is_wrap_symbol): New function.
16191 * options.cc (General_options::parse_wrap): New function.
16192 (General_options::General_options): Initialize wrap_symbols_.
16193 * symtab.cc (Symbol_table::wrap_symbol): New function.
16194 (Symbol_table::add_from_object): Handle --wrap.
16195 * symtab.h (class Symbol_table): Declare wrap_symbol.
16196 * target.h (Target::wrap_char): New function.
16197 (Target::Target_info): Add wrap_char field.
16198 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16199 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16200 * testsuite/testfile.cc (Target_test::test_target_info):
16201 Likewise.
16202
16203 * errors.cc (Errors::undefined_symbol): Mention symbol version if
16204 there is one.
16205
16206 * layout.h (class Layout): Add added_eh_frame_data_ field.
16207 * layout.cc (Layout::Layout): Initialize new field.
16208 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16209 output section until we find a section we merged successfully.
16210 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16211 that the size be non-zero.
16212
16213 * merge.cc (Object_merge_map::get_output_offset): Remove inline
16214 qualifier.
16215
16216 2008-04-08 Craig Silverstein <csilvers@google.com>
16217
16218 * configure.ac: Export new conditional variable HAVE_ZLIB.
16219 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16220 on HAVE_ZLIB.
16221 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16222 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16223
16224 2008-04-07 Ian Lance Taylor <iant@google.com>
16225
16226 * version.cc (version_string): Set to "1.5".
16227
16228 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16229 Add issued_non_pic_error_ field. Declare check_non_pic.
16230 (Target_x86_64::Scan::check_non_pic): New function.
16231 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16232 (Target_x86_64::Scan::global): Likewise.
16233
16234 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16235 addend parameter. Change caller. Handle merge sections.
16236 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16237 Address to Addend. Don't add in the result of
16238 local_section_offset, pass down the addend and use the returned
16239 value.
16240 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16241 Update declarations of local_section_offset and symbol_value.
16242 * testsuite/two_file_test_1.cc (t18): New function.
16243 * testsuite/two_file_test_2.cc (f18): New function.
16244 * testsuite/two_file_test_main.cc (main): Call t18.
16245 * testsuite/two_file_test.h (t18, f18): Declare.
16246
16247 * configure.ac: Don't test for objdump, c++filt, or readelf.
16248 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16249 conditionals.
16250 (TEST_READELF): New variable.
16251 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16252 (check_PROGRAMS): Add two_file_strip_test.
16253 (two_file_strip_test): New target.
16254 (check_PROGRAMS): Add two_file_same_shared_strip_test.
16255 (two_file_same_shared_strip_test_SOURCES): New variable.
16256 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16257 (two_file_same_shared_strip_test_LDFLAGS): New variable.
16258 (two_file_same_shared_strip_test_LDADD): New variable.
16259 (two_file_shared_strip.so): New target.
16260 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16261 (ver_test_5.syms, ver_test_7.syms): Likewise.
16262 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16263 (strip_test_3.stdout): Use TEST_OBJDUMP.
16264 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16265
16266 2008-04-04 Cary Coutant <ccoutant@google.com>
16267
16268 * symtab.h (Symbol::is_weak_undefined): New function.
16269 (Symbol::is_strong_undefined): New function.
16270 (Symbol::is_absolute): New function.
16271 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16272 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16273 absolute symbols.
16274 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16275 (weak_undef_test): New target.
16276 * testsuite/Makefile.in: Rebuild.
16277 * testsuite/weak_undef_file1.cc: New file.
16278 * testsuite/weak_undef_file2.cc: New file.
16279 * testsuite/weak_undef_test.cc: New file.
16280
16281 2008-04-03 Craig Silverstein <csilvers@google.com>
16282
16283 * compressed_output.h (class Output_compressed_section): Use
16284 unsigned buffer.
16285 * compressed_output.cc (zlib_compress): Use unsigned buffers,
16286 add zlib header.
16287 (zlib_compressed_suffix): Removed.
16288 (Output_compressed_section::set_final_data_size): Use unsigned
16289 buffers.
16290 * testsuite/Makefile.am (flagstest_compress_debug_sections):
16291 Fix linker invocation.
16292 (flagstest_o_specialfile_and_compress_debug_sections):
16293 Likewise.
16294 * testsuite/Makefile.in: Regenerated.
16295
16296 2008-04-02 David S. Miller <davem@davemloft.net>
16297
16298 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16299 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16300
16301 2008-04-02 Craig Silverstein <csilvers@google.com>
16302
16303 * TODO: New file.
16304
16305 2008-04-02 Ian Lance Taylor <iant@google.com>
16306
16307 * fileread.cc (File_read::find_view): Add byteshift and vshifted
16308 parameters. Update for new key type to views_. Change all
16309 callers.
16310 (File_read::read): Adjust for byteshift in returned view.
16311 (File_read::add_view): New function, broken out of
16312 find_and_make_view.
16313 (File_read::make_view): New function, broken out of
16314 find_and_make_view.
16315 (File_read::find_or_make_view): Add offset and aligned
16316 parameters. Rewrite accordingly. Change all callers.
16317 (File_read::get_view): Add offset and aligned parameters. Adjust
16318 for byteshift in return value.
16319 (File_read::get_lasting_view): Likewise.
16320 * fileread.h (class File_read): Update declarations.
16321 (class File_read::View): Add byteshift_ field. Add byteshift to
16322 constructor. Add byteshift method.
16323 * archive.h (Archive::clear_uncached_views): New function.
16324 (Archive::get_view): Add aligned parameter. Change all callers.
16325 * object.h (Object::get_view): Add aligned parameter. Change all
16326 callers.
16327 (Object::get_lasting_view): Likewise.
16328
16329 * fileread.cc (File_read::release): Don't call clear_views if
16330 there are multiple objects.
16331 * fileread.h (File_read::clear_uncached_views): New function.
16332 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16333 on the archive.
16334
16335 2008-03-31 Cary Coutant <ccoutant@google.com>
16336
16337 Add thin archive support.
16338 * archive.cc (Archive::armagt): New const.
16339 (Archive::setup): Remove task parameter and calls to unlock.
16340 (Archive::unlock_nested_archives): New function.
16341 (Archive::read_header): Add nested_off parameter. Change
16342 all callers.
16343 (Archive::interpret_header): Likewise.
16344 (Archive::include_all_members): Change to handle thin
16345 archives.
16346 (Archive::include_member): Likewise.
16347 * archive.h (Archive::Archive): Add new parameters and
16348 initializers.
16349 (Archive::armagt): New const.
16350 (Archive::setup): Remove task parameter.
16351 (Archive::unlock_nested_archives): New function.
16352 (Archive::read_header): Add nested_off parameter.
16353 (Archive::interpret_header): Likewise.
16354 (Archive::Nested_archive_table): New typedef.
16355 (Archive::is_thin_archive_): New field.
16356 (Archive::nested_archives_): New field.
16357 (Archive::options_): New field.
16358 (Archive::dirpath_): New field.
16359 (Archive::task_): New field.
16360 * readsyms.cc (Read_symbols::do_read_symbols): Add check
16361 for thin archives. Pass additional parameters to
16362 Archive::Archive. Unlock the archive file after calling
16363 Archive::setup.
16364
16365 2008-03-29 Ian Lance Taylor <iant@google.com>
16366
16367 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16368 version symbol to be local.
16369 * testsuite/ver_test_4.sh: New file.
16370 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16371 (check_DATA): Add ver_test_4.syms.
16372 (ver_test_4.syms): New target.
16373 * testsuite/Makefile.in: Rebuild.
16374
16375 * output.cc
16376 (Output_section::Input_section_sort_entry::has_priority): New
16377 function.
16378 (Output_section::Input_section_sort_entry::match_file_name): New
16379 function.
16380 (Output_section::Input_section_sort_entry::match_section_name):
16381 Remove.
16382 (Output_section::Input_section_sort_entry::match_section_name_prefix):
16383 Remove.
16384 (Output_section::Input_section_sort_entry::match_section_file):
16385 Remove.
16386 (Output_section::Input_section_sort_compare::operator()): Rewrite
16387 using new Input_section_sort_entry functions. Sort crtbegin and
16388 crtend first. Sort sections with no priority before sections with
16389 a priority.
16390 * testsuite/initpri1.c (d3): Check j != 4.
16391 (cd5): New constructor/destructor function.
16392 (main): Check j != 2.
16393
16394 * symtab.cc (Symbol_table::add_from_object): If we don't use the
16395 new symbol when resolving, don't call set_is_default.
16396 * testsuite/ver_test_7.cc: New file.
16397 * testsuite/ver_test_7.sh: New file.
16398 * testsuite/Makefile.am (ver_test_7.so): New target.
16399 (ver_test_7.o): New target.
16400 (check_SCRIPTS): Add ver_test_7.sh.
16401 (check_DATA): Add ver_test_7.syms.
16402 (ver_test_7.syms): New target.
16403
16404 2008-03-28 Ian Lance Taylor <iant@google.com>
16405
16406 * layout.cc (Layout::layout): If we see an input section with a
16407 name that needs sorting, set the must_sort flag for the output
16408 section.
16409 (Layout::make_output_section): If the name of the output section
16410 indicates that it might require sorting, set the may_sort flag.
16411 * output.h (Output_section::may_sort_attached_input_sections): New
16412 function.
16413 (Output_section::set_may_sort_attached_input_sections): New
16414 function.
16415 (Output_section::must_sort_attached_input_sections): New
16416 function.
16417 (Output_section::set_must_sort_attached_input_sections): New
16418 function.
16419 (class Output_section): Declare Input_section_sort_entry. Define
16420 Input_section_sort_compare. Declare
16421 sort_attached_input_sections. Add new fields:
16422 may_sort_attached_input_sections_,
16423 must_sort_attached_input_sections_,
16424 attached_input_sections_are_sorted_.
16425 * output.cc (Output_section::Output_section): Initialize new
16426 fields.
16427 (Output_section::add_input_section): Add an entry to
16428 input_sections_ if may_sort or must_sort are true.
16429 (Output_section::set_final_data_size): Call
16430 sort_attached_input_sections if necessary.
16431 (Output_section::Input_section_sort_entry): Define new class.
16432 (Output_section::Input_section_sort_compare::operator()): New
16433 function.
16434 (Output_section::sort_attached_input_sections): New function.
16435 * configure.ac: Check whether the compiler supports constructor
16436 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
16437 * testsuite/initpri1.c: New file.
16438 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16439 CONSTRUCTOR_PRIORITY.
16440 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16441 (initpri1_LDFLAGS): New variable.
16442 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16443
16444 2008-03-27 Ian Lance Taylor <iant@google.com>
16445
16446 * common.cc (Sort_commons::operator): Correct sorting algorithm.
16447 * testsuite/common_test_1.c: New file.
16448 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16449 (common_test_1_SOURCES): New variable.
16450 (common_test_1_DEPENDENCIES): New variable.
16451 (common_test_1_LDFLAGS): New variable.
16452
16453 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16454 and commons_ correctly when NAME/VERSION does not override
16455 NAME/NULL.
16456 * testsuite/ver_test_6.c: New file.
16457 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16458 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16459 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16460
16461 2008-03-26 Ian Lance Taylor <iant@google.com>
16462
16463 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16464 of an undefined symbol from a version script.
16465 * testsuite/Makefile.am (ver_test_5.so): New target.
16466 (ver_test_5.o): New target.
16467 (check_SCRIPTS): Add ver_test_5.sh.
16468 (check_DATA): Add ver_test_5.syms.
16469 (ver_test_5.syms): New target.
16470 * testsuite/ver_test_5.cc: New file.
16471 * testsuite/ver_test_5.script: New file.
16472 * testsuite/ver_test_5.sh: New file.
16473 * Makefile.in, testsuite/Makefile.in: Rebuild.
16474
16475 PR gold/5986
16476 Fix problems building gold with gcc 4.3.0.
16477 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16478 (gold_error_at_location, gold_warning_at_location): Use it.
16479 * configure.ac: Check whether we can compile and use a template
16480 function with a printf attribute.
16481 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16482 when jumping over bytes.
16483 * object.cc: Instantiate Object::read_section_data.
16484 * debug.h: Include <cstring>
16485 * dwarf_reader.cc: Include <algorithm>
16486 * main.cc: Include <cstring>.
16487 * options.cc: Include <cstring>.
16488 * output.cc: Include <cstring>.
16489 * script.cc: Include <cstring>.
16490 * script.h: Include <string>.
16491 * symtab.cc: Include <cstring> and <algorithm>.
16492 * target-select.cc: Include <cstring>.
16493 * version.cc: Include <string>.
16494 * testsuite/testmain.cc: Include <cstdlib>.
16495 * configure, config.in: Rebuild.
16496
16497 2008-03-25 Ian Lance Taylor <iant@google.com>
16498
16499 * options.cc: Include "../bfd/bfdver.h".
16500 (options::help): Print bug reporting address.
16501
16502 * version.cc (print_version): Adjust output for current value of
16503 BFD_VERSION_STRING.
16504
16505 * NEWS: New file.
16506
16507 * options.cc (options::help): Print list of supported targets.
16508 * target-select.h: Include <vector>.
16509 (class Target_selector): Make machine_, size_, and is_big_endian_
16510 fields const. Add bfd_name_ and instantiated_target_ fields.
16511 (Target_selector::Target_selector): Add bfd_name parameter.
16512 (Target_selector::recognize): Make non-virtual, call
16513 do_recognize.
16514 (Target_selector::recognize_by_name): Make non-virtual, call
16515 do_recognize_by_name.
16516 (Target_selector::supported_names): New function.
16517 (Target_selector::bfd_name): New function.
16518 (Target_selector::do_instantiate_target): New pure virtual
16519 function.
16520 (Target_selector::do_recognize): New virtual function.
16521 (Target_selector::do_recognize_by_name): New virtual function.
16522 (Target_selector::instantiate_target): New private function.
16523 (supported_target_names): Declare.
16524 * target-select.cc (Target_selector::Target_selector): Update for
16525 new parameter and fields.
16526 (select_target_by_name): Check that the name matches before
16527 calling recognize_by_name.
16528 (supported_target_names): New function.
16529 * i386.cc (class Target_selector_i386): Update Target_selector
16530 constructor call. Remove recognize and recognize_by_name. Add
16531 do_instantiate_target.
16532 * x86_64.cc (class Target_selector_x86_64): Likewise.
16533 * testsuite/testfile.cc (class Target_selector_test): Update for
16534 changes to Target_selector.
16535
16536 * README: Rewrite, with some notes on unsupported features.
16537
16538 2008-03-24 Cary Coutant <ccoutant@google.com>
16539
16540 * i386.cc (Target_i386::Got_type): New enum declaration.
16541 (Target_i386::Scan::local): Updated callers of Output_data_got
16542 member functions.
16543 (Target_i386::Scan::global): Likewise.
16544 (Target_i386::Relocate::relocate): Likewise.
16545 (Target_i386::Relocate::relocate_tls): Likewise.
16546 * object.h (Got_offset_list): New class.
16547 (Sized_relobj::local_has_got_offset): Added got_type parameter.
16548 (Sized_relobj::local_got_offset): Likewise.
16549 (Sized_relobj::set_local_got_offset): Likewise.
16550 (Sized_relobj::local_has_tls_got_offset): Removed.
16551 (Sized_relobj::local_tls_got_offset): Removed.
16552 (Sized_relobj::set_local_tls_got_offset): Removed.
16553 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16554 * output.cc (Output_data_got::add_global): Added got_type parameter.
16555 (Output_data_got::add_global_with_rel): Likewise.
16556 (Output_data_got::add_global_with_rela): Likewise.
16557 (Output_data_got::add_global_pair_with_rel): New function.
16558 (Output_data_got::add_global_pair_with_rela): New function.
16559 (Output_data_got::add_local): Added got_type parameter.
16560 (Output_data_got::add_local_with_rel): Likewise.
16561 (Output_data_got::add_local_with_rela): Likewise.
16562 (Output_data_got::add_local_pair_with_rel): New function.
16563 (Output_data_got::add_local_pair_with_rela): New function.
16564 (Output_data_got::add_global_tls): Removed.
16565 (Output_data_got::add_global_tls_with_rel): Removed.
16566 (Output_data_got::add_global_tls_with_rela): Removed.
16567 (Output_data_got::add_local_tls): Removed.
16568 (Output_data_got::add_local_tls_with_rel): Removed.
16569 (Output_data_got::add_local_tls_with_rela): Removed.
16570 * output.h (Output_data_got::add_global): Added got_type parameter.
16571 (Output_data_got::add_global_with_rel): Likewise.
16572 (Output_data_got::add_global_with_rela): Likewise.
16573 (Output_data_got::add_global_pair_with_rel): New function.
16574 (Output_data_got::add_global_pair_with_rela): New function.
16575 (Output_data_got::add_local): Added got_type parameter.
16576 (Output_data_got::add_local_with_rel): Likewise.
16577 (Output_data_got::add_local_with_rela): Likewise.
16578 (Output_data_got::add_local_pair_with_rel): New function.
16579 (Output_data_got::add_local_pair_with_rela): New function.
16580 (Output_data_got::add_global_tls): Removed.
16581 (Output_data_got::add_global_tls_with_rel): Removed.
16582 (Output_data_got::add_global_tls_with_rela): Removed.
16583 (Output_data_got::add_local_tls): Removed.
16584 (Output_data_got::add_local_tls_with_rel): Removed.
16585 (Output_data_got::add_local_tls_with_rela): Removed.
16586 * resolve.cc (Symbol::override_base_with_special): Removed
16587 reference to has_got_offset_ field.
16588 * symtab.cc (Symbol::init_fields): Replaced initialization
16589 of got_offset_ with got_offsets_. Removed initialization
16590 of has_got_offset_
16591 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16592 (Symbol::got_offset): Likewise.
16593 (Symbol::set_got_offset): Likewise.
16594 (Symbol::has_tls_got_offset): Removed.
16595 (Symbol::tls_got_offset): Removed.
16596 (Symbol::set_tls_got_offset): Removed.
16597 (Symbol::got_offset_): Removed.
16598 (Symbol::tls_mod_got_offset_): Removed.
16599 (Symbol::tls_pair_got_offset_): Removed.
16600 (Symbol::got_offsets_): New field.
16601 (Symbol::has_got_offset): Removed.
16602 (Symbol::has_tls_mod_got_offset): Removed.
16603 (Symbol::has_tls_pair_got_offset): Removed.
16604 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16605 (Target_x86_64::Scan::local): Updated callers of Output_data_got
16606 member functions.
16607 (Target_x86_64::Scan::global): Likewise.
16608 (Target_x86_64::Relocate::relocate): Likewise.
16609 (Target_x86_64::Relocate::relocate_tls): Likewise.
16610
16611 2008-03-25 Ben Elliston <bje@au.ibm.com>
16612
16613 * yyscript.y: Fix spelling error in comment.
16614
16615 2008-03-24 Ian Lance Taylor <iant@google.com>
16616
16617 * options.h (class General_options): Define build_id option.
16618 * layout.h (class Layout): Declare write_build_id, create_note,
16619 create_build_id. Add build_id_note_ member.
16620 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16621 "libiberty.h", "md5.h", "sha1.h".
16622 (Layout::Layout): Initialize eh_frame_data_,
16623 eh_frame_hdr_section_, and build_id_note_.
16624 (Layout::finalize): Call create_build_id.
16625 (Layout::create_note): New function, broken out of
16626 Layout::create_gold_note.
16627 (Layout::create_gold_note): Call create_note.
16628 (Layout::create_build_id): New function.
16629 (Layout::write_build_id): New function.
16630 (Close_task_runner::run): Call write_build_id.
16631
16632 * x86_64.cc: Correct license to GPLv3.
16633
16634 2008-03-23 Ian Lance Taylor <iant@google.com>
16635
16636 * options.cc: Include "demangle.h".
16637 (parse_optional_string): New function.
16638 (parse_long_option): Handle takes_optional_argument.
16639 (parse_short_option): Update dash_z initializer. Handle
16640 takes_optional_argument.
16641 (General_options::General_options): Initialize do_demangle_.
16642 (General_options::finalize): Set do_demangle_. Handle demangling
16643 style.
16644 * options.h (parse_optional_string): Declare.
16645 (struct One_option): Add optional_arg field. Update constructor.
16646 Update call constructor calls. Add takes_optional_argument
16647 function.
16648 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16649 (DEFINE_optional_string): Define.
16650 (General_options::demangle): Change from DEFINE_bool to
16651 DEFINE_optional_string.
16652 (General_options::no_demangle): New function.
16653 (General_options::do_demangle): New function.
16654 (General_options::set_do_demangle): New function.
16655 (General_options::execstack_status_): Move definition to end of
16656 class definition.
16657 (General_options::static_): Likewise.
16658 (General_options::do_demangle_): New field.
16659 * object.cc (big_endian>::get_symbol_location_info): Call
16660 Options::do_demangle, not Options::demangle.
16661 * symtab.cc (demangle): Likewise.
16662
16663 2008-03-22 Ian Lance Taylor <iant@google.com>
16664
16665 * gold.h: Include <cstddef> and <sys/types.h>
16666 * options.h: Include <cstring>.
16667
16668 2008-03-21 Ian Lance Taylor <iant@google.com>
16669
16670 * Added source code to GNU binutils.
16671 \f
16672 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16673
16674 Copying and distribution of this file, with or without modification,
16675 are permitted in any medium without royalty provided the copyright
16676 notice and this notice are preserved.
16677
16678 Local Variables:
16679 mode: change-log
16680 left-margin: 8
16681 fill-column: 74
16682 version-control: never
16683 End: