avoid std::vector copy.
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
2
3 * object.cc (write_local_symbols): avoid std::vector copy.
4
5 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
6
7 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
8
9 2015-02-09 Mark Wielaard <mjw@redhat.com>
10
11 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
12 DW_LANG_Fortran03 and DW_LANG_Fortran08.
13
14 2015-02-16 Cary Coutant <ccoutant@google.com>
15
16 PR gold/13577
17 PR gold/16992
18 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
19 DF_SYMBOLIC if --dynamic-list option is used.
20 * options.cc (General_options::finalize): --dynamic-list is not
21 mutually exclusive with -Bsymbolic.
22 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
23 listed in --dynamic-list.
24 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
25 -Bsymbolic-functions.
26 * testsuite/Makefile.in: Regenerate.
27
28 2015-02-16 Cary Coutant <ccoutant@google.com>
29
30 PR gold/17971
31 * incremental.cc: Remove redundant include of "output.h".
32
33 2015-02-12 Jing Yu <jingyu@google.com>
34
35 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
36 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
37 New relocation.
38 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
39 TLSLE_MOVW_* relocations.
40 (Target_aarch64::Scan::global): Likewise.
41 (Target_aarch64::Relocate::relocate): Likewise.
42 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
43 for new TLSLE_MOVW_* relocations.
44
45 2015-02-11 Will Newton <will.newton@linaro.org>
46
47 PR gold/13321
48 * arm.cc (Target_arm::make_plt_section): Create an ARM
49 state mapping symbol at the start of the PLT.
50
51 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
52
53 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
54 Replace two_file_shared_2.so with two_file_shared_1.so.
55 * testsuite/Makefile.in: Regenerated.
56
57 2015-02-09 Alan Modra <amodra@gmail.com>
58
59 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
60 plugin_test_thin.a and defsym_test.
61 * testsuite/Makefile.in: Regenerate.
62
63 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
64
65 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
66 body.
67
68 2015-02-04 Peter Collingbourne <pcc@google.com>
69
70 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
71 forwarding symbols when computing symbol resolution info for plugins.
72 * plugin.h (Plugin_manager::symtab): New method.
73 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
74
75 2015-02-03 Cary Coutant <ccoutant@google.com>
76 Peter Collingbourne <pcc@google.com>
77
78 PR gold/15660
79 * archive.cc (Thin_archive_object_unlocker): New class.
80 (Archive::include_member): Unlock external members of thin archives.
81 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
82 (plugin_test_2): Likewise.
83 (plugin_test_3): Likewise.
84 (plugin_test_4): Likewise.
85 (plugin_test_5): Likewise.
86 (plugin_test_6): Likewise.
87 (plugin_test_7): Likewise.
88 (plugin_test_8): Likewise.
89 (plugin_test_9): Likewise.
90 (plugin_test_10): Likewise.
91 (plugin_test_11): New test case.
92 * testsuite/Makefile.in: Regenerate.
93 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
94 file to decide whether to claim file.
95 (all_symbols_read_hook): Likewise.
96 * testsuite/plugin_test_1.sh: Adjust expected output.
97 * testsuite/plugin_test_2.sh: Likewise.
98 * testsuite/plugin_test_3.sh: Likewise.
99 * testsuite/plugin_test_6.sh: Likewise.
100 * testsuite/plugin_test_tls.sh: Likewise.
101 * testsuite/plugin_test_11.sh: New testcase.
102
103 2015-02-03 Cary Coutant <ccoutant@google.com>
104
105 * descriptors.cc (Descriptors::open): Set artificially-low limit for
106 file descriptors when debugging enabled. Add debug output.
107 (Descriptors::release): Add debug output.
108 (Descriptors::close_some_descriptor): Likewise.
109 (Descriptors::close_all): Likewise.
110 * fileread.cc (File_read::lock): Likewise.
111 (File_read::unlock): Likewise.
112
113 2015-02-02 Cary Coutant <ccoutant@google.com>
114
115 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
116 executable output file.
117
118 2015-01-22 Han Shen <shenhan@google.com>
119
120 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
121 (Target_arm::do_plt_address_for_global): New method.
122 (Target_arm::do_plt_address_for_local): New method.
123 (Target_arm::rel_irelative_section): New method.
124 (Target_arm::make_data_plt): Add more parameters for plt ctor.
125 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
126 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
127 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
128 (Target_arm::Scan::check_non_pic): Add ifunc support.
129 (Target_arm::Scan::local): Add ifunc support.
130 (Target_arm::Scan::global): Add ifunc support.
131 (Target_arm::make_plt_section): New method.
132 (Target_arm::make_plt_entry): Change to call to make_plt_section.
133 (Target_arm::make_local_ifunc_plt_entry): New method.
134 (Target_arm::got_irelative_): New member.
135 (Target_arm::rel_irelative_): New member.
136 (Target_arm::got_section): Add creation for got_irelative_.
137 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
138 (Target_arm::Relocate::relocate): Properly set local ifunc address.
139 (Target_arm::do_dynsym_value): Properly set global ifunc address.
140 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
141 (Output_data_plt_arm::IRelative_data): New type.
142 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
143 (Output_data_plt_arm::add_entry): Add more parameters.
144 (Output_data_plt_arm::add_relocation): New method.
145 (Output_data_plt_arm::add_local_ifunc_entry): New method.
146 (Output_data_plt_arm::rel_irelative): New method.
147 (Output_data_plt_arm::entry_count): Modified.
148 (Output_data_plt_arm::address_for_global): New method.
149 (Output_data_plt_arm::address_for_local): New method.
150 gold/
151 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
152 (Output_data_plt_arm::insert_irelative_data): New method.
153 (Output_data_plt_arm::irelative_rel_): New member.
154 (Output_data_plt_arm::got_): New member.
155 (Output_data_plt_arm::got_irelative_): New member.
156 (Output_data_plt_arm::irelative_count_): New member.
157 (Output_data_plt_arm::IRelative_data_vec): New typedef.
158 (Output_data_plt_arm::irelative_data_vec_): New member.
159 (Output_data_plt_arm::do_write): Write out irelative entries.
160 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
161 more parameters to ctor.
162 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
163 more parameters to ctor.
164 * output.h (Output_data_reloc::add_local_relative): New method.
165 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
166
167 2015-01-29 Alan Modra <amodra@gmail.com>
168
169 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
170 and GOT_TLSGD to LE optimization.
171
172 2015-01-28 Cary Coutant <ccoutant@google.com>
173
174 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
175 for undef TLS symbols.
176 (Target_x86_64::Relocate::relocate_tls): Likewise.
177 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
178
179 2015-01-25 Cary Coutant <ccoutant@google.com>
180
181 * output.cc (Output_segment::set_section_addresses): Fix calculation
182 of size of relro segment.
183
184 2015-01-22 Alan Modra <amodra@gmail.com>
185
186 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
187 condition for need of ifunc plt entry.
188 (Target_powerpc::Scan::global <got relocs>): Likewise.
189
190 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
191
192 * mips.cc (reloc_high): Add r_sym.
193 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
194 reloc_high constructor.
195 (Mips_relocate_functions::relgot16_local): Likewise.
196 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
197 r_type to decide whether LO16 matches HI16.
198 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
199 rello16 and relgot16_local.
200
201 2015-01-09 Cary Coutant <ccoutant@google.com>
202
203 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
204 unless alignment is larger than page size.
205
206 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
207 Cary Coutant <ccoutant@google.com>
208
209 PR gold/17729
210 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
211 (DEFAULT_TARGET_X32): Set for x32.
212 * x86_64.cc (cmp_insn_32): New.
213 (lea_r10_insn_32): Likewise.
214 (lea_r11_insn_32): Likewise.
215 (cmp_insn_64): Likewise.
216 (lea_r10_insn_64): Likewise.
217 (lea_r11_insn_64): Likewise.
218 (Target_x86_64<size>::do_calls_non_split): Handle x32.
219 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
220 (check_DATA): Add split_x32 files.
221 (split_x32_[1234n].o): New targets.
222 (split_x32_[124]): New targets.
223 (split_x32_[1234r].stdout): New targets.
224 * testsuite/split_x32.sh: New file.
225 * testsuite/split_x32_1.s: Likewise.
226 * testsuite/split_x32_2.s: Likewise.
227 * testsuite/split_x32_3.s: Likewise.
228 * testsuite/split_x32_4.s: Likewise.
229 * testsuite/split_x32_n.s: Likewise.
230 * configure: Regenerated.
231 * testsuite/Makefile.in: Likewise.
232
233 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
234
235 PR gold/17809
236 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
237 x32.
238
239 2015-01-02 Alan Modra <amodra@gmail.com>
240
241 * version.cc (print_version): Just print current year.
242 * dwp.cc (print_version): Likewise.
243
244 2015-01-01 Alan Modra <amodra@gmail.com>
245
246 Update year range in copyright notice of all files.
247
248 2014-12-25 Alan Modra <amodra@gmail.com>
249
250 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
251 new enums.
252 (Target_arm::merge_object_attributes, ): Likewise.
253
254 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
255
256 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
257 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
258 AEABI_VFP_args_vfp to check that.
259 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
260 value and replace hardcoded values by enum values.
261
262 2014-12-22 Cary Coutant <ccoutant@google.com>
263
264 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
265
266 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
267
268 PR gold/14608
269 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
270 to "return i * i * 3;".
271
272 2014-12-16 Cary Coutant <ccoutant@google.com>
273
274 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
275 (Mapfile::print_output_data): Use current_data_size() to avoid
276 assert for sections requiring postprocessing; if address is not valid,
277 print 0.
278 (Mapfile::print_output_section): Use current_data_size(); print note
279 that addresses and sizes are before compression.
280
281 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
282
283 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
284 Cast current_group_size to unsigned long when reporting error.
285
286 2014-12-10 Jing Yu <jingyu@google.com>
287
288 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
289 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
290 Update error message.
291 (Target_aarch64::do_relax): Use absolute value of option
292 stub_group_size. Replace local variable with class member
293 stub_group_size_.
294
295 2014-12-04 Alan Modra <amodra@gmail.com>
296
297 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
298 addend of PLTREL24 reloc when not generating a plt stub. Make
299 max_branch_offset an "Address".
300 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
301 (Target_powerpc::Relocate::relocate): Likewise.
302
303 2014-12-04 Alan Modra <amodra@gmail.com>
304
305 PR 17670
306 * symtab.cc (Symbol::set_undefined): Remove assertion.
307 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
308 on symbols defined in discarded sections, instead return false.
309 Rearrange params, update all callers.
310 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
311 branches to syms in discarded sections.
312 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
313 undefined and flag as discarded.
314 (Target_powerpc::Relocate::relocate): Localize variable.
315
316 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
317
318 PR gold/17675
319 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
320 * testsuite/Makefile.in: Regenerated.
321
322 2014-12-03 Alan Modra <amodra@gmail.com>
323
324 PR 17566
325 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
326 when adding dynamic relocations against section symbols.
327
328 2014-12-01 Dimitry Ivanov <dimitry@google.com>
329
330 * layout.cc (Layout::finish_dynamic_section): When '-z global'
331 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
332 * options.h (General_options): New -z option (global).
333
334 2014-12-01 Cary Coutant <ccoutant@google.com>
335
336 PR gold/17578
337 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
338 is given.
339 (Layout::create_executable_stack_info): Warn when -z noexecstack is
340 given but some inputs require executable stack.
341
342 2014-11-26 Cary Coutant <ccoutant@google.com>
343
344 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
345 .debug_str_offsets; strip .debug_gnu_pubnames and
346 .debug_gnu_pubtypes.
347 (lines_only_debug_sections): Strip all four new sections.
348
349 2014-11-26 Jing Yu <jingyu@google.com>
350
351 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
352 register to be x0 when to relax TLSDESC_LD64_LO12.
353
354 2014-11-26 Alan Modra <amodra@gmail.com>
355
356 * powerpc.cc (struct Stub_table_owner): New.
357 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
358 unsigned int vector. Update all references.
359 (powerpc_relobj::set_stub_table): Take an unsigned int param
360 rather than a Stub_table. Update callers.
361 (Powerpc_relobj::clear_stub_table): New function.
362 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
363 stub_group_size_ vars.
364 (Target_powerpc::new_stub_table): Delete.
365 (max_branch_delta): New function, extracted from..
366 (Target_powerpc::Relocate::relocate): ..here..
367 (Target_powerpc::Branch_info::make_stub): ..and here. Return
368 status on whether stub created successfully.
369 (Stub_control::Stub_control): Add "no_size_errors" param. Move
370 default sizing to..
371 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
372 reduce on relax failure.
373 (Target_powerpc::group_sections): Add "no_size_errors" param.
374 Use stub_group_size_. Set up group info in a temp vector,
375 before building Stub_table vector. Account for input sections
376 possibly already converted to relaxed sections.
377 (Stub_table::init): Delete. Merge into..
378 (Stub_table::Stub_table): ..here.
379 (Stub_table::can_reach_stub): New function.
380 (Stub_table::add_plt_call_entry): Add "from" parameter and
381 return true iff stub could be reached.
382 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
383 param too.
384 (Stub_table::clear_stubs): Add "all" param.
385
386 2014-11-26 Alan Modra <amodra@gmail.com>
387
388 * powerpc.cc (Stub_control::set_output_and_owner): New function.
389 (Target_powerpc::group_sections): Use it.
390
391 2014-11-25 Cary Coutant <ccoutant@google.com>
392
393 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
394 (Binary_to_elf::write_symbol): Add st_size parameter.
395 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
396
397 2014-11-25 Cary Coutant <ccoutant@google.com>
398
399 PR gold/17639
400 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
401 (Sized_relobj_file::do_layout): Handle deferred sections properly
402 during GC pass 1. Don't add reloc sections to deferred list twice.
403 * object.h (Sized_relobj_file::is_deferred_layout): New function.
404 (Sized_relobj_file::is_deferred_layout_): New data member.
405
406 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
407
408 PR gold/17619
409 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
410 Check PC-relative offset overflow in PLT entry.
411
412 2014-11-21 Alan Modra <amodra@gmail.com>
413
414 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
415 for undefined weaks.
416
417 2014-11-20 Alan Modra <amodra@gmail.com>
418
419 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
420 from --stub-group-size parameter divided by 1024.
421 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
422 template parameter. Update all uses.
423 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
424 has_stub_value. Set for long branches. Don't report overflow for
425 branch to undefined weak symbols. Print info message on
426 overflowing branch to stub.
427
428 2014-11-20 Alan Modra <amodra@gmail.com>
429
430 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
431
432 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
433
434 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
435 entry for R_X86_64_GOTPLT64.
436 (Target_x86_64<size>::Relocate::relocate): Update comments for
437 R_X86_64_GOTPLT64.
438
439 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
440
441 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
442 * plugin.h: add lock definition
443
444 2014-10-29 Han Shen <shenhan@google.com>
445 Jing Yu <jingyu@google.com>
446
447 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
448 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
449 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
450 Symbol::TLS_REF.
451 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
452 method.
453 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
454 (Target_aarch64::tls_ld_to_le): New method.
455 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
456 for 64bit targets.
457 (Output_data_plt_aarch64::irelative_rel_): New data member.
458 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
459 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
460 (Output_data_plt_aarch64::add_relocation): New method.
461 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
462 offset. Add got_irelative size to got size.
463 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
464 type string with the new typename.
465 (AArch64_relocate_functions::update_adr): Replace parameter x with
466 immed.
467 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
468 (AArch64_relocate_functions::reloc_common): New method.
469 (AArch64_relocate_funcsions::rela_general): Extract common part out
470 into reloc_common method.
471 (AArch64_relocate_functions::rela_general): Likewise.
472 (AArch64_relocate_functions::pcrela_general): Likewise.
473 (AArch64_relocate_functions::adr): New method.
474 (AArch64_relocate_functions::adrp): Calculate immed before calling
475 update_adr.
476 (AArch64_relocate_functions::adrp): Likewise.
477 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
478 comparing x to 0. Calculate immed from ~x when x < 0.
479 (Target_aarch64::optimize_tls_reloc): Add new cases for
480 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
481 TLSLD_MOVW_DTPREL_G0_NC.
482 (Target_aarch64::possible_function_pointer_reloc): Implement this
483 method.
484 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
485 comment.
486 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
487 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
488 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
489 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
490 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
491 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
492 (Target_aarch64::make_plt_entry): Call add_entry with two more
493 parameters.
494 (Target_aarch64::make_local_ifunc_plt_entry): New method.
495 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
496 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
497 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
498 (Target_aarch64::Relocate::relocate_tls): Add cases for
499 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
500 TLSLD_MOVW_DTPREL_G0_NC.
501 * testsuite/icf_safe_so_test.cc: Correct test comment.
502 * testsuite/icf_safe_test.sh: Add AArch64 arch.
503
504 2014-10-22 Alan Modra <amodra@gmail.com>
505
506 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
507 thread_starter.
508
509 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
510
511 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
512
513 2014-10-17 Cary Coutant <ccoutant@google.com>
514
515 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
516 Add "typename" keyword.
517
518 2014-10-15 Han Shen <shenhan@google.com>
519 Jing Yu <jingyu@google.com>
520
521 Patch for gold aarch64 backend to support relaxation.
522 * aarch64-reloc.def: Change format.
523 * aarch64.cc (class Reloc_stub): New class.
524 (class Stub_table): New class.
525 (class AArch64_relobj): New class.
526 (class AArch64_input_section): New class.
527 (class AArch64_output_section): New class.
528 (Target_aarch64::new_stub_table): New method.
529 (Target_aarch64::new_aarch64_input_section): New method.
530 (Target_aarch64::find_aarch64_input_section): New method.
531 (Target_aarch64::scan_section_for_stubs): New method.
532 (Target_aarch64::scan_reloc_section_for_stubs): New method.
533 (Target_aarch64::relocate_stub): New method.
534 (Target_aarch64::current_target): New method.
535 (Target_aarch64::do_make_elf_object): New method.
536 (Target_aarch64::do_may_relax): New method.
537 (Target_aarch64::do_relax): New method.
538 (Target_aarch64::group_sections): New method.
539 (Target_aarch64::scan_reloc_for_stub): New method.
540 (Target_aarch64::do_make_output_section): New method.
541 (Target_aarch64::stub_tables_): New data member.
542 (Target_aarch64::aarch64_input_section_map_): New data member.
543 (AArch64_relocate_functions::maybe_apply_stub): New method.
544
545 2014-09-30 Cary Coutant <ccoutant@google.com>
546
547 PR gold/17432
548 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
549
550 2014-09-30 Kito Cheng <kito@0xlab.org>
551
552 PR gold/13597
553 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
554 hash table before sysv-style hash table.
555
556 2014-09-29 Sriraman Tallam <tmsriram@google.com>
557
558 * options.h (--pic-executable): Add negative to alias to -no-pie.
559
560 2014-09-26 Cary Coutant <ccoutant@google.com>
561
562 PR gold/16773
563 * object.cc (Sized_relobj_file): Compute value of section symbols
564 for TLS sections the same as TLS symbols.
565
566 2014-09-25 Cary Coutant <ccoutant@google.com>
567
568 PR gold/17432
569 * resolve.cc (Symbol_table::resolve): Override common placeholder
570 symbols, but adjust sizes.
571 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
572 symbols to common lists.
573
574 2014-09-24 Alan Modra <amodra@gmail.com>
575
576 * po/POTFILES.in: Regenerate.
577
578 2014-09-23 Taiju Tsuiki <tzik@google.com>
579 Cary Coutant <ccoutant@google.com>
580
581 PR gold/14860
582 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
583 on input_sections_blocker.
584 * layout.cc (Write_sections_task::locks): Unblock
585 input_sections_blocker_.
586 * layout.h (Write_sections_task::Write_sections_task): Add
587 input_sections_blocker.
588 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
589 to DEPENDENCIES.
590 * testsuite/Makefile.in: Regenerate.
591
592 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
593
594 * testsuite/Makefile.am (plugin_test_10): New test.
595 * testsuite/Makefile.in: Regenerate
596 * testsuite/plugin_common_test_2.c (c1): Align to 8.
597 * testsuite/plugin_test_10.sh: New file.
598
599 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
600
601 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
602 * resolve.cc (Symbol_table::resolve): Don't override common symbols
603 during the replacement phase.
604
605 2014-09-17 Han Shen <shenhan@google.com>
606 Jing Yu <jingyu@google.com>
607
608 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
609 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
610 * aarch64.cc (Target_aarch64): Add data members
611 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
612 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
613 constructor.
614 (Target_aarch64::do_reloc_symbol_index): New method.
615 (Target_aarch64::do_reloc_addend): New method.
616 (Target_aarch64::add_tlsdesc_info): New method.
617 (Target_aarch64::do_dynsym_value): New method.
618 (Target_aarch64::do_make_data_plt): Add new parameters: got,
619 got_irelative. Pass them to Output_data_plt_aarch64_standard.
620 (Target_aarch64::make_data_plt): Add new parameters: got,
621 got_irelative. Pass them to do_make_data_plt.
622 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
623 (Target_aarch64::Relocate:tls_gd_to_le): New method.
624 (Target_aarch64::Relocate:tls_ie_to_le): New method.
625 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
626 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
627 (Target_aarch64::got_tlsdesc_section): New method.
628 (Target_aarch64::make_local_ifunc_plt_entry): New method.
629 (Target_aarch64::define_tls_base_symbol): New method.
630 (Target_aarch64::reserve_tlsdesc_entries): New method.
631 (Target_aarch64::got_mod_index_entry): New method.
632 (Target_aarch64::rela_tlsdesc_section): New method.
633 (Target_aarch64::rela_irelative_section): New method.
634 (Target_aarch64::Tlsdesc_info): New struct.
635 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
636 relocations and tlsdesc relocations.
637 (Target_aarch64::optimize_tls_reloc): Implement method.
638 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
639 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
640 in constructor.
641 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
642 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
643 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
644 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
645 (Output_data_plt_aarch64::rela_tlsdesc): New method.
646 (Output_data_plt_aarch64::rela_irelative): New method.
647 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
648 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
649 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
650 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
651 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
652 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
653 (Output_data_plt_aarch64_standard): New member variables:
654 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
655 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
656 New parameter: got, got_irelative.
657 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
658 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
659 (Output_data_plt_aarch64::do_write): Replace got_address with
660 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
661 (AArch64_relocate_functions::update_movnz): New method.
662 (AArch64_relocate_functions): Correct format.
663 (AArch64_relocate_functions::movnz): New method.
664 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
665 before the switch. Add new cases to switch.
666 Check ie_to_le relaxation on tlsie relocations. Add code handling
667 tlsgd tlsdesc cases.
668 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
669 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
670 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
671 Call reloc_name_in_error_message to print unsupported reloc.
672 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
673 make_data_plt.
674 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
675 relocs. Fill in some more dynamic tags.
676 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
677 Skip call tls_get_addr when tlsgd is relaxed.
678 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
679 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
680 tlsdesc->ie relaxation.
681
682 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
683
684 * mips.cc (Target_mips_nacl): New class.
685 (Target_selector_mips_nacl): New class.
686 (target_selector_mips32): Rename from target_selector_mips32be and use
687 Target_selector_mips_nacl instead of Target_selector_mips.
688 (target_selector_mips32el): Rename from target_selector_mips32 and use
689 Target_selector_mips_nacl instead of Target_selector_mips.
690 (target_selector_mips64): Rename from target_selector_mips64be and use
691 Target_selector_mips_nacl instead of Target_selector_mips.
692 (target_selector_mips64el): Rename from target_selector_mips64 and use
693 Target_selector_mips_nacl instead of Target_selector_mips.
694 (Target_mips::mips_info): Add const attribute.
695
696 2014-09-02 Cary Coutant <ccoutant@google.com>
697
698 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
699 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
700 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
701 (Sized_incr_dynobj::do_section_name): Likewise.
702 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
703 (Sized_incr_dynobj::do_section_name): Likewise.
704 * object.h (Object::section_name): Likewise.
705 (Object::do_section_name): Likewise.
706 (Sized_relobj_file::do_section_name): Likewise.
707 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
708 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
709
710 2014-09-02 Cary Coutant <ccoutant@google.com>
711
712 PR gold/17005
713 * ehframe.cc (Fde::write): Add output_offset parameter.
714 (Cie::write): Likewise.
715 (Eh_frame::set_final_data_size): Account for offset within output
716 section.
717 (Eh_frame::do_sized_write): Likewise.
718 * ehframe.h (Fde::write): Add output_offset parameter.
719 (Cie::write): Likewise.
720 * output.cc (Output_section::Input_section_sort_entry): Remove
721 section_has_name_; add output_section_name parameter. Use
722 output section name for non-input sections.
723 (Output_section::Input_section_sort_entry::section_has_name): Remove.
724 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
725 (Output_section::Input_section_sort_compare): Remove logic for
726 sections without names.
727 (Output_section::Input_section_sort_init_fini_compare): Likewise.
728 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
729 Likewise.
730 (Output_section::Input_section_sort_section_name_compare): Likewise.
731
732 2014-08-29 Han Shen <shenhan@google.com>
733 Jing Yu <jingyu@google.com>
734
735 * aarch64-reloc-property.cc
736 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
737 reference reloc property in the table.
738 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
739 3 other entries.
740 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
741 2 new overloaded methods.
742 (Output_data_got_aarch64::do_write): Add code to write out
743 static relocs.
744 (class Output_data_got_aarch64::Static_reloc): New class to wrap
745 static relocs.
746 (Output_data_got_aarch64::static_relocs): New vector to
747 hold static relocs.
748 (Target_aarch64::TCB_SIZE): New const static memeber.
749 (Target_aarch64::tcb_size): New method.
750 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
751 (Target_aarch64::Relocate::relocate_tls): New method.
752 (Target_aarch64::Scan::local): Add code handling new reloc types.
753 (Target_aarch64::Scan::global): Add code handling new reloc types.
754
755 2014-08-13 Sriraman Tallam <tmsriram@google.com>
756
757 * options.h (-no-pie): Add option.
758
759 2014-08-08 Jing Yu <jingyu@google.com>
760 Han Shen <shenhan@google.com>
761
762 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
763 (DEFFILES): add aarch64-reloc.def.
764 (TARGETSOURCES): Add aarch64-reloc-property.cc.
765 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
766 * Makefile.in: Regenerate.
767 * aarch64-reloc-property.cc: New file.
768 * aarch64-reloc-property.h: New file.
769 * aarch64-reloc.def: New file.
770 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
771 with tab to make the format consistent.
772 (Output_data_got_aarch64::symbol_table_): New method.
773 (Target_aarch64::do_plt_address_for_global): New method.
774 (Target_aarch64::do_plt_address_for_local): New method.
775 (Target_aarch64::do_select_as_default_target): New method.
776 (Target_aarch64::do_make_data_plt): New method.
777 (Target_aarch64::make_data_plt): New method.
778 (Output_data_plt_aarch64::has_irelative_section): New method.
779 (Output_data_plt_aarch64::address_for_global): New method.
780 (Output_data_plt_aarch64::address_for_local): New method.
781 (Output_data_plt_aarch64::irelative_rel_): New parameter.
782 (Output_data_plt_aarch64::add_entry): Implement contents.
783 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
784 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
785 the got_pov entry to plt0.
786 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
787 Implement contents.
788 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
789 (AArch64_howto): New struct.
790 (aarch64_howto[]): New static const array.
791 (AArch64_relocate_functions): New class.
792 (Target_aarch64::Scan::get_reference_flags): Remove method.
793 (Target_aarch64::Scan::local): Implement to support a few relocations.
794 (Target_aarch64::Scan::global): Implement to support a few relocations.
795 (Target_aarch64::make_plt_section): Implement contents.
796 (Target_aarch64::make_plt_entry): Implement contents.
797 (Target_aarch64::do_finalize_sections): Implement contents.
798 (Target_aarch64::Relocate::relocate): Implement a few relocations.
799 (Target_aarch64::relocate_section): Implement contents.
800
801 2014-08-06 Alan Modra <amodra@gmail.com>
802
803 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
804
805 2014-08-06 Alan Modra <amodra@gmail.com>
806
807 PR 13227
808 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
809
810 2014-07-21 Sriraman Tallam <tmsriram@google.com>
811
812 * object.cc (Relobj::is_section_name_included): Add
813 ".rodata.nptl_version" to not garbage collect this section.
814
815 2014-07-08 Cary Coutant <ccoutant@google.com>
816
817 * expression.cc (struct Expression::Expression_eval_info): Add
818 new fields type_pointer, vis_pointer, and nonvis_pointer.
819 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
820 nonvis_pointer parameters. Adjust all calls.
821 (Symbol_expression::value): Update type, visibility, and nonvis bits
822 in caller.
823 * script.cc (Symbol_assignment::sized_finalize): Update type,
824 visibility, and remaining st_other bits for new symbol.
825 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
826 vis_pointer, and nonvis_pointer parameters.
827 * symtab.h (Symbol::set_type): New method.
828
829 * testsuite/Makefile.am (defsym_test): New test.
830 * testsuite/Makefile.in: Regenerate.
831 * testsuite/defsym_test.c: New file.
832 * testsuite/defsym_test.sh: New file.
833
834 2014-07-08 Cary Coutant <ccoutant@google.com>
835
836 PR gold/15639
837 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
838 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
839 (Sized_dynobj::base_read_symbols): ...new method.
840 * object.h (Sized_relobj_file::base_read_symbols): New method.
841 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
842 (Sized_relobj_file::base_read_symbols): ...new method.
843 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
844 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
845 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
846
847 2014-07-04 Alan Modra <amodra@gmail.com>
848
849 * po/POTFILES.in: Regenerate.
850
851 2014-07-02 Jing Yu <jingyu@google.com>
852
853 * aarch64.cc: New file
854 * Makefile.am (TARGETSOURCES): Add aarch64.cc
855 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
856 * Makefile.in: Regenerate.
857 * configure.tgt: Add entries for aarch64*.
858 * configure.ac: Likewise.
859 * configure: Likewise.
860
861 2014-06-27 Alan Modra <amodra@gmail.com>
862
863 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
864
865 2014-06-24 Cary Coutant <ccoutant@google.com>
866
867 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
868 sections.
869 (Dwo_file::sized_read_unit_index): Likewise.
870
871 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
872
873 * mips.cc: New file.
874 * Makefile.am (TARGETSOURCES): Add mips.cc
875 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
876 * configure.tgt: Add entries for mips*.
877 * configure.ac: Likewise.
878 * Makefile.in: Regenerate.
879 * configure: Likewise.
880
881 2014-06-09 Cary Coutant <ccoutant@google.com>
882
883 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
884 unit_length is within section bounds.
885
886 2014-06-09 Cary Coutant <ccoutant@google.com>
887
888 PR gold/16980
889 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
890 map.
891
892 2014-06-07 Alan Modra <amodra@gmail.com>
893
894 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
895
896 2014-06-06 Cary Coutant <ccoutant@google.com>
897
898 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
899 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
900 (Dwarf_pubnames_table::read_header): Likewise.
901 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
902 .debug_gnu_pubtypes.
903
904 2014-06-05 Joel Brobecker <brobecker@adacore.com>
905
906 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
907 * Makefile.in, configure: Regenerate.
908
909 2014-06-03 Alan Modra <amodra@gmail.com>
910
911 * powerpc.cc (addis_12_2): Define.
912 (Stub_table::do_write): Support fusion on ELFv2 stubs.
913
914 2014-06-03 Alan Modra <amodra@gmail.com>
915
916 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
917 st_other output.
918
919 2014-06-02 Alan Modra <amodra@gmail.com>
920
921 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
922 Only ignore relocs on ELFv1.
923 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
924
925 2014-05-30 Cary Coutant <ccoutant@google.com>
926
927 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
928 * testsuite/Makefile.in: Regenerate.
929 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
930
931 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
932
933 PR gold/16945
934 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
935 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
936
937 2014-05-15 Alan Modra <amodra@gmail.com>
938
939 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
940 Compare FDE contents with DW_CFA_nop rather than 0.
941
942 2014-05-13 Sriraman Tallam <tmsriram@google.com>
943
944 * symtab.h (may_need_copy_reloc): Remove check for position independent
945 code.
946 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
947 position independence before pc absolute may_need_copy_reloc call.
948 Add check for executable output befor pc relative may_need_copy_reloc
949 call.
950 * i386.cc: Ditto.
951 * arm.cc: Ditto.
952 * sparc.cc: Ditto.
953 * tilegx.cc: Ditto.
954 * powerpc.cc: Add check for no position independence before
955 may_need_copy_reloc calls.
956 * testsuite/pie_copyrelocs_test.cc: New file.
957 * testsuite/pie_copyrelocs_shared_test.cc: New file.
958 * Makefile.am (pie_copyrelocs_test): New test.
959 * Makefile.in: Regenerate.
960
961 2014-05-08 Martin Liška <mliska@suse.cz>
962
963 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
964
965 2014-05-06 Cary Coutant <ccoutant@google.com>
966
967 PR gold/16900
968 * i386.cc (Output_data_got_plt_i386): New class.
969 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
970 parameter. Change all callers.
971 (Output_data_plt_i386::layout_): Remove.
972 (Output_data_plt_i386::got_plt_): Change type.
973 (Target_i386::got_plt_): Change type. Change all references.
974 (Target_i386::got_section): Create instance of new class.
975 (Output_data_got_plt_i386::do_write): New function.
976 * x86_64.cc (Output_data_got_plt_x86_64): New class.
977 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
978 parameter. Change all callers.
979 (Output_data_plt_x86_64::layout_): Remove.
980 (Output_data_plt_x86_64::got_plt_): Change type.
981 (Target_x86_64::got_plt_): Change type. Change all references.
982 (Target_x86_64::got_section): Create instance of new class.
983 (Output_data_got_plt_x86_64::do_write): New function.
984 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
985 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
986 class.
987
988 2014-05-05 Cary Coutant <ccoutant@google.com>
989
990 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
991 if we have pubnames/pubtypes.
992
993 2014-05-02 Cary Coutant <ccoutant@google.com>
994
995 * defstd.cc (in_segment): Define __ehdr_start here...
996 * layout.cc (Layout::finalize): ...Instead of here. Set the
997 output segment when known.
998 * resolve.cc (Symbol::override_base_with_special): Remember
999 the original binding.
1000 * symtab.cc (Symbol::set_output_segment): New function.
1001 (Symbol::set_undefined): New function.
1002 * symtab.h (Symbol::is_weak_undefined): Check original undef
1003 binding.
1004 (Symbol::is_strong_undefined): New function.
1005 (Symbol::set_output_segment): New function.
1006 (Symbol::set_undefined): New function.
1007 * target-reloc.h (is_strong_undefined): Remove.
1008 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1009 Check for hidden undefs.
1010 (relocate_section): Call Symbol::is_strong_undefined.
1011
1012 * testsuite/Makefile.am (ehdr_start_test_1)
1013 (ehdr_start_test_2, ehdr_start_test_3)
1014 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1015 * testsuite/Makefile.in: Regenerate.
1016 * testsuite/ehdr_start_def.cc: New source file.
1017 * testsuite/ehdr_start_test.cc: New source file.
1018 * testsuite/ehdr_start_test.t: New linker script.
1019 * testsuite/ehdr_start_test_4.sh: New shell script.
1020
1021 2014-04-23 Cary Coutant <ccoutant@google.com>
1022
1023 PR gold/16870
1024 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1025
1026 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1027
1028 * layout.cc (Layout::include_section): Allow a target to decide
1029 whether to include a section.
1030 * target.h (Target::should_include_section): New function.
1031 (Target::do_should_include_section): New function.
1032
1033 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1034
1035 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1036 inline into ...
1037 (Copy_relocs::emit): ... here.
1038 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1039 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1040 (Copy_reloc_entry::entries_): Change from private to protected.
1041
1042 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1043
1044 * icf.cc (get_section_contents): Replace copies of reloc
1045 vectors with const references.
1046
1047 2014-04-02 Cary Coutant <ccoutant@google.com>
1048
1049 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1050 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1051 * configure: Regenerate.
1052 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1053 -fno-use-linker-plugin.
1054 (LINK1, CXXLINK1): Add it to the link command.
1055 * testsuite/Makefile.in: Regenerate.
1056
1057 2014-03-12 Alan Modra <amodra@gmail.com>
1058
1059 * Makefile.in: Regenerate.
1060
1061 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1062
1063 * symtab.h (Symbol::set_nonvis): New function.
1064
1065 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1066
1067 * symtab.cc (Sized_symbol<32>::init_output_data):
1068 Instantiate the template.
1069 (Sized_symbol<64>::init_output_data): Likewise.
1070
1071 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1072
1073 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1074 adjust dynamic symbol value.
1075 * target.h (Target::adjust_dyn_symbol): New function.
1076 (Target::do_adjust_dyn_symbol): New function.
1077
1078 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1079
1080 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1081 Get the value of DYNAMIC_CUSTOM dynamic entry.
1082 * output.h (Output_data_dynamic::add_custom): New function.
1083 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1084 dynamic entry.
1085 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1086 * target.h (Target::dynamic_tag_custom_value): New function.
1087 (Target::do_dynamic_tag_custom_value): New function.
1088
1089 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1090
1091 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1092 dynsym indexes.
1093 * target.h (Target::has_custom_set_dynsym_indexes): New function.
1094 (Target::do_has_custom_set_dynsym_indexes): New function.
1095 (Target::set_dynsym_indexes): New function.
1096 (Target::do_set_dynsym_indexes): New function.
1097
1098 2014-03-07 Alan Modra <amodra@gmail.com>
1099
1100 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1101 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1102 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1103 (Powerpc_relocate_functions::has_overflow_bitfield,
1104 overflowed): Use the above.
1105 (Target_powerpc::Relocate::relocate): Correct overflow checking
1106 for a number of relocations. Modify overflow test for 16-bit
1107 fields in instructions to signed/unsigned according to whether
1108 the field takes a signed or unsigned value.
1109
1110 2014-03-05 Alan Modra <amodra@gmail.com>
1111
1112 Update copyright years.
1113
1114 2014-03-05 Alan Modra <amodra@gmail.com>
1115
1116 * powerpc.cc (Target_powerpc::Scan::local, global): Support
1117 R_PPC64_ADDR64_LOCAL.
1118 (Target_powerpc::Relocate::relocate): Likewise.
1119
1120 2014-03-03 Alan Modra <amodra@gmail.com>
1121
1122 * dwp.cc (print_version): Update copyright year to current.
1123
1124 2014-02-10 Alan Modra <amodra@gmail.com>
1125
1126 * po/gold.pot: Regenerate.
1127
1128 2014-02-06 Cary Coutant <ccoutant@google.com>
1129
1130 Fix problem where -u is ignored when a weak undef is seen.
1131
1132 * archive.cc (Library_base::should_include_member): Reorder
1133 code to check for -u option if a weak undef has already been seen.
1134 * testsuite/Makefile.am (weak_undef_test_2): New test case.
1135 * testsuite/Makefile.in: Regenerate.
1136 * testsuite/weak_undef_file3.cc: New file.
1137 * testsuite/weak_undef_file4.cc: New file.
1138 * testsuite/weak_undef_test_2.cc: New file.
1139
1140 2014-02-05 Cary Coutant <ccoutant@google.com>
1141
1142 Fix issues with gold undefined symbol diagnostics.
1143
1144 PR binutils/15435
1145 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1146 check to here.
1147 * target-reloc.h (is_strong_undefined): New function.
1148 (relocate_section): Move undef vtable symbol check from here.
1149 Check for is_strong_undefined.
1150
1151 2014-02-05 Cary Coutant <ccoutant@google.com>
1152
1153 Fix problems with the --dynamic-list option.
1154
1155 PR gold/13577
1156 * options.cc (General_options::parse_dynamic_list):
1157 Set have_dynamic_list_.
1158 (General_options::General_options): Initialize have_dynamic_list_.
1159 (General_options::finalize): Turn off -Bsymbolic and
1160 -Bsymbolic-functions if --dynamic-list provided.
1161 * options.h (General_options::have_dynamic_list): New function.
1162 (General_options::have_dynamic_list_): New data member.
1163 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1164 correctly.
1165
1166 PR gold/16530
1167 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1168 in --dynamic-list, mark it.
1169
1170 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1171 (dynamic_list_2): New test case.
1172 * testsuite/Makefile.in: Regenerate.
1173 * testsuite/dynamic_list_2.cc: New file.
1174 * testsuite/dynamic_list_2.t: New file.
1175 * testsuite/dynamic_list_lib1.cc: New file.
1176 * testsuite/dynamic_list_lib2.cc: New file.
1177 * testsuite/gc_dynamic_list_test.c: New file.
1178 * testsuite/gc_dynamic_list_test.sh: New file.
1179 * testsuite/gc_dynamic_list_test.t: New file.
1180
1181 2014-01-28 Cary Coutant <ccoutant@google.com>
1182
1183 Add .gdb_index version 7 support.
1184
1185 * gold/dwarf_reader.cc: include <utility> (for make_pair).
1186 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1187 debug sections.
1188 (Dwarf_ranges_table::read_ranges_table): Likewise.
1189 (Dwarf_pubnames_table::read_section): Check for GNU-style
1190 sections, and for compressed debug sections.
1191 (Dwarf_pubnames_table::read_header): Compute end address of table.
1192 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
1193 for end of list by offset, not by offset == 0.
1194 (Dwarf_info_reader::do_read_string_table): Check for compressed
1195 debug sections.
1196 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1197 Initialize new data members.
1198 (Dwarf_pubnames_table::next_name): return flag_byte.
1199 (Dwarf_pubnames_table::end_of_table_): New data member.
1200 (Dwarf_pubnames_table::is_gnu_style_): New data member.
1201 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1202 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1203 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1204 read skeleton type unit DIEs.
1205 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1206 (Gdb_index::do_write): Write flag_byte.
1207 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1208 (Gdb_index::Cu_vector): Store flags along with cu indexes.
1209 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1210 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1211
1212 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
1213
1214 * version.cc (print_version): Update copyright year to 2014.
1215
1216 2013-12-19 Dimitry Andric <dimitry@andric.com>
1217
1218 * stringpool.cc (Stringpool_template::reserve): Add
1219 HAVE_UNORDERED_MAP case.
1220 * stringpool.cc (Stringpool_template::print_stats): Likewise.
1221
1222 2013-12-18 Cary Coutant <ccoutant@google.com>
1223
1224 * configure.ac: Check for <unordered_set> and <unordered_map>.
1225 * config.in: Regenerate.
1226 * configure: Regenerate.
1227 * system.h: Use <unordered_set> and <unordered_map> if available.
1228
1229 2013-12-10 Roland McGrath <mcgrathr@google.com>
1230
1231 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1232 with $(INSTALL_PROGRAM_ENV).
1233 * Makefile.in: Regenerate.
1234
1235 2013-11-22 Cary Coutant <ccoutant@google.com>
1236
1237 * configure.ac: Add check for which library is needed for
1238 dlopen.
1239 * configure: Regenerate.
1240
1241 2013-11-22 Cary Coutant <ccoutant@google.com>
1242
1243 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1244 assembler.
1245 * testsuite/Makefile.in: Regenerate.
1246
1247 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
1248
1249 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1250 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1251 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1252 (Target_x86_64<size>::Scan::local): Likewise.
1253 (Target_x86_64<size>::Scan::global): Likewise.
1254 (Target_x86_64<size>::Relocate::relocate): Likewise.
1255 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1256 Likewise.
1257 (Target_x86_64<size>::Scan::check_non_pic(): Handle
1258 R_X86_64_PC32_BND.
1259
1260 * testsuite/Makefile.am (check_PROGRAMS): Add
1261 exception_x86_64_bnd_test.
1262 (exception_x86_64_bnd_test_SOURCES): New macro.
1263 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1264 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1265 (exception_x86_64_bnd_test_LDADD): Likewise.
1266 (exception_x86_64_bnd_1.o): New rule.
1267 (exception_x86_64_bnd_2.o): Likewise.
1268 * testsuite/Makefile.in: Regenerated.
1269
1270 2013-11-15 Alan Modra <amodra@gmail.com>
1271
1272 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1273 accessor.
1274 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1275 Only call ppc64_local_entry_offset for 64-bit. Restrict
1276 symval_for_branch lookup to ELFv1.
1277 (Stub_table::add_plt_call_entry): Use unsigned int off.
1278 (Output_data_glink::Address, invalid_address): New.
1279 (Output_data_glink::add_eh_frame): Move out of line. Add
1280 support for ELFv2.
1281 (Output_data_glink::add_global_entry, find_global_entry,
1282 global_entry_address): New functions.
1283 (Output_data_glink::global_entry_stubs_, end_branch_table_,
1284 ge_size): New variables.
1285 (Output_data_glink::set_final_data_size): Add global entry
1286 stub sizing.
1287 (Output_data_glink::do_write): Write global entry stubs.
1288 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1289 parameter. Return true for ELFv2. Adjust callers.
1290 (Target_powerpc::Scan::local, global): Restrict opd lookup to
1291 ELFv1. Similarly for ifunc and dynamic relocation processing
1292 specific to ELFv1. Recognize that symbols are defined on
1293 their plt entries for ELFv2.
1294 (Target_powerpc::symval_for_branch): Assert if called for
1295 ELFv2 or ppc32.
1296 (Target_powerpc::Relocate::relocate): Use global entry plt
1297 stub for symbol value if such exists on ELFv2.
1298 (Target_powerpc::Relocate::relocate): Don't call
1299 symval_for_branch when ELFv2. Do adjust for local entry
1300 offset when ELFv2.
1301 (Target_powerpc::do_dynsym_value): Set symbols to global entry
1302 plt stub for ELFv2.
1303 (Target_powerpc::do_plt_address_for_global): Similarly.
1304
1305 2013-11-14 Cary Coutant <ccoutant@google.com>
1306
1307 Revert patch -- this did not fix the problem, and there is
1308 no race there.
1309
1310 2013-11-14 Cary Coutant <ccoutant@google.com>
1311
1312 PR gold/14860
1313 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1314 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1315 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1316 updating fde_offsets_.
1317 (Eh_frame_hdr::lock_): New data member.
1318
1319 2013-11-14 Cary Coutant <ccoutant@google.com>
1320
1321 * dwp.cc (Dwo_file_entry): New type.
1322 (File_list): Use Dwo_file_entry.
1323 (Dwo_file::verify): New function.
1324 (Dwo_file::verify_dwo_list): New function.
1325 (Dwo_file::sized_verify_dwo_list): New function.
1326 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1327 list.
1328 (Dwp_options): New enum type.
1329 (dwp_options): Add --verify-only.
1330 (usage): Likewise.
1331 (main): Likewise.
1332 * dwp.h (gold_info): Add declaration.
1333
1334 2013-11-14 Cary Coutant <ccoutant@google.com>
1335
1336 PR gold/14860
1337 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1338 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1339 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1340 updating fde_offsets_.
1341 (Eh_frame_hdr::lock_): New data member.
1342
1343 2013-11-06 Cary Coutant <ccoutant@google.com>
1344
1345 PR gold/15758
1346 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1347 before reloc sections.
1348
1349 2013-11-04 Alan Modra <amodra@gmail.com>
1350
1351 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1352 (Symbol::needs_dynamic_reloc): Test new flag.
1353 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1354 (Target_powerpc::Scan::get_reference_flags): Add target param.
1355 Return FUNC_DESC_ABI for 64-bit ELFv1.
1356 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1357 call.
1358 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1359 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1360
1361 2013-10-31 Cary Coutant <ccoutant@google.com>
1362
1363 Restore support for dwp v2 DWARF package file format.
1364
1365 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1366 tu_length parameter. Adjust all callers.
1367 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1368 * dwp.cc: Include dwarf.h.
1369 (Section_bounds): New struct type.
1370 (Unit_set): New struct type.
1371 (Dwo_file::Dwo_file): Initialize new data member.
1372 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1373 Combine and rename to...
1374 (Dwo_file::read_unit_index): ...this.
1375 (Dwo_file::sized_read_compunit_index)
1376 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1377 (Dwo_file::sized_read_unit_index): ...this.
1378 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1379 parameters; add section_id parameter.
1380 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1381 (Dwo_file::add_unit_set): ...this.
1382 (Dwo_file::shndx_map_): Remove.
1383 (Dwo_file::sect_offsets_): New data member.
1384 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1385 (Dwp_output_file::add_section): Rename to...
1386 (Dwp_output_file::add_contribution): ...this.
1387 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1388 (Dwp_output_file::add_tu_set): Likewise.
1389 (Dwp_output_file::Contribution): New type.
1390 (Dwp_output_file::Section::contributions): New data member.
1391 (Dwp_output_file::Cu_or_tu_set): Remove.
1392 (Dwp_output_file::Section::Section): New ctor.
1393 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1394 (Dwp_output_file::Dwp_index::Section_table): New type.
1395 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1396 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1397 parameter.
1398 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1399 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1400 (Dwp_output_file::Dwp_index::section_table): New member function.
1401 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1402 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1403 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1404 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1405 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1406 (Dwp_output_file::Dwp_index::section_table_): New data member.
1407 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1408 (Dwp_output_file::add_output_section): New member function.
1409 (Dwp_output_file::write_new_section): New member function.
1410 (Dwp_output_file::write_contributions): New member function.
1411 (Dwp_output_file::section_id_map_): New data member.
1412 (class Dwo_id_info_reader): Remove.
1413 (class Unit_reader): New class.
1414 (get_dwarf_section_name): New function.
1415 (Dwo_file::read_executable): Adjust initializations of class data.
1416 (Dwo_file::read): Add support for v2 package file format.
1417 (Dwo_file::read_unit_index): Likewise.
1418 (Dwo_file::sized_read_unit_index): Likewise.
1419 (Dwo_file::copy_section): Likewise.
1420 (Dwo_file::add_unit_set): Likewise.
1421 (Dwp_output_file::add_output_section): Likewise.
1422 (Dwp_output_file::add_contribution): Likewise.
1423 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1424 for empty slot.
1425 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1426 file format.
1427 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1428 slot.
1429 (Dwp_output_file::initialize): Remove unused function.
1430 (Dwp_output_file::finalize): Add support for v2 package file format.
1431 (Dwp_output_file::write_index): Likewise.
1432 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1433 function prototype.
1434
1435 2013-10-31 Cary Coutant <ccoutant@google.com>
1436
1437 * configure.ac: Fix check for -fmerge-constants.
1438 * configure.ac: Regenerate.
1439
1440 2013-10-30 Roland McGrath <mcgrathr@google.com>
1441
1442 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1443 Correct 9-byte nop sequence to match what the assembler generates.
1444
1445 2013-10-30 Alan Modra <amodra@gmail.com>
1446
1447 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1448 ppc64_local_entry_offset, ppc64_local_entry_offset,
1449 do_read_symbols): New functions.
1450 (Powerpc_relobj::e_flags_, st_other_): New vars.
1451 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1452 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1453 (Powerpc_relobj::e_flags_): New var.
1454 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1455 and adjust for ELFv2.
1456 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1457 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1458 (Powerpc_dynobj::do_find_special_sections): Likewise.
1459 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1460 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1461 to ELFv2 local entry.
1462 (Target_powerpc::do_relax): No thread safe barriers needed for
1463 ELFv2.
1464 (Output_data_plt_powerpc::initial_plt_entry_size_,
1465 plt_entry_size): Delete. Replace all uses with
1466 first_plt_entry_offset() and plt_entry_size().
1467 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1468 reserved_size parm. Update callers.
1469 (Output_data_plt_powerpc::entry_count): Update.
1470 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1471 and use Target_powerpc::first_plt_entry_offset().
1472 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1473 rename to plt_entry_size.
1474 (Output_data_plt_powerpc::add_ifunc_entry,
1475 add_local_ifunc_entry): Adjust reloc for ELFv2.
1476 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1477 (glink_eh_frame_fde_64v2): New.
1478 (Stub_table::plt_call_size): Support ELFv2 sizing.
1479 (Output_data_glink::add_eh_frame): Use the new FDE.
1480 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1481 (Stub_table::do_write): Write ELFv2 stubs and glink.
1482 (Target_powerpc::Relocate::relocate): Replaces nop after call
1483 with ld 2,24(1) and adjust local offset destination for ELFv2.
1484
1485 2013-10-30 Alan Modra <amodra@gmail.com>
1486
1487 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1488 (Target_powerpc::Scan::global, local): Likewise.
1489 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
1490 on all ppc64 @h and @ha relocs.
1491
1492 2013-10-14 Alan Modra <amodra@gmail.com>
1493
1494 * output.h (Output_data_got::add_constant): Tidy.
1495 (Output_data_got::add_constant_pair): New function.
1496 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1497 methods used so as to first call reserve_ent().
1498
1499 2013-10-11 Roland McGrath <mcgrathr@google.com>
1500
1501 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1502 add_got_entry and add_got_entry_pair.
1503
1504 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1505 (HAVE_PUBNAMES): Likewise.
1506 * configure: Regenerate.
1507
1508 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1509 * testsuite/Makefile.in: Regenerate.
1510
1511 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1512 Remove const from declaration.
1513 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1514 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1515 * output.h (Output_file_header): Remove const from member target_
1516 and corresponding constructor argument.
1517 * output.cc (Output_file_header::Output_file_header): Update prototype.
1518 (Output_file_header::do_sized_write): Use this->target_ in place
1519 of parameters()->target().
1520
1521 * testsuite/undef_symbol.cc (Foo::get_a): New method.
1522
1523 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1524 * configure: Regenerate.
1525 * Makefile.in: Regenerate.
1526 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1527 * testsuite/merge_string_literals_2.c: Likewise.
1528 * testsuite/Makefile.am
1529 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1530 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1531 literal -fmerge-constants.
1532 * testsuite/Makefile.in: Regenerate.
1533
1534 * i386.cc (Target_i386): Remove unused member dynbss_.
1535 * arm.cc (Target_arm): Likewise.
1536 * powerpc.cc (Target_powerpc): Likewise.
1537 * sparc.cc (Target_sparc): Likewise.
1538 * tilegx.cc (Target_tilegx): Likewise.
1539 * x86_64.cc (Target_x86_64): Likewise.
1540 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1541 type_signature_, type_offset_.
1542 * plugin.h (Plugin_hook): Remove unused member layout_.
1543 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1544 mapfile_.
1545 (Read_member): Remove unused members input_objects_, symtab_,
1546 mapfile_, layout_.
1547 (Check_library): Remove unused member symtab_.
1548 * archive.h (Lib_group): Remove unused member lib_.
1549 * archive.cc (Lib_group::Lib_group): Update initializer.
1550 * incremental.h (Incremental_binary): Remove unused member target_.
1551 (Incremental_script_entry): Removed unused member script_.
1552 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1553 * icf.h (Icf): Remove unused member num_tracked_relocs.
1554
1555 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1556 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1557 its only use.
1558 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1559
1560 * archive.h: Use struct rather than class for forward declaration
1561 of Read_symbols_data.
1562
1563 2013-10-07 Cary Coutant <ccoutant@google.com>
1564
1565 PR gold/16010
1566 * testsuite/Makefile.am (icf_test): Fix dependencies.
1567 (icf_safe_test): Likewise.
1568 (icf_safe_so_test): Likewise.
1569 (large_symbol_alignment): Add empty _LDADD rule.
1570 * testsuite/Makefile.in: Regenerate.
1571
1572 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
1573
1574 PR gold/15927
1575 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1576 relocation for R_X86_64_32 on x32.
1577
1578 2013-08-27 Roland McGrath <mcgrathr@google.com>
1579
1580 * output.cc (Output_segment::set_section_addresses): Take new
1581 Target* argument. If target->isolate_execinstr() and the segment
1582 is executable and starts at a target->abi_pagesize() boundary,
1583 pad its end out to a target->abi_pagesize() boundary with code fill.
1584 * output.h (Output_segment::set_section_addresses): Update decl.
1585 * layout.h (Layout::check_output_data_for_reset_values): Take new
1586 argument RELAX_OUTPUTS.
1587 (Layout): New member relax_output_list_.
1588 (Layout::add_relax_output): New method.
1589 * layout.cc (Layout::Layout): Update constructor.
1590 (Layout::reset_relax_output): New method.
1591 (Layout::clean_up_after_relaxation): Call it.
1592 (Layout::prepare_for_relaxation): Update caller.
1593 (Layout::set_segment_offsets): Update callers of set_section_addresses.
1594 Call reset_relax_output before re-processing segments for
1595 isolate_execinstr case.
1596 (Layout::write_data): Handle relax_output_list_.
1597 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1598 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1599
1600 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1601
1602 PR binutils/15834
1603 * object.h: Fix typos.
1604
1605 2013-08-16 Roland McGrath <mcgrathr@google.com>
1606
1607 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1608 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1609
1610 2013-08-07 Cary Coutant <ccoutant@google.com>
1611
1612 Revert support for v2 DWP files:
1613
1614 2013-03-01 Cary Coutant <ccoutant@google.com>
1615
1616 Add dwp support for v2 DWARF package file format.
1617 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1618 tu_length parameter. Adjust all callers.
1619 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1620 * dwp.cc: Include dwarf.h.
1621 (Section_bounds): New struct type.
1622 (Unit_set): New struct type.
1623 (Dwo_file::Dwo_file): Initialize new data member.
1624 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1625 Combine and rename to...
1626 (Dwo_file::read_unit_index): ...this.
1627 (Dwo_file::sized_read_compunit_index)
1628 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1629 (Dwo_file::sized_read_unit_index): ...this.
1630 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1631 parameters; add section_id parameter.
1632 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1633 (Dwo_file::add_unit_set): ...this.
1634 (Dwo_file::shndx_map_): Remove.
1635 (Dwo_file::sect_offsets_): New data member.
1636 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1637 (Dwp_output_file::add_section): Rename to...
1638 (Dwp_output_file::add_contribution): ...this.
1639 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1640 (Dwp_output_file::add_tu_set): Likewise.
1641 (Dwp_output_file::Contribution): New type.
1642 (Dwp_output_file::Section::contributions): New data member.
1643 (Dwp_output_file::Cu_or_tu_set): Remove.
1644 (Dwp_output_file::Section::Section): New ctor.
1645 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1646 (Dwp_output_file::Dwp_index::Section_table): New type.
1647 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1648 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1649 parameter.
1650 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1651 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1652 (Dwp_output_file::Dwp_index::section_table): New member function.
1653 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1654 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1655 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1656 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1657 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1658 (Dwp_output_file::Dwp_index::section_table_): New data member.
1659 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1660 (Dwp_output_file::add_output_section): New member function.
1661 (Dwp_output_file::write_new_section): New member function.
1662 (Dwp_output_file::write_contributions): New member function.
1663 (Dwp_output_file::section_id_map_): New data member.
1664 (class Dwo_id_info_reader): Remove.
1665 (class Unit_reader): New class.
1666 (get_dwarf_section_name): New function.
1667 (Dwo_file::read_executable): Adjust initializations of class data.
1668 (Dwo_file::read): Add support for v2 package file format.
1669 (Dwo_file::read_unit_index): Likewise.
1670 (Dwo_file::sized_read_unit_index): Likewise.
1671 (Dwo_file::copy_section): Likewise.
1672 (Dwo_file::add_unit_set): Likewise.
1673 (Dwp_output_file::add_output_section): Likewise.
1674 (Dwp_output_file::add_contribution): Likewise.
1675 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1676 for empty slot.
1677 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1678 file format.
1679 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1680 slot.
1681 (Dwp_output_file::initialize): Remove unused function.
1682 (Dwp_output_file::finalize): Add support for v2 package file format.
1683 (Dwp_output_file::write_index): Likewise.
1684 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1685 function prototype.
1686
1687 2013-07-31 Cary Coutant <ccoutant@google.com>
1688
1689 * object.cc (Sized_relobj::do_output_section_address): New function.
1690 (Sized_relobj): Instantiate explicitly.
1691 * object.h (Object::output_section_address): New function.
1692 (Object::do_output_section_address): New function.
1693 (Sized_relobj::do_output_section_address): New function.
1694 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1695
1696 2013-07-30 Cary Coutant <ccoutant@google.com>
1697 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1698
1699 * parameters.cc (Parameters::entry): Return target-specific entry
1700 symbol name.
1701 * target.h (Target::entry_symbol_name): New function.
1702 (Target_info::entry_symbol_name): New data member.
1703
1704 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1705 * i386.cc (Target_i386::i386_info): Likewise.
1706 (Target_i386_nacl::i386_nacl_info): Likewise.
1707 * sparc.cc (Target_sparc::sparc_info): Likewise.
1708 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1709 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1710 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1711 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1712
1713 2013-07-22 Sterling Augustine <saugustine@google.com>
1714
1715 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1716 Convert parameter shndx to local variable. Add parameters symtab
1717 and symtab_size. Scan over section names. Find relocation
1718 section corresponding to current section. Create and initialize
1719 reloc_mapper_ and reloc_type_.
1720 (Dwarf_pubnames_table::read_header): Add assertion. Change
1721 unit_length to off_t. Initialize member unit_length_. Fill in field
1722 cu_offset_.
1723 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1724 Initialize new fields unit_length_ and cu_offset_.
1725 (Dwarf_pubnames_table::read_section): Update prototype.
1726 (Dwarf_pubnames_table::cu_offset): New member function.
1727 (Dwarf_pubnames_table::subsection_size): Likewise.
1728 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1729 New fields.
1730 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1731 member functions public.
1732 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1733 Update comment. Rework logic. Move repeated parts to...
1734 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1735 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1736 pubtypes_table_, and stmt_list_offset.
1737 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1738 Gdb_index::find_pubtype_offset,
1739 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1740 (Gdb_index::pubnames_read): Update prototype and rework logic.
1741 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1742 Forward declare.
1743 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1744 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1745 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1746 Gdb_index::map_pubtable_to_dies):
1747 Declare functions.
1748 (Gdb_index::pubnames_read): Update declaration.
1749 (Gdb_index::Pubname_offset_map): New type.
1750 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1751 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1752 Gdb_index::stmt_list_offset): Declare.
1753 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1754 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1755 Gdb_index::pubtypes_offset_): Remove.
1756
1757 2013-07-19 Roland McGrath <mcgrathr@google.com>
1758
1759 * options.h (General_options): Add -Trodata-segment option.
1760 * parameters.cc (Parameters::check_rodata_segment): New function.
1761 (Parameters::set_target_once): Call it.
1762 * parameters.h (Parameters): Declare it (private member function).
1763 * layout.cc (load_seg_unusable_for_headers): New function, broken
1764 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1765 then validate rodata segment rather than text segment.
1766 (relaxation_loop_body): Call that.
1767 (is_text_segment): New function. Don't admit a non-executable
1768 segment if TARGET->isolate_execinstr().
1769 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1770
1771 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1772
1773 PR gold/15070
1774 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1775 * nacl.h (Sniff_file::View::View): Request aligned view.
1776
1777 2013-07-11 Cary Coutant <ccoutant@google.com>
1778
1779 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1780 correct BRLT entry size.
1781
1782 2013-07-03 Alan Modra <amodra@gmail.com>
1783
1784 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1785 comment.
1786
1787 2013-07-01 Cary Coutant <ccoutant@google.com>
1788
1789 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1790 reloc_type_.
1791 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1792 (Dwarf_ranges_table::lookup_reloc): New function.
1793 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1794 reloc_type_.
1795 (Dwarf_ranges_table::lookup_reloc): New function.
1796 (Dwarf_ranges_table::reloc_type_): New data member.
1797
1798 2013-06-27 Jing Yu <jingyu@google.com>
1799
1800 PR gold/15662
1801 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1802 function.
1803 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1804 (Target_powerpc::do_relax): Call the above.
1805
1806 2013-06-27 Cary Coutant <ccoutant@google.com>
1807
1808 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1809 on garbage collected .opd section.
1810
1811 2013-06-27 Alan Modra <amodra@gmail.com>
1812
1813 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1814 is non-zero.
1815 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1816 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1817
1818 2013-06-14 Cary Coutant <ccoutant@google.com>
1819
1820 * resolve.cc (Symbol::override_base): Don't override st_type
1821 from plugin placeholder symbols.
1822 (Symbol_table::resolve): Likewise.
1823 (Symbol_table::should_override): Don't complain about TLS mismatch
1824 if the TO symbol is a plugin placeholder.
1825 * testsuite/Makefile.am (plugin_test_tls): New test.
1826 * testsuite/Makefile.in: Regenerate.
1827 * testsuite/plugin_test_tls.sh: New test script.
1828 * testsuite/two_file_test_2_tls.cc: New test source.
1829 * testsuite/two_file_test_tls.cc: New test source.
1830
1831 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1832
1833 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1834 the maximum segment alignment is larger than the page size.
1835 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1836 correctly aligns the symbols with large alignemnt.
1837 * testsuite/Makefile.in: Regenerate.
1838 * testsuite/large_symbol_alignment.cc: New file.
1839
1840 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1841 Sriraman Tallam <tmsriram@google.com>
1842
1843 * options.h (sort_section): New option.
1844 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1845 Rename from Input_section_sort_section_name_special_ordering_compare.
1846 (Input_section_sort_section_name_compare): New struct.
1847 * output.cc (Output_section::Input_section_sort_section_name_compare::
1848 operator()): New function.
1849 (Output_section::sort_attached_input_sections): Use new sort function
1850 for .text if --sort-section=name is specified.
1851 * layout.cc (Layout::make_output_section):
1852 Add sorting by name when --sort-section=name is specified.
1853 * testsuite/Makefile.am (text_section_grouping): Test option
1854 --sort-section=name.
1855 * testsuite/Makefile.in: Regenerate.
1856 * testsuite/section_sorting_name.cc: New file.
1857 * testsuite/section_sorting_name.sh: New file.
1858
1859 2013-05-21 Cary Coutant <ccoutant@google.com>
1860
1861 * symtab.h (Symbol::is_cxx_vtable): New function.
1862 * target-reloc.h (relocate_section): Check for vtable symbol.
1863 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1864 * testsuite/Makefile.in: Regenerate.
1865 * testsuite/missing_key_func.cc: New test source.
1866 * testsuite/missing_key_func.sh: New test script.
1867
1868 2013-05-21 Cary Coutant <ccoutant@google.com>
1869
1870 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1871 type of enclosing symbol.
1872 (Relocate_info::location): Check symbol type when describing symbol.
1873 * object.h (Symbol_location_info): Remove unused line_number;
1874 add enclosing_symbol_type.
1875 * testsuite/debug_msg.sh: Adjust expected output.
1876
1877 2013-05-13 Cary Coutant <ccoutant@google.com>
1878
1879 * configure.ac: Export DEFAULT_TARGET.
1880 * configure: Regenerate.
1881 * Makefile.in: Regenerate.
1882 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1883 * testsuite/Makefile.in: Regenerate.
1884 * testsuite/debug_msg.sh: Delete duplicate tests.
1885 Don't check undef_int error message match for powerpc where the
1886 source file and line number aren't available.
1887
1888 2013-05-10 Roland McGrath <mcgrathr@google.com>
1889
1890 * options.h (General_options): Add --rosegment-gap option.
1891 * options.cc (finalize): --rosegment-gap implies --rosegment.
1892 * layout.cc (set_segment_offsets): Let user option override
1893 target->rosegment_gap().
1894
1895 2013-05-10 Roland McGrath <mcgrathr@google.com>
1896
1897 * options.h (General_options): Remove leading space from help
1898 messages for -nostdlib and --rosegment.
1899
1900 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1901
1902 PR ld/15365
1903 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1904
1905 2013-05-03 Alan Modra <amodra@gmail.com>
1906
1907 * merge.cc (Output_merge_string::do_add_input_section): Correct
1908 scan for number of strings. Rename vars to avoid shadowing.
1909 Include missing terminator in input_size_.
1910
1911 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1912
1913 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1914 Restore empty string handling.
1915
1916 2013-05-01 Cary Coutant <ccoutant@google.com>
1917
1918 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1919 uninitialized warning.
1920
1921 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1922
1923 * output.cc (Output_section::add_merge_input_section): Allow
1924 to merge sections if the alignment is more than character size.
1925 * merge.h (Output_merge_string::Output_merge_string): Remove
1926 assert.
1927 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1928 only not-null strings. Check the alignment of strings.
1929 * stringpool.h
1930 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1931 alignment as the argument.
1932 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1933 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1934 Align non-zero length strings according to the addralign_.
1935 (Stringpool_template<Stringpool_char>::set_string_offsets):
1936 Updating offsets according to the given alignment.
1937 * testsuite/Makefile.am (text_section_grouping): Test if string
1938 literals are getting merged.
1939 * testsuite/Makefile.in: Regenerate.
1940 * testsuite/merge_string_literals_1.c: New file.
1941 * testsuite/merge_string_literals_2.c: Ditto.
1942 * testsuite/merge_string_literals.sh: Ditto.
1943
1944 2013-04-26 Ian Lance Taylor <iant@google.com>
1945
1946 * target-reloc.h (relocate_section): If the reloc offset is out of
1947 range, pass VIEW as NULL to relocate.relocate.
1948 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1949 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1950 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1951 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1952 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1953 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1954
1955 2013-04-26 Geoff Pike <gpike@chromium.org>
1956
1957 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1958 * layout.cc (Hash_task): New class.
1959 (Layout::queue_build_id_tasks): New function.
1960 (Layout::write_build_id): Handle single-thread portion of build ID
1961 computation. (In some cases, all of it is single-threaded.) Replace
1962 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1963 functionality in fewer lines of code.
1964 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1965 * options.h (General_options): make "--build-id" default to tree
1966 rather than sha1. Add two new options related to --build-id=tree:
1967 --build-id-chunk-size-for-treehash and
1968 --build-id-min-file-size-for-treehash.
1969 * Makefile.am: add testing of --build-id=tree and related new options
1970 (these tests will be invoked by "make check").
1971 * Makefile.in: Regenerate.
1972
1973 2013-04-25 Alan Modra <amodra@gmail.com>
1974
1975 * configure.tgt: Add powerpcle and powerpc64le.
1976
1977 2013-04-22 Alan Modra <amodra@gmail.com>
1978
1979 PR gold/15355
1980 * layout.cc (Layout::segment_precedes): Allow more than one
1981 segment with the same type and flags.
1982
1983 2013-04-15 Cary Coutant <ccoutant@google.com>
1984
1985 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1986 allocate space in file for BSS sections.
1987
1988 2013-04-15 Cary Coutant <ccoutant@google.com>
1989
1990 * script-sections.cc (Orphan_output_section): Reset address
1991 to zero after each orphaned section for relocatable links.
1992
1993 2013-04-15 Cary Coutant <ccoutant@google.com>
1994
1995 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1996 section starting address for relocatable link.
1997 * testsuite/Makefile.am (script_test_11): New test.
1998 * testsuite/Makefile.in: Regenerate.
1999 * testsuite/script_test_11.c: New source file.
2000 * testsuite/script_test_11.t: New linker script.
2001
2002 2013-04-13 Alan Modra <amodra@gmail.com>
2003
2004 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2005 owner when sections are not adjacent and exceed group size.
2006 (Target_powerpc::group_sections): Handle corner case.
2007 (Target_powerpc::Branch_info::make_stub): Handle case where
2008 stub table doesn't exist due to branches in non-exec sections.
2009 (Target_powerpc::Relocate::relocate): Likewise.
2010
2011 2013-04-11 Alan Modra <amodra@gmail.com>
2012
2013 PR gold/15354
2014 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2015 .branch_lt to match bfd ld. Adjust comments throughout file.
2016
2017 2013-04-04 Ian Lance Taylor <iant@google.com>
2018
2019 GCC PR c++/56840
2020 * object.cc (do_layout_deferred_sections): Handle .eh_frame
2021 sections before checking whether they are included in the link.
2022
2023 2013-03-29 Sriraman Tallam <tmsriram@google.com>
2024
2025 * archive.cc (Archive::get_elf_object_for_member): Create the elf
2026 object before calling the plugin claim_file handler. Pass the elf
2027 object of the archive to the plugin. Delete the elf object if the
2028 plugin claims the file.
2029
2030 2013-03-21 Alan Modra <amodra@gmail.com>
2031
2032 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2033 segment when omagic.
2034
2035 2013-03-21 Alan Modra <amodra@gmail.com>
2036
2037 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2038 comparison warning.
2039 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2040 uninitialized" warning.
2041
2042 2013-03-20 Alan Modra <amodra@gmail.com>
2043
2044 * symtab.h (Symbol::clear_version): New function.
2045 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2046 is_needed by weak references. Clear version for symbols defined
2047 in as-needed objects that are not needed.
2048
2049 2013-03-15 Alan Modra <amodra@gmail.com>
2050
2051 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2052 static and public. Add report_err param. Return false for data refs.
2053 (Target_powerpc::rela_dyn_section): New overloaded function.
2054 (Target_powerpc::plt_, iplt_): Elucidate.
2055 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2056 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2057 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2058 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2059 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2060 push_branch and make_plt_entry for ifunc syms when
2061 reloc_needs_plt_for_ifunc.
2062 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2063 for ifunc unless reloc_needs_plt_for_ifunc.
2064
2065 2013-03-15 Alan Modra <amodra@gmail.com>
2066
2067 * gc.h (gc_process_relocs): Don't look through function descriptors.
2068 * icf.cc (get_section_contents): Do so here instead.
2069
2070 2013-03-13 Alan Modra <amodra@gmail.com>
2071
2072 * powerpc.cc (is_branch_reloc): Forward declare.
2073 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2074 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2075 false for 64-bit, true for 32-bit non-branch relocs.
2076 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2077 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2078 nm output.
2079 (icf_safe_test): Generate linker map file as well as nm output.
2080 (icf_safe_so_test): Likewise.
2081 * testsuite/Makefile.in: Regenerate.
2082 * testsuite/icf_test.sh: Parse linker map file to determine
2083 section folding.
2084 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2085 * testsuite/icf_safe_so_test.sh: Likewise.
2086 (X86_32_or_ARM_specific_safe_fold): Merge into..
2087 (arch_specific_safe_fold): ..this.
2088 (X86_64_specific_safe_fold): Delete unused function.
2089
2090 2013-03-12 Alan Modra <amodra@gmail.com>
2091
2092 * gc.h (gc_process_relocs): Look through function descriptors
2093 to determine shndx, symvalue and addend used by ICF. Tidy
2094 variable duplication.
2095
2096 2013-03-11 Alan Modra <amodra@gmail.com>
2097
2098 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2099 * layout.cc (Layout_task_runner::run): ..to here.
2100 * symtab.h (struct Symbol_location): Extract from..
2101 (class Symbol_table): ..here.
2102 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2103 * target.h (class Target): Add function_location and
2104 do_function_location functions.
2105 (class Sized_target): Add do_function_location.
2106 * object.h (class Sized_relobj_file): Move find_shdr..
2107 (class Object): ..to here.
2108 * object.cc: Likewise. Update to suit. Instantiate.
2109 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2110 * powerpc.cc (class Powerpc_dynobj): New.
2111 (Target_powerpc::do_function_location): New function.
2112 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2113 (Powerpc_dynobj::do_read_symbols): New function.
2114 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2115
2116 2013-03-08 Ian Lance Taylor <iant@google.com>
2117
2118 * options.cc (General_options::string_to_object_format): Accept
2119 "default".
2120
2121 2013-03-08 Alan Modra <amodra@gmail.com>
2122
2123 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2124 pointer to Post_fde.
2125 (struct Post_fde): Move definition to here..
2126 * ehframe.cc (struct Post_fde): ..from here.
2127 (Cie::write): Don't alloc Post_fde.
2128 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2129
2130 2013-03-07 Alan Modra <amodra@gmail.com>
2131
2132 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2133 relocation referencing .LC0.
2134 * testsuite/discard_locals_test.sh: Remove FIXMEs.
2135
2136 2013-03-07 Alan Modra <amodra@gmail.com>
2137
2138 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2139 always_inline. Add assembly for powerpc to avoid GOT.
2140
2141 2013-03-07 Alan Modra <amodra@gmail.com>
2142
2143 * testsuite/script_test_10.sh: Don't test .bss section
2144 header number.
2145
2146 2013-03-06 Alan Modra <amodra@gmail.com>
2147
2148 * powerpc.cc (class Powerpc_relobj): Move some member functions.
2149 (Target_powerpc::symval_for_branch): Add symtab param. Update
2150 all callers. Handle folded sections.
2151 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2152 to Powerpc_relobj.
2153 (Global_symbol_visitor_opd::operator()): Likewise.
2154
2155 2013-03-04 Alan Modra <amodra@gmail.com>
2156
2157 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2158 * testsuite/Makefile.in: Regenerate.
2159
2160 2013-03-01 Cary Coutant <ccoutant@google.com>
2161
2162 Add dwp support for v2 DWARF package file format.
2163 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2164 tu_length parameter. Adjust all callers.
2165 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2166 * dwp.cc: Include dwarf.h.
2167 (Section_bounds): New struct type.
2168 (Unit_set): New struct type.
2169 (Dwo_file::Dwo_file): Initialize new data member.
2170 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2171 Combine and rename to...
2172 (Dwo_file::read_unit_index): ...this.
2173 (Dwo_file::sized_read_compunit_index)
2174 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2175 (Dwo_file::sized_read_unit_index): ...this.
2176 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2177 parameters; add section_id parameter.
2178 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2179 (Dwo_file::add_unit_set): ...this.
2180 (Dwo_file::shndx_map_): Remove.
2181 (Dwo_file::sect_offsets_): New data member.
2182 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2183 (Dwp_output_file::add_section): Rename to...
2184 (Dwp_output_file::add_contribution): ...this.
2185 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2186 (Dwp_output_file::add_tu_set): Likewise.
2187 (Dwp_output_file::Contribution): New type.
2188 (Dwp_output_file::Section::contributions): New data member.
2189 (Dwp_output_file::Cu_or_tu_set): Remove.
2190 (Dwp_output_file::Section::Section): New ctor.
2191 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2192 (Dwp_output_file::Dwp_index::Section_table): New type.
2193 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2194 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2195 parameter.
2196 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2197 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2198 (Dwp_output_file::Dwp_index::section_table): New member function.
2199 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2200 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2201 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2202 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2203 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2204 (Dwp_output_file::Dwp_index::section_table_): New data member.
2205 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2206 (Dwp_output_file::add_output_section): New member function.
2207 (Dwp_output_file::write_new_section): New member function.
2208 (Dwp_output_file::write_contributions): New member function.
2209 (Dwp_output_file::section_id_map_): New data member.
2210 (class Dwo_id_info_reader): Remove.
2211 (class Unit_reader): New class.
2212 (get_dwarf_section_name): New function.
2213 (Dwo_file::read_executable): Adjust initializations of class data.
2214 (Dwo_file::read): Add support for v2 package file format.
2215 (Dwo_file::read_unit_index): Likewise.
2216 (Dwo_file::sized_read_unit_index): Likewise.
2217 (Dwo_file::copy_section): Likewise.
2218 (Dwo_file::add_unit_set): Likewise.
2219 (Dwp_output_file::add_output_section): Likewise.
2220 (Dwp_output_file::add_contribution): Likewise.
2221 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2222 for empty slot.
2223 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2224 file format.
2225 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2226 slot.
2227 (Dwp_output_file::initialize): Remove unused function.
2228 (Dwp_output_file::finalize): Add support for v2 package file format.
2229 (Dwp_output_file::write_index): Likewise.
2230 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2231 function prototype.
2232
2233 2013-03-01 Cary Coutant <ccoutant@google.com>
2234
2235 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2236 function into class definition in header file.
2237 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2238 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2239 New function.
2240 (Dwarf_info_reader::check_buffer): Move here from .cc file.
2241
2242 2013-02-28 Alan Modra <amodra@gmail.com>
2243
2244 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2245 * target.cc (Target::do_plt_fde_location): New function.
2246 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2247 accessor function, and constructor param.
2248 (struct Post_fde, Post_fdes): Declare.
2249 (Cie::write): Add post_fdes param.
2250 * ehframe.cc (Fde::write): Use plt_fde_location.
2251 (struct Post_fde): Define.
2252 (Cie::write): Stash FDEs added post merge mapping.
2253 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2254 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
2255 (Eh_frame::do_sized_write): Arrange to write post map FDES after
2256 other FDEs.
2257 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2258 (Target_powerpc::has_glink): New function.
2259 (Target_powerpc::do_relax): Add eh_frame info for stubs.
2260 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2261 glink_eh_frame_fde_32, default_fde): New data.
2262 (Stub_table::eh_frame_added_): New var.
2263 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2264 Make const.
2265 (Stub_table::add_eh_frame): New function.
2266 (Output_data_glink::add_eh_frame): New function.
2267 (Target_powerpc::make_glink_section): Call add_eh_frame.
2268
2269 2013-02-15 Ian Lance Taylor <iant@google.com>
2270
2271 * options.h (DEFINE_uint64_alias): Define.
2272 (class General_options): Add -Ttext-segment as an alias for
2273 -Ttext.
2274
2275 2013-02-15 Alan Modra <amodra@gmail.com>
2276
2277 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2278 (Stub_table::do_write): ..here, two places.
2279 (Stub_table::plt_call_size): Use it here too.
2280
2281 2013-02-11 Ian Lance Taylor <iant@google.com>
2282
2283 * descriptors.cc (Descriptors::close_all): New function.
2284 * descriptors.h (class Descriptors): Declare close_all.
2285 (close_all_descriptors): New inline function.
2286 * plugin.cc: Include "descriptors.h".
2287 (Plugin_manager::cleanup): Call close_all_descriptors.
2288
2289 2013-02-06 Alan Modra <amodra@gmail.com>
2290
2291 * README: Update coding style link.
2292
2293 2013-01-28 Cary Coutant <ccoutant@google.com>
2294
2295 * dwp.cc (File_list): New typedef.
2296 (Dwo_name_info_reader): New class.
2297 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2298 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2299 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2300 (Dwo_file::read_executable): New function.
2301 (Dwo_file::read): Move common setup code to ...
2302 (Dwo_file::make_object): ... here.
2303 (dwp_options): Add --exec/-e.
2304 (usage): Likewise.
2305 (main): Likewise.
2306
2307 2013-01-24 Sriraman Tallam <tmsriram@google.com>
2308
2309 * layout.cc (Layout::layout): Check for option text_reorder.
2310 (Layout::make_output_section): Ditto.
2311 * options.h (text_reorder): New option.
2312 * output.cc (Input_section_sort_compare): Remove special ordering
2313 of section names.
2314 (Output_section::
2315 Input_section_sort_section_name_special_ordering_compare::
2316 operator()): New function.
2317 (Output_section::sort_attached_input_sections): Use new sort function
2318 for .text.
2319 * output.h (Input_section_sort_section_name_special_ordering_compare):
2320 New struct.
2321 * testsuite/Makefile.am (text_section_grouping): Test option
2322 --no-text-reorder
2323 * testsuite/Makefile.in: Regenerate.
2324 * testsuite/text_section_grouping.sh: Check order of functions without
2325 default text reordering.
2326
2327 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2328
2329 * options.h (General_options): Change default to true for new_dtags.
2330
2331 2013-01-18 Mike Frysinger <vapier@gentoo.org>
2332
2333 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2334 when enable_new_dtags is false. Only add DT_RUNPATH when
2335 enable_new_dtags is true.
2336
2337 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
2338
2339 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2340 used in declaration and definition consistent.
2341 (Target_powerpc::symval_for_branch): Ditto.
2342
2343 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2344
2345 * testsuite/plugin_final_layout.cc: Fix comment.
2346
2347 2013-01-16 Sriraman Tallam <tmsriram@google.com>
2348
2349 * layout.cc (Layout::layout): Do not do default sorting for
2350 text sections when section ordering is specified.
2351 (make_output_section): Ditto.
2352 * testsuite/plugin_final_layout.cc: Name the function sections
2353 to catch reordering issues.
2354
2355 2013-01-15 Alan Modra <amodra@gmail.com>
2356
2357 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2358 plt-thread-safe.
2359
2360 2013-01-15 Alan Modra <amodra@gmail.com>
2361
2362 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2363 * testsuite/Makefile.in: Regenerate.
2364
2365 2013-01-14 Alan Modra <amodra@gmail.com>
2366
2367 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2368 * testsuite/Makefile.in: Regenerate.
2369
2370 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
2371
2372 PR bfd/14430
2373 Fix mingw gold build with plugins enabled
2374 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2375 * configure.ac: Export DLOPEN_LIBS and add headers check.
2376 * plugin.cc: Handle non-dlfcn case.
2377 * Makefile.in: Regenerate.
2378 * config.in: Regenerate.
2379 * configure: Regenerate.
2380 * testsuite/Makefile.in: Regenerate.
2381
2382 2013-01-09 Sriraman Tallam <tmsriram@google.com>
2383
2384 * output.h (sort_attached_input_sections): Change to be public.
2385 * script-sections.cc
2386 (Output_section_definition::set_section_addresses): Sort
2387 attached input sections according to section order before linker
2388 script assigns section addresses.
2389 (Orphan_output_section::set_section_addresses): Sort
2390 attached input sections according to section order before linker
2391 script assigns section addresses.
2392 * Makefile.am (final_layout.sh): Use a simple linker script to
2393 check if section ordering still works.
2394 * Makefile.in: Regenerate.
2395
2396 2013-01-09 Ben Cheng <bccheng@google.com>
2397
2398 * arm.cc (Target_arm::attributes_accept_div): New function.
2399 (Target_arm::attributes_forbid_div): New function.
2400 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2401 attribute using the same new functions as what bfd/elf32_arm.c
2402 does.
2403
2404 2013-01-07 Cary Coutant <ccoutant@google.com>
2405
2406 PR gold/14993
2407 * output.cc (Output_section::add_input_section): For incremental
2408 updates, don't track input sections that are allocated from patch
2409 space.
2410
2411 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2412 Ian Lance Taylor <iant@google.com>
2413
2414 PR gold/14897
2415 * configure.ac (--enable-ld): Removed.
2416 (install_as_default): Set to yes only for --enable-gold=default
2417 or --disable-ld.
2418 * configure: Regenerated.
2419
2420 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
2421
2422 * options.h (General_options): Add -fuse-ld= for GCC linker
2423 option compatibility.
2424
2425 2013-01-04 Cary Coutant <ccoutant@google.com>
2426
2427 * configure.ac: Fix typo restoring CXXFLAGS.
2428 * configure: Regenerate.
2429
2430 2013-01-04 Cary Coutant <ccoutant@google.com>
2431
2432 * testsuite/Makefile.am (CXXLINK_S): New macro.
2433 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2434 * testsuite/Makefile.in: Regenerate.
2435
2436 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
2437
2438 * version.cc (print_version): Update copyright year to 2013.
2439
2440 2012-12-20 Ian Lance Taylor <iant@google.com>
2441
2442 * layout.cc (Layout::special_ordering_of_input_section): New
2443 function.
2444 (Layout::layout): If input section requires special ordering, must
2445 sort input sections.
2446 (Layout::make_output_section): May sort .text input sections.
2447 (Layout::is_section_name_prefix_grouped): Remove.
2448 * layout.h (class Layout): Declare
2449 special_ordering_of_input_section. Don't declare
2450 is_section_name_prefix_grouped.
2451 * output.cc (Output_section::add_input_section): Revert last
2452 change.
2453 (Output_section::Input_section_sort::match_file_name): Don't crash
2454 if called on output section data.
2455 (Output_section::Input_section_sort_compare): Sort based on
2456 special ordering.
2457 (Output_section::Input_section_sort_section_order_index_compare):
2458 Revert last patch.
2459 (Output_section::sort_attached_input_sections): Likewise.
2460
2461 2012-12-18 Sriraman Tallam <tmsriram@google.com>
2462
2463 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2464 * layout.h (Layout::is_section_name_prefix_grouped): New function.
2465 * output.cc (Output_section::add_input_section): Check if section
2466 name contains special prefix. Keep input sections to sort such
2467 sections.
2468 (Output_section::Input_section_sort_section_order_index_compare
2469 ::operator()): Group sections according to prefixes.
2470 (Output_section::sort_attached_input_sections): Add condition to
2471 Input_section_entry constructor call.
2472 * testsuite/Makefile.am (text_section_grouping): New test.
2473 * testsuite/Makefile.in: Regenerate.
2474 * testsuite/text_section_grouping.cc: New file.
2475 * testsuite/text_section_grouping.sh: New file.
2476
2477 2012-12-17 Nick Clifton <nickc@redhat.com>
2478
2479 * Makefile.am: Add copyright notice.
2480 * NEWS: Likewise.
2481 * README: Likewise.
2482 * configure.ac: Likewise.
2483 * ftruncate.c: Likewise.
2484 * Makefile.in: Regenerate.
2485
2486 2012-12-14 Cary Coutant <ccoutant@google.com>
2487
2488 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2489 --no-as-needed flag.
2490 (exception_separate_shared_12_test): Likewise.
2491 (incremental_copy_test): Likewise.
2492 * testsuite/Makefile.in: Regenerate.
2493
2494 2012-12-14 Cary Coutant <ccoutant@google.com>
2495
2496 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2497 (Dwp_output_file::Dwp_index::enter_set): Add assert.
2498
2499 2012-12-12 Alan Modra <amodra@gmail.com>
2500
2501 * powerpc.cc (class Track_tls): New.
2502 (class Relocate, class Scan): Inherit Track_tls.
2503 (Target_powerpc::Scan::local, global): Track tls optimization
2504 and avoid creating plt entry for __tls_get_addr if all uses
2505 are optimized away.
2506 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2507
2508 2012-12-12 Alan Modra <amodra@gmail.com>
2509
2510 * options.h (General_options): Add --toc-sort/--no-toc-sort.
2511 Replace no_toc_optimize with toc_optimize.
2512 * output.h (Output_section::input_sections): Provide non-const variant.
2513 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2514 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2515 accessors.
2516 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2517 (class Sort_toc_sections): New.
2518 (Target_powerpc::do_finalize_sections): Sort toc sections.
2519 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2520
2521 2012-12-10 Roland McGrath <mcgrathr@google.com>
2522
2523 * testsuite/binary_unittest.cc (read_all): New function.
2524 (Sized_binary_test): Use it instead of ::read.
2525 * fileread.cc (do_read): Don't assume pread always reads the whole
2526 amount in a single call.
2527
2528 2012-12-10 Alan Modra <amodra@gmail.com>
2529
2530 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2531 Set EM_PPC64 or EM_PPC here.
2532 (Target_selector_powerpc::do_recognize): Delete.
2533
2534 2012-12-10 Alan Modra <amodra@gmail.com>
2535
2536 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2537 stub_table_.
2538 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2539
2540 2012-12-07 Roland McGrath <mcgrathr@google.com>
2541
2542 * testsuite/binary_unittest.cc (Sized_binary_test):
2543 Use open_descriptor rather than ::open.
2544
2545 2012-12-07 Alan Modra <amodra@gmail.com>
2546
2547 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2548 typedef and invalid_address constant.
2549 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2550 instantiate constants.
2551
2552 2012-12-06 Roland McGrath <mcgrathr@google.com>
2553
2554 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2555 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2556 * aclocal.m4: Regenerate.
2557 * configure: Regenerate.
2558 * Makefile.in: Regenerate.
2559 * testsuite/Makefile.in: Regenerate.
2560
2561 2012-12-07 Alan Modra <amodra@gmail.com>
2562
2563 * options.h (General_options): Add no_toc_optimize.
2564 * powerpc.cc (ok_lo_toc_insn): New function.
2565 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2566
2567 2012-12-06 Alan Modra <amodra@gmail.com>
2568
2569 * options.h (General_options): Add plt_align, plt_static_chain,
2570 plt_thread_safe. Update stub_group_size help text.
2571 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2572 for new plt_thread_safe_ var.
2573 (use_plt_offset): Correct comments.
2574 (Target_powerpc::do_relax): Look for thread creation symbols to
2575 determine default plt_thread_safe value. Clear plt call stubs
2576 as well as branch stubs each iteration.
2577 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2578 insn constants.
2579 (l, hi, ha, write_insn): Move earlier.
2580 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2581 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2582 plt stubs too.
2583 (Stub_table::update_size): Adjust.
2584 (Stub_table::prev_size, set_prev_size): Delete.
2585 (Stub_table::stub_align): Let --plt-align affect result.
2586 (Stub_table::plt_call_size): Calculate sizes for various stubs.
2587 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2588 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2589 (Stub_table::do_write): Support more stub variants.
2590
2591 2012-12-04 Alan Modra <amodra@gmail.com>
2592
2593 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2594 (Target_powerpc::do_define_standard_symbols): New function.
2595
2596 2012-12-03 Alan Modra <amodra@gmail.com>
2597
2598 * output.h: Formatting, whitespace.
2599
2600 2012-12-03 Alan Modra <amodra@gmail.com>
2601
2602 * layout.h (Layout::get_executable_sections): Declare.
2603 * layout.cc (Layout::get_executable_sections): New function.
2604 * arm.cc (Target_arm::group_sections): Use it.
2605 (Arm_output_section::group_sections): Delete now redundant test.
2606 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2607 param to handle relative relocs.
2608 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2609 (Output_data_reloc::add_absolute): Adjust.
2610 (Output_data_reloc::add_relative): New function.
2611 (Output_data::reset_data_size): New function.
2612 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2613 (Output_section::set_addralign): New function.
2614 (Output_section::checkpoint_set_addralign): New function.
2615 (Output_section::clear_section_offsets_need_adjustment): New function.
2616 (Output_section::input_sections): Make public.
2617 * powerpc.cc (class Output_data_brlt_powerpc): New.
2618 (class Stub_table, class Stub_control): New.
2619 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2620 stub_table_, set_stub_table, stub_table): New vectors and accessor
2621 functions.
2622 (Target_powerpc::do_may_relax, do_relax, push_branch,
2623 new_stub_table, stub_tables, brlt_section, group_sections,
2624 add_branch_lookup_table, find_branch_lookup_table,
2625 write_branch_lookup_table, make_brlt_section): New functions.
2626 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2627 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2628 branch_info_): New vars.
2629 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2630 make call stubs here.
2631 (Output_data_glink): Remove all call stub handling from this class.
2632 (Target_powerpc::Scan::local, global): Save interesting branch
2633 relocs and relocs for ifunc. Adjust calls to plt entry functions.
2634 (Target_powerpc::do_finalize_sections): Only make reg save/restore
2635 functions on final link.
2636 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2637 Handle long branch destinations too.
2638 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2639 do_plt_address_for_local): Adjust lookup of plt call stubs.
2640
2641 2012-11-30 Alan Modra <amodra@gmail.com>
2642
2643 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2644 relocs against protected symbols when building 32-bit shared libs.
2645
2646 2012-11-30 Alan Modra <amodra@gmail.com>
2647
2648 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2649 param. Call got_section() to make .got. Update all callers
2650 and their callers and so on.
2651
2652 2012-11-30 Alan Modra <amodra@gmail.com>
2653
2654 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2655 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2656 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2657 value if it already exists.
2658
2659 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
2660
2661 PR gold/14858
2662 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2663
2664 2012-11-14 Roland McGrath <mcgrathr@google.com>
2665
2666 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2667 than bfc instruction for data sandboxing.
2668
2669 2012-11-08 Alan Modra <amodra@gmail.com>
2670
2671 * po/POTFILES.in: Regenerate.
2672
2673 2012-11-05 Alan Modra <amodra@gmail.com>
2674
2675 * configure.ac: Apply 2012-09-10 change to config.in here.
2676 * configure: Regenerate.
2677
2678 2012-11-05 Alan Modra <amodra@gmail.com>
2679
2680 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2681 (struct Opd_ent): Use "Address" rather than "Offset".
2682 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2683 (Target_powerpc::got_section): Make public.
2684 (Target_powerpc::scan_relocs): Move code setting symbols..
2685 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2686 Create _SDA_BASE_ only when referenced.
2687
2688 2012-11-02 Roland McGrath <mcgrathr@google.com>
2689
2690 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2691 from last change.
2692
2693 2012-11-01 Roland McGrath <mcgrathr@google.com>
2694
2695 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2696 for offset_in_output_section parameter.
2697 (Sized_target::relocate_special_relocatable): Likewise.
2698 * arm.cc (Target_arm::relocate_relocs): Likewise.
2699 (Target_arm::relocate_special_relocatable): Likewise.
2700 * i386.cc (Target_i386::relocate_relocs): Likewise.
2701 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2702 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2703 * target-reloc.h (relocate_relocs): Likewise.
2704 * testsuite/testfile.cc (Target_test): Likewise.
2705 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2706 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2707
2708 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2709 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2710
2711 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2712 parameter, which is unused in the [!F_SETFD] case.
2713
2714 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2715 SYMNDX to off_t before comparing it to this->data_size().
2716 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2717 * incremental.cc (Output_section_incremental_inputs::do_write):
2718 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2719
2720 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2721
2722 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2723
2724 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2725 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2726 in EABI_VER5.
2727
2728 2012-10-29 Cary Coutant <ccoutant@google.com>
2729
2730 * dwp.cc (usage): Add file and exit status parameters;
2731 add --help and --version options.
2732 (print_version): New function.
2733 (main): Add --help and --version options.
2734
2735 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2736
2737 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2738 final_layout_sequence.txt.
2739 * testsuite/Makefile.in: Regenerated.
2740
2741 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2742
2743 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2744 COMPILE generated by automake.
2745 (LINK1): Likewise.
2746 (CXXCOMPILE1): Likewise.
2747 (CXXLINK1): Likewise.
2748 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2749 (LINK): Likewise.
2750 (CXXCOMPILE): Likewise.
2751 (CXXLINK): Likewise.
2752 * testsuite/Makefile.in: Regenerated.
2753
2754 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2755
2756 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2757 on bad fwrite return.
2758
2759 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2760
2761 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2762 on val.
2763
2764 2012-10-23 Cary Coutant <ccoutant@google.com>
2765
2766 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2767 * testsuite/Makefile.in: Regenerate.
2768 * testsuite/dwp_test.h: New source file.
2769 * testsuite/dwp_test_1.cc: New source file.
2770 * testsuite/dwp_test_1.s: New source file.
2771 * testsuite/dwp_test_1.sh: New source file.
2772 * testsuite/dwp_test_1b.cc: New source file.
2773 * testsuite/dwp_test_1b.s: New source file.
2774 * testsuite/dwp_test_2.cc: New source file.
2775 * testsuite/dwp_test_2.s: New source file.
2776 * testsuite/dwp_test_2.sh: New source file.
2777 * testsuite/dwp_test_main.cc: New source file.
2778 * testsuite/dwp_test_main.s: New source file.
2779
2780 2012-10-23 Cary Coutant <ccoutant@google.com>
2781
2782 * dwp.h: New header file.
2783 * dwp.cc: New source file.
2784 * gold.h: Move shared declarations to system.h.
2785 * system.h: New header file.
2786 * Makefile.am: Add dwp.
2787 * Makefile.in: Regenerate.
2788
2789 2012-10-23 Cary Coutant <ccoutant@google.com>
2790
2791 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2792 Dwarf_info_reader::read_from_pointer.
2793 (Dwarf_pubnames_table::read_header): Likewise.
2794 (Dwarf_pubnames_table::next_name): Likewise.
2795 (Dwarf_die::read_attributes): Likewise.
2796 (Dwarf_die::skip_attributes): Likewise.
2797 (Dwarf_info_reader::read_from_pointer): New function template.
2798 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2799 (Dwarf_pubnames_table): Likewise.
2800 (Dwarf_info_reader::read_from_pointer): New function template.
2801 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2802 Dwarf_pubnames_table ctor.
2803
2804 2012-10-23 Cary Coutant <ccoutant@google.com>
2805
2806 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2807 abbrev_shndx.
2808 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2809 abbrev_shndx_.
2810 (Dwarf_info_reader::set_abbrev_shndx): New method.
2811 (Dwarf_info_reader::abbrev_shndx_): New data member.
2812
2813 2012-10-23 Cary Coutant <ccoutant@google.com>
2814
2815 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2816 from object, not parameters.
2817 (Dwarf_info_reader::parse): Likewise.
2818 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2819 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2820 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2821 methods.
2822
2823 2012-10-23 Cary Coutant <ccoutant@google.com>
2824
2825 * fileread.cc (Input_file::Input_file): New constructor.
2826 * fileread.h (class Input_file): Add new constructor.
2827
2828 2012-10-18 Alan Modra <amodra@gmail.com>
2829
2830 PR gold/14727
2831 * object.cc (Relobj::is_section_name_included): Also match
2832 .sdata personality section.
2833
2834 2012-10-18 Alan Modra <amodra@gmail.com>
2835
2836 * target-reloc.h (class Default_comdat_behavior): New, package up..
2837 (get_comdat_behaviour): ..this.
2838 (relocate_section): Add Relocate_comdat_behavior template arg,
2839 adjust code to suit.
2840 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2841 (Target_arm::scan_reloc_section): Likewise.
2842 * i386.cc (Target_i386::relocate_section): Likewise.
2843 * sparc.cc (Target_sparc::relocate_section): Likewise.
2844 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2845 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2846 * powerpc.cc (class Relocate_comdat_behavior): New.
2847 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2848 gold::relocate_section with new template arg.
2849
2850 2012-10-18 Alan Modra <amodra@gmail.com>
2851
2852 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2853 dynamic relocs for GOT_TPREL got entries, without symbol if
2854 resolving locally.
2855 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2856 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2857 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2858
2859 2012-10-17 Alan Modra <amodra@gmail.com>
2860
2861 PR gold/14726
2862 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2863
2864 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2865
2866 * layout.cc (Layout::include_section): Keep sections marked
2867 SHF_EXCLUDE when doing relocatable links.
2868
2869 2012-10-16 Alan Modra <amodra@gmail.com>
2870
2871 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2872 (Target_powerpc::do_finalize_sections): Call it.
2873 (Output_data_save_res): New class and supporting functions.
2874 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2875 normal symbols defined in object files.
2876
2877 2012-10-12 Alan Modra <amodra@gmail.com>
2878
2879 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2880 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2881 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2882 section if scan_opd_relocs not yet called.
2883 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2884
2885 2012-10-12 Alan Modra <amodra@gmail.com>
2886
2887 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2888 add_local_ifunc_entry): Revert last change.
2889 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2890
2891 2012-10-05 Alan Modra <amodra@gmail.com>
2892
2893 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2894 do_plt_address_for_global): New functions.
2895 (Output_data_got_powerpc::do_write): Don't segfault when linking
2896 statically.
2897 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2898 add_local_ifunc_entry): Return true on adding entry..
2899 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2900 glink->add_entry call. Remove unused symtab param. Adjust calls.
2901 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2902 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2903 set up symbols here.
2904 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2905 syms here. Do so even when no .iplt. Don't segfault when linking
2906 statically.
2907 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2908 new variants without reloc param.
2909 (Glink_sym_ent::Glink_sym_ent): Likewise.
2910 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2911 reloc when refs will resolve to plt call stub.
2912 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2913 R_PPC_PLTREL24 to resolve locally.
2914 (Target_powerpc::Scan::global): Correct ifunc handling.
2915 (Target_powerpc::Relocate::relocate): Correct local sym glink
2916 lookup. Don't destroy "value" when we have a plt call stub,
2917 and when checking plt call validity.
2918 (Target_powerpc::do_dynsym_value): Simplify.
2919
2920 2012-10-05 Alan Modra <amodra@gmail.com>
2921
2922 * i386.cc (Output_data_plt_i386::address_for_global,
2923 address_for_local): Add plt offset to returned value. Adjust uses.
2924 * sparc.cc (Output_data_plt_sparc::address_for_global,
2925 address_for_local): Likewise.
2926 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2927 address_for_local): Likewise.
2928 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2929 address_for_local): Likewise.
2930 * target.h (Target::plt_address_for_global, plt_address_for_local):
2931 Update comment.
2932 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2933 (Output_data_got::Got_entry::write): Nor here.
2934 * output.h: Comment fix.
2935
2936 2012-10-02 Jiong Wang <jiwang@tilera.com>
2937
2938 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2939 global_offset_table_ value for larget got.
2940 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2941
2942 2012-09-29 Alan Modra <amodra@gmail.com>
2943
2944 * powerpc.cc (Target_powerpc::iplt_): New output section.
2945 (Target_powerpc::iplt_section, make_iplt_section,
2946 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2947 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2948 Target_powerpc::plt_entry_count): Count iplt entries too.
2949 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2950 reloc section in constructor. New params.
2951 (Target_powerpc::make_plt_section): Create reloc section here instead.
2952 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2953 functions.
2954 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2955 (Output_data_glink::add_entry, find_entry): New functions to
2956 deal with local syms.
2957 (Glink_sym_ent): Add support for local syms.
2958 (Output_data_glink::do_write): Handle ifunc plt entries.
2959 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2960 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2961 (Target_powerpc::Relocate::relocate): Likewise.
2962 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2963
2964 2012-09-25 Alan Modra <amodra@gmail.com>
2965
2966 * object.h (Sized_relobj_file::adjust_local_symbol,
2967 do_adjust_local_symbol): New functions.
2968 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2969 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2970 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2971 and irregular opd entry spacing.
2972 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2973 (Global_symbol_visitor_opd): New functor.
2974 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2975 on deleted opd entries.
2976
2977 2012-09-15 Jiong Wang <jiwang@tilera.com>
2978
2979 * tilegx.cc: New file.
2980 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2981 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2982 * configure.tgt: Add entries for tilegx*.
2983 * configure.ac: Likewise.
2984 * Makefile.in: Rebuild.
2985 * configure: Likewise.
2986 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2987 tilegx.
2988
2989 2012-09-13 Alan Modra <amodra@gmail.com>
2990
2991 * target-reloc.h (scan_relocs): Call scan.local for relocs
2992 against symbols in discarded sections. Pass is_discarded
2993 param.
2994 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2995 Add is_discarded param.
2996 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2997 is_discarded to flag opd entry as discarded. Don't emit dyn
2998 relocs on such entries.
2999 (Target_powerpc::Scan::global): Similarly detect and handle
3000 such opd entries.
3001 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3002 opd_ent_. Update all uses.
3003 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3004 (Target_powerpc::relocate_section): Zero out discarded opd
3005 entry relocs.
3006
3007 2012-09-12 Ian Lance Taylor <iant@google.com>
3008
3009 PR gold/14570
3010 * output.cc: Rename Output_data_got template parameter from size
3011 to got_size for all functions. Compile all variants of
3012 Output_data_got.
3013 (Output_data_got::Got_entry::write): Correct use of size for
3014 symbol value. Use local_is_tls rather than casting to
3015 Sized_relobj_file.
3016 * object.h (class Object): Add local_is_tls and do_local_is_tls.
3017 (class Sized_relobj_file): Add do_local_is_tls.
3018 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3019
3020 2012-09-11 Alan Modra <amodra@gmail.com>
3021
3022 PR gold/14566
3023 * layout.cc (Layout::set_segment_offsets): When using
3024 common-page-size alignment, ensure we are on a new max-page-size
3025 page.
3026 * output.cc (Output_segment::set_section_addresses): Use
3027 abi_pagesize, not common_pagesize for relro boundary.
3028 (Output_segment::set_offset): Likewise.
3029
3030 2012-09-11 Alan Modra <amodra@gmail.com>
3031
3032 * output.h (Output_data_got::add_global_tls, add_local_tls,
3033 add_local_tls_pair): New functions.
3034 (Output_data_got::add_local_pair_with_rel): Remove second
3035 reloc param. Expand comment.
3036 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3037 use_plt_or_tls_offset_, similarly for constructor param.
3038 (Output_data_got::Got_entry::write): Add got_index param.
3039 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3040 add_local_tls_pair): New functions.
3041 (Output_data_got::Got_entry::write): Handle tls symbols
3042 with use_plt_or_tls_offset_ set specially.
3043 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3044 (Output_data_got::do_write): Replace iterator with index, pass
3045 index to entry write function.
3046 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3047 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3048 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3049 call.
3050 * i386.cc (Target_i386::Scan::local): Likewise.
3051 * sparc.cc (Target_sparc::Scan::local): Likewise.
3052 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3053 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3054 do_tls_offset_for_global): New functions.
3055 (Target_powerpc::Scan::local): Correct TLS relocations and got
3056 entry values.
3057 (Target_powerpc::Scan::global): Don't emit unnecessary
3058 dynamic relocations on TLS GOT entries.
3059
3060 2012-09-10 Matthias Klose <doko@ubuntu.com>
3061
3062 * config.in: Disable sanity check for kfreebsd.
3063
3064 2012-09-10 Sterling Augustine <saugustine@google.com>
3065
3066 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3067 (Gdb_index::pubtypes_read): New parameter.
3068 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3069 to calls.
3070 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3071 pubtypes_object_.
3072
3073 2012-09-09 Alan Modra <amodra@gmail.com>
3074
3075 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3076 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3077 * gc.h (gc_process_relocs): Call target gc_add_reference.
3078 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3079 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3080 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3081 unnecessary cast.
3082 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3083 to cater for when we don't need code offset. Update use.
3084 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3085 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3086 set_opd_valid): New functions.
3087 (Target_powerpc::do_gc_add_reference): New function.
3088 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3089 stashed refs.
3090 (Target_powerpc::do_gc_mark_symbol): New function.
3091
3092 2012-09-06 Cary Coutant <ccoutant@google.com>
3093
3094 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3095 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3096 (Dwarf_die::skip_attributes): Likewise.
3097 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3098 * testsuite/gdb_index_test.cc (inline_func_1): New function.
3099 (main): Call it.
3100 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3101
3102 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
3103
3104 * testsuite/script_test_3.t: Add .got.plt output section
3105 statement.
3106 * testsuite/script_test_4.t: Likewise.
3107
3108 2012-09-05 Alan Modra <amodra@gmail.com>
3109
3110 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3111 update all uses and lose "enum" when using type.
3112
3113 2012-09-05 Alan Modra <amodra@gmail.com>
3114
3115 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3116 * configure: Regenerate.
3117 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3118 (plugin_final_layout.stdout): Likewise.
3119 (memory_test): Set page sizes to 0x1000.
3120 * testsuite/Makefile.in: Regenerate.
3121 * testsuite/discard_locals_test.sh: Add FIXME comment.
3122 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3123 * testsuite/pr14265.t: Add .got output section statement.
3124 * testsuite/script_test_2.t: Likewise.
3125 * testsuite/script_test_3.t: Likewise.
3126 * testsuite/script_test_4.t: Likewise.
3127 * testsuite/script_test_5.t: Likewise.
3128 * testsuite/script_test_6.t: Likewise.
3129 * testsuite/script_test_7.t: Likewise.
3130 * testsuite/script_test_9.t: Likewise.
3131
3132 2012-09-05 Alan Modra <amodra@gmail.com>
3133
3134 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3135 (Powerpc_relocate_functions::Status): New typedef.
3136 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3137 (Target_powerpc::Scan::local): Handle REL64.
3138 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3139 for REL32 and REL64.
3140 (Target_powerpc::symval_for_branch): New function, extracted from..
3141 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
3142 checks. Report overflow errors.
3143
3144 2012-09-05 Alan Modra <amodra@gmail.com>
3145
3146 * object.h (Sized_relobj_file::emit_relocs): Delete.
3147 (Sized_relobj_file::emit_relocs_reltype): Delete.
3148 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3149 relocate_relocs for --emit-relocs.
3150 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3151 * output.h: Update comment.
3152 (Output_segment::first_section): New function.
3153 (Output_segment::first_section_load_address): Use first_section.
3154 * output.cc (Output_segment::first_section): New function extracted..
3155 (Output_segment::first_section_load_address): ..from here. Delete.
3156 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3157 * target.h (Sized_target::relocate_for_relocatable): Likewise.
3158 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3159 adjust call to target.h function.
3160 * i386.cc (Target_i386): Likewise.
3161 * sparc.cc (Target_sparc): Likewise.
3162 * x86_64.cc (Target_x86_64): Likewise.
3163 * powerpc.cc (Target_powerpc): Likewise.
3164 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
3165 first tls section has section symbol for optimised local dynamic
3166 output relocs.
3167 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3168 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3169 optimised tls code.
3170 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3171 Rename to relocate_relocs. Update error message.
3172
3173 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
3174
3175 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3176 --just-symbols.
3177
3178 2012-08-31 Alan Modra <amodra@gmail.com>
3179
3180 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3181 (Powerpc_relobj::toc_base_offset): New stub function.
3182 (Target_powerpc): Add tp_offset, dtp_offset. Rename
3183 got_mod_index_offset to tlsld_got_offset. Update all refs.
3184 (Target_powerpc::Relocate::enum skip_tls): New.
3185 (Target_powerpc::call_tls_get_addr_): New var.
3186 (Target_powerpc::is_branch_reloc): Move to file scope.
3187 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3188 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3189 New functions.
3190 (Target_powerpc::enum Got_type): Delete old values, add new ones.
3191 (powerpc_info): Correct common_pagesize for ppc64.
3192 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3193 (Powerpc_relocate_functions): Add overflow check enums and functions.
3194 Add non-shift version of rela, rela_ua. Delete all rel public
3195 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
3196 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3197 addr16_ha3, addr14 functions.
3198 (Output_data_got_powerpc::add_constant_pair): New function.
3199 (Output_data_got_powerpc::got_base_offset): Likewise.
3200 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3201 (instruction constants): Sort, add some more.
3202 (Output_data_glink::do_write): Add and use Address typedef. Use
3203 object->toc_base_offset() stub for 64-bit.
3204 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3205 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3206 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3207 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
3208 Always treat .opd relocs as against locally defined symbol.
3209 Correct condition for RELATIVE relocs.
3210 (Target_powerpc::do_finalize_sections): Test for NULL sections.
3211 (Target_powerpc::Relocate::relocate): Use plt call stub as value
3212 for 32-bit syms with a plt entry. Correct ppc64 toc base
3213 calculations. Handle TLS relocs, and more. Add overflow
3214 checking and adjust for Powerpc_relocate_functions changes.
3215 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3216 Reinstate --emit-relocs code with FIXME.
3217
3218 2012-08-30 Alan Modra <amodra@gmail.com>
3219
3220 * layout.cc (Layout::set_segment_offsets): Set p_align to
3221 abi_pagesize, not common_pagesize.
3222 (Layout::relaxation_loop_body): Similarly use abi_pagesize
3223 to determine whether file header can go in segment.
3224
3225 2012-08-30 Alan Modra <amodra@gmail.com>
3226
3227 * output.h (Output_reloc::Output_reloc <output section>): Add
3228 is_relative param. Adjust calls.
3229 (Output_reloc::add_output_section_relative): New functions.
3230 * output.cc (Output_reloc::Output_reloc <output section>): Handle
3231 is_relative.
3232 (Output_reloc::symbol_value): Handle SECTION_CODE.
3233
3234 2012-08-24 Sriraman Tallam <tmsriram@google.com>
3235
3236 * gold.cc (queue_middle_tasks): Call layout again when unique
3237 segments for sections is desired.
3238 * layout.cc (Layout::Layout): Initialize new members.
3239 (Layout::get_output_section_flags): New function.
3240 (Layout::choose_output_section): Call get_output_section_flags.
3241 (Layout::layout): Make output section for mapping to a unique segment.
3242 (Layout::insert_section_segment_map): New function.
3243 (Layout::attach_allocated_section_to_segment): Make unique segment for
3244 output sections marked so.
3245 (Layout::segment_precedes): Check for unique segments when sorting.
3246 * layout.h (Layout::Unique_segment_info): New struct.
3247 (Layout::Section_segment_map): New typedef.
3248 (Layout::insert_section_segment_map): New function.
3249 (Layout::get_output_section_flags): New function.
3250 (Layout::is_unique_segment_for_sections_specified): New function.
3251 (Layout::set_unique_segment_for_sections_specified): New function.
3252 (Layout::unique_segment_for_sections_specified_): New member.
3253 (Layout::section_segment_map_): New member.
3254 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3255 Rename is_gc_pass_one to is_pass_one.
3256 Rename is_gc_pass_two to is_pass_two.
3257 Rename is_gc_or_icf to is_two_pass.
3258 Check for which pass based on whether symbols data is present.
3259 Make it two pass when unique segments for sections is desired.
3260 * output.cc (Output_section::Output_section): Initialize new
3261 members.
3262 * output.h (Output_section::is_unique_segment): New function.
3263 (Output_section::set_is_unique_segment): New function.
3264 (Output_section::is_unique_segment_): New member.
3265 (Output_section::extra_segment_flags): New function.
3266 (Output_section::set_extra_segment_flags): New function.
3267 (Output_section::extra_segment_flags_): New member.
3268 (Output_section::segment_alignment): New function.
3269 (Output_section::set_segment_alignment): New function.
3270 (Output_section::segment_alignment_): New member.
3271 (Output_segment::Output_segment): Initialize is_unique_segment_.
3272 (Output_segment::is_unique_segment): New function.
3273 (Output_segment::set_is_unique_segment): New function.
3274 (Output_segment::is_unique_segment_): New member.
3275 * plugin.cc (allow_unique_segment_for_sections): New function.
3276 (unique_segment_for_sections): New function.
3277 (Plugin::load): Add new functions to transfer vector.
3278 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3279 * Makefile.in: Regenerate.
3280 * testsuite/plugin_final_layout.sh: Check if unique segment
3281 functionality works.
3282 * testsuite/plugin_section_order.c (onload): Check if new interfaces
3283 are available.
3284 (allow_unique_segment_for_sections): New global.
3285 (unique_segment_for_sections): New global.
3286 (claim_file_hook): Call allow_unique_segment_for_sections.
3287 (all_symbols_read_hook): Call unique_segment_for_sections.
3288
3289 2012-08-22 Cary Coutant <ccoutant@google.com>
3290
3291 * layout.cc (Layout::include_section): Don't assert on GROUP
3292 sections with --emit-relocs.
3293
3294 2012-08-21 Cary Coutant <ccoutant@google.com>
3295
3296 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3297 if --export-dynamic-symbol names an undef symbol.
3298
3299 2012-08-18 Alan Modra <amodra@gmail.com>
3300
3301 * powerpc.cc: Formatting and white space.
3302 (Powerpc_relobj): Rename got2_section_ to special_.
3303 Add opd_ent_shndx_ and opd_ent_off_ vectors.
3304 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3305 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3306 (Target_powerpc): Add Address typedef and invalid_address. Use
3307 throughout.
3308 (Target_powerpc::is_branch_reloc): New function.
3309 (Powerpc_relocate_functions): Add Address typedef, use throughout.
3310 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3311 for dst_mask, value and addend.
3312 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3313 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3314 (Output_data_glink::do_write): Correct toc base. Don't try to use
3315 uint16_t for 24-bit offset. Use get_output_section_offset and
3316 check return.
3317 (Target_powerpc::Scan::local): Handle more relocs.
3318 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3319 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3320 Plug in toc restoring insn after plt calls. Translate branches
3321 to function descriptor symbols to corresponding entry point.
3322 (Target_powerpc::relocate_for_relocatable): Check return from
3323 get_output_section_offset.
3324 * symtab.h: Comment typo.
3325
3326 2012-08-14 Ian Lance Taylor <iant@google.com>
3327
3328 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3329 unsupported_relocal_local to call unsupported_reloc_global.
3330
3331 2012-08-14 Nick Clifton <nickc@redhat.com>
3332
3333 PR ld/14265
3334 * script-sections.cc (Sections_element::output_section_name): Add
3335 keep return parameter.
3336 (Output_section_element::match_name): Add keep return parameter.
3337 Return the value of the keep_ member.
3338 * script-sections.h (class Output_section): Update
3339 output_section_name prototype.
3340 * layout.cc (Layout::keep_input_section): New public member
3341 function.
3342 (Layout::choose_output_section): Pass keep parameter to
3343 output_section_name.
3344 * layout.h (class Layout): Add keep_input_section.
3345 * object.cc (Sized_relobj_file::do_layout): Check for kept input
3346 sections.
3347 * testsuite/Makefile.am: Add a test.
3348 * testsuite/Makefile.in: Regenerate.
3349 * testsuite/pr14265.c: Source file for the test.
3350 * testsuite/pr14265.t: Linker script for the test.
3351 * testsuite/pr14265.sh: Shell script for the test.
3352
3353 2012-08-14 Alan Modra <amodra@gmail.com>
3354
3355 * target.h (Target::output_section_name): New function.
3356 (Target::do_output_section_name): New function.
3357 * layout.cc (Layout::choose_output_section): Call the above.
3358 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3359
3360 2012-08-14 Alan Modra <amodra@gmail.com>
3361
3362 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3363 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3364 for replace_constant call.
3365 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3366 (Output_data_glink::do_print_to_mapfile): New function.
3367 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3368 (Target_powerpc::Relocate::relocate): Likewise.
3369
3370 2012-08-14 Alan Modra <amodra@gmail.com>
3371
3372 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3373 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3374 (Output_data_glink::add_entry,find_entry): Remove shndx param.
3375 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
3376 all references to shndx_. Handle special case for R_PPC_PLTREL24
3377 here.
3378 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3379 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3380 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3381 here.
3382 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3383 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3384
3385 2012-08-12 Alan Modra <amodra@gmail.com>
3386
3387 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
3388 (glink insn constants): Use uint32_t.
3389 (Output_data_glink::add_entry): Use insert, not [] operator.
3390
3391 2012-08-11 Alan Modra <amodra@gmail.com>
3392
3393 * object.h (Sized_relobj_file::find_shdr): New function.
3394 (Sized_relobj_file::find_special_sections): New function.
3395 * object.cc (Sized_relobj_file::find_shdr): New function.
3396 (Sized_relobj_file::find_eh_frame): Use find_shdr.
3397 (Sized_relobj_file::find_special_sections): New function, split out..
3398 (Sized_relobj_file::do_read_symbols): ..from here.
3399 * output.h (Output_data_got::replace_constant): New function.
3400 (Output_data_got::num_entries): New function.
3401 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3402 (Output_data_got::got_offset): Protected rather than private.
3403 (Output_data_got::replace_got_entry): New function.
3404 * output.cc (Output_data_got::replace_got_entry): New function.
3405 * powerpc.cc (class Powerpc_relobj): New.
3406 (class Powerpc_relocate_functions): Delete all psymval variants or
3407 convert to value,addend type. Delete pcrela, pcrela_unaligned.
3408 Implement _ha functions using corresponding _hi function.
3409 (Powerpc_relobj::find_special_sections): New function.
3410 (Target_powerpc::do_make_elf_object): New function.
3411 (class Output_data_got_powerpc): New.
3412 (class Output_data_glink): New.
3413 (class Powerpc_scan_relocatable_reloc): New.
3414 Many more changes througout file.
3415
3416 2012-08-09 Nick Clifton <nickc@redhat.com>
3417
3418 * po/vi.po: Updated Vietnamese translation.
3419
3420 2012-08-07 Ian Lance Taylor <iant@google.com>
3421
3422 * layout.cc (Layout::add_target_dynamic_tags): If
3423 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3424 plt_rel.
3425
3426 2012-07-30 Nick Clifton <nickc@redhat.com>
3427
3428 * po/gold.pot: Updated template.
3429 * po/es.po: Updated Spanish translation.
3430
3431 2012-07-18 Cary Coutant <ccoutant@google.com>
3432
3433 PR gold/14344
3434 * configure.ac: Add check for -gpubnames support.
3435 * configure: Regenerate.
3436 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3437 support; force -gno-pubnames.
3438 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3439 support.
3440 (gdb_index_test_4): New test.
3441 * testsuite/Makefile.in: Regenerate.
3442 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3443 * testsuite/gdb_index_test_2.sh: Likewise.
3444 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3445 * testsuite/gdb_index_test_4.sh: New script.
3446 * testsuite/gdb_index_test_comm.sh: New script with common code;
3447 don't look for space after colon.
3448
3449 2012-07-16 Sriraman Tallam <tmsriram@google.com>
3450
3451 * gold.cc (queue_middle_tasks): Update function order only after
3452 deferred objects due to plugins are processed.
3453
3454 2012-07-11 Ian Lance Taylor <iant@google.com>
3455
3456 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3457 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3458 (Target_arm::scan_reloc_for_stub): Likewise.
3459 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3460 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3461 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3462 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3463 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3464
3465 2012-07-10 Dodji Seketeli <dodji@redhat.com>
3466 Ian Lance Taylor <iant@google.com>
3467
3468 PR gold/14309
3469 * configure.ac: Test whether std::tr1::hash<off_t> works.
3470 * gold.h: Add a specialization for std::tr1::hash<off_t> if
3471 needed.
3472 * output.h (class Output_fill): Add virtual destructor.
3473 * configure, config.in: Rebuild.
3474
3475 2012-06-22 Roland McGrath <mcgrathr@google.com>
3476
3477 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3478
3479 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
3480
3481 * plugin.cc (Plugin::load): Handle position independent executables.
3482
3483 2012-06-06 Cary Coutant <ccoutant@google.com>
3484
3485 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3486 add .debug_macro.
3487 (lines_only_debug_sections): Likewise.
3488 (gdb_fast_lookup_sections): New static array.
3489 (is_gdb_debug_section): Rename formal parameter.
3490 (is_lines_only_debug_section): Likewise.
3491 (is_gdb_fast_lookup_section): New function.
3492 (Layout::include_section): Check for ".zdebug_" prefix; pass
3493 section name suffix to is_gdb_debug_section, et al.; check for
3494 fast-lookup sections when building .gdb_index.
3495 * options.h (--strip-debug-gdb): Update GDB version number.
3496
3497 2012-06-06 Cary Coutant <ccoutant@google.com>
3498
3499 * configure.ac: Add check for fallocate.
3500 * configure: Regenerate.
3501 * config.in: Regenerate.
3502
3503 * options.h (class General_options): Add --mmap-output-file and
3504 --posix-fallocate options.
3505 * output.cc: (posix_fallocate): Remove; replace with...
3506 (gold_fallocate): New function.
3507 (Output_file::map_no_anonymous): Call gold_fallocate.
3508 (Output_file::map): Check --mmap-output-file option.
3509
3510 2012-06-05 Jing Yu <jingyu@google.com>
3511
3512 * gold.h (textdomain): Add do {} to empty while(0).
3513 (bindtextdomain): Likewise.
3514
3515 2012-06-04 Cary Coutant <ccoutant@google.com>
3516
3517 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3518 has_dynsym_index.
3519
3520 2012-05-25 Sriraman Tallam <tmsriram@google.com>
3521
3522 * symtab.cc (Symbol_table::define_special_symbol):
3523 Initialize *poldsym to prevent uninitialized variable errors.
3524
3525 2012-05-23 Cary Coutant <ccoutant@google.com>
3526
3527 * layout.cc (Layout::section_name_mapping): Add rules to handle
3528 exact match on .data.rel.ro.local or .data.rel.ro.
3529 (Layout::output_section_name): Check for exact matches.
3530
3531 2012-05-23 Cary Coutant <ccoutant@google.com>
3532
3533 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3534 more carefully.
3535
3536 2012-05-22 Cary Coutant <ccoutant@google.com>
3537
3538 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3539 object before exporting symbol.
3540
3541 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
3542
3543 * testsuite/tls_test.cc: Include "config.h" first.
3544 * testsuite/tls_test_c.c: Likewise.
3545
3546 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
3547 Nick Clifton <nickc@redhat.com>
3548
3549 PR 14072
3550 * configure.in: Add check that sysdep.h has been included before
3551 any system header files.
3552 * configure: Regenerate.
3553 * config.in: Regenerate.
3554
3555 2012-05-14 Cary Coutant <ccoutant@google.com>
3556
3557 * layout.cc (Layout::make_output_section): Mark .tdata section
3558 as RELRO.
3559 * testsuite/relro_test.cc: Add a TLS variable.
3560
3561 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
3562
3563 PR gold/14091
3564 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3565 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3566 R_X86_64_64.
3567
3568 2012-05-08 Cary Coutant <ccoutant@google.com>
3569
3570 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3571 (lines_only_debug_sections): Likewise.
3572
3573 2012-05-02 Roland McGrath <mcgrathr@google.com>
3574
3575 * nacl.cc: New file.
3576 * nacl.h: New file.
3577 * Makefile.am (CCFILES, HFILES): Add them.
3578 * Makefile.in: Regenerate.
3579 * i386.cc (Output_data_plt_i386_nacl): New class.
3580 (Output_data_plt_i386_nacl_exec): New class.
3581 (Output_data_plt_i386_nacl_dyn): New class.
3582 (Target_i386_nacl): New class.
3583 (Target_selector_i386_nacl): New class.
3584 (target_selector_i386): Use it instead of Target_selector_i386.
3585 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3586 (Target_x86_64_nacl): New class.
3587 (Target_selector_x86_64_nacl): New class.
3588 (target_selector_x86_64, target_selector_x32): Use it instead of
3589 Target_selector_x86_64.
3590 * arm.cc (Output_data_plt_arm_nacl): New class.
3591 (Target_arm_nacl): New class.
3592 (Target_selector_arm_nacl): New class.
3593 (target_selector_arm, target_selector_armbe): Use it instead of
3594 Target_selector_arm.
3595
3596 * target-select.cc (select_target): Take new Input_file* and off_t
3597 arguments, pass them on to recognize method of selector.
3598 * object.cc (make_elf_sized_object): Update caller.
3599 * parameters.cc (parameters_force_valid_target): Likewise.
3600 * incremental.cc (make_sized_incremental_binary): Likewise.
3601 * target-select.h: Update decl.
3602 (Target_selector::recognize): Take new Input_file* argument,
3603 pass it on to do_recognize.
3604 (Target_selector::do_recognize): Take new Input_file* argument.
3605 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3606 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3607 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3608 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3609
3610 * target.h (Target::Target_info): New members isolate_execinstr
3611 and rosegment_gap.
3612 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3613 * arm.cc (Target_arm::arm_info): Update initializer.
3614 * i386.cc (Target_i386::i386_info): Likewise.
3615 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3616 * sparc.cc (Target_sparc::sparc_info): Likewise.
3617 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3618 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3619 * layout.cc (Layout::attach_allocated_section_to_segment):
3620 Take new const Target* argument. If target->isolate_execinstr(), act
3621 like --rosegment.
3622 (Layout::find_first_load_seg): Take new const Target* argument;
3623 if target->isolate_execinstr(), reject PF_X segments.
3624 (Layout::relaxation_loop_body): Update caller.
3625 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3626 reset file offset to zero when we hit LOAD_SEG, and then do a second
3627 loop over the segments before LOAD_SEG to reassign offsets after
3628 addresses have been determined. Handle target->rosegment_gap().
3629 (Layout::attach_section_to_segment): Take new const Target* argument;
3630 pass it to attach_allocated_section_to_segment.
3631 (Layout::make_output_section): Update caller.
3632 (Layout::attach_sections_to_segments): Take new const Target* argument;
3633 pass it to attach_section_to_segment.
3634 * gold.cc (queue_middle_tasks): Update caller.
3635 * layout.h (Layout): Update method decls with new arguments.
3636
3637 * arm.cc (Target_arm::Target_arm): Take optional argument for the
3638 Target_info pointer to use.
3639 (Target_arm::do_make_data_plt): New virtual method.
3640 (Target_arm::make_data_plt): New method that calls it.
3641 (Target_arm::make_plt_entry): Use it.
3642 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3643 for the section alignment.
3644 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3645 method.
3646 (Output_data_plt_arm::first_plt_entry_offset): Call it.
3647 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3648 method.
3649 (Output_data_plt_arm::get_plt_entry_size): Call it.
3650 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3651 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3652 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3653 method.
3654 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3655 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3656 method instead of sizeof(plt_entry).
3657 (Output_data_plt_arm::add_entry): Likewise.
3658 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3659 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3660 than static method.
3661 (Target_arm::plt_entry_size): Likewise.
3662 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3663 Move to ...
3664 (Output_data_plt_arm_standard): ... here, new class.
3665 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3666 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3667 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3668
3669 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3670 Take additional argument for the PLT entry size.
3671 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3672 Use get_plt_entry_size method rather than plt_entry_size variable.
3673 (Output_data_plt_x86_64::reserve_slot): Likewise.
3674 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3675 (Output_data_plt_x86_64::add_entry): Likewise.
3676 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3677 (Output_data_plt_x86_64::address_for_global): Likewise.
3678 (Output_data_plt_x86_64::address_for_local): Likewise.
3679 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3680 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3681 Make method non-static.
3682 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3683 method.
3684 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3685 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3686 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3687 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3688 virtual method.
3689 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3690 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3691 virtual method.
3692 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3693 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3694 virtual method.
3695 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3696 (Output_data_plt_x86_64::plt_entry_size)
3697 (Output_data_plt_x86_64::first_plt_entry)
3698 (Output_data_plt_x86_64::plt_entry)
3699 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3700 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3701 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3702 (Output_data_plt_x86_64_standard): ... here, new class.
3703 (Target_x86_64::Target_x86_64): Take optional argument for the
3704 Target_info pointer to use.
3705 (Target_x86_64::do_make_data_plt): New virtual method.
3706 (Target_x86_64::make_data_plt): New method to call it.
3707 (Target_x86_64::init_got_plt_for_update): Use that.
3708 Call this->plt_->add_eh_frame method here.
3709 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3710 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3711 rather than static method.
3712 (Target_x86_64::plt_entry_size): Likewise.
3713 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3714 rather than plt_entry_size variable. Move guts of PLT filling to...
3715 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3716 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3717 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3718
3719 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3720 additional argument for the section alignment.
3721 Don't do add_eh_frame_for_plt here.
3722 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3723 non-static. Use get_plt_entry_size method rather than plt_entry_size
3724 variable.
3725 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3726 method.
3727 (Output_data_plt_i386::get_plt_entry_size): Call it.
3728 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3729 (Output_data_plt_i386::add_eh_frame): New method to call it.
3730 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3731 method.
3732 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3733 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3734 method.
3735 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3736 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3737 method instead of plt_entry_size.
3738 (Output_data_plt_i386::plt_entry_size)
3739 (Output_data_plt_i386::plt_eh_frame_fde_size)
3740 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3741 (Output_data_plt_i386_standard): ... here, new class.
3742 (Output_data_plt_i386_exec): New class.
3743 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3744 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3745 (Output_data_plt_i386::exec_plt_entry): Move to ...
3746 (Output_data_plt_i386_exec::plt_entry): ... here.
3747 (Output_data_plt_i386_dyn): New class.
3748 (Output_data_plt_i386::first_plt_entry): Move to ...
3749 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3750 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3751 (Output_data_plt_i386_dyn::plt_entry): ... here.
3752 (Target_i386::Target_i386): Take optional argument for the Target_info
3753 pointer to use.
3754 (Target_i386::do_make_data_plt): New virtual method.
3755 (Target_i386::make_data_plt): New method to call it.
3756 (Target_i386::make_plt_section): Use that.
3757 Call this->plt_->add_eh_frame method here.
3758 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3759 rather than plt_entry_size variable.
3760 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3761 (Output_data_plt_i386::address_for_local): Likewise.
3762 (Output_data_plt_i386::do_write): Likewise.
3763 Move guts of PLT filling to...
3764 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3765 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3766 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3767 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3768
3769 2012-05-01 Cary Coutant <ccoutant@google.com>
3770
3771 * dwarf_reader.cc (Dwarf_die::read_attributes)
3772 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3773 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3774 * reduced_debug_output.cc
3775 (Output_reduced_debug_info_section::get_die_end): Remove
3776 DW_FORM_GNU_ref_index. Add default case.
3777
3778 2012-04-26 Mark Wielaard <mjw@redhat.com>
3779
3780 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3781 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3782 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3783 DW_AT_high_pc as offset from DW_AT_low_pc.
3784
3785 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3786 * testsuite/Makefile.in: Regenerate.
3787 * testsuite/gdb_index_test_3.c: New test source file.
3788 * testsuite/gdb_index_test_3.sh: New test source file.
3789
3790 2012-04-25 Ian Lance Taylor <iant@google.com>
3791
3792 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3793 pointer.
3794 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3795 as a class, not a struct.
3796 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3797 (Target_arm::apply_cortex_a8_workaround): Likewise.
3798 * gc.h: Declare Reloc_types as a struct, not a class.
3799 * object.h: Declare Symbols_data as a struct.
3800 * reloc.h: Declare Read_relocs_data as a struct.
3801 * target.h: Declare Relocate_info as a struct.
3802
3803 2012-04-24 David S. Miller <davem@davemloft.net>
3804
3805 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3806 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3807 and R_SPARC_WPLT30.
3808
3809 2012-04-24 Cary Coutant <ccoutant@google.com>
3810
3811 * incremental-dump.cc (find_input_containing_global): Replace
3812 magic number with symbolic constant.
3813 (dump_incremental_inputs): Update version number.
3814 * incremental.cc (Output_section_incremental_inputs): Update version
3815 number; import symbolic constants from Incremental_inputs_reader.
3816 (Incremental_inputs::create_data_sections): Align relocations
3817 section correctly for 64-bit targets.
3818 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3819 constants; add padding.
3820 (Output_section_incremental_inputs::write_header): Add assert for
3821 header_size.
3822 (Output_section_incremental_inputs::write_input_files): Add assert
3823 for input_entry_size.
3824 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3825 add assert for object_info_size, input_section_entry_size,
3826 global_sym_entry_size.
3827 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3828 for data structure sizes; use them.
3829 (Incremental_input_entry_reader): Import symbolic constants from
3830 Incremental_inputs_reader; use them.
3831
3832 2012-04-23 David S. Miller <davem@davemloft.net>
3833
3834 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3835 and elf_flags_set_.
3836 (Target_sparc::Target_sparc): Initialize new fields.
3837 (Target_sparc::do_make_elf_object): New function.
3838 (Target_sparc::do_adjust_elf_header): New function.
3839
3840 2012-04-23 Cary Coutant <ccoutant@google.com>
3841
3842 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3843 CU range table of gdb index.
3844
3845 2012-04-20 David S. Miller <davem@davemloft.net>
3846
3847 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3848 instead of false.
3849
3850 2012-04-16 David S. Miller <davem@davemloft.net>
3851
3852 * sparc.cc (Target_sparc::got_address): New function.
3853 (Sparc_relocate_functions::gdop_hix22): New function.
3854 (Sparc_relocate_functions::gdop_lox10): New function.
3855 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3856 relocs.
3857 (Target_sparc::Scan::local): Likewise if the global symbol is not
3858 preemptible and is not IFUNC.
3859 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3860 transformations for local and non-preemptible non-IFUNC global
3861 symbols.
3862
3863 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3864 writing out 64-bit part of ranges.
3865
3866 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3867 -fpic and -fpie respectively.
3868 * Makefile.in: Regenerate.
3869
3870 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3871 (Target_sparc::Target_sparc): Initialize new field.
3872 (Target_sparc::do_plt_section_for_global): New function.
3873 (Target_sparc::do_plt_section_for_local): New function.
3874 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3875 (Target_sparc::make_plt_section): New function, broken out of
3876 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3877 (Target_sparc::make_plt_entry): Call make_plt_section.
3878 (Target_sparc::make_local_ifunc_plt_entry): New function.
3879 (Target_sparc::rela_ifunc_section): New function.
3880 (Target_sparc::plt_section): Remove const.
3881 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3882 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3883 and ifunc_count_ fields.
3884 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3885 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3886 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3887 (Output_data_plt_sparc::rela_ifunc): New function.
3888 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3889 (Output_data_plt_sparc::has_ifunc_section): New function.
3890 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3891 (Output_data_plt_sparc::address_for_global): New function.
3892 (Output_data_plt_sparc::address_for_local): New function.
3893 (Output_data_plt_sparc::plt_index_to_offset): New function.
3894 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3895 and entry_count.
3896 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3897 entry_count.
3898 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3899 R_SPARC_JMP_IREL to switch.
3900 (Target_sparc::Scan::check_non_pic): Likewise.
3901 (Target_sparc::Scan::local): Handle IFUNC symbols.
3902 (Target_sparc::Scan::local): Likewise.
3903 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3904 and plt_address_for_local.
3905 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3906 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3907
3908 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3909 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3910 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3911 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3912 global relocs too.
3913 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3914 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3915 calls.
3916 * sparc.cc (Target_sparc::Scan::global): Likewise.
3917 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3918
3919 2012-04-16 Cary Coutant <ccoutant@google.com>
3920
3921 * archive.cc (Library_base::should_include_member): Check for
3922 --export-dynamic-symbol.
3923 * options.h (class General_options): Add --export-dynamic-symbol.
3924 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3925 --export-dynamic-symbol.
3926 (Symbol_table::gc_mark_undef_symbols): Likewise.
3927 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3928
3929 2012-04-12 David S. Miller <davem@davemloft.net>
3930
3931 * sparc.cc (Reloc::wdisp10): New relocation method.
3932 (Reloc::h34): Likewise.
3933 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3934 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3935 R_SPARC_WDISP10.
3936 (Target_sparc::Scan::local): Likewise.
3937 (Target_sparc::Scan::global): Likewise.
3938 (Target_sparc::Relocate::relocate): Likewise.
3939
3940 2012-04-09 Cary Coutant <ccoutant@google.com>
3941
3942 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3943 low_pc == 0.
3944
3945 2012-04-06 Ian Lance Taylor <iant@google.com>
3946
3947 * timer.cc: #include <unistd.h>.
3948
3949 2012-04-06 Roland McGrath <mcgrathr@google.com>
3950
3951 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3952 * config.in: Regenerate.
3953 * configure: Regenerate.
3954
3955 2012-04-05 Nick Clifton <nickc@redhat.com>
3956
3957 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3958 (AM_LC_MESSAGES): Add.
3959 * aclocal.m4: Regenerate.
3960 * config.in: Regenerate.
3961 * configure: Regenerate.
3962
3963 2012-03-21 Cary Coutant <ccoutant@google.com>
3964
3965 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3966 * Makefile.in: Regenerate.
3967 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3968 (Sized_elf_reloc_mapper::symbol_section): New function.
3969 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3970 (make_elf_reloc_mapper): New function.
3971 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3972 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3973 (Dwarf_abbrev_table::do_get_abbrev): New function.
3974 (Dwarf_ranges_table::read_ranges_table): New function.
3975 (Dwarf_ranges_table::read_range_list): New function.
3976 (Dwarf_pubnames_table::read_section): New function.
3977 (Dwarf_pubnames_table::read_header): New function.
3978 (Dwarf_pubnames_table::next_name): New function.
3979 (Dwarf_die::Dwarf_die): New function.
3980 (Dwarf_die::read_attributes): New function.
3981 (Dwarf_die::skip_attributes): New function.
3982 (Dwarf_die::set_name): New function.
3983 (Dwarf_die::set_linkage_name): New function.
3984 (Dwarf_die::attribute): New function.
3985 (Dwarf_die::string_attribute): New function.
3986 (Dwarf_die::int_attribute): New function.
3987 (Dwarf_die::uint_attribute): New function.
3988 (Dwarf_die::ref_attribute): New function.
3989 (Dwarf_die::child_offset): New function.
3990 (Dwarf_die::sibling_offset): New function.
3991 (Dwarf_info_reader::check_buffer): New function.
3992 (Dwarf_info_reader::parse): New function.
3993 (Dwarf_info_reader::do_parse): New function.
3994 (Dwarf_info_reader::do_read_string_table): New function.
3995 (Dwarf_info_reader::lookup_reloc): New function.
3996 (Dwarf_info_reader::get_string): New function.
3997 (Dwarf_info_reader::visit_compilation_unit): New function.
3998 (Dwarf_info_reader::visit_type_unit): New function.
3999 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4000 Sized_elf_reloc_mapper.
4001 (Sized_dwarf_line_info::symbol_section): Remove function.
4002 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4003 (Sized_dwarf_line_info::read_line_mappings): Remove object
4004 parameter, adjust callers.
4005 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4006 * dwarf_reader.h: Include <sys/types.h>.
4007 (class Track_relocs): Remove forward declaration.
4008 (class Elf_reloc_mapper): New class.
4009 (class Sized_elf_reloc_mapper): New class.
4010 (class Dwarf_abbrev_table): New class.
4011 (class Dwarf_range_list): New class.
4012 (class Dwarf_ranges_table): New class.
4013 (class Dwarf_pubnames_table): New class.
4014 (class Dwarf_die): New class.
4015 (class Dwarf_info_reader): New class.
4016 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4017 (Sized_dwarf_line_info::symbol_section): Remove member function.
4018 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4019 base class.
4020 * gdb-index.cc: New source file.
4021 * gdb-index.h: New source file.
4022 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4023 and .debug_types sections, call Layout::add_to_gdb_index.
4024 (Sized_relobj_incr::do_section_name): Implement.
4025 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4026 return type; Implement.
4027 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4028 return type.
4029 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4030 parameter list and return type.
4031 (Sized_incr_dynobj::do_section_contents): Likewise.
4032 * layout.cc: Include gdb-index.h.
4033 (Layout::Layout): Initialize gdb_index_data_.
4034 (Layout::init_fixed_output_section): Check for .gdb_index section.
4035 (Layout::add_to_gdb_index): New function. Instantiate.
4036 * layout.h: Add forward declaration for class Gdb_index.
4037 (Layout::add_to_gdb_index): New member function.
4038 (Layout::gdb_index_data_): New data member.
4039 * main.cc: Include gdb-index.h.
4040 (main): Print statistics for gdb index.
4041 * object.cc (Object::section_contents): Move code into
4042 do_section_contents.
4043 (need_decompressed_section): Check for sections needed when building
4044 gdb index.
4045 (build_compressed_section_map): Likewise.
4046 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4047 gdb index.
4048 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4049 sections; call Layout::add_to_gdb_index.
4050 (Sized_relobj_file::do_decompressed_section_contents): Call
4051 do_section_contents directly.
4052 * object.h (Object::do_section_contents): Adjust parameter list and
4053 return type.
4054 (Object::do_decompressed_section_contents): Call do_section_contents
4055 directly.
4056 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4057 return type.
4058 * options.h (class General_options): Add --gdb-index option.
4059 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4060 list and return type.
4061 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4062 * reloc.h (Track_relocs::checkpoint): New function.
4063 (Track_relocs::reset): New function.
4064
4065 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4066 New test cases.
4067 * testsuite/Makefile.in: Regenerate.
4068 * testsuite/gdb_index_test.cc: New test source file.
4069 * testsuite/gdb_index_test_1.sh: New test source file.
4070 * testsuite/gdb_index_test_2.sh: New test source file.
4071
4072 2012-03-19 Doug Kwan <dougkwan@google.com>
4073
4074 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4075 (Target_arm::do_finalize_sections): Remove code which defines
4076 __exidx_start and __exidx_end. Make symbol table parameter
4077 anonymous as it is not used.
4078 * gold.cc (queue_middle_tasks): Call target hook to define any
4079 target-specific symbols.
4080 * target.h (Target::define_standard_symbols): New method.
4081 (Target::do_define_standard_symbols): Same.
4082 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4083 * testsuite/Makefile.in: Regenerate.
4084 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4085 and __exidx_end.
4086 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4087 relocations are generated for __exidx_start and __exidx_end.
4088
4089 2012-03-16 Doug Kwan <dougkwan@google.com>
4090
4091 * testsuite/Makefile.am: Disable test initpri3b.
4092 * testsuite/Makefile.in: Regenerate.
4093
4094 2012-03-15 Doug Kwan <dougkwan@google.com>
4095
4096 * arm.cc (Target_arm::got_section): Make .got section read-only
4097 if -z now is given.
4098
4099 2012-03-15 Ian Lance Taylor <iant@google.com>
4100
4101 PR gold/13850
4102 * layout.cc (Layout::make_output_section): Correctly mark
4103 SHT_INIT_ARRAY, et. al., as relro.
4104
4105 2012-03-14 Doug Kwan <dougkwan@google.com>
4106
4107 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4108 dynamic relocations for protected symbols in shared objects.
4109
4110 2012-03-13 Ian Lance Taylor <iant@google.com>
4111
4112 * resolve.cc (Symbol_table::resolve): When merging common symbols,
4113 keep the larger alignment.
4114
4115 2012-03-12 Cary Coutant <ccoutant@google.com>
4116
4117 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4118 handling of DW_LNE_define_file.
4119
4120 2012-03-12 Cary Coutant <ccoutant@google.com>
4121
4122 * reduced_debug_output.cc
4123 (Output_reduced_debug_info_section::get_die_end): Add new FORM
4124 codes to switch.
4125
4126 2012-02-29 Cary Coutant <ccoutant@google.com>
4127
4128 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4129
4130 2012-02-29 Cary Coutant <ccoutant@google.com>
4131
4132 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4133 Call Object::decompressed_section_contents.
4134 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4135 New dtor.
4136 (Sized_dwarf_line_info::buffer_start_): New data member.
4137 * merge.cc (Output_merge_data::do_add_input_section): Call
4138 Object::decompressed_section_contents.
4139 (Output_merge_string::do_add_input_section): Likewise.
4140 * object.cc (need_decompressed_section): New function.
4141 (build_compressed_section_map): Decompress sections needed later.
4142 (Sized_relobj_file::do_decompressed_section_contents): New function.
4143 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4144 * object.h (Object::decompressed_section_contents): New function.
4145 (Object::discard_decompressed_sections): New function.
4146 (Object::do_decompressed_section_contents): New function.
4147 (Object::do_discard_decompressed_sections): New function.
4148 (Compressed_section_info): New type.
4149 (Compressed_section_map): Include decompressed section contents.
4150 (Sized_relobj_file::do_decompressed_section_contents): New function.
4151 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4152
4153 2012-02-16 Cary Coutant <ccoutant@google.com>
4154
4155 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4156 * testsuite/Makefile.in: Regenerate.
4157
4158 2012-02-14 Cary Coutant <ccoutant@google.com>
4159
4160 * options.cc (General_options::finalize): Disallow -pie and -static.
4161
4162 2012-02-03 Doug Kwan <dougkwan@google.com>
4163
4164 * arm.cc (Arm_relocate_functions::abs8,
4165 Arm_relocate_functions::abs16): Use
4166 Bits::has_signed_unsigned_overflow32.
4167 (Arm_relocate_functions::thm_abs8): Correct range of
4168 overflow check.
4169 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4170 in assertions.
4171
4172 2012-02-02 Doug Kwan <dougkwan@google.com>
4173
4174 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4175 position independent outputs, not just shared objects.
4176
4177 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
4178
4179 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4180 * configure: Regenerated.
4181
4182 2012-01-27 Ian Lance Taylor <iant@google.com>
4183
4184 * reloc.h (Bits): New class with static functions, copied from
4185 namespace utils in arm.cc.
4186 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
4187 instead.
4188
4189 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4190
4191 * incremental.cc (write_info_blocks): Correct relocation offset.
4192
4193 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4194
4195 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4196 (Relocate::tls_gd_to_le): Likewise.
4197
4198 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4199
4200 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4201
4202 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4203
4204 * configure.ac: Check if -mcmodel=medium works.
4205 * configure: Regenerated.
4206
4207 2012-01-24 Cary Coutant <ccoutant@google.com>
4208
4209 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4210 definition and ...
4211 (read_unsigned_LEB_128_x): ... this new function.
4212 (read_signed_LEB_128): Replaced with inline definition and ...
4213 (read_signed_LEB_128_x): ... this new function.
4214 * int_encoding.h (read_unsigned_LEB_128_x): New function.
4215 (read_unsigned_LEB_128): Add inline definition.
4216 (read_signed_LEB_128_x): New function.
4217 (read_signed_LEB_128): Add inline definition.
4218 * testsuite/Makefile.am (leb128_unittest): New unit test.
4219 * testsuite/Makefile.in: Regenerate.
4220 * testsuite/leb128_unittest.cc: New unit test.
4221
4222 2012-01-23 Ian Lance Taylor <iant@google.com>
4223
4224 PR gold/13617
4225 * i386.cc (Target_i386::do_code_fill): When using a jmp
4226 instruction, pad with nop instructions.
4227 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4228
4229 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
4230
4231 * x86_64.cc (gc_process_relocs): Add typename on types used in
4232 template.
4233 (scan_relocs): Likewise.
4234 (relocate_section): Likewise.
4235 (apply_relocation): Likewise.
4236
4237 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
4238
4239 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4240 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4241 under x32.
4242
4243 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
4244
4245 * x86_64.cc: Initial support for x32.
4246
4247 2012-01-03 Cary Coutant <ccoutant@google.com>
4248
4249 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4250 Use abstract base class for GOT.
4251 * gold/output.h (class Output_data_got_base): New abstract base class.
4252 (class Output_data_got): Derive from new base class, adjust ctors.
4253 (Output_data_got::reserve_slot): Make virtual; rename to
4254 do_reserve_slot; Adjust callers.
4255 * gold/target.h (Sized_target::init_got_plt_for_update): Return
4256 pointer to abstract base class.
4257 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4258
4259 2011-12-18 Ian Lance Taylor <iant@google.com>
4260
4261 * object.h (Relobj::local_symbol_value): New function.
4262 (Relobj::local_plt_offset): New function.
4263 (Relobj::local_has_got_offset): New function.
4264 (Relobj::local_got_offset): New function.
4265 (Relobj::set_local_got_offset): New function.
4266 (Relobj::do_local_symbol_value): New pure virtual function.
4267 (Relobj::do_local_plt_offset): Likewise.
4268 (Relobj::do_local_has_got_offset): Likewise.
4269 (Relobj::do_local_got_offset): Likewise.
4270 (Relobj::do_set_local_got_offset): Likewise.
4271 (Sized_relobj::do_local_has_got_offset): Rename from
4272 local_has_got_offset.
4273 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4274 (Sized_relobj::do_set_local_got_offset): Rename from
4275 set_local_got_offset.
4276 (Sized_relobj_file::do_local_plt_offset): Rename from
4277 local_plt_offset.
4278 (Sized_relobj_file::do_local_symbol_value): New function.
4279 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4280 local_plt_offset.
4281 * output.cc (Output_data_got::Got_entry::write): Change object to
4282 Relobj. Use local_symbol_value.
4283 (Output_data_got::add_global_with_rel): Change rel_dyn to
4284 Output_data_reloc_generic*. Use add_global_generic.
4285 (Output_data_got::add_global_with_rela): Remove. Change all
4286 callers to use add_global_with_rel.
4287 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4288 Output_data_reloc_generic*. Use add_global_generic.
4289 (Output_data_got::add_global_pair_with_rela): Remove. Change all
4290 callers to use add_global_pair_with_rel.
4291 (Output_data_got::add_local): Change object to Relobj*.
4292 (Output_data_got::add_local_plt): Likewise.
4293 (Output_data_got::add_local_with_rel): Change object to Relobj*,
4294 change rel_dyn to Output_data_reloc_generic*. Use
4295 add_local_generic.
4296 (Output_data_got::add_local_with_rela): Remove. Change all
4297 callers to use all_local_with_rel.
4298 (Output_data_got::add_local_pair_with_rel): Change object to
4299 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
4300 add_output_section_generic.
4301 (Output_data_got::add_local_pair_with_rela): Remove. Change all
4302 callers to use add_local_pair_with_rel.
4303 (Output_data_got::reserve_local): Change object to Relobj*.
4304 * output.h: (class Output_data_reloc_generic): Add pure virtual
4305 declarations for add_global_generic, add_local_generic,
4306 add_output_section_generic.
4307 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4308 functions for Output_data_reloc_generic. Update declarations for
4309 changes listed in output.cc.
4310 (class Output_data_got): Change template parameter to got_size.
4311 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
4312 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4313 function.
4314 (Sized_relobj_incr::do_local_plt_offset): New function.
4315 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4316 add_global_generic.
4317
4318 2011-12-17 Cary Coutant <ccoutant@google.com>
4319
4320 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4321 * resolve.cc (Symbol_table::resolve): Likewise.
4322 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4323 arrays.
4324 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4325
4326 2011-12-16 Ian Lance Taylor <iant@google.com>
4327
4328 * output.h (Output_data_reloc_generic::add): Only call
4329 add_dynamic_reloc if this is a dynamic reloc section.
4330
4331 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
4332
4333 PR gold/13505
4334 * target-reloc.h (apply_relocation): Replace <64, false> with
4335 <size, big_endian>.
4336
4337 2011-11-25 Nick Clifton <nickc@redhat.com>
4338
4339 * po/it.po: New Italian translation.
4340
4341 2011-11-17 Sterling Augustine <saugustine@google.com>
4342
4343 * script.cc (script_include_directive): Implement.
4344 (read_script_file): New local variables name and search_path. Update
4345 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4346 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4347 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4348
4349 2011-11-11 Sterling Augustine <saugustine@google.com>
4350
4351 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4352 (file_or_sections_cmd): Likewise.
4353
4354 2011-11-11 Doug Kwan <dougkwan@google.com>
4355
4356 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4357 if --just-symbols is given.
4358
4359 2011-11-10 Doug Kwan <dougkwan@google.com>
4360
4361 PR gold/13362
4362 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4363 when processing data relocs.
4364 * reloc.h (Relocate_functions::rel_unaligned): New method.
4365 (Relocate_functions::pcrel_unaligned): Ditto.
4366 (Relocate_functions::rel32_unaligned): Ditto.
4367 (Relocate_functions::pcrel32_unaligned): Ditto.
4368
4369 2011-11-09 Doug Kwan <dougkwan@google.com>
4370
4371 PR gold/13362
4372 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4373 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4374 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4375 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4376 (Relocate_functions::rel_unaligned): New.
4377 (Relocate_functions::rel32_unaligned): New.
4378 * target-reloc.h (relocate_for_relocatable): Add code to handle
4379 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4380 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4381 arm_unaligned_reloc_r): New targets.
4382 * testsuite/Makefile.in: Regenerate.
4383 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4384 linking.
4385
4386 2011-11-02 Ian Lance Taylor <iant@google.com>
4387
4388 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
4389 NATIVE_LINKER.
4390 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4391 * options.cc (General_options::finalize): Use library search path
4392 from configure script if specified. If not native and no sysroot,
4393 only search TOOLLIBDIR.
4394 * options.h (Search_directory::Search_directory): Change name to
4395 const std::string&.
4396 (General_options::add_to_library_path_with_sysroot): Change arg to
4397 const std::string&.
4398 * configure, Makefile.in, config.in: Rebuild.
4399
4400 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4401
4402 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4403 we are working around the ARM1176 Erratum.
4404 * options.h (General_options::fix_arm1176): Add option.
4405 * testsuite/Makefile.am: Add testcases, and keep current ones
4406 working.
4407 * testsuite/Makefile.in: Regenerate.
4408 * testsuite/arm_fix_1176.s: New file.
4409 * testsuite/arm_fix_1176.sh: Likewise.
4410
4411 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
4412
4413 * arm.cc (Target_arm::Target_arm): Remove initialisation of
4414 may_use_blx_.
4415 (Target_arm::may_use_blx): Remove method.
4416 (Target_arm::set_may_use_blx): Likewise.
4417 (Target_arm::may_use_v4t_interworking): New method.
4418 (Target_arm::may_use_v5t_interworking): Likewise.
4419 (Target_arm::may_use_blx_): Remove member variable.
4420 (Arm_relocate_functions::arm_branch_common): Check for v5T
4421 interworking.
4422 (Arm_relocate_functions::thumb_branch_common): Likewise.
4423 (Reloc_stub::stub_type_for_reloc): Likewise.
4424 (Target_arm::do_finalize_sections): Correct interworking checks.
4425 * testsuite/Makefile.am: Add new tests.
4426 * testsuite/Makefile.in: Regenerate.
4427 * testsuite/arm_farcall_arm_arm.s: New test.
4428 * testsuite/arm_farcall_arm_arm.sh: Likewise.
4429 * testsuite/arm_farcall_arm_thumb.s: Likewise.
4430 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4431 * testsuite/arm_farcall_thumb_arm.s: Likewise.
4432 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4433 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4434 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4435
4436 2011-10-31 Cary Coutant <ccoutant@google.com>
4437
4438 PR gold/13023
4439 * expression.cc (Expression::eval_with_dot): Add
4440 is_section_dot_assignment parameter.
4441 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
4442 absolute and assigning to dot within a section.
4443 * script-sections.cc
4444 (Output_section_element_assignment::set_section_addresses): Pass
4445 dot_section to set_if_absolute.
4446 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4447 as is_section_dot_assignment flag to eval_with_dot.
4448 (Output_section_element_dot_assignment::set_section_addresses):
4449 Likewise.
4450 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4451 parameter. Also set value if relative to dot_section; set the
4452 symbol's output_section.
4453 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4454 parameter. Adjust all callers.
4455 (Expression::eval_maybe_dot): Likewise.
4456 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4457 Adjust all callers.
4458 * testsuite/script_test_2.t: Test assignment of an absolute value
4459 to dot within an output section element.
4460
4461 2011-10-31 Cary Coutant <ccoutant@google.com>
4462
4463 * options.h (class General_options): Add --[no-]gnu-unique options.
4464 * symtab.cc (Symbol_table::sized_write_globals): Convert
4465 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4466
4467 2011-10-31 Cary Coutant <ccoutant@google.com>
4468
4469 PR gold/13359
4470 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4471 unnecessary assertion.
4472 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4473
4474 2011-10-31 Sriraman Tallam <tmsriram@google.com>
4475
4476 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4477 gc_mark_symbol.
4478 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4479 gc_mark_symbol.
4480 Change to just keep the section associated with symbol.
4481 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4482 they are externally visible and --export-dynamic is turned on.
4483 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4484
4485 2011-10-19 Ian Lance Taylor <iant@google.com>
4486
4487 PR gold/13163
4488 * script-sections.cc
4489 (Output_section_element_dot_assignment::needs_output_section): New
4490 function.
4491
4492 2011-10-19 Ian Lance Taylor <iant@google.com>
4493
4494 PR gold/13204
4495 * layout.cc (Layout::segment_precedes): Don't assert failure if a
4496 --section-start option was seen.
4497 * options.h (General_options::any_section_start): New function.
4498
4499 2011-10-18 David S. Miller <davem@davemloft.net>
4500
4501 PR binutils/13301
4502 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4503 member to track relocation locations that have moved during TLS
4504 reloc optimizations.
4505 (Target_sparc::Relocate::Relocate): Initialize to NULL.
4506 (Target_sparc::Relocate::relocate): Adjust view down by 4
4507 bytes if it matches reloc_adjust_addr_.
4508 (Target_sparc::Relocate::relocate_tls): Always move the
4509 __tls_get_addr call delay slot instruction forward 4 bytes when
4510 performing relaxation.
4511
4512 2011-10-18 Cary Coutant <ccoutant@google.com>
4513
4514 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4515 (Output_file::map_no_anonymous): Check for non-zero
4516 return code from posix_fallocate.
4517
4518 2011-10-17 Cary Coutant <ccoutant@google.com>
4519
4520 PR gold/13245
4521 * plugin.cc (is_visible_from_outside): Check for symbols
4522 referenced from dynamic objects.
4523 * resolve.cc (Symbol_table::resolve): Don't count references
4524 from dynamic objects as references from real ELF files.
4525 * testsuite/plugin_test_2.sh: Adjust expected result.
4526
4527 2011-10-17 Cary Coutant <ccoutant@google.com>
4528
4529 * gold.cc: Include timer.h.
4530 (queue_middle_tasks): Stamp time.
4531 (queue_final_tasks): Likewise.
4532 * main.cc (main): Store timer in parameters. Print timers
4533 for each pass.
4534 * parameters.cc (Parameters::Parameters): Initialize timer_.
4535 (Parameters::set_timer): New function.
4536 (set_parameters_timer): New function.
4537 * parameters.h (Parameters::set_timer): New function.
4538 (Parameters::timer): New function.
4539 (Parameters::timer_): New data member.
4540 (set_parameters_timer): New function.
4541 * timer.cc (Timer::stamp): New function.
4542 (Timer::get_pass_time): New function.
4543 * timer.h (Timer::stamp): New function.
4544 (Timer::get_pass_time): New function.
4545 (Timer::pass_times_): New data member.
4546
4547 2011-10-17 Cary Coutant <ccoutant@google.com>
4548
4549 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4550 task for members of lib groups.
4551
4552 2011-10-17 Cary Coutant <ccoutant@google.com>
4553
4554 PR gold/13288
4555 * fileread.cc (File_read::find_view): Add assert.
4556 (File_read::make_view): Move bounds check (replace with assert)...
4557 (File_read::find_or_make_view): ... to here.
4558
4559 2011-10-12 Cary Coutant <ccoutant@google.com>
4560
4561 * output.cc (Output_file::open_base_file): Handle case where
4562 ::read returns less than requested size.
4563
4564 2011-10-10 Cary Coutant <ccoutant@google.com>
4565
4566 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4567 Initialize defined_count_.
4568 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4569 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4570 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4571 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4572 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4573 * incremental.h (Sized_relobj_incr::defined_count_): New data
4574 member.
4575 (Sized_incr_dynobj::defined_count_): New data member.
4576 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4577 Return zeroes instead of internal error.
4578
4579 2011-10-10 Cary Coutant <ccoutant@google.com>
4580
4581 PR gold/13249
4582 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4583 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4584 * output.h (class Output_reloc): Add use_plt_offset flag.
4585 (Output_reloc::type_): Adjust size of bit field.
4586 (Output_reloc::use_plt_offset_): New bit field.
4587 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4588 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4589 flag. Adjust all callers.
4590 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4591 creating RELATIVE relocations.
4592
4593 2011-10-10 Nick Clifton <nickc@redhat.com>
4594
4595 * po/es.po: Updated Spanish translation.
4596 * po/fi.po: Updated Finnish translation.
4597
4598 2011-10-03 Diego Novillo <dnovillo@google.com>
4599
4600 * options.cc (parse_uint): Fix dereference of RETVAL.
4601
4602 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4603
4604 * layout.h (section_order_map_): New member.
4605 (get_section_order_map): New member function.
4606 * output.cc (Output_section::add_input_section): Check for patterns
4607 only when --section-ordering-file is specified.
4608 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4609 output_sections have been formed.
4610 * layout.cc (Layout_Layout): Initialize section_order_map_.
4611 * plugin.cc (update_section_order): Store order in order_map. Do not
4612 update the order.
4613 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4614 * testsuite/Makefile.in: Regenerate.
4615 * testsuite/plugin_section_order.c: New file.
4616 * testsuite/plugin_final_layout.cc: New file.
4617 * testsuite/plugin_final_layout.sh: New file.
4618
4619 2011-09-29 Cary Coutant <ccoutant@google.com>
4620
4621 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4622 Check for NULL.
4623 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4624 symbols during incremental update.
4625 (Symbol_table::add_from_dynobj): Likewise.
4626
4627 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4628 Ian Lance Taylor <iant@google.com>
4629
4630 * symtab.cc (Symbol_table::define_special_symbol): Always
4631 canonicalize version string.
4632
4633 2011-09-26 Cary Coutant <ccoutant@google.com>
4634
4635 * gold.cc (queue_initial_tasks): Move option checks ...
4636 * options.cc (General_options::finalize): ... to here. Disable
4637 some options; make others fatal.
4638
4639 2011-09-26 Cary Coutant <ccoutant@google.com>
4640
4641 gcc PR lto/47247
4642 * plugin.cc (get_symbols_v2): New function.
4643 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4644 (is_referenced_from_outside): New function.
4645 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4646 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4647 (get_symbols): Pass version parameter.
4648 (get_symbols_v2): New function.
4649 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4650 parameter.
4651 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4652 (onload): Add LDPT_GET_SYMBOLS_V2.
4653 (all_symbols_read_hook): Use get_symbols_v2; check for
4654 LDPR_PREVAILING_DEF_IRONLY_EXP.
4655 * testsuite/plugin_test_3.sh: Update expected results.
4656
4657 2011-09-23 Simon Baldwin <simonb@google.com>
4658
4659 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4660 configuration options.
4661 * configure: Regenerate.
4662 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4663 * Makefile.in: Regenerate.
4664 * testsuite/Makefile.in: Regenerate.
4665
4666 2011-09-19 Sriraman Tallam <tmsriram@google.com>
4667
4668 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4669
4670 2011-09-19 Cary Coutant <ccoutant@google.com>
4671
4672 * incremental.cc (can_incremental_update): Fix typo in comment.
4673 * incremental.h (can_incremental_update): Likewise.
4674
4675 2011-09-18 Cary Coutant <ccoutant@google.com>
4676
4677 * incremental.cc (can_incremental_update): New function.
4678 * incremental.h (can_incremental_update): New function.
4679 * layout.cc (Layout::init_fixed_output_section): Call it.
4680 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4681 * object.cc (Sized_relobj_file::do_layout): Call
4682 can_incremental_update.
4683
4684 2011-09-13 Cary Coutant <ccoutant@google.com>
4685
4686 * configure.ac: Check for glibc support for gnu_indirect_function
4687 support with static linking, setting automake conditional
4688 IFUNC_STATIC.
4689 * Makefile.in: Regenerate.
4690 * configure: Regenerate.
4691
4692 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4693 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4694 for IFUNC_STATIC.
4695 * testsuite/Makefile.in: Regenerate.
4696
4697 2011-09-13 Cary Coutant <ccoutant@google.com>
4698
4699 * incremental.cc (Sized_relobj_incr::do_layout): Call
4700 report_comdat_group for kept comdat sections.
4701 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4702 * testsuite/Makefile.in: Regenerate.
4703 * testsuite/incr_comdat_test_1.cc: New source file.
4704 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4705 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4706 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4707
4708 2011-09-13 Ian Lance Taylor <iant@google.com>
4709
4710 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4711 variable external_symbols_offset.
4712
4713 2011-09-12 Ian Lance Taylor <iant@google.com>
4714
4715 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4716 triggered if object has no symbols.
4717
4718 2011-09-09 David S. Miller <davem@davemloft.net>
4719
4720 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4721 (Output_fill_debug_line::do_write): Likewise.
4722
4723 2011-08-29 Cary Coutant <ccoutant@google.com>
4724
4725 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4726 casts to match formatting specs.
4727 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4728
4729 2011-08-26 Cary Coutant <ccoutant@google.com>
4730
4731 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4732 remaining hole size when allocating.
4733 (Layout::make_output_section): Set fill methods for debug sections.
4734 * layout.h (Free_list::Free_list_node): Move from private to
4735 public.
4736 (Free_list::set_min_hole_size): New function.
4737 (Free_list::begin, Free_list::end): New functions.
4738 (Free_list::min_hole_): New data member.
4739 * output.cc: Include dwarf.h.
4740 (Output_fill_debug_info::do_minimum_hole_size): New function.
4741 (Output_fill_debug_info::do_write): New function.
4742 (Output_fill_debug_line::do_minimum_hole_size): New function.
4743 (Output_fill_debug_line::do_write): New function.
4744 (Output_section::Output_section): Initialize new data member.
4745 (Output_section::set_final_data_size): Ensure patch space is larger
4746 than minimum hole size.
4747 (Output_section::do_write): Fill holes in debug sections.
4748 * output.h (Output_fill): New class.
4749 (Output_fill_debug_info): New class.
4750 (Output_fill_debug_line): New class.
4751 (Output_section::set_free_space_fill): New function.
4752 (Output_section::free_space_fill_): New data member.
4753 * testsuite/Makefile.am (incremental_test_3): Add
4754 --incremental-patch option.
4755 (incremental_test_4): Likewise.
4756 (incremental_test_5): Likewise.
4757 (incremental_test_6): Likewise.
4758 (incremental_copy_test): Likewise.
4759 (incremental_common_test_1): Likewise.
4760 * testsuite/Makefile.in: Regenerate.
4761
4762 2011-08-26 Nick Clifton <nickc@redhat.com>
4763
4764 * po/es.po: Updated Spanish translation.
4765
4766 2011-08-01 Cary Coutant <ccoutant@google.com>
4767
4768 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4769 * gold/testsuite/Makefile.in: Regenerate.
4770 * gold/testsuite/justsyms_exec.c: New source file.
4771 * gold/testsuite/justsyms_lib.c: New source file.
4772
4773 2011-08-01 Cary Coutant <ccoutant@google.com>
4774
4775 * layout.cc (Layout::set_segment_offsets): Don't realign text
4776 segment if -Ttext was specified.
4777 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4778 file type.
4779 * object.h (Sized_relobj_file::e_type): New function.
4780 (Sized_relobj_file::e_type_): New data member.
4781 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4782 base address for ET_EXEC files.
4783 * target.cc (Target::do_make_elf_object_implementation): Allow
4784 ET_EXEC files with --just-symbols option.
4785
4786 2011-07-28 Cary Coutant <ccoutant@google.com>
4787
4788 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4789 Add thread_number parameter.
4790 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4791 * workqueue-threads.cc
4792 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4793 current thread if its thread number is greater than desired thread
4794 count.
4795 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4796 Add thread_number parameter.
4797 (Workqueue::should_cancel_thread): Likewise.
4798 (Workqueue::find_runnable_or_wait): Pass thread_number to
4799 should_cancel_thread.
4800 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4801 parameter.
4802
4803 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4804
4805 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4806 only after checking if it cannot be forced local.
4807 * symtab.h (is_externally_visible): Check if the symbol is not forced
4808 local.
4809
4810 2011-07-15 Ian Lance Taylor <iant@google.com>
4811
4812 * options.h (class General_options): Add --print-output-format.
4813 Move -EL next to -EB, for better --help output.
4814 * target-select.cc: Include <cstdio>, "options.h", and
4815 "parameters.h".
4816 (Target_selector::do_target_bfd_name): New function.
4817 (print_output_format): New function.
4818 * target-select.h (class Target_selector): Update declarations.
4819 (Target_selector::target_bfd_name): New function.
4820 (print_output_format): Declare.
4821 * main.cc: Include "target-select.h".
4822 (main): Handle --print-output-format.
4823 * gold.cc: Include "target-select.h".
4824 (queue_initial_tasks): Handle --print-output-format when there are
4825 no input files.
4826 * parameters.cc (parameters_force_valid_target): Give a better
4827 error message if -EB/-EL does not match target.
4828 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4829 function.
4830
4831 2011-07-15 Ian Lance Taylor <iant@google.com>
4832
4833 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4834 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4835 (Output_data_plt_i386::do_write): Write address of .dynamic
4836 section to first entry in .got.plt section.
4837 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4838 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4839 Initialize layout_.
4840 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4841 section to first entry in .got.plt section.
4842 * layout.h (Layout::dynamic_section): New function.
4843
4844 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4845
4846 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4847 to claim_file call.
4848 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4849 input_section_position_, and input_section_glob_.
4850 (read_layout_from_file): Call function section_ordering_specified.
4851 * layout.h (is_section_ordering_specified): New function.
4852 (section_ordering_specified): New function.
4853 (section_ordering_specified_): New boolean member.
4854 * main.cc(main): Call load_plugins after layout object is defined.
4855 * output.cc (Output_section::add_input_section): Use
4856 function section_ordering_specified to check if section ordering is
4857 needed.
4858 * output.cc (Output_section::add_relaxed_input_section): Use
4859 function section_ordering_specified to check if section ordering is
4860 needed.
4861 (Output_section::update_section_layout): New function.
4862 (Output_section::sort_attached_input_sections): Check if input section
4863 must be reordered.
4864 * output.h (Output_section::update_section_layout): New function.
4865 * plugin.cc (get_section_count): New function.
4866 (get_section_type): New function.
4867 (get_section_name): New function.
4868 (get_section_contents): New function.
4869 (update_section_order): New function.
4870 (allow_section_ordering): New function.
4871 (Plugin::load): Add the new interfaces to the transfer vector.
4872 (Plugin_manager::load_plugins): New parameter.
4873 (Plugin_manager::all_symbols_read): New parameter.
4874 (Plugin_manager::claim_file): New parameter. Save the elf object for
4875 unclaimed objects.
4876 (Plugin_manager::get_elf_object): New function.
4877 (Plugin_manager::get_view): Change to directly use the bool to check
4878 if get_view is called from claim_file_hook.
4879 * plugin.h (input_objects): New function
4880 (Plugin__manager::load_plugins): New parameter.
4881 (Plugin_manager::claim_file): New parameter.
4882 (Plugin_manager::get_elf_object): New function.
4883 (Plugin_manager::in_claim_file_handler): New function.
4884 (Plugin_manager::in_claim_file_handler_): New member.
4885 (layout): New function.
4886 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4887 handler with an extra parameter. Make the elf object before calling
4888 claim_file handler.
4889 * testsuite/plugin_test.c (get_section_count): New function pointer.
4890 (get_section_type): New function pointer.
4891 (get_section_name): New function pointer.
4892 (get_section_contents): New function pointer.
4893 (update_section_order): New function pointer.
4894 (allow_section_ordering): New function pointer.
4895 (onload): Check if the new interfaces exist.
4896
4897 2011-07-13 Ian Lance Taylor <iant@google.com>
4898
4899 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4900 relro section.
4901 * x86_64.cc (Target_x86_64::got_section): Likewise.
4902 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4903 (relro_now_test_SOURCES): New variable.
4904 (relro_now_test_DEPENDENCIES): New variable.
4905 (relro_now_test_LDFLAGS): New variable.
4906 (relro_now_test_LDADD): New variable.
4907 (relro_now_test.so): New target.
4908 * testsuite/Makefile.in: Rebuild.
4909
4910 2011-07-12 Ian Lance Taylor <iant@google.com>
4911
4912 PR gold/12980
4913 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4914 GLOB_DAT relocation rather than a RELATIVE relocation for a
4915 protected symbol when creating a shared library.
4916 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4917 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4918 * testsuite/protected_main_1.cc (main): Test that protected
4919 function has same address.
4920
4921 2011-07-11 Ian Lance Taylor <iant@google.com>
4922
4923 PR gold/12979
4924 * options.h (class General_options): Add -Bgroup.
4925 * options.cc (General_options::finalize): If -Bgroup is set,
4926 default to --unresolved-symbols=report-all.
4927 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4928 * target-reloc.h (issue_undefined_symbol_error): Handle
4929 --unresolved-symbols=report-all.
4930
4931 2011-07-08 Ian Lance Taylor <iant@google.com>
4932
4933 PR gold/11985
4934 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4935 if linker script discards key sections.
4936 (Layout::create_dynamic_symtab): Likewise.
4937 (Layout::assign_local_dynsym_offsets): Likewise.
4938 (Layout::sized_create_version_sections): Likewise.
4939 (Layout::create_interp): Likewise.
4940 (Layout::finish_dynamic_section): Likewise.
4941 (Layout::set_dynamic_symbol_size): Likewise.
4942
4943 2011-07-08 Ian Lance Taylor <iant@google.com>
4944
4945 PR gold/12386
4946 * options.h (class General_options): Add --unresolved-symbols.
4947 * target-reloc.h (issue_undefined_symbol_error): Check
4948 --unresolved-symbols. Add comments.
4949
4950 2011-07-08 Ian Lance Taylor <iant@google.com>
4951
4952 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4953 expression more complex.
4954
4955 2011-07-08 Ian Lance Taylor <iant@google.com>
4956
4957 PR gold/11317
4958 * target-reloc.h (issue_undefined_symbol_error): New inline
4959 function, broken out of relocate_section.
4960 (relocate_section): Call issue_undefined_symbol_error.
4961 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4962 there is no TLS segment if we are about to issue an undefined
4963 symbol error.
4964 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4965
4966 2011-07-08 Ian Lance Taylor <iant@google.com>
4967
4968 PR gold/12279
4969 * resolve.cc (Symbol_table::should_override): Add fromtype
4970 parameter. Change all callers. Give error when linking together
4971 TLS and non-TLS symbol.
4972 (Symbol_table::should_override_with_special): Add fromtype
4973 parameter. Change all callers.
4974 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4975 there is no TLS segment if we have reported some errors.
4976 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4977
4978 2011-07-08 Ian Lance Taylor <iant@google.com>
4979
4980 PR gold/12372
4981 * target.h (Target::plt_address_for_global): New function.
4982 (Target::plt_address_for_local): New function.
4983 (Target::plt_section_for_global): Remove.
4984 (Target::plt_section_for_local): Remove.
4985 (Target::do_plt_address_for_global): New virtual function.
4986 (Target::do_plt_address_for_local): New virtual function.
4987 (Target::do_plt_section_for_global): Remove.
4988 (Target::do_plt_section_for_local): Remove.
4989 (Target::register_global_plt_entry): Add Symbol_table and Layout
4990 parameters.
4991 * output.cc (Output_data_got::Got_entry::write): Use
4992 plt_address_for_global and plt_address_for_local.
4993 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4994 address of output section.
4995 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4996 got_irelative_, and irelative_count_ fields. Update
4997 declarations.
4998 (Output_data_plt_i386::has_irelative_section): New function.
4999 (Output_data_plt_i386::entry_count): Add irelative_count_.
5000 (Output_data_plt_i386::set_final_data_size): Likewise.
5001 (class Target_i386): Add got_irelative_ and rel_irelative_
5002 fields. Update declarations.
5003 (Target_i386::Target_i386): Initialize new fields.
5004 (Target_i386::do_plt_address_for_global): New function replacing
5005 do_plt_section_for_global.
5006 (Target_i386::do_plt_address_for_local): New function replacing
5007 do_plt_section_for_local.
5008 (Target_i386::got_section): Create got_irelative_.
5009 (Target_i386::rel_irelative_section): New function.
5010 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5011 fields. Don't define __rel_iplt_{start,end}.
5012 (Output_data_plt_i386::add_entry): Add symtab and layout
5013 parameters. Change all callers. Use different PLT and GOT for
5014 IFUNC symbols.
5015 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5016 layout parameters. Change all callers. Use different PLT and
5017 GOT.
5018 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5019 (Output_data_plt_i386::rel_irelative): New function.
5020 (Output_data_plt_i386::address_for_global): New function.
5021 (Output_data_plt_i386::address_for_local): New function.
5022 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
5023 IRELATIVE GOT when changing IFUNC GOT entries.
5024 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5025 reloc.
5026 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5027 if we didn't create an IRELATIVE GOT.
5028 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5029 plt_address_for_local.
5030 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5031 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5032 got_irelative_, and irelative_count_ fields. Update
5033 declarations.
5034 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5035 Initialize new fields. Remove symtab parameter. Change all
5036 callers.
5037 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5038 irelative_count_.
5039 (Output_data_plt_x86_64::has_irelative_section): New function.
5040 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5041 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5042 fields. Update declarations.
5043 (Target_x86_64::Target_x86_64): Initialize new fields.
5044 (Target_x86_64::do_plt_address_for_global): New function replacing
5045 do_plt_section_for_global.
5046 (Target_x86_64::do_plt_address_for_local): New function replacing
5047 do_plt_section_for_local.
5048 (Target_x86_64::got_section): Create got_irelative_.
5049 (Target_x86_64::rela_irelative_section): New function.
5050 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5051 all callers. Don't create __rel_iplt_{start,end}.
5052 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5053 parameters. Change all callers. Use different PLT and GOT for
5054 IFUNC symbols.
5055 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5056 layout parameters. Change all callers. Use different PLT and
5057 GOT.
5058 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5059 parameters. Change all callers. Use different PLT and GOT for
5060 IFUNC symbols.
5061 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5062 (Output_data_plt_x86_64::rela_irelative): New function.
5063 (Output_data_plt_x86_64::address_for_global): New function.
5064 (Output_data_plt_x86_64::address_for_local): New function.
5065 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5066 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5067 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5068 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5069 parameters.
5070 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5071 reloc.
5072 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5073 symbols if we didn't create an IRELATIVE GOT.
5074 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5075 plt_address_for_local.
5076 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5077 * testsuite/ifuncvar1.c: New test file.
5078 * testsuite/ifuncvar2.c: New test file.
5079 * testsuite/ifuncvar3.c: New test file.
5080 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5081 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5082 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5083 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5084 * testsuite/Makefile.in: Rebuild.
5085
5086 2011-07-07 Cary Coutant <ccoutant@google.com>
5087
5088 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5089 (two_file_test_1_ndebug.o): Likewise.
5090 (two_file_test_1b_ndebug.o): Likewise.
5091 (two_file_test_2_ndebug.o): Likewise.
5092 (two_file_test_main_ndebug.o): Likewise.
5093 (incremental_test_2): Link with no-debug versions.
5094
5095 2011-07-06 Cary Coutant <ccoutant@google.com>
5096
5097 * gold/incremental.cc
5098 (Output_section_incremental_inputs::write_info_blocks): Check for
5099 hidden and internal symbols.
5100
5101 2011-07-06 Cary Coutant <ccoutant@google.com>
5102
5103 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5104 Check disposition for startup file.
5105 (Incremental_inputs::report_command_line): Ignore
5106 --incremental-startup-unchanged option.
5107 * options.cc (General_options::parse_incremental_startup_unchanged):
5108 New function.
5109 (General_options::General_options): Initialize new data member.
5110 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5111 (General_options): Add --incremental-startup-unchanged option.
5112 (General_options::incremental_startup_disposition): New function.
5113 (General_options::incremental_startup_disposition_): New data member.
5114
5115 2011-07-06 Cary Coutant <ccoutant@google.com>
5116
5117 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5118 input file index to Script_info ctor.
5119 (Sized_incremental_binary::do_file_has_changed): Find the
5120 command-line argument for files named in scripts.
5121 * incremental.h (Script_info::Script_info): New ctor
5122 with input file index.
5123 (Script_info::input_file_index): New function.
5124 (Script_info::input_file_index_): New data member.
5125 (Incremental_binary::get_library): Add const.
5126 (Incremental_binary::get_script_info): Add const.
5127 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5128 * testsuite/Makefile.am (incremental_test_5): New test case.
5129 (incremental_test_6): New test case.
5130 * testsuite/Makefile.in: Regenerate.
5131
5132 2011-07-06 Cary Coutant <ccoutant@google.com>
5133
5134 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5135 debug output when command lines differ.
5136
5137 2011-07-06 Cary Coutant <ccoutant@google.com>
5138
5139 * incremental.cc (Incremental_inputs::report_command_line): Ignore
5140 --incremental-patch option.
5141 * layout.cc (Free_list::allocate): Extend allocation beyond original
5142 end if enabled.
5143 (Layout::make_output_section): Mark sections that should get
5144 patch space.
5145 * options.cc (parse_percent): New function.
5146 * options.h (parse_percent): New function.
5147 (DEFINE_percent): New macro.
5148 (General_options): Add --incremental-patch option.
5149 * output.cc (Output_section::Output_section): Initialize new data
5150 members.
5151 (Output_section::add_input_section): Print section name when out
5152 of patch space.
5153 (Output_section::add_output_section_data): Likewise.
5154 (Output_section::set_final_data_size): Add patch space when
5155 doing --incremental-full.
5156 (Output_section::do_reset_address_and_file_offset): Remove patch
5157 space.
5158 (Output_segment::set_section_list_addresses): Print debug output
5159 only if --incremental-update.
5160 * output.h (Output_section::set_is_patch_space_allowed): New function.
5161 (Output_section::is_patch_space_allowed_): New data member.
5162 (Output_section::patch_space_): New data member.
5163 * parameters.cc (Parameters::incremental_full): New function.
5164 * parameters.h (Parameters::incremental_full): New function
5165 * testsuite/Makefile.am (incremental_test_2): Add test for
5166 --incremental-patch option.
5167 * testsuite/Makefile.in: Regenerate.
5168 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5169 (t18): Remove function body.
5170
5171 2011-07-05 Doug Kwan <dougkwan@google.com>
5172
5173 PR gold/12771
5174 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5175 Arm_Address type for relocation result.
5176 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
5177 overflow check.
5178 (Arm_relocate_functions::abs32): Use unaligned access.
5179 (Arm_relocate_functions::rel32): Ditto.
5180 (Arm_relocate_functions::prel31): Ditto.
5181 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5182 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5183 static data relocations.
5184 * testsuite/Makefile.in: Regnerate.
5185 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5186
5187 2011-07-05 Ian Lance Taylor <iant@google.com>
5188
5189 PR gold/12392
5190 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5191 symbols if necessary.
5192 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5193
5194 2011-07-05 Ian Lance Taylor <iant@google.com>
5195
5196 PR gold/12952
5197 * resolve.cc (Symbol::override_base_with_special): Simply override
5198 version with special symbol version, ignoring previous version.
5199
5200 2011-07-05 Ian Lance Taylor <iant@google.com>
5201
5202 * object.cc (Sized_relobj_file::include_section_group): Add
5203 information to comment about signature location.
5204
5205 2011-07-02 Ian Lance Taylor <iant@google.com>
5206
5207 PR gold/12957
5208 * options.h (class General_options): Add -f and -F.
5209 * options.cc (General_options::finalize): Fatal error if -f/-F
5210 are used without -shared.
5211 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5212
5213 2011-07-02 Ian Lance Taylor <iant@google.com>
5214
5215 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5216
5217 2011-07-01 Ian Lance Taylor <iant@google.com>
5218
5219 PR gold/12525
5220 PR gold/12952
5221 * resolve.cc (Symbol::override_base_with_special): Don't override
5222 the version if the overriding symbol has a different name.
5223 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
5224 all callers. If we give an error about an undefined version,
5225 define the base version if necessary.
5226 * dynobj.h (class Versions): Update declaration.
5227 * testsuite/weak_alias_test_5.cc: New file.
5228 * testsuite/weak_alias_test.script: New file.
5229 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5230 and versioned_alias have the right value, and call t2.
5231 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5232 weak_alias_test_5.so.
5233 (weak_alias_test_LDADD): Likewise.
5234 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5235 * testsuite/Makefile.in: Rebuild.
5236
5237 2011-07-01 Ian Lance Taylor <iant@google.com>
5238
5239 PR gold/12525
5240 * options.h (class General_options): Support -z notext.
5241 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5242 -Wl,-z,notext.
5243 (two_file_shared_nonpic.so): Likewise.
5244 (two_file_shared_mixed.so): Likewise.
5245 (two_file_shared_mixed_1.so): Likewise.
5246 (weak_undef_lib_nonpic.so): Likewise.
5247 (alt/weak_undef_lib_nonpic.so): Likewise.
5248 (tls_test_shared_nonpic.so): Likewise.
5249 * testsuite/Makefile.in: Rebuild.
5250
5251 2011-07-01 Ian Lance Taylor <iant@google.com>
5252
5253 PR gold/12525
5254 * configure.ac: Test whether static linking works, setting
5255 the automake conditional HAVE_STATIC.
5256 * testsuite/Makefile.am: Disable tests using -static if
5257 HAVE_STATIC is not true.
5258 * configure, testsuite/Makefile.in: Rebuild.
5259
5260 2011-07-01 Ian Lance Taylor <iant@google.com>
5261
5262 PR gold/12525
5263 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5264 Assert if we see DW_EH_PE_indirect.
5265 * target.h (Target::ehframe_datarel_base): New function.
5266 (Target::do_ehframe_datarel_base): New target function.
5267 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5268 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5269 function.
5270
5271 2011-07-01 Ian Lance Taylor <iant@google.com>
5272
5273 PR gold/12571
5274 * options.h (class General_options): Add
5275 --ld-generated-unwind-info.
5276 * ehframe.cc (Fde::write): Add address parameter. Change all
5277 callers. If associated with PLT, fill in address and size.
5278 (Cie::set_output_offset): Only add merge mapping if there is an
5279 object.
5280 (Cie::write): Add address parameter. Change all callers.
5281 (Eh_frame::add_ehframe_for_plt): New function.
5282 * ehframe.h (class Fde): Update declarations. Move shndx_ and
5283 input_offset_ fields into union u_, with new plt field.
5284 (Fde::Fde): Adjust for new union field.
5285 (Fde::Fde) [Output_data version]: New constructor.
5286 (Fde::add_mapping): Only add merge mapping if there is an object.
5287 (class Cie): Update declarations.
5288 (class Eh_frame): Declare add_ehframe_for_plt.
5289 * layout.cc (Layout::layout_eh_frame): Break out code into
5290 make_eh_frame_section, and call it.
5291 (Layout::make_eh_frame_section): New function.
5292 (Layout::add_eh_frame_for_plt): New function.
5293 * layout.h (class Layout): Update declarations.
5294 * merge.cc (Merge_map::add_mapping): Add assertion.
5295 * i386.cc: Include "dwarf.h".
5296 (class Output_data_plt_i386): Make first_plt_entry,
5297 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
5298 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5299 and plt_eh_frame_fde.
5300 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5301 boundary. Call add_eh_frame_for_plt if appropriate.
5302 * x86_64.cc: Include "dwarf.h".
5303 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
5304 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
5305 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5306 and plt_eh_frame_fde.
5307 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5308 appropriate.
5309
5310 2011-06-29 Ian Lance Taylor <iant@google.com>
5311
5312 PR gold/12629
5313 * object.cc (Sized_relobj_file::layout_section): Change shdr
5314 parameter to be const.
5315 (Sized_relobj_file::layout_eh_frame_section): New function, broken
5316 out of do_layout.
5317 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5318 appropriate. Call layout_eh_frame_section.
5319 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5320 sections.
5321 * object.h (class Sized_relobj_file): Update declarations.
5322
5323 2011-06-29 Ian Lance Taylor <iant@google.com>
5324
5325 PR gold/12652
5326 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5327 modifier.
5328 (Lex::gather_token): Accept trailing M/m/K/k for integers.
5329
5330 2011-06-29 Ian Lance Taylor <iant@google.com>
5331
5332 PR gold/12675
5333 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5334 SHT_X86_64_UNWIND.
5335 * layout.cc (Layout::layout_eh_frame): Likewise.
5336
5337 2011-06-29 Ian Lance Taylor <iant@google.com>
5338
5339 PR gold/12695
5340 * layout.cc (Layout::symtab_section_shndx): New function.
5341 * layout.h (class Layout): Declare symtab_section_shndx.
5342 * output.cc (Output_section::write_header): Call it.
5343
5344 2011-06-29 Ian Lance Taylor <iant@google.com>
5345
5346 PR gold/12818
5347 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5348 symbols which are not used in a relocation.
5349
5350 2011-06-28 Ian Lance Taylor <iant@google.com>
5351
5352 PR gold/12898
5353 * layout.cc (Layout::segment_precedes): Don't crash if a linker
5354 script create indistinguishable segments.
5355 (Layout::set_segment_offsets): Use stable_sort when sorting
5356 segments. Pass this to Compare_segments constructor.
5357 * layout.h (class Layout): Make segment_precedes non-static.
5358 (class Compare_segments): Change from struct to class. Add
5359 layout_ field. Add constructor.
5360 * script-sections.cc
5361 (Script_sections::attach_sections_using_phdrs_clause): Rename
5362 local orphan to is_orphan. Don't report failure to put empty
5363 section in segment. On attachment failure, report name of
5364 section, and attach to first PT_LOAD segment.
5365
5366 2011-06-28 Ian Lance Taylor <iant@google.com>
5367
5368 PR gold/12934
5369 * target-select.cc (Target_selector::Target_selector): Add
5370 emulation parameter. Change all callers.
5371 (select_target_by_bfd_name): Rename from select_target_by_name.
5372 Change all callers.
5373 (select_target_by_emulation): New function.
5374 (supported_emulation_names): New function.
5375 * target-select.h (class Target_selector): Add emulation_ field.
5376 Update declarations.
5377 (Target_selector::recognize_by_bfd_name): Rename from
5378 recognize_by_name. Change all callers.
5379 (Target_selector::supported_bfd_names): Rename from
5380 supported_names. Change all callers.
5381 (Target_selector::recognize_by_emulation): New function.
5382 (Target_selector::supported_emulations): New function.
5383 (Target_selector::emulation): New function.
5384 (Target_selector::do_recognize_by_bfd_name): Rename from
5385 do_recognize_by_name. Change all callers.
5386 (Target_selector::do_supported_bfd_names): Rename from
5387 do_supported_names. Change all callers.
5388 (Target_selector::do_recognize_by_emulation): New function.
5389 (Target_selector::do_supported_emulations): New function.
5390 (select_target_by_bfd_name): Change name in declaration.
5391 (select_target_by_emulation): Declare.
5392 (supported_emulation_names): Declare.
5393 * parameters.cc (parameters_force_valid_target): Try to find
5394 target based on emulation from -m option.
5395 * options.h (class General_options): Change doc string for -m.
5396 * options.cc (help): Print emulations.
5397 (General_options::parse_V): Likewise.
5398 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5399 Add emulation parameter. Change all callers.
5400
5401 2011-06-28 Ian Lance Taylor <iant@google.com>
5402
5403 * target.h (class Target): Add osabi_ field.
5404 (Target::osabi): New function.
5405 (Target::set_osabi): New function.
5406 (Target::Target): Initialize osabi_.
5407 (Target::do_adjust_elf_header): Make pure virtual.
5408 (Sized_target::do_adjust_elf_header): Declare.
5409 * target.cc (Sized_target::do_adjust_elf_header): New function.
5410 (class Sized_target): Instantiate all versions.
5411 * freebsd.h (class Target_freebsd): Remove.
5412 (Target_selector_freebsd::do_recognize): Call set_osabi on
5413 Target.
5414 (Target_selector_freebsd::do_recognize_by_name): Likewise.
5415 (Target_selector_freebsd::set_osabi): Remove.
5416 * i386.cc (class Target_i386): Inherit from Sized_target rather
5417 than Target_freebsd.
5418 * x86_64.cc (class Target_x86_64): Likewise.
5419
5420 2011-06-28 Ian Lance Taylor <iant@google.com>
5421
5422 * target.h (Target::can_check_for_function_pointers): Rewrite.
5423 Make non-virtual.
5424 (Target::can_icf_inline_merge_sections): Likewise.
5425 (Target::section_may_have_icf_unsafe_poineters): Likewise.
5426 (Target::Target_info): Add can_icf_inline_merge_sections field.
5427 (Target::do_can_check_for_function_pointers): New virtual
5428 function.
5429 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5430 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5431 from can_check_for_function_pointers, move in file.
5432 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5433 section_may_have_icf_unsafe_poineters, move in file.
5434 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5435 * i386.cc (Target_i386::do_can_check_for_function_pointers):
5436 Rename from can_check_for_function_pointers, move in file.
5437 (Target_i386::can_icf_inline_merge_sections): Remove.
5438 (Target_i386::i386_info): Initialize
5439 can_icf_inline_merge_sections.
5440 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5441 Initialize can_icf_inline_merge_sections.
5442 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5443 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5444 Rename from can_check_for_function_pointers, move in file.
5445 (Target_x86_64::can_icf_inline_merge_sections): Remove.
5446 (Target_x86_64::x86_64_info): Initialize
5447 can_icf_inline_merge_sections.
5448 * testsuite/testfile.cc (Target_test::test_target_info):
5449 Likewise.
5450 * icf.cc (get_section_contents): Correct formatting.
5451
5452 2011-06-27 Ian Lance Taylor <iant@google.com>
5453
5454 * symtab.cc (Symbol::versioned_name): New function.
5455 (Symbol_table::add_to_final_symtab): Use versioned_name when
5456 appropriate.
5457 (Symbol_table::sized_write_symbol): Likewise.
5458 * symtab.h (class Symbol): Declare versioned_name.
5459 * stringpool.h (class Stringpool_template): Add variant of add
5460 which takes a std::basic_string.
5461 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5462 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5463 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5464 (ver_test_12.o): New target.
5465 * testsuite/Makefile.in: Rebuild.
5466
5467 2011-06-27 Doug Kwan <dougkwan@google.com>
5468
5469 * arm.cc (Arm_relocate_functions::thm_jump8,
5470 Arm_relocate_functions::thm_jump11): Use a wider signed
5471 type to compute offset.
5472 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5473 arm_thm_jump8.
5474 * testsuite/Makefile.in: Regenerate.
5475 * testsuite/arm_branch_in_range.sh: Check test results of
5476 arm_thm_jump11 and arm_thm_jump8.
5477 * testsuite/arm_thm_jump11.s: New test source file.
5478 * testsuite/arm_thm_jump11.t: New linker script.
5479 * testsuite/arm_thm_jump8.s: New test source file.
5480 * testsuite/arm_thm_jump8.t: New linker script.
5481
5482 2011-06-24 Ian Lance Taylor <iant@google.com>
5483
5484 * layout.cc: Include "object.h".
5485 (ctors_sections_in_init_array): New static variable.
5486 (Layout::is_ctors_in_init_array): New function.
5487 (Layout::layout): Add entry to ctors_sections_in_init_array if
5488 appropriate.
5489 * layout.h (class Layout): Declare is_ctors_in_init_array.
5490 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5491 is_ctors_reverse_view is set.
5492 (Sized_relobj_file::write_sections): Add layout parameter. Change
5493 all callers. Set is_ctors_reverse_view field of View_size.
5494 (Sized_relobj_file::reverse_words): New function.
5495 * object.h (Sized_relobj_file::View_size): Add
5496 is_ctors_reverse_view field.
5497 (class Sized_relobj_file): Update declarations.
5498 * testsuite/initpri3.c: New test.
5499 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5500 initpri3b.
5501 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5502 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5503 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5504 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5505 * testsuite/Makefile.in: Rebuild.
5506
5507 2011-06-24 Cary Coutant <ccoutant@google.com>
5508
5509 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5510 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5511 (debug_msg_cdebug.err): New targets.
5512 * testsuite/Makefile.in: Regenerate.
5513 * testsuite/debug_msg.sh: Check output of link with compressed debug.
5514 Fix checks for link with shared library.
5515
5516 2011-06-24 Doug Kwan <dougkwan@google.com>
5517
5518 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5519 skip empty text sections.
5520 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5521
5522 2011-06-22 Ian Lance Taylor <iant@google.com>
5523
5524 PR gold/12910
5525 * options.h (class General_options): Add --ctors-in-init-array.
5526 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5527 friends as SHT_PROGBITS for merging sections.
5528 (Layout::layout): Remove special handling of .init_array and
5529 friends. Don't sort if doing relocatable link. Sort for .ctors
5530 and .dtors if ctors_in_init_array.
5531 (Layout::make_output_section): Force correct section types for
5532 .init_array and friends. Don't sort if doing relocatable link,
5533 Don't sort .ctors and .dtors if ctors_in_init_array.
5534 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5535 (Layout::output_section_name): Add relobj parameter. Change all
5536 callers. Handle .ctors. and .dtors. in code rather than table.
5537 Handle .ctors and .dtors if ctors_in_init_array.
5538 (Layout::match_file_name): New function, moved from output.cc.
5539 * layout.h (class Layout): Update declarations.
5540 * output.cc: Include "layout.h".
5541 (Input_section_sort_entry::get_priority): New function.
5542 (Input_section_sort_entry::match_file_name): Just call
5543 Layout::match_file_name.
5544 (Output_section::Input_section_sort_init_fini_compare::operator()):
5545 Handle .ctors and .dtors. Sort by explicit priority rather than
5546 by name.
5547 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5548 * testsuite/initpri2.c: New test.
5549 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5550 (check_PROGRAMS): Add initpri2.
5551 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5552 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5553 * configure, testsuite/Makefile.in: Rebuild.
5554
5555 2011-06-19 Ian Lance Taylor <iant@google.com>
5556
5557 PR gold/12880
5558 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5559 .interp section to a PT_INTERP segment even if we have seen a
5560 --dynamic-linker option. Don't do it if we have seen a PHDRS
5561 clause in a linker script.
5562 (Layout::finalize): Don't create a .interp section if we've
5563 already create a PT_INTERP segment.
5564 (Layout::create_interp): Always call choose_output_section (revert
5565 patch of 2011-06-17). Don't create PT_INTERP segment.
5566 * script-sections.cc
5567 (Script_sections::create_note_and_tls_segments): Add a .interp
5568 section to a PT_INTERP segment even if we have seen a
5569 --dynamic-linker option.
5570
5571 2011-06-18 Ian Lance Taylor <iant@google.com>
5572
5573 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5574 merely because a non-PT_LOAD segment has a dynamic reloc.
5575
5576 2011-06-18 Ian Lance Taylor <iant@google.com>
5577
5578 * layout.cc (Layout::finish_dynamic_section): Don't create
5579 DT_FLAGS entry if not needed.
5580
5581 2011-06-18 Ian Lance Taylor <iant@google.com>
5582
5583 PR gold/12745
5584 * layout.cc (Layout::layout_eh_frame): Correct handling of
5585 writable .eh_frame section.
5586
5587 2011-06-17 Ian Lance Taylor <iant@google.com>
5588
5589 PR gold/12893
5590 * resolve.cc (Symbol_table::resolve): Don't give an error if a
5591 symbol is redefined with the exact same object and value.
5592
5593 2011-06-17 Ian Lance Taylor <iant@google.com>
5594
5595 PR gold/12880
5596 * layout.h (class Layout): Add interp_segment_ field.
5597 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5598 (Layout::attach_allocated_section_to_segment): If making shared
5599 library, put .interp section in PT_INTERP segment.
5600 (Layout::finalize): Also call create_interp if -dynamic-linker
5601 option was used.
5602 (Layout::create_interp): Assert that there is no PT_INTERP
5603 segment. If not using a SECTIONS clause, use make_output_section.
5604 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5605 * script-sections.cc
5606 (Script_sections::create_note_and_tls_segments): If making shared
5607 library, put .interp section in PT_INTERP segment.
5608
5609 2011-06-17 Ian Lance Taylor <iant@google.com>
5610
5611 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5612 when making a shared library.
5613
5614 2011-06-17 Ian Lance Taylor <iant@google.com>
5615
5616 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5617 parameter. Change all callers. Don't issue warning about PC32
5618 against locally defined symbol.
5619
5620 2011-06-16 Ian Lance Taylor <iant@google.com>
5621
5622 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5623 occurs in same object.
5624
5625 2011-06-14 Alan Modra <amodra@gmail.com>
5626
5627 * po/POTFILES.in: Regenerate.
5628
5629 2011-06-09 Ian Lance Taylor <iant@google.com>
5630
5631 * script-sections.cc
5632 (Orphan_output_section::set_section_addresses): For a relocatable
5633 link set address to 0.
5634
5635 2011-06-09 Cary Coutant <ccoutant@google.com>
5636
5637 PR gold/12804
5638 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5639 used with --compress-debug-sections.
5640 * gold/object.cc (Sized_relobj_file::do_layout): Report
5641 uncompressed size of compressed input sections.
5642
5643 2011-06-08 Cary Coutant <ccoutant@google.com>
5644
5645 PR gold/12804
5646 * testsuite/two_file_test_2_v1.cc: Change initialization of
5647 v2 to keep it in .data.
5648
5649 2011-06-07 Cary Coutant <ccoutant@google.com>
5650
5651 * common.cc (Symbol_table::do_allocate_commons_list): Call
5652 gold_fallback.
5653 * errors.cc (Errors::fatal): Adjust call to gold_exit.
5654 (Errors::fallback): New function.
5655 (gold_fallback): New function.
5656 * errors.h (Errors::fallback): New function.
5657 * gold.cc (gold_exit): Change status parameter to enum; adjust
5658 all callers.
5659 (queue_initial_tasks): Call gold_fallback.
5660 * gold.h: Include cstdlib.
5661 (Exit_status): New enum type.
5662 (gold_exit): Change status parameter to enum.
5663 (gold_fallback): New function.
5664 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5665 (Layout::create_symtab_sections): Likewise.
5666 (Layout::create_shdrs): Likewise.
5667 * main.cc (main): Adjust call to gold_exit.
5668 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5669 (Output_data_got::add_got_entry_pair): Likewise.
5670 (Output_section::add_input_section): Likewise.
5671 (Output_section::add_output_section_data): Likewise.
5672 (Output_segment::set_section_list_addresses): Likewise.
5673 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5674
5675 2011-06-07 Cary Coutant <ccoutant@google.com>
5676
5677 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5678 for incremental links.
5679 * output.cc (Output_segment::set_section_list_addresses): Remove
5680 FIXME and test for TLS or BSS.
5681
5682 2011-06-07 Cary Coutant <ccoutant@google.com>
5683
5684 * testsuite/Makefile.am: Add incremental_copy_test,
5685 incremental_common_test_1.
5686 * testsuite/Makefile.in: Regenerate.
5687 * testsuite/common_test_1_v1.c: New source file.
5688 * testsuite/common_test_1_v2.c: New source file.
5689 * testsuite/copy_test_v1.cc: New source file.
5690
5691 2011-06-07 Cary Coutant <ccoutant@google.com>
5692
5693 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5694 update, allocate common from bss section's free list.
5695 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5696 linker-defined symbols.
5697 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5698 Skip GOT and PLT entries that are no longer referenced.
5699 (Output_section_incremental_inputs::write_info_blocks): Mark
5700 linker-defined symbols.
5701 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5702 * output.cc (Output_section::allocate): New function.
5703 * output.h (Output_section::allocate): New function.
5704 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5705 linker-defined symbols.
5706 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5707 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5708 (Symbol::init_base_output_data): Likewise.
5709 (Symbol::init_base_output_segment): Likewise.
5710 (Symbol::init_base_constant): Likewise.
5711 (Sized_symbol::init_output_data): Likewise.
5712 (Sized_symbol::init_output_segment): Likewise.
5713 (Sized_symbol::init_constant): Likewise.
5714 (Symbol_table::do_define_in_output_data): Likewise.
5715 (Symbol_table::do_define_in_output_segment): Likewise.
5716 (Symbol_table::do_define_as_constant): Likewise.
5717 * symtab.h (Symbol::is_predefined): New function.
5718 (Symbol::init_base_output_data): Add is_predefined parameter.
5719 (Symbol::init_base_output_segment): Likewise.
5720 (Symbol::init_base_constant): Likewise.
5721 (Symbol::is_predefined_): New data member.
5722 (Sized_symbol::init_output_data): Add is_predefined parameter.
5723 (Sized_symbol::init_output_segment): Likewise.
5724 (Sized_symbol::init_constant): Likewise.
5725 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5726
5727 2011-06-07 Cary Coutant <ccoutant@google.com>
5728
5729 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5730 instead of emit_copy_reloc.
5731 (Copy_relocs::emit_copy_reloc): Refactor.
5732 (Copy_relocs::make_copy_reloc): New function.
5733 (Copy_relocs::add_copy_reloc): Remove.
5734 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5735 section.
5736 (Copy_relocs::make_copy_reloc): New function.
5737 (Copy_relocs::add_copy_reloc): Remove.
5738 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5739 unchanged input files.
5740 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5741 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5742 Reserve BSS space for COPY relocations.
5743 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5744 (Output_section_incremental_inputs::write_info_blocks): Record
5745 whether a symbol is copied from a shared object.
5746 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5747 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5748 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5749 (Incremental_input_entry_reader::get_output_symbol_index): Add
5750 is_copy parameter.
5751 (Incremental_binary::emit_copy_relocs): New function.
5752 (Incremental_binary::do_emit_copy_relocs): New function.
5753 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5754 new data member.
5755 (Sized_incremental_binary::add_copy_reloc): New function.
5756 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5757 (Sized_incremental_binary::Copy_reloc): New struct.
5758 (Sized_incremental_binary::Copy_relocs): New typedef.
5759 (Sized_incremental_binary::copy_relocs_): New data member.
5760 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5761 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5762 * target.h (Sized_target::emit_copy_reloc): New function.
5763 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5764
5765 2011-06-02 Cary Coutant <ccoutant@google.com>
5766
5767 PR gold/12163
5768 * gold/archive.cc (Archive::Archive): Initialize new data member.
5769 (Archive::include_all_members): Return if archive has already been
5770 included.
5771 * gold/archive.h (Archive::include_all_members_): New data member.
5772
5773 2011-06-02 Nick Clifton <nickc@redhat.com>
5774
5775 * dynobj.h: Fix spelling mistake in comment.
5776 * output.cc: Likewise.
5777
5778 2011-05-31 Doug Kwan <dougkwan@google.com>
5779 Asier Llano
5780
5781 PR gold/12826
5782 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5783 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5784 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5785 redundant arm_exidx_test.so.
5786 * testsuite/Makefile.in: Regenerate.
5787 (check_SCRIPTS): Add pr12826.sh
5788 (check_DATA): Add pr12826.stdout
5789 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5790 * testsuite/pr12826.sh: New file.
5791 * testsuite/pr12826_1.s: Ditto.
5792 * testsuite/pr12826_1.s: Ditto.
5793
5794 2011-05-30 Ian Lance Taylor <iant@google.com>
5795
5796 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5797 sections.
5798
5799 2011-05-29 Ian Lance Taylor <iant@google.com>
5800
5801 PR gold/12804
5802 * testsuite/Makefile.am: Use different file name for two_file_test
5803 temporary file for each incremental test.
5804 * testsuite/Makefile.in: Rebuild.
5805
5806 2011-05-29 Ian Lance Taylor <iant@google.com>
5807
5808 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5809 binary input file is empty.
5810
5811 2011-05-27 Ian Lance Taylor <iant@google.com>
5812
5813 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5814 (ver_test_9.so): Likewise.
5815 * testsuite/Makefile.in: Rebuild.
5816
5817 2011-05-26 Cary Coutant <ccoutant@google.com>
5818
5819 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5820 * incremental.cc (Incremental_inputs::report_input_section): Fix
5821 comment, indentation.
5822 (Incremental_inputs::report_comdat_group): New function.
5823 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5824 of data for incremental input file entry.
5825 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5826 group count, COMDAT group signatures.
5827 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5828 an unchanged input file.
5829 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5830 Initialize new data member.
5831 (Incremental_object_entry::add_comdat_group): New function.
5832 (Incremental_object_entry::get_comdat_group_count): New function.
5833 (Incremental_object_entry::get_comdat_signature_key): New function.
5834 (Incremental_object_entry::groups_): New data member.
5835 (Incremental_inputs::report_comdat_group): New function.
5836 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5837 data for incremental input file entry.
5838 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5839 (Incremental_input_entry_reader::get_input_section): Adjust size of
5840 data for incremental input file entry.
5841 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5842 (Incremental_input_entry_reader::get_comdat_group_signature): New
5843 function.
5844 * object.cc (Sized_relobj::include_section_group): Report kept
5845 COMDAT groups for incremental links.
5846
5847 2011-05-24 David Meyer <pdox@google.com>
5848
5849 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5850 with name parameter. Add found_name parameter.
5851 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5852 * dirsearch.h (class Dirsearch): Update declaration.
5853
5854 2011-05-24 Ian Lance Taylor <iant@google.com>
5855
5856 * archive.cc (Library_base::should_include_member): Pull in object
5857 from archive if it defines the entry symbol.
5858 * parameters.cc (Parameters::entry): New function.
5859 * parameters.h (class Parameters): Declare entry.
5860 * output.h (class Output_file_header): Remove entry_ field.
5861 * output.cc (Output_file_header::Output_file_header): Remove entry
5862 parameter. Change all callers.
5863 (Output_file_header::entry): Use parameters->entry.
5864 * gold.cc (queue_middle_tasks): Likewise.
5865 * plugin.cc (Plugin_hook::run): Likewise.
5866
5867 2011-05-24 Cary Coutant <ccoutant@google.com>
5868
5869 * gold.cc (queue_initial_tasks): Pass incremental base filename
5870 to Output_file::open_base_file; don't print error message.
5871 * incremental-dump.cc (main): Adjust call to
5872 Output_file::open_for_modification.
5873 * incremental-dump.cc (main): Likewise.
5874 * incremental.cc (Incremental_inputs::report_command_line):
5875 Ignore --incremental-base option when comparing command lines.
5876 Ignore parameter when given as separate argument.
5877 * options.h (class General_options): Add --incremental-base.
5878 * output.cc (Output_file::Output_file):
5879 (Output_file::open_base_file): Add base_name and writable parameters;
5880 read base file into new file; print error message here.
5881 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5882 callers.
5883 * output.h (Output_file::open_for_modification): Rename to...
5884 (Output_file::open_base_file): ...this; add base_name and
5885 writable parameters; adjust all callers.
5886 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5887 callers.
5888 * testsuite/Makefile.am (incremental_test_4): Test
5889 --incremental-base.
5890 * testsuite/Makefile.in: Regenerate.
5891
5892 2011-05-24 Cary Coutant <ccoutant@google.com>
5893
5894 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5895 incremental_test_4.
5896 * testsuite/Makefile.in: Regenerate.
5897 * testsuite/two_file_test_1_v1.cc: New test source file.
5898 * testsuite/two_file_test_1b_v1.cc: New test source file.
5899 * testsuite/two_file_test_2_v1.cc: New test source file.
5900
5901 2011-05-24 Cary Coutant <ccoutant@google.com>
5902
5903 * dynobj.h (Dynobj::do_dynobj): New function.
5904 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5905 flag and soname for shared objects.
5906 * incremental.cc (Incremental_inputs::report_object): Make
5907 either Incremental_object_entry or Incremental_dynobj_entry; add
5908 soname to string table.
5909 (Incremental_inputs::report_input_section): Add assertion.
5910 (Output_section_incremental_inputs::set_final_data_size): Adjust
5911 type of input file entry for shared libraries; adjust size of
5912 shared library info entry.
5913 (Output_section_incremental_inputs::write_input_files): Write
5914 as_needed flag for shared libraries.
5915 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5916 of input file entry for shared libraries; write soname.
5917 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5918 soname from incremental info.
5919 * incremental.h (enum Incremental_input_flags): Add
5920 INCREMENTAL_INPUT_AS_NEEDED.
5921 (Incremental_input_entry::Incremental_input_entry): Initialize new
5922 data member.
5923 (Incremental_input_entry::set_as_needed): New function.
5924 (Incremental_input_entry::as_needed): New function.
5925 (Incremental_input_entry::do_dynobj_entry): New function.
5926 (Incremental_input_entry::as_needed_): New data member.
5927 (Incremental_object_entry::Incremental_object_entry): Don't check
5928 for shared library.
5929 (Incremental_object_entry::do_type): Likewise.
5930 (class Incremental_dynobj_entry): New class.
5931 (Incremental_input_entry_reader::as_needed): New function.
5932 (Incremental_input_entry_reader::get_soname): New function.
5933 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5934 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5935 size of shared library info entry.
5936 * layout.cc (Layout::finish_dynamic_section): Don't test for
5937 incremental link when adding DT_NEEDED entries.
5938 * object.h (Object::Object): Initialize new data member.
5939 (Object::dynobj): New function.
5940 (Object::set_as_needed): New function.
5941 (Object::as_needed): New function.
5942 (Object::do_dynobj): New function.
5943 (Object::as_needed_): New data member.
5944
5945 2011-05-24 Cary Coutant <ccoutant@google.com>
5946
5947 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5948 info; adjust display of GOT entries.
5949 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5950 vector of input objects; remove file_status_.
5951 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5952 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5953 got_plt reader; call target hooks to reserve GOT entries.
5954 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5955 of input file info header and GOT info entry.
5956 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5957 relocation info.
5958 (Got_plt_view_info::got_descriptor): Remove.
5959 (Got_plt_view_info::sym_index): New data member.
5960 (Got_plt_view_info::input_index): New data member.
5961 (Local_got_offset_visitor::visit): Write input file index.
5962 (Global_got_offset_visitor::visit): Write 0 for input file index.
5963 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5964 with sym_index and input_index.
5965 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5966 incremental info GOT entry; replace got_descriptor with input_index.
5967 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5968 map from input file index to object.
5969 (Sized_relobj_incr::do_layout): Replace direct data member reference
5970 with accessor function.
5971 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5972 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5973 Adjust size of input file info header.
5974 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5975 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5976 (Incremental_input_entry_reader::get_input_section): Adjust size of
5977 input file info header.
5978 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5979 of incremental info GOT entry.
5980 (Incremental_got_plt_reader::get_got_desc): Remove.
5981 (Incremental_got_plt_reader::get_got_symndx): New function.
5982 (Incremental_got_plt_reader::get_got_input_index): New function.
5983 (Sized_incremental_binary::Sized_incremental_binary): Remove
5984 file_status_; add input_objects_.
5985 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5986 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5987 (Sized_incremental_binary::file_is_unchanged): Remove.
5988 (Sized_incremental_binary::set_input_object): New function.
5989 (Sized_incremental_binary::input_object): New function.
5990 (Sized_incremental_binary::file_status_): Remove.
5991 (Sized_incremental_binary::input_objects_): New data member.
5992 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5993 references.
5994 (Sized_relobj_incr::invalid_address): Move to base class.
5995 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5996 class.
5997 (Sized_relobj_incr::do_output_section_offset): Likewise.
5998 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5999 (Sized_relobj_incr::section_offsets_): Likewise.
6000 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6001 function.
6002 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6003 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6004 with accessor function.
6005 (Sized_relobj_file::do_layout): Likewise.
6006 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6007 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6008 (Sized_relobj_file::compute_final_local_value): Replace refs to
6009 section_offsets_ with accessor function.
6010 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6011 * object.h (Relobj::Relobj): Initialize new data members.
6012 (Relobj::add_dyn_reloc): New function.
6013 (Relobj::first_dyn_reloc): New function.
6014 (Relobj::dyn_reloc_count): New function.
6015 (Relobj::first_dyn_reloc_): New data member.
6016 (Relobj::dyn_reloc_count_): New data member.
6017 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6018 references.
6019 (Sized_relobj::Address): New typedef.
6020 (Sized_relobj::invalid_address): Move here from child class.
6021 (Sized_relobj::Sized_relobj): Initialize new data members.
6022 (Sized_relobj::sized_relobj): New function.
6023 (Sized_relobj::is_output_section_offset_invalid): Move here from
6024 child class.
6025 (Sized_relobj::get_output_section_offset): Likewise.
6026 (Sized_relobj::local_has_got_offset): Likewise.
6027 (Sized_relobj::local_got_offset): Likewise.
6028 (Sized_relobj::set_local_got_offset): Likewise.
6029 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6030 (Sized_relobj::clear_got_offsets): New function.
6031 (Sized_relobj::section_offsets): Move here from child class.
6032 (Sized_relobj::do_output_section_offset): Likewise.
6033 (Sized_relobj::do_set_section_offset): Likewise.
6034 (Sized_relobj::Local_got_offsets): Likewise.
6035 (Sized_relobj::local_got_offsets_): Likewise.
6036 (Sized_relobj::section_offsets_): Likewise.
6037 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6038 references.
6039 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6040 class.
6041 (Sized_relobj_file::sized_relobj): New function
6042 (Sized_relobj_file::local_has_got_offset): Move to base class.
6043 (Sized_relobj_file::local_got_offset): Likewise.
6044 (Sized_relobj_file::set_local_got_offset): Likewise.
6045 (Sized_relobj_file::get_output_section_offset): Likewise.
6046 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6047 (Sized_relobj_file::do_output_section_offset): Likewise.
6048 (Sized_relobj_file::do_set_section_offset): Likewise.
6049 (Sized_relobj_file::Local_got_offsets): Likewise.
6050 (Sized_relobj_file::local_got_offsets_): Likewise.
6051 (Sized_relobj_file::section_offsets_): Likewise.
6052 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6053 (all constructors).
6054 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6055 (Output_reloc::get_symbol_index): Likewise.
6056 (Output_reloc::local_section_offset): Likewise.
6057 (Output_reloc::get_address): Likewise.
6058 (Output_reloc::symbol_value): Likewise.
6059 (Output_data_got::reserve_slot): Move to class definition.
6060 (Output_data_got::reserve_local): New function.
6061 (Output_data_got::reserve_slot_for_global): Remove.
6062 (Output_data_got::reserve_global): New function.
6063 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6064 (all constructors, two instantiations).
6065 (Output_reloc::get_relobj): New function (two instantiations).
6066 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6067 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6068 (Output_data_reloc::add_global): Adjust type of relobj.
6069 (Output_data_reloc::add_global_relative): Likewise.
6070 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6071 (Output_data_reloc::add_local): Likewise.
6072 (Output_data_reloc::add_local_relative): Likewise.
6073 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6074 (Output_data_reloc::add_local_section): Likewise.
6075 (Output_data_reloc::add_output_section): Likewise.
6076 (Output_data_reloc::add_absolute): Likewise.
6077 (Output_data_reloc::add_target_specific): Likewise.
6078 (Output_data_got::reserve_slot): Move definition here.
6079 (Output_data_got::reserve_local): New function.
6080 (Output_data_got::reserve_global): New function.
6081 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6082 section_offsets_ with accessor function.
6083 (Sized_relobj_file::write_sections): Likewise.
6084 (Sized_relobj_file::do_relocate_sections): Likewise.
6085 * target.h (Sized_target::reserve_local_got_entry): New function.
6086 (Sized_target::reserve_global_got_entry): New function.
6087 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6088 (Target_x86_64::reserve_global_got_entry): New function.
6089 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6090
6091 2011-05-23 Cary Coutant <ccoutant@google.com>
6092
6093 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6094 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6095 bit when checking got_type.
6096 * incremental.cc (Sized_incremental_binary::setup_readers):
6097 Store symbol table and string table locations; initialize bit vector
6098 of file status flags.
6099 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6100 unchanged files.
6101 (Sized_incremental_binary::do_process_got_plt): New function.
6102 (Sized_incremental_binary::get_symtab_view): Use stored locations.
6103 (Output_section_incremental_inputs::set_final_data_size): Record
6104 file index for each input file.
6105 (Output_section_incremental_inputs::write_got_plt): Store file index
6106 instead of input entry offset for each GOT entry.
6107 * incremental.h
6108 (Incremental_input_entry::Incremental_input_entry): Initialize new
6109 data member.
6110 (Incremental_input_entry::set_offset): Store file index.
6111 (Incremental_input_entry::get_file_index): New function.
6112 (Incremental_input_entry::file_index_): New data member.
6113 (Incremental_binary::process_got_plt): New function.
6114 (Incremental_binary::do_process_got_plt): New function.
6115 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6116 data members.
6117 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6118 (Sized_incremental_binary::set_file_is_unchanged): New function.
6119 (Sized_incremental_binary::file_is_unchanged): New function.
6120 (Sized_incremental_binary::do_process_got_plt): New function.
6121 (Sized_incremental_binary::file_status_): New data member.
6122 (Sized_incremental_binary::main_symtab_loc_): New data member.
6123 (Sized_incremental_binary::main_strtab_loc_): New data member.
6124 * output.cc (Output_data_got::Got_entry::write): Add case
6125 RESERVED_CODE.
6126 (Output_data_got::add_global): Call add_got_entry.
6127 (Output_data_got::add_global_plt): Likewise.
6128 (Output_data_got::add_global_with_rel): Likewise.
6129 (Output_data_got::add_global_with_rela): Likewise.
6130 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6131 (Output_data_got::add_global_pair_with_rela): Likewise.
6132 (Output_data_got::add_local): Call add_got_entry.
6133 (Output_data_got::add_local_plt): Likewise.
6134 (Output_data_got::add_local_with_rel): Likewise.
6135 (Output_data_got::add_local_with_rela): Likewise.
6136 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6137 (Output_data_got::add_local_pair_with_rela): Likewise.
6138 (Output_data_got::reserve_slot): New function.
6139 (Output_data_got::reserve_slot_for_global): New function.
6140 (Output_data_got::add_got_entry): New function.
6141 (Output_data_got::add_got_entry_pair): New function.
6142 (Output_section::add_output_section_data): Edit FIXME.
6143 * output.h
6144 (Output_section_data_build::Output_section_data_build): New
6145 constructor with size parameter.
6146 (Output_data_space::Output_data_space): Likewise.
6147 (Output_data_got::Output_data_got): Initialize new data member; new
6148 constructor with size parameter.
6149 (Output_data_got::add_constant): Call add_got_entry.
6150 (Output_data_got::reserve_slot): New function.
6151 (Output_data_got::reserve_slot_for_global): New function.
6152 (class Output_data_got::Got_entry): Add RESERVED_CODE.
6153 (Output_data_got::add_got_entry): New function.
6154 (Output_data_got::add_got_entry_pair): New function.
6155 (Output_data_got::free_list_): New data member.
6156 * target.h (Sized_target::init_got_plt_for_update): New function.
6157 (Sized_target::register_global_plt_entry): New function.
6158 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6159 Initialize new data member; call init; add constructor with PLT count.
6160 (Output_data_plt_x86_64::init): New function.
6161 (Output_data_plt_x86_64::add_relocation): New function.
6162 (Output_data_plt_x86_64::reserve_slot): New function.
6163 (Output_data_plt_x86_64::free_list_): New data member.
6164 (Target_x86_64::init_got_plt_for_update): New function.
6165 (Target_x86_64::register_global_plt_entry): New function.
6166 (Output_data_plt_x86_64::add_entry): Allocate from free list for
6167 incremental updates.
6168 (Output_data_plt_x86_64::add_relocation): New function.
6169 * testsuite/object_unittest.cc (Object_test): Set default options.
6170
6171 2011-05-16 Ian Lance Taylor <iant@google.com>
6172
6173 * options.h (class General_options): Make -i a synonym for -r.
6174
6175 2011-05-16 Ian Lance Taylor <iant@google.com>
6176
6177 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6178
6179 2011-05-10 Cary Coutant <ccoutant@google.com>
6180
6181 * object.cc (Sized_relobj::do_count_local_symbols): Check for
6182 strip_all (-s).
6183
6184 2011-05-06 Ian Lance Taylor <iant@google.com>
6185
6186 * layout.cc (Layout::layout): If the output section flags change,
6187 update the ordering.
6188
6189 2011-04-25 Cary Coutant <ccoutant@google.com>
6190
6191 * incremental-dump.cc (dump_incremental_inputs): Print local
6192 symbol info for each input file.
6193 * incremental.cc
6194 (Output_section_incremental_inputs::set_final_data_size): Add local
6195 symbol info to input file entries in incremental info.
6196 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6197 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6198 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6199 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6200 implementation.
6201 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6202 (Sized_incr_relobj::do_relocate): Write the local symbols.
6203 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6204 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6205 Adjust size of input file header.
6206 (Incremental_inputs_reader::get_local_symbol_offset): New function.
6207 (Incremental_inputs_reader::get_local_symbol_count): New function.
6208 (Incremental_inputs_reader::get_input_section): Adjust size of input
6209 file header.
6210 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6211 (Sized_incr_relobj::This): New typedef.
6212 (Sized_incr_relobj::sym_size): New const data member.
6213 (Sized_incr_relobj::Local_symbol): New struct.
6214 (Sized_incr_relobj::do_output_local_symbol_count): New function.
6215 (Sized_incr_relobj::do_local_symbol_offset): New function.
6216 (Sized_incr_relobj::local_symbol_count_): New data member.
6217 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6218 (Sized_incr_relobj::local_symbol_index_): New data member.
6219 (Sized_incr_relobj::local_symbol_offset_): New data member.
6220 (Sized_incr_relobj::local_dynsym_offset_): New data member.
6221 (Sized_incr_relobj::local_symbols_): New data member.
6222 * object.h (Relobj::output_local_symbol_count): New function.
6223 (Relobj::local_symbol_offset): New function.
6224 (Relobj::do_output_local_symbol_count): New function.
6225 (Relobj::do_local_symbol_offset): New function.
6226 (Sized_relobj::do_output_local_symbol_count): New function.
6227 (Sized_relobj::do_local_symbol_offset): New function.
6228
6229 2011-04-22 Vladimir Simonov <sv@sw.ru>
6230
6231 * descriptors.cc (set_close_on_exec): New function.
6232 (Descriptors::open): Use set_close_on_exec.
6233 * output.cc (S_ISLNK): Define if not defined.
6234
6235 2011-04-22 Cary Coutant <ccoutant@google.com>
6236
6237 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6238 global symbol map.
6239 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6240 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6241 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6242 relocations.
6243 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6244 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6245 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6246 * incremental.h
6247 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6248 function.
6249 (Incremental_binary::apply_incremental_relocs): New function.
6250 (Incremental_binary::do_apply_incremental_relocs): New function.
6251 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6252 data member.
6253 (Sized_incremental_binary::add_global_symbol): New function.
6254 (Sized_incremental_binary::global_symbol): New function.
6255 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6256 (Sized_incremental_binary::symbol_map_): New data member.
6257 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6258 * target.h (Sized_target::apply_relocation): New function.
6259 * target-reloc.h (apply_relocation): New function.
6260 * x86_64.cc (Target_x86_64::apply_relocation): New function.
6261
6262 2011-04-22 Doug Kwan <dougkwan@google.com>
6263
6264 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6265 flag of a SHT_ARM_EXIDX section.
6266 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6267 * testsuite/Makefile.in: Regenerate.
6268 * testsuite/arm_exidx_test.s: New file.
6269 * testsuite/arm_exidx_test.sh: Same.
6270
6271 2011-04-20 Cary Coutant <ccoutant@google.com>
6272
6273 PR gold/12689
6274 * archive.h (Incremental_archive_entry::Archive_member):
6275 Initialize arg_serial_ (second constructor).
6276
6277 2011-04-17 Ian Lance Taylor <iant@google.com>
6278
6279 * object.cc (Relocate_info::location): Simplify location string.
6280 * errors.cc (Errors::error_at_location): Don't print program
6281 name.
6282 (Errors::warning_at_location): Likewise.
6283 (Errors::undefined_symbol): Likewise.
6284 * testsuite/debug_msg.sh: Update accordingly.
6285
6286 2011-04-14 Cary Coutant <ccoutant@google.com>
6287
6288 * gold/layout.cc (Layout::symtab_section_offset): New function.
6289 * gold/layout.h (Layout::symtab_section_offset): New function.
6290 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6291
6292 2011-04-12 Ian Lance Taylor <iant@google.com>
6293
6294 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
6295 with MREMAP_MAYMOVE.
6296 * output.h (class Output_file): Add map_is_allocated_ field.
6297 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
6298 not available, provide stubs. If mremap is not available, #define
6299 it to gold_mremap.
6300 (MREMAP_MAYMOVE): Define if not defined.
6301 (Output_file::Output_file): Initialize map_is_allocated_.
6302 (Output_file::resize): Check map_is_allocated_.
6303 (Output_file::map_anonymous): If mmap fails, use malloc.
6304 (Output_file::unmap): Don't do anything for an anonymous map.
6305 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
6306 is not available, provide stubs.
6307 (File_read::View::~View): Use free rather than delete[].
6308 (File_read::make_view): Use malloc rather than new[]. If mmap
6309 fails, use malloc.
6310 (File_read::find_or_make_view): Use malloc rather than new[].
6311 * gold.h: Remove HAVE_REMAP code.
6312 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
6313 exists. Rename mremap to gold_mremap. If mmap is not available
6314 don't do anything.
6315 * configure, config.in: Rebuild.
6316
6317 2011-04-11 Ian Lance Taylor <iant@google.com>
6318
6319 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6320 initialize local variable v.
6321
6322 2011-04-11 Cary Coutant <ccoutant@google.com>
6323
6324 * archive.cc (Archive::include_member): Adjust call to
6325 report_object.
6326 (Add_archive_symbols::run): Track argument serial numbers.
6327 (Lib_group::include_member): Likewise.
6328 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6329 * archive.h (Incremental_archive_entry::Archive_member):
6330 Initialize arg_serial_.
6331 (Archive_member::arg_serial_): New data member.
6332 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6333 (Sized_dynobj::do_add_symbols): Track symbols when doing an
6334 incremental link.
6335 (Sized_dynobj::do_for_all_local_got_entries): New function.
6336 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6337 function.
6338 * fileread.cc (get_mtime): New function.
6339 * fileread.h (get_mtime): New function.
6340 * gold.cc (queue_initial_tasks): Check for incremental update.
6341 (process_incremental_input): New function.
6342 (queue_middle_tasks): Don't force valid target for incremental
6343 update.
6344 * incremental-dump.cc (find_input_containing_global): Adjust
6345 size of symbol info entry.
6346 (dump_incremental_inputs): Dump argument serial number and
6347 in_system_directory flag; bias shndx by 1; print symbol names
6348 when dumping per-file symbol lists; use new symbol info readers.
6349 * incremental.cc
6350 (Output_section_incremental_inputs:update_data_size): New function.
6351 (Sized_incremental_binary::setup_readers): Setup input readers
6352 for each input file; build maps for files added from libraries
6353 and scripts.
6354 (Sized_incremental_binary::check_input_args): New function.
6355 (Sized_incremental_binary::do_check_inputs): Build map of argument
6356 serial numbers to input arguments.
6357 (Sized_incremental_binary::do_file_has_changed): Rename
6358 do_file_is_unchanged to this; compare file modification times.
6359 (Sized_incremental_binary::do_init_layout): New function.
6360 (Sized_incremental_binary::do_reserve_layout): New function.
6361 (Sized_incremental_binary::do_get_input_reader): Remove.
6362 (Sized_incremental_binary::get_symtab_view): New function.
6363 (Incremental_checker::can_incrementally_link_output_file): Remove.
6364 (Incremental_inputs::report_command_line): Exclude --debug options.
6365 (Incremental_inputs::report_archive_begin): Add parameter; track
6366 argument serial numbers; don't put input file entry for archive
6367 before archive members.
6368 (Incremental_inputs::report_archive_end): Put input file entry
6369 for archive after archive members.
6370 (Incremental_inputs::report_object): Add parameter; track argument
6371 serial numbers and in_system_directory flag.
6372 (Incremental_inputs::report_script): Add parameter; track argument
6373 serial numbers.
6374 (Output_section_incremental_inputs::set_final_data_size): Adjust
6375 size of symbol info entry; check for forwarding symbols.
6376 (Output_section_incremental_inputs::write_input_files): Write
6377 in_system_directory flag and argument serial number.
6378 (Output_section_incremental_inputs::write_info_blocks): Map section
6379 indices between incremental info and original input file; store
6380 input section index for each symbol.
6381 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6382 change operator() to visit().
6383 (class Global_got_offset_visitor): Likewise.
6384 (class Global_symbol_visitor_got_plt):
6385 (Output_section_incremental_inputs::write_got_plt): Use new visitor
6386 classes.
6387 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6388 (Sized_incr_relobj::do_read_symbols): New function.
6389 (Sized_incr_relobj::do_layout): New function.
6390 (Sized_incr_relobj::do_layout_deferred_sections): New function.
6391 (Sized_incr_relobj::do_add_symbols): New function.
6392 (Sized_incr_relobj::do_should_include_member): New function.
6393 (Sized_incr_relobj::do_for_all_global_symbols): New function.
6394 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6395 (Sized_incr_relobj::do_section_size): New function.
6396 (Sized_incr_relobj::do_section_name): New function.
6397 (Sized_incr_relobj::do_section_contents): New function.
6398 (Sized_incr_relobj::do_section_flags): New function.
6399 (Sized_incr_relobj::do_section_entsize): New function.
6400 (Sized_incr_relobj::do_section_address): New function.
6401 (Sized_incr_relobj::do_section_type): New function.
6402 (Sized_incr_relobj::do_section_link): New function.
6403 (Sized_incr_relobj::do_section_info): New function.
6404 (Sized_incr_relobj::do_section_addralign): New function.
6405 (Sized_incr_relobj::do_initialize_xindex): New function.
6406 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6407 (Sized_incr_relobj::do_read_relocs): New function.
6408 (Sized_incr_relobj::do_gc_process_relocs): New function.
6409 (Sized_incr_relobj::do_scan_relocs): New function.
6410 (Sized_incr_relobj::do_count_local_symbols): New function.
6411 (Sized_incr_relobj::do_finalize_local_symbols): New function.
6412 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6413 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6414 (Sized_incr_relobj::do_relocate): New function.
6415 (Sized_incr_relobj::do_set_section_offset): New function.
6416 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6417 (Sized_incr_dynobj::do_read_symbols): New function.
6418 (Sized_incr_dynobj::do_layout): New function.
6419 (Sized_incr_dynobj::do_add_symbols): New function.
6420 (Sized_incr_dynobj::do_should_include_member): New function.
6421 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6422 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6423 (Sized_incr_dynobj::do_section_size): New function.
6424 (Sized_incr_dynobj::do_section_name): New function.
6425 (Sized_incr_dynobj::do_section_contents): New function.
6426 (Sized_incr_dynobj::do_section_flags): New function.
6427 (Sized_incr_dynobj::do_section_entsize): New function.
6428 (Sized_incr_dynobj::do_section_address): New function.
6429 (Sized_incr_dynobj::do_section_type): New function.
6430 (Sized_incr_dynobj::do_section_link): New function.
6431 (Sized_incr_dynobj::do_section_info): New function.
6432 (Sized_incr_dynobj::do_section_addralign): New function.
6433 (Sized_incr_dynobj::do_initialize_xindex): New function.
6434 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6435 (make_sized_incremental_object): New function.
6436 (Incremental_library::copy_unused_symbols): New function.
6437 (Incremental_library::do_for_all_unused_symbols): New function.
6438 * incremental.h (enum Incremental_input_flags): New type.
6439 (class Incremental_checker): Remove.
6440 (Incremental_input_entry::Incremental_input_entry): Add argument
6441 serial number.
6442 (Incremental_input_entry::arg_serial): New function.
6443 (Incremental_input_entry::set_is_in_system_directory): New function.
6444 (Incremental_input_entry::is_in_system_directory): New function.
6445 (Incremental_input_entry::arg_serial_): New data member.
6446 (Incremental_input_entry::is_in_system_directory_): New data member.
6447 (class Script_info): Move here from script.h.
6448 (Script_info::Script_info): Add filename parameter.
6449 (Script_info::filename): New function.
6450 (Script_info::filename_): New data member.
6451 (Incremental_script_entry::Incremental_script_entry): Add argument
6452 serial number.
6453 (Incremental_object_entry::Incremental_object_entry): Likewise.
6454 (Incremental_object_entry::add_input_section): Build list of input
6455 sections with map to original shndx.
6456 (Incremental_object_entry::get_input_section_index): New function.
6457 (Incremental_object_entry::shndx_): New data member.
6458 (Incremental_object_entry::name_key_): Rename; adjust all refs.
6459 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6460 (Incremental_archive_entry::Incremental_archive_entry): Add argument
6461 serial number.
6462 (Incremental_inputs::report_archive_begin): Likewise.
6463 (Incremental_inputs::report_object): Likewise.
6464 (Incremental_inputs::report_script): Likewise.
6465 (class Incremental_global_symbol_reader): New class.
6466 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6467 and store flags and input file type.
6468 (Incremental_input_entry_reader::arg_serial): New function.
6469 (Incremental_input_entry_reader::type): Extract type from flags.
6470 (Incremental_input_entry_reader::is_in_system_directory): New function.
6471 (Incremental_input_entry_reader::get_input_section_count): Call
6472 accessor function for type.
6473 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6474 function for type; adjust size of global symbol entry.
6475 (Incremental_input_entry_reader::get_global_symbol_count): Call
6476 accessor function for type.
6477 (Incremental_input_entry_reader::get_object_count): Likewise.
6478 (Incremental_input_entry_reader::get_object_offset): Likewise.
6479 (Incremental_input_entry_reader::get_member_count): Likewise.
6480 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6481 (Incremental_input_entry_reader::get_member_offset): Likewise.
6482 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6483 (Incremental_input_entry_reader::Global_symbol_info): Remove.
6484 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6485 (Incremental_input_entry_reader::get_global_symbol_reader): New
6486 function.
6487 (Incremental_input_entry_reader::get_output_symbol_index): New
6488 function.
6489 (Incremental_input_entry_reader::type_): Remove.
6490 (Incremental_input_entry_reader::flags_): New data member.
6491 (Incremental_inputs_reader::input_file_offset): New function.
6492 (Incremental_inputs_reader::input_file_index): New function.
6493 (Incremental_inputs_reader::input_file): Call input_file_offset.
6494 (Incremental_inputs_reader::input_file_at_offset): New function.
6495 (Incremental_relocs_reader::get_r_type): Reformat.
6496 (Incremental_relocs_reader::get_r_shndx): Reformat.
6497 (Incremental_relocs_reader::get_r_offset): Reformat.
6498 (Incremental_relocs_reader::data): New function.
6499 (Incremental_binary::Incremental_binary): Initialize new data members.
6500 (Incremental_binary::check_inputs): Add cmdline parameter.
6501 (Incremental_binary::file_is_unchanged): Remove.
6502 (Input_reader::arg_serial): New function.
6503 (Input_reader::get_unused_symbol_count): New function.
6504 (Input_reader::get_unused_symbol): New function.
6505 (Input_reader::do_arg_serial): New function.
6506 (Input_reader::do_get_unused_symbol_count): New function.
6507 (Input_reader::do_get_unused_symbol): New function.
6508 (Incremental_binary::input_file_count): New function.
6509 (Incremental_binary::get_input_reader): Change signature to use
6510 index instead of filename.
6511 (Incremental_binary::file_has_changed): New function.
6512 (Incremental_binary::get_input_argument): New function.
6513 (Incremental_binary::get_library): New function.
6514 (Incremental_binary::get_script_info): New function.
6515 (Incremental_binary::init_layout): New function.
6516 (Incremental_binary::reserve_layout): New function.
6517 (Incremental_binary::output_file): New function.
6518 (Incremental_binary::do_check_inputs): New function.
6519 (Incremental_binary::do_file_is_unchanged): Remove.
6520 (Incremental_binary::do_file_has_changed): New function.
6521 (Incremental_binary::do_init_layout): New function.
6522 (Incremental_binary::do_reserve_layout): New function.
6523 (Incremental_binary::do_input_file_count): New function.
6524 (Incremental_binary::do_get_input_reader): Change signature.
6525 (Incremental_binary::input_args_map_): New data member.
6526 (Incremental_binary::library_map_): New data member.
6527 (Incremental_binary::script_map_): New data member.
6528 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6529 new data members.
6530 (Sized_incremental_binary::output_section): New function.
6531 (Sized_incremental_binary::inputs_reader): Add const.
6532 (Sized_incremental_binary::symtab_reader): Add const.
6533 (Sized_incremental_binary::relocs_reader): Add const.
6534 (Sized_incremental_binary::got_plt_reader): Add const.
6535 (Sized_incremental_binary::get_symtab_view): New function.
6536 (Sized_incremental_binary::Inputs_reader): New typedef.
6537 (Sized_incremental_binary::Input_entry_reader): New typedef.
6538 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6539 (Sized_incremental_binary::do_file_is_unchanged): Remove.
6540 (Sized_incremental_binary::do_file_has_changed): New function.
6541 (Sized_incremental_binary::do_init_layout): New function.
6542 (Sized_incremental_binary::do_reserve_layout): New function.
6543 (Sized_input_reader::Inputs_reader): Remove.
6544 (Sized_input_reader::Input_entry_reader): Remove.
6545 (Sized_input_reader::do_arg_serial): New function.
6546 (Sized_input_reader::do_get_unused_symbol_count): New function.
6547 (Sized_input_reader::do_get_unused_symbol): New function.
6548 (Sized_incremental_binary::do_input_file_count): New function.
6549 (Sized_incremental_binary::do_get_input_reader): Change signature;
6550 use index instead of filename.
6551 (Sized_incremental_binary::section_map_): New data member.
6552 (Sized_incremental_binary::input_entry_readers_): New data member.
6553 (class Sized_incr_relobj): New class.
6554 (class Sized_incr_dynobj): New class.
6555 (make_sized_incremental_object): New function.
6556 (class Incremental_library): New class.
6557 * layout.cc (Free_list::num_lists): New static data member.
6558 (Free_list::num_nodes): New static data member.
6559 (Free_list::num_removes): New static data member.
6560 (Free_list::num_remove_visits): New static data member.
6561 (Free_list::num_allocates): New static data member.
6562 (Free_list::num_allocate_visits): New static data member.
6563 (Free_list::init): New function.
6564 (Free_list::remove): New function.
6565 (Free_list::allocate): New function.
6566 (Free_list::dump): New function.
6567 (Free_list::print_stats): New function.
6568 (Layout_task_runner::run): Resize output file for incremental updates.
6569 (Layout::Layout): Initialize new data members.
6570 (Layout::set_incremental_base): New function.
6571 (Layout::init_fixed_output_section): New function.
6572 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6573 incremental updates.
6574 (Layout::create_gold_note): Do not create gold note section for
6575 incremental updates.
6576 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6577 for incremental updates.
6578 (Layout::set_section_offsets): For incremental updates, allocate space
6579 from free list.
6580 (Layout::create_symtab_sections): Layout with offsets relative to
6581 start of section; for incremental updates, allocate space from free
6582 list.
6583 (Layout::create_shdrs): For incremental updates, allocate space from
6584 free list.
6585 (Layout::finish_dynamic_section): For incremental updates, do not
6586 check --as-needed (fixed in subsequent patch).
6587 * layout.h (class Free_list): New class.
6588 (Layout::set_incremental_base): New function.
6589 (Layout::incremental_base): New function.
6590 (Layout::init_fixed_output_section): New function.
6591 (Layout::allocate): New function.
6592 (Layout::incremental_base_): New data member.
6593 (Layout::free_list_): New data member.
6594 * main.cc (main): Print Free_list statistics.
6595 * object.cc (Relobj::finalize_incremental_relocs): Add
6596 clear_counts parameter; clear counts only when clear_counts is set.
6597 (Sized_relobj::Sized_relobj): Initialize new base class.
6598 (Sized_relobj::do_layout): Don't report special sections.
6599 (Sized_relobj::do_for_all_local_got_entries): New function.
6600 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6601 symtab_off to all symbol table offsets.
6602 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6603 * object.h (class Got_offset_list): Move to top of file.
6604 (Object::Object): Allow case where input_file == NULL.
6605 (Object::~Object): Likewise.
6606 (Object::input_file): Assert that input_file != NULL.
6607 (Object::lock): Allow case where input_file == NULL.
6608 (Object::unlock): Likewise.
6609 (Object::is_locked): Likewise.
6610 (Object::token): Likewise.
6611 (Object::release): Likewise.
6612 (Object::is_incremental): New function.
6613 (Object::get_mtime): New function.
6614 (Object::for_all_local_got_entries): New function.
6615 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6616 (Object::set_is_in_system_directory): New function.
6617 (Object::is_in_system_directory): New function.
6618 (Object::do_is_incremental): New function.
6619 (Object::do_get_mtime): New function.
6620 (Object::do_for_all_local_got_entries): New function.
6621 (Object::is_in_system_directory_): New data member.
6622 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6623 (class Sized_relobj_base): New class.
6624 (class Sized_relobj): Derive from Sized_relobj_base.
6625 (class Sized_relobj::Symbols): Redeclare from base class.
6626 (class Sized_relobj::local_got_offset_list): Remove.
6627 (class Sized_relobj::Output_sections): Redeclare from base class.
6628 (class Sized_relobj::do_for_all_local_got_entries): New function.
6629 (class Sized_relobj::write_local_symbols): Add offset parameter.
6630 (class Sized_relobj::local_symbol_offset_): Update comment.
6631 (class Sized_relobj::local_dynsym_offset_): Update comment.
6632 * options.cc (Input_arguments::add_file): Remove const.
6633 * options.h (Input_file_argument::Input_file_argument):
6634 Initialize arg_serial_ (all constructors).
6635 (Input_file_argument::set_arg_serial): New function.
6636 (Input_file_argument::arg_serial): New function.
6637 (Input_file_argument::arg_serial_): New data member.
6638 (Input_arguments::Input_arguments): Initialize file_count_.
6639 (Input_arguments::add_file): Remove const.
6640 (Input_arguments::number_of_input_files): New function.
6641 (Input_arguments::file_count_): New data member.
6642 (Command_line::number_of_input_files): Call
6643 Input_arguments::number_of_input_files.
6644 * output.cc (Output_segment_headers::Output_segment_headers):
6645 Set current size.
6646 (Output_section::Input_section::current_data_size): New function.
6647 (Output_section::Output_section): Initialize new data members.
6648 (Output_section::add_input_section): Don't do merge sections for
6649 an incremental link; allocate space from free list for an
6650 incremental update.
6651 (Output_section::add_output_section_data): Allocate space from
6652 free list for an incremental update.
6653 (Output_section::update_data_size): New function.
6654 (Output_section::set_fixed_layout): New function.
6655 (Output_section::reserve): New function.
6656 (Output_segment::set_section_addresses): Remove const.
6657 (Output_segment::set_section_list_addresses): Remove const; allocate
6658 space from free list for an incremental update.
6659 (Output_segment::set_offset): Adjust size of RELRO segment for an
6660 incremental update.
6661 * output.h (Output_data::current_data_size): Move here from
6662 child classes.
6663 (Output_data::pre_finalize_data_size): New function.
6664 (Output_data::update_data_size): New function.
6665 (Output_section_headers::update_data_size): new function.
6666 (Output_section_data_build::current_data_size): Move to Output_data.
6667 (Output_data_strtab::update_data_size): New function.
6668 (Output_section::current_data_size): Move to Output_data.
6669 (Output_section::set_fixed_layout): New function.
6670 (Output_section::has_fixed_layout): New function.
6671 (Output_section::reserve): New function.
6672 (Output_section::update_data_size): New function.
6673 (Output_section::has_fixed_layout_): New data member.
6674 (Output_section::free_list_): New data member.
6675 (Output_segment::set_section_addresses): Remove const.
6676 (Output_segment::set_section_list_addresses): Remove const.
6677 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6678 New function.
6679 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6680 New function.
6681 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6682 parameter when calling Add_symbols constructor; store argument
6683 serial number for members of a lib group.
6684 (Add_symbols::locks): Allow case where token == NULL.
6685 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6686 (Read_member::~Read_member): New function.
6687 (Read_member::is_runnable): New function.
6688 (Read_member::locks): New function.
6689 (Read_member::run): New function.
6690 (Check_script::~Check_script): New function.
6691 (Check_script::is_runnable): New function.
6692 (Check_script::locks): New function.
6693 (Check_script::run): New function.
6694 (Check_library::~Check_library): New function.
6695 (Check_library::is_runnable): New function.
6696 (Check_library::locks): New function.
6697 (Check_library::run): New function.
6698 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6699 (Add_symbols::library_): New data member.
6700 (class Read_member): New class.
6701 (class Check_script): New class.
6702 (class Check_library): New class.
6703 * reloc.cc (Read_relocs::is_runnable): Allow case where
6704 token == NULL.
6705 (Read_relocs::locks): Likewise.
6706 (Scan_relocs::locks): Likewise.
6707 (Relocate_task::locks): Likewise.
6708 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6709 to clear counters.
6710 (Sized_relobj::incremental_relocs_scan): Fix comment.
6711 (Sized_relobj::do_relocate): Pass output file offset to
6712 write_local_symbols.
6713 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6714 from class declaration.
6715 * script.cc (read_input_script): Allocate Script_info; pass
6716 argument serial number to report_script.
6717 * script.h (class Script_info): Move to incremental.h.
6718 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6719 * symtab.h (Symbol_table::add_from_incrobj): New function.
6720 (Symbol_table::set_file_offset): New function.
6721
6722 2011-04-05 Cary Coutant <ccoutant@google.com>
6723
6724 * incremental-dump.cc (dump_incremental_inputs): Change signature
6725 to take a Sized_incremental_binary; change caller. Use readers
6726 in Sized_incremental_binary.
6727 * incremental.cc
6728 (Sized_incremental_binary::find_incremental_inputs_sections):
6729 Rename do_find_incremental_inputs_sections to this.
6730 (Sized_incremental_binary::setup_readers): New function.
6731 (Sized_incremental_binary::do_check_inputs): Check
6732 has_incremental_info_ flag; move setup code to setup_readers;
6733 use input readers.
6734 (Sized_incremental_binary::do_file_is_unchanged): New function.
6735 (Sized_incremental_binary::do_get_input_reader): New function.
6736 * incremental.h (class Incremental_binary): Move to end of file.
6737 (Incremental_binary::file_is_unchanged): New function.
6738 (Incremental_binary::do_file_is_unchanged): New function.
6739 (Incremental_binary::Input_reader): New class.
6740 (Incremental_binary::get_input_reader): New function.
6741 (class Sized_incremental_binary): Move to end of file.
6742 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6743 input section reader classes.
6744 (Sized_incremental_binary::has_incremental_info): New function.
6745 (Sized_incremental_binary::inputs_reader): New function.
6746 (Sized_incremental_binary::symtab_reader): New function.
6747 (Sized_incremental_binary::relocs_reader): New function.
6748 (Sized_incremental_binary::got_plt_reader): New function.
6749 (Sized_incremental_binary::do_file_is_unchanged): New function.
6750 (Sized_incremental_binary::Sized_input_reader): New class.
6751 (Sized_incremental_binary::get_input_reader): New function.
6752 (Sized_incremental_binary::find_incremental_inputs_sections):
6753 Rename do_find_incremental_inputs_sections to this.
6754 (Sized_incremental_binary::setup_readers): New function.
6755 (Sized_incremental_binary::has_incremental_info_): New data member.
6756 (Sized_incremental_binary::inputs_reader_): New data member.
6757 (Sized_incremental_binary::symtab_reader_): New data member.
6758 (Sized_incremental_binary::relocs_reader_): New data member.
6759 (Sized_incremental_binary::got_plt_reader_): New data member.
6760 (Sized_incremental_binary::current_input_file_): New data member.
6761
6762 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6763
6764 PR gold/12640
6765 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6766 violation.
6767
6768 2011-03-30 Cary Coutant <ccoutant@google.com>
6769
6770 * archive.cc (Archive::include_member): Adjust call to report_object.
6771 (Add_archive_symbols::run): Add script_info to call to
6772 report_archive_begin.
6773 (Lib_group::include_member): Adjust call to report_object.
6774 (Add_lib_group_symbols::run): Adjust call to report_object.
6775 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6776 blocks. Add object count for script input files.
6777 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6778 script_info parameter; change all callers.
6779 (Incremental_inputs::report_object): Add script_info parameter;
6780 change all callers.
6781 (Incremental_inputs::report_script): Store backpointer to
6782 incremental info entry.
6783 (Output_section_incremental_inputs::set_final_data_size): Record
6784 additional information for scripts.
6785 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6786 * incremental.h (Incremental_script_entry::add_object): New function.
6787 (Incremental_script_entry::get_object_count): New function.
6788 (Incremental_script_entry::get_object): New function.
6789 (Incremental_script_entry::objects_): New data member; adjust
6790 constructor.
6791 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6792 (Incremental_inputs::report_object): Add script_info parameter.
6793 (Incremental_inputs_reader::get_object_count): New function.
6794 (Incremental_inputs_reader::get_object_offset): New function.
6795 * options.cc (Input_arguments::add_file): Return reference to
6796 new input argument.
6797 * options.h (Input_argument::set_script_info): New function.
6798 (Input_argument::script_info): New function.
6799 (Input_argument::script_info_): New data member; adjust all
6800 constructors.
6801 (Input_file_group::add_file): Return reference to new input argument.
6802 (Input_file_lib::add_file): Likewise.
6803 (Input_arguments::add_file): Likewise.
6804 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6805 * script.cc (Parser_closure::Parser_closure): Add script_info
6806 parameter; adjust all callers.
6807 (Parser_closure::script_info): New function.
6808 (Parser_closure::script_info_): New data member.
6809 (read_input_script): Report scripts earlier to incremental info.
6810 (script_add_file): Set script_info in Input_argument.
6811 (script_add_library): Likewise.
6812 * script.h (Script_options::Script_info): Rewrite class.
6813
6814 2011-03-29 Cary Coutant <ccoutant@google.com>
6815
6816 * archive.cc (Library_base::should_include_member): Move
6817 method here from class Archive.
6818 (Archive::Archive): Initialize base class.
6819 (Archive::should_include_member): Move to base class.
6820 (Archive::do_for_all_unused_symbols): New function.
6821 (Add_archive_symbols::run): Remove redundant access to
6822 incremental_inputs.
6823 (Lib_group::Lib_group): Initialize base class.
6824 (Lib_group::do_filename): New function.
6825 (Lib_group::include_member): Pass pointer to Lib_group to
6826 report_object.
6827 (Lib_group::do_for_all_unused_symbols): New function.
6828 (Add_lib_group_symbols::run): Report archive information for
6829 incremental links.
6830 * archive.h (class Library_base): New base class.
6831 (class Archive): Derive from Library_base.
6832 (Archive::filename): Move to base class.
6833 (Archive::set_incremental_info): Likewise.
6834 (Archive::incremental_info): Likewise.
6835 (Archive::Should_include): Likewise.
6836 (Archive::should_include_member): Likewise.
6837 (Archive::Armap_entry): Remove.
6838 (Archive::Unused_symbol_iterator): Remove.
6839 (Archive::unused_symbols_begin): Remove.
6840 (Archive::unused_symbols_end): Remove.
6841 (Archive::do_filename): New function.
6842 (Archive::do_get_mtime): New function.
6843 (Archive::do_for_all_unused_symbols): New function.
6844 (Archive::task_): Move to base class.
6845 (Archive::incremental_info_): Likewise.
6846 (class Lib_group): Derive from Library_base.
6847 (Lib_group::do_filename): New function.
6848 (Lib_group::do_get_mtime): New function.
6849 (Lib_group::do_for_all_unused_symbols): New function.
6850 (Lib_group::task_): Move to base class.
6851 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6852 function.
6853 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6854 function.
6855 * incremental.cc (Incremental_inputs::report_archive_begin):
6856 Use Library_base; call library's get_mtime; add incremental inputs
6857 entry before members.
6858 (class Unused_symbol_visitor): New class.
6859 (Incremental_inputs::report_archive_end): Use Library_base; use
6860 visitor class to record unused symbols; don't add incremental inputs
6861 entry after members.
6862 (Incremental_inputs::report_object): Use Library_base.
6863 * incremental.h
6864 (Incremental_archive_entry::Incremental_archive_entry): Remove
6865 unused Archive parameter.
6866 (Incremental_inputs::report_archive_begin): Use Library_base.
6867 (Incremental_inputs::report_archive_end): Likewise.
6868 (Incremental_inputs::report_object): Likewise.
6869 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6870 function.
6871 * object.h (Object::for_all_global_symbols): New function.
6872 (Object::do_for_all_global_symbols): New function.
6873 (Sized_relobj::do_for_all_global_symbols): New function.
6874 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6875 function.
6876 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6877 function.
6878
6879 2011-03-27 Ian Lance Taylor <iant@google.com>
6880
6881 * archive.cc (Archive::interpret_header): Return -1 if something
6882 goes wrong. Change callers accordingly.
6883
6884 2011-03-25 Cary Coutant <ccoutant@google.com>
6885
6886 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6887 * testsuite/Makefile.in: Regenerate.
6888
6889 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6890
6891 * plugin.cc (get_view): New.
6892 (Plugin::load): Pass get_view to the plugin.
6893 (Plugin_manager::get_view): New.
6894
6895 2011-03-21 Ian Lance Taylor <iant@google.com>
6896
6897 * testsuite/final_layout.sh: Rewrite to not use dc.
6898 * testsuite/relro_test.sh: Fail if dc is not present.
6899
6900 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6901
6902 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6903 Change == to -eq.
6904 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6905 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6906 Change == to -eq.
6907 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6908 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6909
6910 2011-03-14 Ian Lance Taylor <iant@google.com>
6911
6912 * script-sections.cc (Sort_output_sections::script_compare):
6913 Rename from is_before, change return type.
6914 (Sort_output_sections::operator()): Adjust accordingly.
6915
6916 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6917
6918 PR gold/12572
6919 * testsuite/odr_violation2.cc: Add comment to make all error line
6920 numbers double digits.
6921 * testsuite/debug_msg.sh: Adjust expected errors.
6922
6923 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6924
6925 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6926 but mark earlier ones as non-canonical
6927 (offset_to_iterator): Update search target and example
6928 (do_addr2line): Return extra lines in a vector*
6929 (format_file_lineno): Extract from do_addr2line
6930 (one_addr2line): Add vector* out-param
6931 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6932 when a lineno entry appeared last for its instruction
6933 (Dwarf_line_info): Add vector* out-param
6934 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6935 * symtab.cc (Odr_violation_compare): Include the lineno in the
6936 comparison again.
6937 (linenos_from_loc): New. Combine the canonical line for an
6938 address with its other lines.
6939 (True_if_intersect): New. Helper functor to make
6940 std::set_intersection a query.
6941 (detect_odr_violations): Compare sets of lines instead of just
6942 one line for each function. This became less deterministic, but
6943 has fewer false positives.
6944 * symtab.h: Declarations.
6945 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6946 mix an optimized and non-optimized object in the same binary
6947 (odr_violation2.so): Same.
6948 * testsuite/Makefile.in: Regenerate from Makefile.am.
6949 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6950 * testsuite/debug_msg.sh: Update line numbers and add
6951 assertions.
6952 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6953 non-optimized context.
6954 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6955 isn't inlined, and use OdrDerived in an optimized context.
6956 * testsuite/odr_header1.h: Defines OdrDerived, where
6957 optimization will change the
6958 first-instruction-in-the-destructor's file and line number.
6959 * testsuite/odr_header2.h: Defines OdrBase.
6960
6961 2011-03-09 Ian Lance Taylor <iant@google.com>
6962
6963 * fileread.cc (File_read::clear_views): Don't delete the whole
6964 file view.
6965
6966 2011-03-08 Ian Lance Taylor <iant@google.com>
6967
6968 PR gold/12525
6969 * fileread.cc: #include <climits>.
6970 (GOLD_IOV_MAX): Define.
6971 (File_read::read_multiple): Limit number of entries by iov_max.
6972 * fileread.h (class File_read): Always set max_readv_entries to
6973 128.
6974
6975 2011-03-07 Ian Lance Taylor <iant@google.com>
6976
6977 PR gold/12525
6978 * options.h (class General_options): Add -dy and -dn.
6979
6980 2011-03-02 Cary Coutant <ccoutant@google.com>
6981
6982 * testsuite/script_test_9.t: Add TLS segment.
6983
6984 2011-03-02 Simon Baldwin <simonb@google.com>
6985
6986 * configure.ac: Add check for gnu_indirect_function support in
6987 the toolchain building binutils.
6988 * configure: Rebuild.
6989
6990 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6991
6992 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6993 plugin only symbols.
6994 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6995 in plugin files as not needed in the symbol table.
6996
6997 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6998
6999 * output.cc (Output_section::add_input_section): Delay fill
7000 generation for section ordering.
7001
7002 2011-02-09 Ian Lance Taylor <iant@google.com>
7003
7004 PR gold/12316
7005 * object.h (class Sized_relobj): Remove clear_local_symbols.
7006 * reloc.cc (Sized_relobj::do_relocate): Don't call
7007 clear_local_symbols.
7008
7009 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
7010
7011 * plugin.cc (is_visible_from_outside): Return true for symbols
7012 in the -u option.
7013
7014 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
7015
7016 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7017 filename.
7018
7019 2011-02-02 Sriraman Tallam <tmsriram@google.com>
7020
7021 * icf.h (is_section_foldable_candidate): Change type of parameter
7022 to std::string.
7023 * icf.cc (Icf::find_identical_sections): Change type of local variable
7024 section_name to be std::string.
7025 (is_function_ctor_or_dtor): Change type of parameter to std::string.
7026
7027 2011-01-25 Ian Lance Taylor <iant@google.com>
7028
7029 * script.cc (script_add_extern): Rewrite to use
7030 add_symbol_reference.
7031
7032 2011-01-25 Doug Kwan <dougkwan@google.com>
7033
7034 * icf.cc (get_section_contents): Always lock section's object.
7035
7036 2011-01-24 Ian Lance Taylor <iant@google.com>
7037
7038 * options.h (class General_options): Accept
7039 --no-detect-odr-violations.
7040
7041 2011-01-24 Ian Lance Taylor <iant@google.com>
7042
7043 * version.cc (version_string): Bump to 1.11.
7044
7045 2011-01-24 Ian Lance Taylor <iant@google.com>
7046
7047 * plugin.cc (class Plugin_rescan): Define new class.
7048 (Plugin_manager::claim_file): Set any_claimed_.
7049 (Plugin_manager::save_archive): New function.
7050 (Plugin_manager::save_input_group): New function.
7051 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7052 necessary.
7053 (Plugin_manager::new_undefined_symbol): New function.
7054 (Plugin_manager::rescan): New function.
7055 (Plugin_manager::rescannable_defines): New function.
7056 (Plugin_manager::add_input_file): Set any_added_.
7057 * plugin.h (class Plugin_manager): define new fields rescannable_,
7058 undefined_symbols_, any_claimed_, and any_added_. Declare
7059 Plugin_rescan as friend. Declare new functions.
7060 (Plugin_manager::Rescannable): Define type.
7061 (Plugin_manager::Rescannable_list): Define type.
7062 (Plugin_manager::Undefined_symbol_list): Define type.
7063 (Plugin_manager::Plugin_manager): Initialize new fields.
7064 * archive.cc (Archive::defines_symbol): New function.
7065 (Add_archive_symbols::run): Pass archive to plugins if any.
7066 * archive.h (class Archive): Declare defines_symbol.
7067 * readsyms.cc (Input_group::~Input_group): New function.
7068 (Finish_group::run): Pass input_group to plugins if any.
7069 * readsyms.h (class Input_group): Declare destructor.
7070 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7071 any.
7072
7073 2011-01-10 Ian Lance Taylor <iant@google.com>
7074
7075 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7076 section as relro.
7077 (Layout::set_segment_offsets): Reset increase_relro before calling
7078 set_section_addresses a second time.
7079
7080 2011-01-04 Cary Coutant <ccoutant@google.com>
7081
7082 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7083 sections before NOBITS sections.
7084
7085 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
7086
7087 * version.cc (print_version): Update copyright to 2011.
7088
7089 2010-12-23 Cary Coutant <ccoutant@google.com>
7090
7091 * output.h (Output_data_reloc::add_output_section): Pass OD instead
7092 of OS to this->add. Add OD parameter to second form of the function.
7093
7094 2010-12-20 Ian Lance Taylor <iant@google.com>
7095
7096 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7097 second of two consecutive entries with same offset.
7098
7099 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7100
7101 * testsuite/Makefile.am (ifuncmain2static_LDADD)
7102 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7103 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7104 to avoid unneeded links against $(LDADD).
7105 * testsuite/Makefile.in: Regenerate.
7106
7107 2010-12-15 Ian Lance Taylor <iant@google.com>
7108
7109 PR gold/12324
7110 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7111 for R_X86_64_32 and R_X86_64_PC32.
7112 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7113 ver_matching_def_pic.o.
7114 (ver_matching_def_pic.o): New target.
7115
7116 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7117
7118 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7119 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7120 Move definition before File_read::View member definitions.
7121 (File_read::View::~View): Initialize and hold lock before
7122 updating current_mapped_bytes.
7123
7124 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7125
7126 * dwarf_reader.cc: Remove outdated comment.
7127 * gold-threads.cc: Fix typo in error message.
7128 * archive.cc: Fix typos in comments.
7129 * archive.h: Likewise.
7130 * arm-reloc-property.cc: Likewise.
7131 * arm-reloc-property.h: Likewise.
7132 * arm-reloc.def: Likewise.
7133 * arm.cc: Likewise.
7134 * attributes.h: Likewise.
7135 * cref.cc: Likewise.
7136 * ehframe.cc: Likewise.
7137 * fileread.h: Likewise.
7138 * gold.h: Likewise.
7139 * i386.cc: Likewise.
7140 * icf.cc: Likewise.
7141 * incremental.h: Likewise.
7142 * int_encoding.cc: Likewise.
7143 * layout.h: Likewise.
7144 * main.cc: Likewise.
7145 * merge.h: Likewise.
7146 * object.cc: Likewise.
7147 * object.h: Likewise.
7148 * options.cc: Likewise.
7149 * readsyms.cc: Likewise.
7150 * reduced_debug_output.cc: Likewise.
7151 * reloc.cc: Likewise.
7152 * script-sections.cc: Likewise.
7153 * sparc.cc: Likewise.
7154 * symtab.h: Likewise.
7155 * target-reloc.h: Likewise.
7156 * target.cc: Likewise.
7157 * target.h: Likewise.
7158 * timer.cc: Likewise.
7159 * timer.h: Likewise.
7160 * x86_64.cc: Likewise.
7161
7162 2010-12-09 Cary Coutant <ccoutant@google.com>
7163
7164 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7165 stack.
7166 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7167 parameter; change all callers.
7168 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7169 * options.h (warn_execstack): New option.
7170
7171 2010-12-07 Doug Kwan <dougkwan@google.com>
7172
7173 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7174 like function call relocations.
7175
7176 2010-12-07 Ian Lance Taylor <iant@google.com>
7177
7178 * archive.cc (Archive::get_elf_object_for_member): Permit
7179 punconfigured to be NULL.
7180 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7181 (Archive::include_member): Pass NULL to get_elf_object_for_member
7182 if we searched for the archive and this is the first included
7183 object.
7184
7185 2010-12-01 Ian Lance Taylor <iant@google.com>
7186
7187 * dwarf_reader.h (class Sized_dwarf_line_info): Add
7188 track_relocs_type_ field.
7189 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7190 Set track_relocs_type_.
7191 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7192 contents when using RELA relocs.
7193 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7194 reloc_map_.
7195 * reloc.cc (Track_relocs::next_addend): New function.
7196 * reloc.h (class Track_relocs): Declare next_addend.
7197
7198 2010-12-01 Ian Lance Taylor <iant@google.com>
7199
7200 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7201 virtual destructor.
7202
7203 2010-12-01 Ian Lance Taylor <iant@google.com>
7204
7205 * README: Update compilers known to work and fail.
7206
7207 2010-11-23 Matthias Klose <doko@ubuntu.com>
7208
7209 * configure.in: For --enable-gold, handle value `default' instead of
7210 `both*'. Always install ld as ld.bfd, install as ld if gold is
7211 not the default.
7212 * configure: Regenerate.
7213
7214 2010-11-18 Doug Kwan <dougkwan@google.com>
7215
7216 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7217 and right_alignment to be zero. Store result alignment only if it is
7218 greater than existing alignment.
7219
7220 2010-11-16 Cary Coutant <ccoutant@google.com>
7221
7222 PR gold/12220
7223 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7224 Check for ".zdebug_line".
7225
7226 2010-11-16 Doug Kwan <dougkwan@google.com>
7227 Cary Coutant <ccoutant@google.com>
7228
7229 * output.h (Output_segment::set_section_addresses): Pass increase_relro
7230 by reference; adjust all callers.
7231 * output.cc (Output_segment::set_section_addresses): Adjust references
7232 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7233 list is empty.
7234 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7235 end at page boundary.
7236
7237 2010-11-16 Cary Coutant <ccoutant@google.com>
7238
7239 PR gold/12220
7240 * layout.cc (Layout::choose_output_section): Transform names of
7241 compressed sections even when using a script with a SECTIONS clause.
7242 (Layout::output_section_name): Remove code to transform
7243 compressed debug section names.
7244 * output.cc (Output_section::add_input_section): Use uncompressed
7245 section size when tracking input sections.
7246
7247 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
7248
7249 * symtab.h (Symbol::NON_PIC_REF): Remove.
7250 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7251 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
7252 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7253 (Symbol::use_plt_offset): Take a flags argument and pass it
7254 directly to needs_dynamic_reloc. Restrict check for undefined
7255 weak symbols to function calls.
7256 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7257 (Target_arm::Scan::global): Use it.
7258 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7259 (Target_arm::Relocate::relocate): Likewise.
7260 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7261 parameter with an r_type parameter. Use get_reference_flags
7262 to get the flags.
7263 (Target_arm::Relocate::relocate): Update accordingly.
7264 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7265 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7266 (Target_i386::Scan::global): Likewise.
7267 (Target_i386::Relocate::relocate): Likewise.
7268 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7269 parameter with an r_type parameter. Use get_reference_flags
7270 to get the flags.
7271 (Target_i386::Relocate::relocate): Update accordingly.
7272 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7273 (Target_powerpc::Scan::global): Use it.
7274 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7275 (Target_powerpc::Relocate::relocate): Likewise.
7276 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7277 (Target_sparc::Scan::global): Use it.
7278 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7279 (Target_sparc::Relocate::relocate): Likewise.
7280 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7281 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7282 (Target_x86_64::Scan::global): Likewise.
7283 (Target_x86_64::Relocate::relocate): Likewise.
7284
7285 2010-11-08 Doug Kwan <dougkwan@google.com>
7286 Cary Coutant <ccoutant@google.com>
7287
7288 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7289 (Arm_exidx_merge_section::section_contents_): New data member.
7290 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7291 (Arm_input_section::~Arm_input_section): De-allocate memory.
7292 (Arm_input_section::original_contents_): New data member.
7293 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7294 in parameters instead of calling Object::section_contents without
7295 locking.
7296 (Arm_output_section::group_section): New parameter TASK. Pass it
7297 to callees that need locking objects.
7298 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
7299 to lock EXIDX input sections. Fix a formatting issue. Call
7300 Arm_exidx_merged_section::build_contents to create merged section
7301 contents.
7302 (Arm_output_section::create_stub_group): New parameter TASK. Use it
7303 to lock object of stub table owner.
7304 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7305 TEXT_SIZE to initialize data member TEXT_SIZE_.
7306 (Arm_exidx_input_section::addralign): Fix typo in comment.
7307 (Arm_exidx_input_section::text_size): New method.
7308 (Target_arm::do_relax): New parameter TASK. Pass it to callees
7309 that require locking objects. Lock objects before scanning for stubs
7310 and updating local symbols.
7311 (Arm_input_section<big_endian>::init): Copy contents of original
7312 input section.
7313 (Arm_input_section<big_endian>::do_write): Use saved contents of
7314 original input section instead of calling Object::section_contents
7315 without locking.
7316 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7317 size without calling Object::section_size().
7318 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7319 for size. Allocate a buffer for merged EXIDX entries.
7320 (Arm_exidx_merged_section::build_contents): New method.
7321 (Arm_exidx_merged_section::do_write): Move merge section contents
7322 building code to Arm_exidx_merged_section::build_contetns. Write
7323 out contetns in buffer instead of building it on the fly.
7324 (Arm_relobj::make_exidx_input_section): Also pass text section size
7325 to Arm_exidx_input_section constructor.
7326 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
7327 (Arm_dynobj::do_read_symbols): Fix memory leak.
7328 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7329 * target.h: (class Task): Add forward declaration.
7330 (Target::relax): Add new parameter TASK and pass it to
7331 Target::do_relax().
7332 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
7333
7334 2010-11-05 Cary Coutant <ccoutant@google.com>
7335
7336 PR gold/10708
7337 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7338 object when reading from the file.
7339 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7340 second layout pass.
7341 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7342 when reading section contents.
7343 (get_section_contents): Likewise.
7344 (icf::find_identical_sections): Likewise.
7345 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7346 object when reading from the file.
7347 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7348 the object when doing deferred section layout.
7349
7350 2010-11-03 Nick Clifton <nickc@redhat.com>
7351
7352 PR gold/12001
7353 * script.h (class Symbol_assignment: name): New member. Returns
7354 the name of the symbol.
7355 * scrfipt.cc (Script_options::is_pending_assignment): New member.
7356 Returns true if the given symbol name is on the list of
7357 assignments wating to be processed.
7358 * archive.cc (should_incldue_member): If the symbol is undefined,
7359 check to see if it is on the list of symbols pending assignment.
7360
7361 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
7362
7363 * script-sections.cc (Script_sections::find_memory_region): Check
7364 for a NULL output section pointer.
7365
7366 2010-10-29 Doug Kwan <dougkwan@google.com>
7367
7368 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7369 Output_section::add_relaxed_input_section.
7370 * output.cc (Output_section::add_relaxed_input_section): Add new
7371 arguments LAYOUT and NAME. Set section order index.
7372 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7373 Copy section order index.
7374 * output.h (Output_section::add_relaxed_input_section): Add new
7375 arguments LAYOUT and NAME.
7376
7377 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7378
7379 * testsuite/Makefile.am: Move gcctestdir/ld rule to
7380 NATIVE_OR_CROSS_LINKER.
7381 * testsuite/Makefile.in: Regenerate.
7382
7383 2010-10-20 Doug Kwan <dougkwan@google.com>
7384
7385 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7386 without SHF_LINK_ORDER flags.
7387 * layout.cc (Layout::choose_output_section): Do not filter
7388 SHF_LINK_ORDER flag in a relocatable link.
7389
7390 2010-10-17 Cary Coutant <ccoutant@google.com>
7391
7392 * output.h (Output_segment::set_section_addresses): Change function
7393 signature. Update all callers.
7394 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7395 sections.
7396 (Output_segment::set_section_addresses): Align after last TLS
7397 section. Add padding before last relro section instead of after.
7398
7399 2010-10-17 Doug Kwan <dougkwan@google.com>
7400
7401 * gold/arm.cc (Target_arm::got_section): Use correct order and set
7402 GOT output section to be writable.
7403
7404 2010-10-14 Cary Coutant <ccoutant@google.com>
7405
7406 * debug.h (DEBUG_INCREMENTAL): New flag.
7407 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7408 * gold.cc (queue_initial_tasks): Check parameters for incremental link
7409 mode.
7410 * incremental.cc (report_command_line): Ignore all forms of
7411 --incremental.
7412 * layout.cc (Layout::Layout): Check parameters for incremental link
7413 mode.
7414 * options.cc (General_options::parse_incremental): New function.
7415 (General_options::parse_no_incremental): New function.
7416 (General_options::parse_incremental_full): New function.
7417 (General_options::parse_incremental_update): New function.
7418 (General_options::incremental_mode_): New data member.
7419 (General_options::finalize): Check incremental_mode_.
7420 * options.h (General_options): Update help text for --incremental.
7421 Add --no-incremental, --incremental-full, --incremental-update.
7422 (General_options::Incremental_mode): New enum type.
7423 (General_options::incremental_mode): New function.
7424 (General_options::incremental_mode_): New data member.
7425 * parameters.cc (Parameters::incremental_mode_): New data member.
7426 (Parameters::set_options): Set incremental_mode_.
7427 (Parameters::set_incremental_full): New function.
7428 (Parameters::incremental): New function.
7429 (Parameters::incremental_update): New function.
7430 (set_parameters_incremental_full): New function.
7431 * parameters.h (Parameters::set_incremental_full): New function.
7432 (Parameters::incremental): New function.
7433 (Parameters::incremental_update): New function.
7434 (Parameters::incremental_mode_): New data member.
7435 (set_parameters_incremental_full): New function.
7436 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7437 incremental link mode.
7438 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7439 (Sized_relobj::do_relocate_sections): Likewise.
7440 * testsuite/Makefile.am (incremental_test): Use --incremental-full
7441 option.
7442 * testsuite/Makefile.in: Regenerate.
7443 * testsuite/incremental_test.sh: Filter all forms of --incremental.
7444
7445 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7446
7447 * script-sections.h (class Script_sections): Make
7448 Sections_elements typedef public.
7449 * script-sections.cc (class Sort_output_sections): Add elements_
7450 field. Add constructor which sets it; change all callers.
7451 (Sort_output_sections::is_before): New function.
7452 (Sort_output_sections::operator()): Call is_before.
7453 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7454 conditional.
7455 * testsuite/script_test_10.sh: New test. Test script section
7456 order.
7457 * testsuite/script_test_10.t: Likewise.
7458 * testsuite/script_test_10.s: Likewise.
7459 * testsuite/Makefile.am: Wrap the cross linker tests and the
7460 common tests into NATIVE_OR_CROSS_LINKER.
7461 (check_SCRIPTS): Add script_test_10.sh.
7462 (check_DATA): Add script_test_10.stdout.
7463 (script_test_10.o, script_test_10): New targets.
7464 (script_test_10.stdout): New target.
7465 * configure, testsuite/Makefile.in: Regenerate.
7466
7467 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7468
7469 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7470 error for the deprecated relocations.
7471 (Target_arm::Scan::global): Likewise.
7472 (Target_arm::Relocate::relocate): Likewise.
7473
7474 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
7475
7476 * fileread.cc (Input_file::find_file): Initialize *found_name
7477 and *namep when using the fallback search for case 4.
7478
7479 2010-10-11 Cary Coutant <ccoutant@google.com>
7480
7481 * options.h (class General_options): Redefine -z lazy as an alias for
7482 the negation of -z now.
7483
7484 2010-10-11 Ian Lance Taylor <iant@google.com>
7485
7486 * resolve.cc (symbol_to_bits): Report the value of the unsupported
7487 binding.
7488
7489 2010-10-06 Nick Clifton <nickc@redhat.com>
7490
7491 * script-sections.cc(class Memory_region): Remove
7492 current_lma_offset_ field. Rename current_vma_offset_ to
7493 current_offset_. Add last_section_ field.
7494 (Memory_region::get_current_vma_address): Rename to
7495 get_current_address.
7496 (Memory_region::get_current_lma_address): Delete.
7497 (Memory_region::increment_vma_offset): Rename to
7498 increment_offset.
7499 (Memory_region::increment_lma_offset): Delete.
7500 (Memory_region::attributes_compatible): New method. Returns
7501 true if the provided section is compatible with the region.
7502 (Memory_region::get_last_section): New method. Returns the last
7503 section to use the region.
7504 (Memory_region::set_last_section): New method. Stores the last
7505 section to use the region.
7506 (Script_sections::block_in_region): New method. Returns true if
7507 a block of memory is contained within a region.
7508 (Script_sections::find_memory_region): New method. Locates a
7509 memory region to be used to set a VMA or LMA address.
7510 (Output_section_definition::set_section_addresses): Add code to
7511 check for addresses set by memory regions.
7512 (Output_segment::set_section_addresses): Remove memory region
7513 walking code.
7514 (Script_sections::create_segment): Add a warning if a header
7515 segment is created outside of any region.
7516 * script-sections.h (class Script_sections): Add prototypes for
7517 find_memory_region and block_in_region methods.
7518 * testsuite/memory_test.s: Use .long instead of .word.
7519 * testsuite/memory_test.t: Add some more output sections.
7520 * testsuite/memory_test.sh: Update expected output.
7521
7522 2010-10-02 Doug Kwan <dougkwan@google.com>
7523
7524 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7525 defintion to symtab.h
7526 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7527 declaration to defintion.
7528
7529 2010-10-01 Nick Clifton <nickc@redhat.com>
7530
7531 * expression.cc (eval): Replace dummy argument with NULL.
7532 (eval_maybe_dot): Check for a NULL result section pointer.
7533 (Symbol_expression::value): Likewise.
7534 (Dot_expression::value): Likewise.
7535 (BINARY_EXPRESSION): Likewise.
7536 (Max_expression::value): Likewise.
7537 (Min_expression::value): Likewise.
7538 (Absolute_expression::value): Likewise.
7539 (Addr_expression::value_from_output_section): Likewise.
7540 (Loaddddr_expression::value_from_output_section): Likewise.
7541 (Segment_start_expression::value): Likewise.
7542 * script-sections.cc
7543 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7544 argument with NULL.
7545 (Sections_elememt_dot_assignment::set_section_addresses):
7546 Likewise.
7547 (Output_data_expression::do_write_to_buffer): Likewise.
7548 (Output_section_definition::finalize_symbols): Likewise.
7549 (Output_section_definition::set_section_addresses): Likewise.
7550
7551 2010-09-30 Doug Kwan <dougkwan@google.com>
7552
7553 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7554
7555 2010-09-28 Sriraman Tallam <tmsriram@google.com>
7556
7557 * target.h (Target::can_icf_inline_merge_sections): New virtual
7558 function.
7559 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7560 virtual function.
7561 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7562 virtual function.
7563 * icf.cc (get_section_contents): Inline merge sections only when
7564 target allows it.
7565
7566 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7567
7568 * configure: Regenerate.
7569
7570 2010-09-17 Ian Lance Taylor <iant@google.com>
7571
7572 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7573 * testsuite/Makefile.am (memory_test.o): New target.
7574 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7575 memory_test.t.
7576 * testsuite/Makefile.in: Rebuild.
7577
7578 2010-09-17 Doug Kwan <dougkwan@google.com>
7579
7580 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7581 defintion if relocation uses GOT entries of the symbol.
7582 * testsuite/icf_safe_test.sh: Fix test.
7583 * testsuite/icf_safe_so_test.sh: Fix test.
7584
7585 2010-09-16 Cary Coutant <ccoutant@google.com>
7586
7587 * script_sections.cc (class Memory_region): Remove "NULL" from
7588 vector initializations.
7589
7590 2010-09-15 Cary Coutant <ccoutant@google.com>
7591
7592 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7593 Resolve forwarding symbols.
7594
7595 2010-09-15 Doug Kwan <dougkwan@google.com>
7596
7597 * gold/testsuite/script_test_3.t: Add ARM special sections.
7598 * gold/testsuite/script_test_4.t: Same.
7599 * gold/testsuite/script_test_5.t: Same.
7600 * gold/testsuite/script_test_6.t: Same.
7601 * gold/testsuite/script_test_7.t: Same.
7602 * gold/testsuite/script_test_7.t: Same.
7603 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7604
7605 2010-09-14 Cary Coutant <ccoutant@google.com>
7606
7607 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7608 (Target_x86_64::Relocate::relocate_tls): Replace check for
7609 saw_tls_block_reloc_ with test for executable section.
7610
7611 2010-09-12 Cary Coutant <ccoutant@google.com>
7612
7613 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7614 position-independent executables to shared libraries need dynamic
7615 relocations.
7616 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7617 position-independent executables.
7618 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7619 * testsuite/Makefile.in: Regenerate.
7620
7621 2010-09-10 Nick Clifton <nickc@redhat.com>
7622
7623 PR gold/11997
7624 * testsuite/memory_test.t: Discard any sections that are not
7625 needed.
7626
7627 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7628
7629 PR gold/11996
7630 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7631 "This::" to work around a bug in gcc 4.2.
7632
7633 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7634
7635 2010-09-09 Rafael Espindola <espindola@google.com>
7636
7637 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7638 sections with different PF_X flags in the same segment.
7639 (Layout::find_first_load_seg): Search all segments to find the first
7640 one.
7641 * options.h (rosegment): New.
7642
7643 2010-09-08 Rafael Espindola <espindola@google.com>
7644
7645 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7646
7647 2010-09-08 Doug Kwan <dougkwan@google.com>
7648
7649 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7650 (Arm_relobj::do_relocate_sections): Add new parameter for output
7651 file to match the parent.
7652 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7653 of local symbols instead of input values. Update code to track
7654 changes in gold::relocate_section.
7655 * object.cc (Sized_relobj::compute_final_local_value): New methods.
7656 (Sized_relobj::compute_final_local_value_internal): New methods.
7657 (Sized_relobj::do_finalize_local_symbols): Move code from loop
7658 body into private version of Sized_relobj::compute_final_local_value.
7659 Call the inline method.
7660 * object.h (Symbol_value::Symbol_value): Define destructor. Free
7661 merged symbol value if there is one.
7662 (Symbol_value::has_output_value): New method defintiion.
7663 (Sized_relobj::Compute_final_local_value_status): New enum type.
7664 (Sized_relobj::compute_final_local_value): New methods.
7665 (Sized_relobj::compute_final_local_value_internal): New methods.
7666 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7667 and arm_cortex_a8.sh.
7668 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7669 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7670 New tests.
7671 * Makefile.in: Regenerate.
7672 * testsuite/arm_bl_out_of_range.s: Update test.
7673 * testsuite/thumb_bl_out_of_range.s: Ditto.
7674 * testsuite/thumb_blx_out_of_range.s: Ditto.
7675 * testsuite/arm_branch_out_of_range.sh: New file.
7676 * testsuite/arm_cortex_a8.sh: Ditto.
7677 * testsuite/arm_cortex_a8_b.s: Ditto.
7678 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7679 * testsuite/arm_cortex_a8_b_local.s: Ditto.
7680 * testsuite/arm_cortex_a8_bl.s: Ditto.
7681 * testsuite/arm_cortex_a8_blx.s: Ditto.
7682 * testsuite/arm_cortex_a8_local.s: Ditto.
7683 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7684 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7685
7686 2010-09-08 Rafael Espindola <espindola@google.com>
7687
7688 * Makefile.am (memory_test.stdout): Run readelf with -W.
7689 * Makefile.in: Regenerate.
7690 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7691 64 bit output.
7692
7693 2010-09-08 Rafael Espindola <espindola@google.com>
7694
7695 * script-sections.cc (Script_sections::add_memory_region): Convert
7696 field precision to int.
7697 * script.cc (script_set_section_region, script_set_section_region):
7698 Convert field precision to int.
7699
7700 2010-09-08 Rafael Espindola <espindola@google.com>
7701
7702 * arm.cc (do_finalize_sections): Create the __exidx_start and
7703 __exdix_end symbols even when the section is missing.
7704
7705 2010-09-08 Nick Clifton <nickc@redhat.com>
7706
7707 * README: Remove claim that MEMORY is not supported.
7708 * expression.cc (script_exp_function_origin)
7709 (script_exp_function_length): Move from here to ...
7710 * script.cc: ... here.
7711 (script_set_section_region, script_add_memory)
7712 (script_parse_memory_attr, script_include_directive): New
7713 functions.
7714 * script-sections.cc
7715 (class Memory_region): New class.
7716 (class Output_section_definition): Add set_memory_region,
7717 set_section_vma, set_section_lma and get_section_name methods.
7718 (class Script_Sections): Add add_memory_region,
7719 find_memory_region, find_memory_region_origin,
7720 find_memory_region_length and set_memory_region methods.
7721 Have set_section_addresses method walk the list of set memory
7722 regions.
7723 Extend the print methos to display memory regions.
7724 * script-sections.h: Add prototypes for new methods.
7725 Add enum for MEMORY region attributes.
7726 * yyscript.y: Add support for parsing MEMORY regions.
7727 * script-c.h: Add prototypes for new functions.
7728 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7729 * testsuite/Makefile.in: Regenerate.
7730 * testsuite/memory_test.sh: New script.
7731 * testsuite/memory_test.s: New assembler source file.
7732 * testsuite/memory_test.t: New linker script.
7733
7734 2010-08-27 Doug Kwan <dougkwan@google.com>
7735
7736 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7737 reference override an existing dynamic weak reference.
7738 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7739 * testsuite/Makefile.in: Regenerate.
7740 * testsuite/dyn_weak_ref.sh: New file.
7741 * testsuite/dyn_weak_ref_1.c: Ditto.
7742 * testsuite/dyn_weak_ref_2.c: Ditto.
7743
7744 2010-08-27 Ian Lance Taylor <iant@google.com>
7745
7746 * incremental.h (class Incremental_input_entry): Add virtual
7747 destructor.
7748
7749 2010-08-27 Ian Lance Taylor <iant@google.com>
7750
7751 * testsuite/start_lib_test_3.c: Mark t3 as used.
7752
7753 2010-08-27 Nick Clifton <nickc@redhat.com>
7754
7755 * options.cc (version_script): Fix small typo in previous
7756 whitespace tidyup.
7757
7758 2010-08-25 Nick Clifton <nickc@redhat.com>
7759
7760 * archive.cc: Formatting fixes: Remove whitespace between
7761 typename and following asterisk. Remove whitespace between
7762 function name and opening parenthesis.
7763 * archive.h: Likewise.
7764 * arm.cc: Likewise.
7765 * attributes.cc: Likewise.
7766 * attributes.h: Likewise.
7767 * common.cc: Likewise.
7768 * copy-relocs.cc: Likewise.
7769 * dirsearch.h: Likewise.
7770 * dynobj.cc: Likewise.
7771 * ehframe.cc: Likewise.
7772 * ehframe.h: Likewise.
7773 * expression.cc: Likewise.
7774 * fileread.cc: Likewise.
7775 * fileread.h: Likewise.
7776 * gc.h: Likewise.
7777 * gold-threads.cc: Likewise.
7778 * gold.cc: Likewise.
7779 * i386.cc: Likewise.
7780 * icf.h: Likewise.
7781 * incremental-dump.cc: Likewise.
7782 * incremental.cc: Likewise.
7783 * layout.cc: Likewise.
7784 * layout.h: Likewise.
7785 * main.cc: Likewise.
7786 * merge.cc: Likewise.
7787 * merge.h: Likewise.
7788 * object.cc: Likewise.
7789 * object.h: Likewise.
7790 * options.cc: Likewise.
7791 * options.h: Likewise.
7792 * output.cc: Likewise.
7793 * output.h: Likewise.
7794 * plugin.cc: Likewise.
7795 * plugin.h: Likewise.
7796 * powerpc.cc: Likewise.
7797 * reloc.cc: Likewise.
7798 * script-c.h: Likewise.
7799 * script-sections.cc: Likewise.
7800 * script.cc: Likewise.
7801 * stringpool.cc: Likewise.
7802 * symtab.cc: Likewise.
7803 * symtab.h: Likewise.
7804 * target.cc: Likewise.
7805 * timer.cc: Likewise.
7806 * timer.h: Likewise.
7807 * version.cc: Likewise.
7808 * x86_64.cc: Likewise.
7809
7810 2010-08-24 Nick Clifton <nickc@redhat.com>
7811
7812 PR 11899
7813 * layout.cc (segment_precedes): Sort segments by their physical
7814 addresses, if they have been set.
7815
7816 2010-08-23 Cary Coutant <ccoutant@google.com>
7817
7818 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7819 symbols data.
7820 (Lib_group::include_member): Unlock object after deleting its
7821 symbols data.
7822 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7823 the bug fixed here.
7824
7825 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7826 Cary Coutant <ccoutant@google.com>
7827
7828 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7829 constructor, and set_blocker.
7830 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7831 readsyms_blocker_.
7832 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7833 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7834 * testsuite/Makefile.am (start_lib_test): New test case.
7835 * testsuite/Makefile.in: Regenerate.
7836 * testsuite/start_lib_test_main.c: New file.
7837 * testsuite/start_lib_test_1.c: New file.
7838 * testsuite/start_lib_test_2.c: New file.
7839 * testsuite/start_lib_test_3.c: New file.
7840
7841 2010-08-19 Ian Lance Taylor <iant@google.com>
7842
7843 * Makefile.in: Rebuild with automake 1.11.1.
7844 * aclocal.m4: Likewise.
7845 * testsuite/Makefile.in: Likewise.
7846
7847 2010-08-19 Ian Lance Taylor <iant@google.com>
7848
7849 PR 10893
7850 * i386.cc (class Output_data_plt_i386): Update declarations.
7851 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7852 local_ifuncs_ fields.
7853 (Target_i386::do_plt_section_for_global): New function.
7854 (Target_i386::do_plt_section_for_local): New function.
7855 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7856 parameter; change all callers. Initialize global_ifuncs_ and
7857 local_ifuncs_. If doing a static link define __rel_iplt_start and
7858 __rel_iplt_end.
7859 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7860 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7861 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7862 symbols.
7863 (Target_i386::make_plt_section): New function, broken out of
7864 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7865 (Target_i386::make_plt_entry): Call make_plt_section.
7866 (Target_i386::make_local_ifunc_plt_entry): New function.
7867 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7868 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7869 R_386_IRELATIVE to switch.
7870 (Target_i386::Scan::global): Likewise.
7871 (Target_i386::Relocate::relocate): Likewise.
7872 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7873 switch.
7874 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7875 (Target_x86_64::do_plt_section_for_global): New function.
7876 (Target_x86_64::do_plt_section_for_local): New function.
7877 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7878 parameter; change all callers. If doing a static link define
7879 __rela_iplt_start and __rela_iplt_end.
7880 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7881 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7882 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7883 to point to .plt.
7884 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7885 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7886 switch.
7887 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7888 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7889 R_X86_64_IRELATIVE to switch.
7890 (Target_x86_64::Scan::global): Likewise.
7891 (Target_x86_64::Relocate::relocate): Likewise.
7892 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7893 switch.
7894 * target.h (class Target): Add plt_section_for_global and
7895 plt_section_for_local functions. Add do_plt_section_for_global
7896 and do_plt_section_for_local virtual functions.
7897 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7898 clarifying comments.
7899 (Symbol::use_plt_offset): Handle IFUNC symbol.
7900 * object.cc (Sized_relobj::Sized_relobj): Initialize
7901 local_plt_offsets_.
7902 (Sized_relobj::local_has_plt_offset): New function.
7903 (Sized_relobj::local_plt_offset): New function.
7904 (Sized_relobj::set_local_plt_offset): New function.
7905 (Sized_relobj::do_count): Handle IFUNC symbol.
7906 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7907 a bit away from input_shndx_ field. Add set_is_func_symbol and
7908 is_ifunc_symbol functions.
7909 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7910 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7911 local_plt_offsets_ field.
7912 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7913 * output.h (class Output_section_data): Add non-const
7914 output_section function.
7915 (class Output_data_got): Update declarations.
7916 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7917 Add use_plt_offset parameter to global and local constructors.
7918 Change all callers. Change local_sym_index_ field to 31 bits.
7919 Change GSYM_CODE and CONSTANT_CODE accordingly.
7920 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7921 doing a static link don't set sh_link field.
7922 (Output_data_got::Got_entry::write): Use PLT offset if
7923 appropriate.
7924 (Output_data_got::add_global_plt): New function.
7925 (Output_data_got::add_local_plt): New function.
7926 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7927 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7928 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7929 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7930 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7931 IFUNC conditional.
7932 * testsuite/ifunc-sel.h: New file.
7933 * testsuite/ifuncmain1.c: New file.
7934 * testsuite/ifuncmain1vis.c: New file.
7935 * testsuite/ifuncmod1.c: New file.
7936 * testsuite/ifuncdep2.c: New file.
7937 * testsuite/ifuncmain2.c: New file.
7938 * testsuite/ifuncmain3.c: New file.
7939 * testsuite/ifuncmod3.c: New file.
7940 * testsuite/ifuncmain4.c: New file.
7941 * testsuite/ifuncmain5.c: New file.
7942 * testsuite/ifuncmod5.c: New file.
7943 * testsuite/ifuncmain6pie.c: New file.
7944 * testsuite/ifuncmod6.c: New file.
7945 * testsuite/ifuncmain7.c: New file.
7946 * configure, testsuite/Makefile.in: Rebuild.
7947
7948 2010-08-18 Ian Lance Taylor <iant@google.com>
7949
7950 * incremental.cc
7951 (Output_section_incremental_inputs::write_input_files): Add cast
7952 to avoid signed/unsigned comparison warning.
7953 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7954
7955 2010-08-12 Cary Coutant <ccoutant@google.com>
7956
7957 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7958
7959 2010-08-13 Ian Lance Taylor <iant@google.com>
7960
7961 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7962
7963 2010-08-12 Cary Coutant <ccoutant@google.com>
7964 Doug Kwan <dougkwan@google.com>
7965
7966 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7967 defintion overrides non-weak undef, remember that the original undef
7968 is not weak.
7969 * symtab.cc (Symbol_table::sized_write_global): For undef without
7970 an original weak binding, set binding to global in output.
7971 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7972 * testsuite/Makefile.in: Regenerate.
7973 * testsuite/strong_ref_weak_def.sh: New file.
7974 * testsuite/strong_ref_weak_def_1.c: Ditto.
7975 * testsuite/strong_ref_weak_def_2.c: Ditto.
7976
7977 2010-08-12 Cary Coutant <ccoutant@google.com>
7978
7979 * testsuite/incremental_test.sh: Rewrite.
7980 * testsuite/incremental_test_1.c: Rewrite.
7981 * testsuite/incremental_test_2.c: Rewrite.
7982
7983 2010-08-12 Cary Coutant <ccoutant@google.com>
7984
7985 * arm.cc (Target_arm::got_size): Add const.
7986 (Target_arm::got_entry_count): New function.
7987 (Target_arm::plt_entry_count): New function.
7988 (Target_arm::first_plt_entry_offset): New function.
7989 (Target_arm::plt_entry_size): New function.
7990 (Output_data_plt_arm::entry_count): New function.
7991 (Output_data_plt_arm::first_plt_entry_offset): New function.
7992 (Output_data_plt_arm::get_plt_entry_size): New function.
7993 * i386.cc (Target_i386::got_size): Add const.
7994 (Target_i386::got_entry_count): New function.
7995 (Target_i386::plt_entry_count): New function.
7996 (Target_i386::first_plt_entry_offset): New function.
7997 (Target_i386::plt_entry_size): New function.
7998 (Output_data_plt_i386::entry_count): New function.
7999 (Output_data_plt_i386::first_plt_entry_offset): New function.
8000 (Output_data_plt_i386::get_plt_entry_size): New function.
8001 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8002 find_incremental_inputs_sections. Dump incremental_got_plt section.
8003 * incremental.cc: Include target.h.
8004 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8005 parameter. Adjust all callers. Find incremental_got_plt section.
8006 (Incremental_inputs::create_data_sections): Create incremental_got_plt
8007 section.
8008 (Output_section_incremental_inputs::set_final_data_size): Calculate
8009 size of incremental_got_plt section.
8010 (Output_section_incremental_inputs::do_write): Write the
8011 incremental_got_plt section.
8012 (Got_plt_view_info): New struct.
8013 (Local_got_offset_visitor): New class.
8014 (Global_got_offset_visitor): New class.
8015 (Global_symbol_visitor_got_plt): New class.
8016 (Output_section_incremental_inputs::write_got_plt): New function.
8017 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8018 Add parameter. Adjust all callers.
8019 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8020 (Incremental_inputs::got_plt_section): New function.
8021 (Incremental_inputs::got_plt_section_): New data member.
8022 (Incremental_got_plt_reader): New class.
8023 * layout.cc (Layout::create_incremental_info_sections): Add the
8024 incremental_got_plt section.
8025 * object.h (Got_offset_list::get_list): New function.
8026 (Got offset_list::for_all_got_offsets): New function.
8027 (Sized_relobj::local_got_offset_list): New function.
8028 * powerpc.cc (Target_powerpc::got_size): Add const.
8029 (Target_powerpc::got_entry_count): New function.
8030 (Target_powerpc::plt_entry_count): New function.
8031 (Target_powerpc::first_plt_entry_offset): New function.
8032 (Target_powerpc::plt_entry_size): New function.
8033 (Output_data_plt_powerpc::entry_count): New function.
8034 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8035 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8036 * sparc.cc (Target_sparc::got_size): Add const.
8037 (Target_sparc::got_entry_count): New function.
8038 (Target_sparc::plt_entry_count): New function.
8039 (Target_sparc::first_plt_entry_offset): New function.
8040 (Target_sparc::plt_entry_size): New function.
8041 (Output_data_plt_sparc::entry_count): New function.
8042 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8043 (Output_data_plt_sparc::get_plt_entry_size): New function.
8044 * symtab.h (Symbol::got_offset_list): New function.
8045 (Symbol_table::for_all_symbols): New function.
8046 * target.h (Sized_target::got_entry_count): New function.
8047 (Sized_target::plt_entry_count): New function.
8048 (Sized_target::plt_entry_size): New function.
8049 * x86_64.cc (Target_x86_64::got_size): Add const.
8050 (Target_x86_64::got_entry_count): New function.
8051 (Target_x86_64::plt_entry_count): New function.
8052 (Target_x86_64::first_plt_entry_offset): New function.
8053 (Target_x86_64::plt_entry_size): New function.
8054 (Output_data_plt_x86_64::entry_count): New function.
8055 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8056 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8057
8058 2010-08-12 Cary Coutant <ccoutant@google.com>
8059
8060 * archive.cc: Include incremental.h.
8061 (Archive::Archive): Initialize incremental_info_.
8062 (Archive::include_member): Record archive members in incremental info.
8063 (Add_archive_symbols::run): Record begin and end of an archive in
8064 incremental info.
8065 (Lib_group::include_member): Record objects in incremental info.
8066 * archive.h (Incremental_archive_entry): Forward declaration.
8067 (Archive::set_incremental_info): New member function.
8068 (Archive::incremental_info): New member function.
8069 (Archive::Unused_symbol_iterator): New class.
8070 (Archive::unused_symbols_begin): New member function.
8071 (Archive::unused_symbols_end): New member function.
8072 (Archive::incremental_info_): New data member.
8073 * incremental-dump.cc (find_input_containing_global): New function.
8074 (dump_incremental_inputs): Dump new incremental info sections.
8075 * incremental.cc: Include symtab.h.
8076 (Output_section_incremental_inputs): New class.
8077 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8078 new incremental info sections.
8079 (Sized_incremental_binary::do_check_inputs): Likewise.
8080 (Incremental_inputs::report_archive): Remove.
8081 (Incremental_inputs::report_archive_begin): New function.
8082 (Incremental_inputs::report_archive_end): New function.
8083 (Incremental_inputs::report_object): New function.
8084 (Incremental_inputs::finalize_inputs): Remove.
8085 (Incremental_inputs::report_input_section): New function.
8086 (Incremental_inputs::report_script): Rewrite.
8087 (Incremental_inputs::finalize): Do nothing but finalize string table.
8088 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8089 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8090 (Incremental_inputs::create_data_sections): New function.
8091 (Incremental_inputs::relocs_entsize): New function.
8092 (Output_section_incremental_inputs::set_final_data_size): New function.
8093 (Output_section_incremental_inputs::do_write): New function.
8094 (Output_section_incremental_inputs::write_header): New function.
8095 (Output_section_incremental_inputs::write_input_files): New function.
8096 (Output_section_incremental_inputs::write_info_blocks): New function.
8097 (Output_section_incremental_inputs::write_symtab): New function.
8098 * incremental.h (Incremental_script_entry): Forward declaration.
8099 (Incremental_object_entry): Forward declaration.
8100 (Incremental_archive_entry): Forward declaration.
8101 (Incremental_inputs): Forward declaration.
8102 (Incremental_inputs_header_data): Remove.
8103 (Incremental_inputs_header): Remove.
8104 (Incremental_inputs_header_write): Remove.
8105 (Incremental_inputs_entry_data): Remove.
8106 (Incremental_inputs_entry): Remove.
8107 (Incremental_inputs_entry_write): Remove.
8108 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8109 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8110 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8111 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8112 Likewise.
8113 (Incremental_input_entry): New class.
8114 (Incremental_script_entry): New class.
8115 (Incremental_object_entry): New class.
8116 (Incremental_archive_entry): New class.
8117 (Incremental_inputs::Incremental_inputs): Initialize new data members.
8118 (Incremental_inputs::report_inputs): Remove.
8119 (Incremental_inputs::report_archive): Remove.
8120 (Incremental_inputs::report_archive_begin): New function.
8121 (Incremental_inputs::report_archive_end): New function.
8122 (Incremental_inputs::report_object): Change prototype.
8123 (Incremental_inputs::report_input_section): New function.
8124 (Incremental_inputs::report_script): Change prototype.
8125 (Incremental_inputs::get_reloc_count): New function.
8126 (Incremental_inputs::set_reloc_count): New function.
8127 (Incremental_inputs::create_data_sections): New function.
8128 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8129 (Incremental_inputs::inputs_section): New function.
8130 (Incremental_inputs::symtab_section): New function.
8131 (Incremental_inputs::relocs_section): New function.
8132 (Incremental_inputs::get_stringpool): Add const.
8133 (Incremental_inputs::command_line): Add const.
8134 (Incremental_inputs::inputs): Remove.
8135 (Incremental_inputs::command_line_key): New function.
8136 (Incremental_inputs::input_file_count): New function.
8137 (Incremental_inputs::input_files): New function.
8138 (Incremental_inputs::relocs_entsize): New function.
8139 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8140 (Incremental_inputs::finalize_inputs): Remove.
8141 (Incremental_inputs::Input_info): Remove.
8142 (Incremental_inputs::lock_): Remove.
8143 (Incremental_inputs::inputs_): Change type.
8144 (Incremental_inputs::inputs_map_): Remove.
8145 (Incremental_inputs::current_object_entry_): New data member.
8146 (Incremental_inputs::inputs_section_): New data member.
8147 (Incremental_inputs::symtab_section_): New data member.
8148 (Incremental_inputs::relocs_section_): New data member.
8149 (Incremental_inputs::reloc_count_): New data member.
8150 (Incremental_inputs_reader): New class.
8151 (Incremental_symtab_reader): New class.
8152 (Incremental_relocs_reader): New class.
8153 * layout.cc (Layout::finalize): Move finalization of incremental info
8154 and creation of incremental info sections to follow finalization of
8155 symbol table. Set offsets for postprocessing sections.
8156 (Layout::create_incremental_info_sections): Call
8157 Incremental_inputs::create_data_sections. Add incremental symtab
8158 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
8159 sections to layout after input sections.
8160 * layout.h (struct Timespec): Forward declaration.
8161 (Layout::incremental_inputs): Add const.
8162 (Layout::create_incremental_info_sections): Add parameter.
8163 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8164 * object.cc: Include incremental.h.
8165 (Relobj::finalize_incremental_relocs): New function.
8166 (Sized_relobj::do_layout): Record input sections in incremental info.
8167 * object.h (Object::output_section): New function.
8168 (Object::output_section_offset): Moved from Relobj.
8169 (Object::get_incremental_reloc_base): New function.
8170 (Object::get_incremental_reloc_count): New function.
8171 (Object::do_output_section): New function.
8172 (Object::do_output_section_offset): Moved from Relobj.
8173 (Object::do_get_incremental_reloc_base): New function.
8174 (Object::do_get_incremental_reloc_count): New function.
8175 (Object::Object): Initialize new data members.
8176 (Relobj::output_section): Renamed do_output_section and moved to
8177 protected.
8178 (Relobj::output_section_offset): Moved to Object.
8179 (Relobj::do_get_incremental_reloc_base): New function.
8180 (Relobj::do_get_incremental_reloc_count): New function.
8181 (Relobj::allocate_incremental_reloc_counts): New function.
8182 (Relobj::count_incremental_reloc): New function.
8183 (Relobj::finalize_incremental_relocs): New function.
8184 (Relobj::next_incremental_reloc_index): New function.
8185 (Relobj::reloc_counts_): New data member.
8186 (Relobj::reloc_bases_): New data member.
8187 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
8188 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
8189 (Sized_relobj::incremental_relocs_scan): New function.
8190 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8191 (Sized_relobj::incremental_relocs_write): New function.
8192 (Sized_relobj::incremental_relocs_write_reltype): New function.
8193 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8194 incremental link.
8195 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8196 archives and object files elsewhere.
8197 (Add_symbols::run): Report object files here.
8198 (Finish_group::run): Report end of archive at end of group.
8199 * reloc.cc: Include layout.h, incremental.h.
8200 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8201 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8202 (Sized_relobj::incremental_relocs_scan): New function.
8203 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8204 (Sized_relobj::do_relocate_sections): Write incremental relocations.
8205 (Sized_relobj::incremental_relocs_write): New function.
8206 (Sized_relobj::incremental_relocs_write_reltype): New function.
8207 * script.cc (read_input_script): Rewrite test for incremental link.
8208 Change call to Incremental_inputs::report_script.
8209 * symtab.h (Symbol_table::first_global_index): New function.
8210 (Symbol_table::output_count): New function.
8211
8212 2010-08-12 Doug Kwan <dougkwan@google.com>
8213
8214 * arm.cc (Target_arm::merge_object_attributes): Check command line
8215 options --no-wchar-size-warning and --no-enum-size-warning.
8216 * options.h (General_options): Add ld-compatible options
8217 --no-enum-size-warning and --no-wchar-size-warning.
8218
8219 2010-08-04 Ian Lance Taylor <iant@google.com>
8220
8221 * x86_64.cc (Target_x86_64::Scan::local): Use
8222 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8223 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8224 (Target_x86_64::Scan::global): Likewise.
8225 (Target_x86_64::Relocate::relocate): Likewise.
8226 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8227 Likewise.
8228
8229 2010-08-03 Cary Coutant <ccoutant@google.com>
8230
8231 * merge.cc (Output_merge_string::do_add_input_section): Count strings
8232 to reserve space in merged_strings vector. Keep total input size
8233 for stats.
8234 (Output_merge_string::do_print_merge_stats): Print total input size.
8235 * merge.h (Output_merge_string): Add input_size_ field.
8236 * stringpool.cc (Stringpool_template::string_length): Move
8237 implementations out of Stringpool_template class and place in
8238 stringpool.h.
8239 * stringpool.h (string_length): Move out of Stringpool_template.
8240
8241 2010-08-03 Ian Lance Taylor <iant@google.com>
8242
8243 PR 11712
8244 * layout.cc (relaxation_loop_body): If address of load segment is
8245 set, adjust address to include headers if possible.
8246
8247 2010-08-03 Ian Lance Taylor <iant@google.com>
8248
8249 * version.cc (version_string): Bump to 1.10.
8250
8251 2010-08-03 Ian Lance Taylor <iant@google.com>
8252
8253 PR 11805
8254 * layout.h (enum Output_section_order): Define.
8255 (class Layout): Update declarations.
8256 * layout.cc (Layout::get_output_section): Add order parameter.
8257 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8258 is_first_non_relro parameters. Change all callers.
8259 (Layout::choose_output_section): Likewise.
8260 (Layout::add_output_section_data): Likewise.
8261 (Layout::make_output_section): Likewise. Set order.
8262 (Layout::default_section_order): New function.
8263 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8264 * output.cc (Output_section::Output_section): Initialize order_.
8265 Don't initialize deleted fields.
8266 (Output_segment::Output_segment): Don't initialize deleted
8267 fields.
8268 (Output_segment::add_output_section_to_load): New function
8269 replacing add_output_section. Change all callers to call this or
8270 add_output_section_to_nonload.
8271 (Output_segment::add_output_section_to_nonload): New function.
8272 (Output_segment::remove_output_section): Rewrite.
8273 (Output_segment::add_initial_output_data): Likewise.
8274 (Output_segment::has_any_data_sections): Likewise.
8275 (Output_segment::is_first_section_relro): Likewise.
8276 (Output_segment::maximum_alignment): Likewise.
8277 (Output_segment::has_dynamic_reloc): New function replacing
8278 dynamic_reloc_count. Change all callers.
8279 (Output_segment::has_dynamic_reloc_list): New function replacing
8280 dynamic_reloc_count_list. Change all callers.
8281 (Output_segment::set_section_addresses): Rewrite.
8282 (Output_segment::set_offset): Rewrite.
8283 (Output_segment::find_first_and_last_list): Remove.
8284 (Output_segment::set_tls_offsets): Rewrite.
8285 (Output_segment::first_section_load_address): Likewise.
8286 (Output_segment::output_section_count): Likewise.
8287 (Output_segment::section_with_lowest_load_address): Likewise.
8288 (Output_segment::write_section_headers): Likewise.
8289 (Output_segment::print_sections_to_map): Likewise.
8290 * output.h (class Output_data): Remove dynamic_reloc_count_
8291 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
8292 (Output_data::add_dynamic_reloc): Rewrite.
8293 (Output_data::has_dynamic_reloc): New function.
8294 (Output_data::dynamic_reloc_count): Remove.
8295 (class Output_section): Add order_ field. Remvoe is_relro_local_,
8296 is_last_relro_, is_first_non_relro_, is_interp_,
8297 is_dynamic_linker_section_ fields. Add order and set_order
8298 functions. Remove is_relro_local, set_is_relro_local,
8299 is_last_relro, set_is_last_relro, is_first_non_relro,
8300 set_is_first_non_relro functions, is_interp, set_is_interp,
8301 is_dynamic_linker_section, and set_is_dynamic_linker_section
8302 functions.
8303 (class Output_segment): Change Output_data_list from std::list to
8304 std:;vector. Add output_lists_ field. Remove output_data_ and
8305 output_bss_ fields. Update declarations.
8306
8307 2010-08-02 Ian Lance Taylor <iant@google.com>
8308
8309 * arm.cc (Target_arm::gc_process_relocs): Use typename.
8310 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8311 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8312
8313 2010-08-02 Ian Lance Taylor <iant@google.com>
8314
8315 PR 11855
8316 * script.cc (Script_options::Script_options): Initialize
8317 symbol_definitions_ and symbol_references_.
8318 (Script_options::add_symbol_assignment): Update
8319 symbol_definitions_ and symbol_references_.
8320 (Script_options::add_symbol_reference): New function.
8321 (script_symbol): New function.
8322 * script.h (class Script_options): Add symbol_definitions_ and
8323 symbol_references_ fields.
8324 (Script_options::referenced_const_iterator): New type.
8325 (Script_options::referenced_begin): New function.
8326 (Script_options::referenced_end): New function.
8327 (Script_options::is_referenced): New function.
8328 (Script_options::any_unreferenced): New function.
8329 * script-c.h (script_symbol): Declare.
8330 * yyscript.y (exp): Call script_symbol.
8331 * symtab.cc: Include "script.h".
8332 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8333 Change all callers. Check symbols referenced by scripts.
8334 (Symbol_table::add_undefined_symbols_from_command_line): Add
8335 layout parameter. Change all callers.
8336 (Symbol_table::do_add_undefined_symbols_from_command_line):
8337 Likewise. Break out loop body. Check symbols referenced by
8338 scripts.
8339 (Symbol_table::add_undefined_symbol_from_command_line): New
8340 function broken out of
8341 do_add_undefined_symbols_from_command_line.
8342 * symtab.h (class Symbol_table): Update declarations.
8343 * archive.cc: Include "layout.h".
8344 (Archive::should_include_member): Add layout parameter. Change
8345 all callers. Check for symbol mentioned in expression.
8346 * archive.h (class Archive): Update declaration.
8347 * object.cc (Sized_relobj::do_should_include_member): Add layout
8348 parameter.
8349 * object.h (Object::should_include_member): Add layout parameter.
8350 Change all callers.
8351 (Object::do_should_include_member): Add layout parameter.
8352 (class Sized_relobj): Update declaration.
8353 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8354 parameter.
8355 * dynobj.h (class Sized_dynobj): Update declaration.
8356 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8357 layout parameter.
8358 * plugin.h (class Sized_pluginobj): Update declaration.
8359
8360 2010-08-02 Ian Lance Taylor <iant@google.com>
8361
8362 PR 11866
8363 * output.cc (Output_segment::set_offset): Search for the first and
8364 last sections rather than assuming that the list is in order.
8365 (Output_segment::find_first_and_last_list): New function.
8366 * output.h (class Output_segment): Update declarations.
8367 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8368 (relro_strip_test_SOURCES): New variable.
8369 (relro_strip_test_DEPENDENCIES): New variable.
8370 (relro_strip_test_LDFLAGS): New variable.
8371 (relro_strip_test_LDADD): New variable.
8372 (relro_strip_test.so): New target.
8373
8374 2010-08-02 Ian Lance Taylor <iant@google.com>
8375
8376 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8377 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8378 (Target_i386::got_tlsdesc_section): New function.
8379 (Target_i386::got_section): Create space for GOT entries for
8380 TLSDESC relocations.
8381 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8382 R_386_TLS_GOTDESC.
8383 (Target_i386::Scan::global): Likewise.
8384 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8385 using TLSDESC GOT.
8386 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8387 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8388 (Target_x86_64::got_tlsdesc_section): New function.
8389 (Target_x86_64::got_section): Create space for GOT entries for
8390 TLSDESC relocations.
8391 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8392 R_386_TLS_GOTDESC.
8393 (Target_x86_64::Scan::global): Likewise.
8394 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8395 using TLSDESC GOT.
8396
8397 2010-08-02 Ian Lance Taylor <iant@google.com>
8398
8399 * testsuite/final_layout.sh: Use dc to convert from hex to
8400 decimal.
8401
8402 2010-07-29 Sriraman Tallam <tmsriram@google.com>
8403
8404 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8405 paramter to the call to gold::gc_process_relocs.
8406 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8407 paramter to the call to gold::gc_process_relocs.
8408 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8409 parameter to the call to gold::gc_process_relocs.
8410 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8411 template parameter to the call to gold::gc_process_relocs.
8412 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8413 paramter to the call to gold::gc_process_relocs.
8414 * gc.h (get_embedded_addend_size): New function.
8415 (gc_process_relocs): Save the size of the reloc for use by ICF.
8416 * icf.cc (get_section_contents): Get the addend from the text section
8417 for SHT_REL relocation sections.
8418 * icf.h (Icf::Reloc_addend_size_info): New typedef.
8419 (Icf::Reloc_info): Add new member reloc_addend_size_info.
8420 * int_encoding.h (read_from_pointer): New overloaded function.
8421 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8422 * testsuite/icf_sht_rel_addend_test.sh: New file.
8423 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8424 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8425
8426 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8427
8428 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8429 * Makefile.in: Regenerate.
8430 * testsuite/Makefile.in: Regenerate.
8431
8432 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
8433
8434 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8435 * gold/testsuite/debug_msg.cc: Likewise.
8436 * gold/testsuite/odr_violation1.cc
8437 * gold/testsuite/odr_violation2.cc
8438
8439 2010-07-21 Cary Coutant <ccoutant@google.com>
8440
8441 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8442 string, and length fields.
8443 (Output_merge_string::Merged_strings_list): New type.
8444 (Output_merge_string::Merged_strings_lists): New typedef.
8445 (Output_merge_string): Replace merged_strings_ with
8446 merged_strings_lists_.
8447 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8448 Merged_strings_list per input object and section. Don't store pointer
8449 to the string. Don't store length with each merged string entry.
8450 (Output_merge_string::finalize_merged_data): Loop over list of merged
8451 strings lists. Recompute length of each merged string.
8452
8453 2010-07-15 Cary Coutant <ccoutant@google.com>
8454
8455 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8456 here.
8457
8458 2010-07-14 Ian Lance Taylor <iant@google.com>
8459
8460 * descriptors.cc (Descriptors::open): Report correct name in error
8461 message.
8462
8463 2010-07-13 Doug Kwan <dougkwan@google.com>
8464
8465 * arm.cc (Arm_input_section::Arm_input_section): For a
8466 SHT_ARM_EXIDX section, always keeps the input sections.
8467 (Arm_input_section::set_exidx_section_link): New method.
8468 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8469 has_errors_ to false.
8470 (Arm_exidx_input_section::has_errors,
8471 Arm_exidx_input_section::set_has_errors): New methods.
8472 (Arm_exidx_input_section::has_errors_): New data member.
8473 (Arm_relobj::get_exidx_shndx_list): New method.
8474 (Arm_output_section::append_text_sections_to_list): Do not skip
8475 section without SHF_EXECINSTR.
8476 (Arm_output_section::fix_exidx_coverage): Skip input sections with
8477 errors.
8478 (Arm_relobj::make_exidx_input_section): Add new parameter for text
8479 section header. Make error messages more verbose. Check for
8480 a non-executable section linked to an EXIDX section.
8481 (Arm_relobj::do_read_symbols): Remove error checking, which has been
8482 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
8483 check that there is no deferred EXIDX section if we exit early.
8484 Instead of not making an EXIDX section in case of an error, make one
8485 and set the has_errors flag of it.
8486 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8487 in a relocatable link.
8488 (Target_arm::do_relax): Look for the EXIDX output section instead of
8489 assuming that it is called .ARM.exidx.
8490 (Target_arm::fix_exidx_coverage): Add a new parameter for input
8491 section list. Do not check for SHF_EXECINSTR section flags but
8492 skip any input section with errors.
8493 * output.cc (Output_section::Output_section): Initialize
8494 always_keeps_input_sections_ to false.
8495 (Output_section::add_input_section): Check for
8496 always_keeps_input_sections_.
8497 * output.h (Output_section::always_keeps_input_sections,
8498 Output_section::set_always_keeps_input_sections): New methods.
8499 (Output_section::always_keeps_input_sections): New data member.
8500
8501 2010-07-13 Rafael Espindola <espindola@google.com>
8502
8503 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8504 * fileread.h (Input_file): Add try_extra_search_path and find_file.
8505
8506 2010-07-13 Philip Herron <herron.philip@googlemail.com>
8507 Ian Lance Taylor <iant@google.com>
8508
8509 * output.h (Output_section_lookup_maps::add_merge_section):
8510 Correct check of whether value was inserted.
8511 (Output_section_lookup_maps::add_merge_input_section): Likewise.
8512 (Output_section_lookup_maps::add_relaxed_input_section):
8513 Likewise.
8514 * arm.cc (Target_arm::got_section): Remove used local os.
8515 * i386.cc (Target_i386::got_section): Likewise.
8516 * x86_64.cc (Target_x86_64::got_section): Likewise.
8517 * sparc.cc (Target_sparc::got_section): Likewise.
8518 (Target_sparc::relocate): Remove unused local have_got_offset.
8519 * powerpc.cc (Target_powerpc::relocate): Likewise.
8520
8521 2010-07-13 Ian Lance Taylor <iant@google.com>
8522
8523 * compressed_output.cc (zlib_decompress): Fix signature in
8524 !HAVE_ZLIB_H case.
8525
8526 * archive.cc (Archive::include_member): Unlock an external member
8527 of a thin archive. Don't bother to delete an object we know is
8528 NULL.
8529
8530 2010-07-12 Cary Coutant <ccoutant@google.com>
8531
8532 * compressed_output.cc (zlib_decompress): New function.
8533 (get_uncompressed_size): New function.
8534 (decompress_input_section): New function.
8535 * compressed_output.h (get_uncompressed_size): New function.
8536 (decompress_input_section): New function.
8537 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8538 Handle compressed debug sections.
8539 * layout.cc (is_compressed_debug_section): New function.
8540 (Layout::output_section_name): Map compressed section names to
8541 canonical names.
8542 * layout.h (is_compressed_debug_section): New function.
8543 (is_debug_info_section): Recognize compressed debug sections.
8544 * merge.cc: Include compressed_output.h.
8545 (Output_merge_data::do_add_input_section): Handle compressed
8546 debug sections.
8547 (Output_merge_string::do_add_input_section): Handle compressed
8548 debug sections.
8549 * object.cc: Include compressed_output.h.
8550 (Sized_relobj::Sized_relobj): Initialize new data members.
8551 (build_compressed_section_map): New function.
8552 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8553 * object.h (Object::section_is_compressed): New method.
8554 (Object::do_section_is_compressed): New method.
8555 (Sized_relobj::Compressed_section_map): New type.
8556 (Sized_relobj::do_section_is_compressed): New method.
8557 (Sized_relobj::compressed_sections_): New data member.
8558 * output.cc (Output_section::add_input_section): Handle compressed
8559 debug sections.
8560 * reloc.cc: Include compressed_output.h.
8561 (Sized_relobj::write_sections): Handle compressed debug sections.
8562
8563 2010-07-08 Cary Coutant <ccoutant@google.com>
8564
8565 * resolve.cc (Symbol_table::resolve): Remember whether undef was
8566 weak when resolving to a dynamic def.
8567 (Symbol_table::should_override): Add adjust_dyndef flag; set it
8568 for weak undef/dynamic def cases. Adjust callers.
8569 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8570 undef_binding_weak_.
8571 (Symbol_table::sized_write_globals): Adjust symbol binding.
8572 (Symbol_table::sized_write_symbol): Add binding parameter.
8573 * symtab.h (Symbol::set_undef_binding): New method.
8574 (Symbol::is_undef_binding_weak): New method.
8575 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8576 (Symbol_table::should_override): Add new parameter.
8577 (Symbol_table::sized_write_symbol): Add new parameter.
8578
8579 * testsuite/weak_undef_file1.cc: Add new test case.
8580 * testsuite/weak_undef_file2.cc: Fix header comment.
8581 * testsuite/weak_undef_test.cc: Add new test case.
8582
8583 2010-06-29 Doug Kwan <dougkwan@google.com>
8584
8585 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8586 Initialize USE_SYMBOL_.
8587 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8588 definition.
8589 (Arm_reloc_property::uses_symbol_): New data member declaration.
8590 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8591 uses symbol value and symbol is undefined but not weakly undefined.
8592
8593 2010-06-28 Rafael Espindola <espindola@google.com>
8594
8595 * plugin.cc (Plugin::load): Use dlerror.
8596
8597 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8598
8599 * symtab.cc (detect_odr_violations): When reporting an ODR
8600 violation, report an object where the symbol is defined.
8601
8602 2010-06-25 Doug Kwan <dougkwan@google.com>
8603
8604 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8605 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8606 definition.
8607 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8608 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8609 target hook to detect function points.
8610 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8611 * icf.h (Icf::check_section_for_function_pointers): Change type of
8612 parameter SECTION_NAME to const reference to std::string. Use
8613 target hook to determine if section may have unsafe pointers.
8614 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8615 method definition.
8616
8617 2010-06-21 Rafael Espindola <espindola@google.com>
8618
8619 * fileread.cc (Input_file::find_fie): New
8620 (Input_file::open): Use Input_file::find_fie.
8621 * fileread.h (Input_file::find_fie): New
8622 * plugin.cc (set_extra_library_path): New.
8623 (Plugin::load): Add set_extra_library_path to the transfer vector.
8624 (Plugin_manager::set_extra_library_path): New.
8625 (Plugin_manager::add_input_file): Use the extra search path if set.
8626 (set_extra_library_path(): New.
8627 * plugin.h (Plugin_manager): Add set_extra_library_path and
8628 extra_search_path_.
8629
8630 2010-06-19 Cary Coutant <ccoutant@google.com>
8631
8632 * layout.cc (gdb_sections): Add .debug_types.
8633 (lines_only_debug_sections): Likewise.
8634
8635 2010-06-18 Rafael Espindola <espindola@google.com>
8636
8637 * plugin.cc (add_input_file,add_input_library)
8638 (Plugin_manager::add_input_file): Make filename arguments const.
8639 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8640 const.
8641
8642 2010-06-16 Doug Kwan <dougkwan@google.com>
8643
8644 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8645 .ARM.attributes section if we have not merged any input
8646 attributes sections.
8647
8648 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8649
8650 * arm.cc: Allow combining objects with no EABI version
8651 information.
8652
8653 2010-06-15 Rafael Espindola <espindola@google.com>
8654
8655 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8656
8657 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8658
8659 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8660 (struct iovec): Correct !HAVE_READV definition.
8661
8662 2010-06-10 Cary Coutant <ccoutant@google.com>
8663
8664 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8665 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8666 reloc sections.
8667 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8668
8669 PR 11683
8670 * symtab.h (Symbol::is_placeholder): New member function.
8671 * target-reloc.h (relocate_section): Check for placeholder symbols.
8672
8673 * testsuite/Makefile.am (plugin_test_8): New test.
8674 (plugin_test_9): New test.
8675 * testsuite/Makefile.in: Regenerate.
8676
8677 2010-06-09 Nick Clifton <nickc@redhat.com>
8678
8679 * yyscript.y (input_list_element): Allow strings prefixed with
8680 the '-' character. Treat these as libraries.
8681 * script.cc (script_add_library): New function. Adds a library
8682 specified by "-l<name>" found in an input script.
8683 * script-c.h: Add prototype for script_add_library.
8684
8685 2010-06-07 Doug Kwan <dougkwan@google.com>
8686
8687 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8688 Restrict stub-group size to be within long conditional branch
8689 range when working around cortex-A8 erratum.
8690
8691 2010-06-07 Damien Diederen <dd@crosstwine.com>
8692
8693 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8694 #ifdef typo.
8695
8696 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8697
8698 PR gold/11658
8699 * output.cc
8700 (Output_section::Input_section_sort_entry::compare_section_ordering):
8701 Change to return non-zero correctly.
8702 (Output_section::Input_section_sort_section_order_index_compare
8703 ::operator()): Change to fix ambiguity in comparisons.
8704
8705 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8706
8707 * gold.h (is_wildcard_string): New function.
8708 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8709 (Layout::layout_eh_frame): Ditto.
8710 (Layout::find_section_order_index): New method.
8711 (Layout::read_layout_from_file): New method.
8712 * layout.h (Layout::find_section_order_index): New method.
8713 (Layout::read_layout_from_file): New method.
8714 (Layout::input_section_position_): New private member.
8715 (Layout::input_section_glob_): New private member.
8716 * main.cc (main): Call read_layout_from_file here.
8717 * options.h (--section-ordering-file): New option.
8718 * output.cc (Output_section::input_section_order_specified_): New
8719 member.
8720 (Output_section::Output_section): Initialize new member.
8721 (Output_section::add_input_section): Add new parameter.
8722 Keep input sections when --section-ordering-file is used.
8723 (Output_section::set_final_data_size): Sort input sections when
8724 section ordering file is specified.
8725 (Output_section::Input_section_sort_entry): Add new parameter.
8726 Check sorting type.
8727 (Output_section::Input_section_sort_entry::compare_section_ordering):
8728 New method.
8729 (Output_section::Input_section_sort_compare::operator()): Change to
8730 consider section_order_index.
8731 (Output_section::Input_section_sort_init_fini_compare::operator()):
8732 Change to consider section_order_index.
8733 (Output_section::Input_section_sort_section_order_index_compare
8734 ::operator()): New method.
8735 (Output_section::sort_attached_input_sections): Change to sort
8736 according to section order when specified.
8737 (Output_section::add_input_section<32, true>): Add new parameter.
8738 (Output_section::add_input_section<64, true>): Add new parameter.
8739 (Output_section::add_input_section<32, false>): Add new parameter.
8740 (Output_section::add_input_section<64, false>): Add new parameter.
8741 * output.h (Output_section::add_input_section): Add new parameter.
8742 (Output_section::input_section_order_specified): New
8743 method.
8744 (Output_section::set_input_section_order_specified): New method.
8745 (Input_section::Input_section): Initialize section_order_index_.
8746 (Input_section::section_order_index): New method.
8747 (Input_section::set_section_order_index): New method.
8748 (Input_section::section_order_index_): New member.
8749 (Input_section::Input_section_sort_section_order_index_compare): New
8750 struct.
8751 (Output_section::input_section_order_specified_): New member.
8752 * script-sections.cc (is_wildcard_string): Delete and move modified
8753 method to gold.h.
8754 (Output_section_element_input::Output_section_element_input): Modify
8755 call to is_wildcard_string.
8756 (Output_section_element_input::Input_section_pattern
8757 ::Input_section_pattern): Ditto.
8758 (Output_section_element_input::Output_section_element_input): Ditto.
8759 * testsuite/Makefile.am (final_layout): New test case.
8760 * testsuite/Makefile.in: Regenerate.
8761 * testsuite/final_layout.cc: New file.
8762 * testsuite/final_layout.sh: New file.
8763
8764 2010-06-01 Rafael Espindola <espindola@google.com>
8765
8766 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8767
8768 2010-06-01 Rafael Espindola <espindola@google.com>
8769
8770 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8771 visibility of symbols.
8772
8773 2010-05-27 Doug Kwan <dougkwan@google.com>
8774
8775 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8776 from start of output section instead of address for a local symbol
8777 in a merged or relaxed section when doing a relocatable link.
8778
8779 2010-05-26 Rafael Espindola <espindola@google.com>
8780
8781 PR 11604
8782 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8783 adding sections the garbage collector removed.
8784 * gold/testsuite/Makefile.am: Add test.
8785 * gold/testsuite/Makefile.in: Regenerate.
8786 * gold/testsuite/plugin_test_7.sh: New.
8787 * gold/testsuite/plugin_test_7_1.c: New.
8788 * gold/testsuite/plugin_test_7_2.c: New.
8789
8790 2010-05-26 Rafael Espindola <espindola@google.com>
8791
8792 * script-sections.cc (Output_section_definition::set_section_addresses):
8793 Check for --section-start.
8794
8795 2010-05-26 Doug Kwan <dougkwan@google.com>
8796
8797 * arm.cc (Arm_scan_relocatable_relocs): New class.
8798 (Target_arm::relocate_special_relocatable): New method.
8799 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8800 (Arm_relocate_functions::thumb_branch_common): Same.
8801 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8802 instead of Default_scan_relocatable_relocs.
8803 * target-reloc.h (relocate_for_relocatable): Let target handle
8804 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8805 * target.h (Sized_target::relocate_special_relocatable): New method.
8806
8807 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8808
8809 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8810
8811 2010-05-23 Doug Kwan <dougkwan@google.com>
8812
8813 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8814 instead of a cast.
8815 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8816 with a direct branch, not a conditional branch, to a stub.
8817 * merge.cc (Output_merge_base::record_input_section): New method
8818 defintion.
8819 (Output_merge_data::do_add_input_section): Record input section if
8820 keeps-input-sections flag is set.
8821 (Output_merge_string::do_add_input_section): Ditto.
8822 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8823 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8824 INPUT_SECTIONS_.
8825 (Output_merge_base::keeps_input_sections,
8826 Output_merge_base::set_keeps_input_sections,
8827 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8828 method definitions.
8829 (Output_merge_base::Input_sections): New type declaration.
8830 (Output_merge_base::input_sections_begin,
8831 Output_merge_base::input_sections_end,
8832 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8833 (Output_merge_base::bool keeps_input_sections_,
8834 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8835 Output_merge_base::input_sections_): New data members.
8836 (Output_merge_data::do_set_keeps_input_sections): New method
8837 defintion.
8838 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8839 * output.cc (Output_section::Input_section::relobj): Move method
8840 defintion from class declaration to here and handle merge sections.
8841 (Output_section::Input_section::shndx): Ditto.
8842 (Output_section::Output_section): Remove initializations of removed
8843 data members and initialize new data member LOOKUP_MAPS_.
8844 (Output_section::add_input_section): Set keeps-input-sections flag
8845 for a newly created merge output section as appropriate. Adjust code
8846 to use Output_section_lookup_maps class.
8847 (Output_section::add_relaxed_input_section): Adjst code for lookup
8848 maps code refactoring.
8849 (Output_section::add_merge_input_section): Add a new parameter
8850 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8851 class. If adding input section to a newly created merge output
8852 section fails, remove the new merge section.
8853 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8854 Adjust code for use of the Output_section_lookup_maps class.
8855 (Output_section::find_merge_section): Ditto.
8856 (Output_section::build_lookup_maps): New method defintion.
8857 (Output_section::find_relaxed_input_section): Adjust code to use
8858 Output_section_lookup_maps class.
8859 (Output_section::get_input_sections): Export merge sections. Adjust
8860 code to use Output_section_lookup_maps class.
8861 (Output_section:::add_script_input_section): Adjust code to use
8862 Output_section_lookup_maps class. Update lookup maps for merge
8863 sections also.
8864 (Output_section::discard_states): Use Output_section_lookup_maps.
8865 (Output_section::restore_states): Same.
8866 * output.h (Merge_section_properties): Move class defintion out of
8867 Output_section.
8868 (Output_section_lookup_maps): New class.
8869 (Output_section::Input_section::is_merge_section): New method
8870 defintion.
8871 (Output_section::Input_section::relobj): Move defintion out of class
8872 defintion. Declare method only.
8873 (Output_section::Input_section::shndx): Ditto.
8874 (Output_section::Input_section::output_merge_base): New method defintion.
8875 (Output_section::Input_section::u2_.pomb): New union field.
8876 (Output_section::Merge_section_by_properties_map,
8877 Output_section::Output_section_data_by_input_section_map,
8878 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8879 Remove types.
8880 (Output_section::add_merge_input_section): Add new parameter
8881 KEEPS_INPUT_SECTIONS.
8882 (Output_section::build_lookup_maps): New method declaration.
8883 (Output_section::merge_section_map_,
8884 Output_section::merge_section_by_properties_map_,
8885 Output_section::relaxed_input_section_map_,
8886 Output_section::is_relaxed_input_section_map_valid_): Remove data
8887 members.
8888 (Output_section::lookup_maps_): New data member.
8889
8890 2010-05-21 Doug Kwan <dougkwan@google.com>
8891
8892 PR gold/11619
8893 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8894 avoid a compilation error.
8895
8896 2010-05-19 Rafael Espindola <espindola@google.com>
8897
8898 * script-sections.cc (Output_section_definition::allocate_to_segment):
8899 Update the phdrs_list even when the output section is NULL.
8900 * testsuite/Makefile.am: Add test.
8901 * testsuite/Makefile.in: Regenerate.
8902 * testsuite/script_test_9.cc: New.
8903 * testsuite/script_test_9.sh: New.
8904 * testsuite/script_test_9.t: New.
8905
8906 2010-05-19 Doug Kwan <dougkwan@google.com>
8907
8908 * arm.cc (Arm_input_section::original_size): New method.
8909 (Arm_input_section::do_addralign): Add a cast.
8910 (Arm_input_section::do_output_offset): Remove static cast.
8911 (Arm_input_section::original_addralign,
8912 Arm_input_section::original_size_): Change type to uint32_t.
8913 (Arm_input_section::init): Add safe casts for section alignment
8914 and size.
8915 (Arm_input_section::set_final_data_size): Do not set address and
8916 offset of stub table.
8917 (Arm_output_section::fix_exidx_coverage): Change use of of
8918 Output_section::Simple_input_section to that of
8919 Output_section::Input_section.
8920 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8921 except for the first pass.
8922 * output.cc (Output_section::get_input_sections): Change type of
8923 input_sections to std::list<Input_section>.
8924 (Output_section::add_script_input_section): Rename from
8925 Output_section::add_simple_input_section. Change type of SIS
8926 parameter from Simple_input_section to Input_section.
8927 * output.h (Output_section::Simple_input_section): Remove class.
8928 (Output_section::Input_section): Change class visibility to public.
8929 (Output_section::Input_section::addralign): Use stored alignments
8930 for special input sections if set.
8931 (Output_section::Input_section::set_addralign): New method.
8932 (Output_section::get_input_sections): Change parameter type from
8933 list of Simple_input_section to list of Input_section.
8934 (Output_section::add_script_input_section): Rename from
8935 Output_section::add_simple_input_section. Change first parameter's
8936 type from Simple_input_section to Input_section and remove the
8937 second and third parameters.
8938 * script-sections.cc (Input_section::Input_section_list): Change
8939 type to list of Output_section::Input_section/
8940 (Input_section_info::Input_section_info): Change parameter type of
8941 INPUT_SECTION to Output_section::Input_section.
8942 (Input_section_info::input_section): Change return type.
8943 (Input_section_info::input_section_): Change type to
8944 Output_section::Input_section.
8945 (Output_section_element_input::set_section_addresses): Adjust code
8946 to use Output_section::Input_section instead of
8947 Output_section::Simple_input_section. Adjust code for renaming
8948 of Output_section::add_simple_input_section.
8949 (Orphan_output_section::set_section_addresses): Ditto.
8950
8951 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8952
8953 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8954 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8955
8956 2010-05-18 Rafael Espindola <espindola@google.com>
8957
8958 * options.cc (General_options::finalize): Handle -nostdlib.
8959 * options.h (nostdlib): New option.
8960 * script.cc (script_add_search_dir): Handle -nostdlib.
8961
8962 2010-05-12 Doug Kwan <dougkwan@google.com>
8963
8964 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8965 attributes section only if there no attributes section after merging.
8966 (Target_arm::merge_object_attributes): Move value of
8967 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8968 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8969 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8970 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8971 and arm_attr_merge_7.stdout.
8972 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8973 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8974 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8975 arm_attr_merge_7b.o): New rules.
8976 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8977 arm_attr_merge_7
8978 * testsuite/Makefile.in: Regenerate.
8979 * testsuite/arm_attr_merge.sh: New file.
8980 * testsuite/arm_attr_merge_[67][ab].s: Same.
8981
8982 2010-05-05 Nick Clifton <nickc@redhat.com>
8983
8984 * po/es.po: Updated Spanish translation.
8985
8986 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8987
8988 * Makefile.am (install-exec-local): Properly install gold as
8989 default cross linker.
8990 * Makefile.in: Regenerated.
8991
8992 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8993 Nick Clifton <nickc@redhat.com>
8994
8995 * configure.ac (install_as_default): Define and set to false
8996 unless --enable-gold or --enable-gold=both/gold has been
8997 specified.
8998 * configure: Regenerate.
8999
9000 * Makefile.am (install-exec-local): Install the executable as
9001 'ld.gold'. If install_as_default is true then also install it as
9002 'ld'.
9003 * Makefile.in: Regenerated.
9004
9005 2010-04-24 Ian Lance Taylor <iant@google.com>
9006
9007 * layout.cc (Layout::layout_reloc): In relocatable link don't
9008 combine reloc sections for grouped sections.
9009
9010 2010-04-23 Sriraman Tallam <tmsriram@google.com>
9011
9012 * gc.h (gc_process_relocs): Pass information on relocs pointing to
9013 sections that are not ordinary to icf.
9014 * icf.cc (get_section_contents): Handle relocation pointing to section
9015 with no object or shndx information.
9016 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9017 * testsuite/Makefile.in: Regenerate.
9018 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9019 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9020
9021 2010-04-22 Ian Lance Taylor <iant@google.com>
9022
9023 * expression.cc (Expression::Expression_eval_info): Add
9024 result_alignment_pointer field.
9025 (Expression::eval_with_dot): Add result_alignment_pointer
9026 parameter. Change all callers.
9027 (Expression::eval_maybe_dot): Likewise.
9028 (class Binary_expression): Add alignment_pointer parameter to
9029 left_value and right_value. Change all callers.
9030 (BINARY_EXPRESSION): Set result alignment.
9031 (class Trinary_expression): Add alignment_pointer parameter to
9032 arg2_value and arg3_value. Change all callers.
9033 (Trinary_cond::value): Set result alignment.
9034 (Max_expression::value, Min_expression::value): Likewise.
9035 (Align_expression::value): Likewise.
9036 * script-sections.cc (class Sections_element): Add dot_alignment
9037 parameter to set_section_addresses virtual function. Update
9038 instantiations.
9039 (class Output_section_element): Likewise.
9040 (Script_sections::create_segments): Add dot_alignment parameter.
9041 Change all callers.
9042 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9043 (Script_sections::set_phdrs_clause_addresses): Likewise.
9044 * script-sections.h: Update declarations.
9045 * script.h: Update declarations.
9046 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9047 min_p_align.
9048 * testsuite/script_test_3.t: Set large alignment.
9049 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9050 segment has expected alignment.
9051
9052 2010-04-22 Nick Clifton <nickc@redhat.com>
9053
9054 * po/gold.pot: Updated by the Translation project.
9055 * po/vi.po: Updated Vietnamese translation.
9056
9057 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9058
9059 * testsuite/Makefile.am (check_PROGRAMS): Add
9060 icf_virtual_function_folding_test.
9061 * testsuite/Makefile.in: Regenerated.
9062
9063 2010-04-15 Andrew Haley <aph@redhat.com>
9064
9065 * options.h (merge_exidx_entries): New option.
9066 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9067 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9068 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9069 (Target_arm::merge_exidx_entries): New function.
9070 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9071 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9072 to Arm_exidx_fixup constructor.
9073 Add new arg, merge_exidx_entries.
9074 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9075 Arm_output_section::fix_exidx_coverage.
9076
9077 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9078
9079 * icf.cc (get_section_contents): Check for preemptible functions.
9080 Ignore addend when appropriate.
9081 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9082 section folded.
9083 (add_from_relobj): Check for section folded.
9084 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9085 * symtab.h (should_add_dynsym_entry): Add new parameter.
9086 * target-reloc.h (scan_relocs): Check for section folded.
9087 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9088 Check reloc types for function pointers in shared objects.
9089 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9090 case.
9091 (icf_preemptible_functions_test): New test case.
9092 (icf_string_merge_test): New test case.
9093 * testsuite.Makefile.in: Regenerate.
9094 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9095 bar_glob. Refactor code.
9096 * testsuite/icf_preemptible_functions_test.cc: New file.
9097 * testsuite/icf_preemptible_functions_test.sh: New file.
9098 * testsuite/icf_string_merge_test.cc: New file.
9099 * testsuite/icf_string_merge_test.sh: New file.
9100 * testsuite/icf_virtual_function_folding_test.cc: New file.
9101 * testsuite/icf_virtual_function_folding_test.sh: New file.
9102
9103 2010-04-14 Doug Kwan <dougkwan@google.com>
9104
9105 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9106 for local symbol recounting if we remove a section due to ICF.
9107 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9108 there are no regular objects in input.
9109
9110 2010-04-13 Doug Kwan <dougkwan@google.com>
9111
9112 * arm.cc (Arm_input_section::set_final_data_size): Compute
9113 accurate final data size instead of using current data size.
9114
9115 2010-04-09 Doug Kwan <dougkwan@google.com>
9116
9117 * layout.cc (Layout::choose_output_section): Handle script section
9118 types.
9119 (Layout::make_output_section_for_script): Add section type parameter.
9120 Handle script section types.
9121 * layout.h (Layout::make_output_section_for_script): Add section
9122 type parameter.
9123 * output.cc (Output_section::Output_section): Initialize data member
9124 is_noload_.
9125 (Output_section::do_reset_address_and_file_offset): Do not set address
9126 to 0 if section is a NOLOAD section.
9127 * output.h (Output_section::is_noload): New method.
9128 (Output_section::set_is_noload): Ditto.
9129 (Output_section::is_noload_): New data member.
9130 * script-c.h (Script_section_type): New enum type.
9131 (struct Parser_output_section_header): Add new file section_type.
9132 * script-sections.cc (Sections_element::output_section_name): Add
9133 parameter for returning script section type.
9134 (Output_section_definition::output_section_name): Ditto.
9135 (Output_section_definition::section_type)P; New method.
9136 (Output_section_definiton::script_section_type_name): Ditto.
9137 (Output_section_definition::script_section_type_): New data member.
9138 (Output_section_definition::Output_section_definition): Initialize
9139 data member Output_section_definition::script_section_type_.
9140 (Output_section_definition::create_sections): Pass script section type
9141 to Layout::make_output_section_for_script.
9142 (Output_section_definition::output_section_name): Return script
9143 section type to caller.
9144 (Output_section_definition::set_section_address): Do not advance
9145 dot value and load address if section type is NOLOAD. Set address
9146 of NOLOAD sections regardless of section flags.
9147 (Output_section_definition::print): Print section type if it is
9148 not SCRIPT_SECTION_TYPE_NONE.
9149 (Output_section_definition::section_type): New method.
9150 (Output_section_definition::script_section_type_name): Ditto.
9151 (Script_sections::output_section_name): Add new parameter
9152 PSECTION_TYPE for returning script section type. Pass it to
9153 section elements. Handle discard sections.
9154 (Sort_output_sections::operator()): Handle NOLOAD sections.
9155 * script-sections.h (Script_sections::Section_type): New enum type.
9156 (Script_sections::output_section_name): Add a new parameter for
9157 returning script section type.
9158 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9159 INFO and NOLOAD.
9160 * yyscript.y (union): Add new field SECTION_TYPE.
9161 (COPY, DSECT, INFO, NOLOAD): New tokens.
9162 (opt_address_and_section_type): Change type to output_section_header.
9163 (section_type): New non-terminal
9164 (section_header): Handle section type.
9165 (opt_address_and_section_type): Return section type value.
9166
9167 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
9168
9169 * testsuite/plugin_common_test_1.c (foo): Add prototype.
9170 * testsuite/plugin_common_test_2.c (foo): Likewise.
9171
9172 2010-04-08 Doug Kwan <dougkwan@google.com>
9173
9174 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9175 Output_merge_data.
9176 * output.cc (Output_section::add_merge_input_section): Simplify
9177 code and return status of Output_merge_base::add_input_section.
9178 Update merge section map only if Output_merge_base::add_input_section
9179 returns true.
9180
9181 2010-04-07 Doug Kwan <dougkwan@google.com>
9182
9183 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9184 if section is marked as containing instructions but has no mapping
9185 symbols.
9186 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9187 correct section index.
9188 (Arm_relobj::find_linked_text_section): Ditto.
9189
9190 2010-04-07 Cary Coutant <ccoutant@google.com>
9191
9192 * archive.cc (include_member): Destroy Read_symbols_data object before
9193 releasing file.
9194 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9195 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9196 (Read_symbols_data::~Read_symbols_data) New destructor.
9197 (Section_relocs::Section_relocs) New constructor.
9198 (Section_relocs::~Section_relocs) New destructor.
9199 (Read_relocs_data::Read_relocs_data) New constructor.
9200 (Read_relocs_data::~Read_relocs_data) New destructor.
9201 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9202 pointers to NULL after deleting.
9203
9204 2010-04-07 Doug Kwan <dougkwan@google.com>
9205
9206 * arm.cc: Replace "endianity" with "endianness" in comments.
9207 (Arm_exidx_cantunwind): Ditto.
9208 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9209 (Arm_relobj::merge_flags_and_attributes): New method.
9210 (Arm_relobj::merge_flags_and_attributes_): New data member.
9211 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9212 (Arm_relobj::scan_sections_for_stubs): Ditto.
9213 (Arm_relobj::do_read_symbols): Check to see if we really want to
9214 merge processor-specific flags and attributes. Exit early if
9215 an object is empty except for section names and the undefined symbol.
9216 (Target_arm::do_finalize_sections): Move check for ELF format to
9217 Arm_relobj::do_read_symbols. Merge processor specific flags and
9218 attributes from a regular object only when we have determined that
9219 it is aapropriate. Do not create an .ARM.attributes section in
9220 output if there is no regular input object.
9221 (Target_arm::merge_processor_specific_flags): Check
9222 --warn-mismatch before printing any error.
9223 (Target_arm::merge_object_attributes): Ditto.
9224 * gold.cc (queue_middle_tasks): Handle the case in which there is
9225 no regular object in input.
9226 * options.cc (General_options::parse_EB): New method.
9227 (General_options::parse_EL): Same.
9228 (General_options::General_options): Initialize endianness_.
9229 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9230 New options.
9231 (General_options::Endianness): New enum.
9232 (General_options::endianness): New method.
9233 (General_options::endianness_): New data member.
9234 * parameters.cc (Parameters::set_options): Check target endianness.
9235 (Parameters::set_target_once): Ditto.
9236 (Parameters::check_target_endianness): New method.
9237 (parameters_force_valid_target): If either -EL or -EB is specified,
9238 use it to define endianness of default target.
9239 * parameters.h (Parameters::check_target_endianness): New method
9240 declaration.
9241 * target.h (class Target): Change "endianity" to "endianness"
9242 in comments.
9243
9244 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9245
9246 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9247 * configure: Regenerate.
9248 * Makefile.in: Regenerate.
9249 * testsuite/Makefile.in: Regenerate.
9250
9251 2010-04-06 Cary Coutant <ccoutant@google.com>
9252
9253 gcc PR lto/42757
9254 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9255 prevailing definitions of common symbols.
9256 * testsuite/plugin_test_6.sh: New test case.
9257 * testsuite/plugin_common_test_1.c: New test case.
9258 * testsuite/plugin_common_test_2.c: New test case.
9259 * testsuite/Makefile.am (plugin_test_6): New test case.
9260 * testsuite/Makefile.in: Regenerate.
9261
9262 2010-04-06 Nick Clifton <nickc@redhat.com>
9263
9264 * po/vi.po: New Vietnamese translation.
9265
9266 2010-03-30 Doug Kwan <dougkwan@google.com>
9267
9268 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9269
9270 2010-03-25 Doug Kwan <dougkwan@google.com>
9271
9272 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9273 to avoid a conversion warning on a 32-bit host.
9274
9275 2010-03-24 Ian Lance Taylor <iant@google.com>
9276
9277 * testsuite/script_test_3.t: Add a TLS segment.
9278 * testsuite/Makefile.am (check_PROGRAMS): Add
9279 tls_phdrs_script_test.
9280 (tls_phdrs_script_test_SOURCES): Define.
9281 (tls_phdrs_script_test_DEPENDENCIES): Define.
9282 (tls_phdrs_script_test_LDFLAGS): Define.
9283 (tls_phdrs_script_test_LDADD): Define.
9284 * testsuite/Makefile.in: Rebuild.
9285
9286 2010-03-23 Cary Coutant <ccoutant@google.com>
9287
9288 * fileread.cc (find_or_make_view): Fix comment.
9289
9290 2010-03-23 Ian Lance Taylor <iant@google.com>
9291
9292 * script-sections.cc (class Orphan_section_placement): Define
9293 PLACE_TLS and PLACE_TLS_BSS.
9294 (Orphan_section_placement::Orphan_section_placement): Initialize
9295 new places.
9296 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9297 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9298 (tls_script_test_SOURCES): Define.
9299 (tls_script_test_DEPENDENCIES): Define.
9300 (tls_script_test_LDFLAGS): Define.
9301 (tls_script_test_LDADD): Define.
9302 * testsuite/Makefile.in: Rebuild.
9303
9304 2010-03-22 Doug Kwan <dougkwan@google.com>
9305
9306 * arm.cc (Arm_relocate_functions::abs8,
9307 Arm_relocate_functions::abs16): Use correct check for overflow
9308 specified in the ARM ELF specs.
9309 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
9310 target of a BLX instruction specially.
9311 (Reloc_stub::stub_type_for_reloc): Ditto.
9312 (Relocate::relocate): Use symbolic names instead of numeric relocation
9313 codes to report error.
9314 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9315 workaround.
9316 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9317 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9318 thumb2_blx_out_of_range.stdout
9319 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9320 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9321 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9322 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9323 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9324 thumb2_blx_in_range, thumb2_blx_in_range.o,
9325 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9326 thumb2_blx_out_of_range.o): New rules.
9327 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9328 thumb2_blx_in_range and thumb2_blx_out_of_range.
9329 * testsuite/Makefile.in: Regenerate.
9330 * arm_branch_in_range.sh: Add tests for THUMB BLX.
9331 * testsuite/thumb_blx_in_range.s: New file.
9332 * testsuite/thumb_blx_out_of_range.s: New file.
9333
9334 2010-03-22 Rafael Espindola <espindola@google.com>
9335
9336 * archive.cc (Should_include): Move to archive.h.
9337 (should_include_member): Make it a member of Archive.
9338 (Lib_group): New.
9339 (Add_lib_group_symbols): New.
9340 * archive.h: Include options.h.
9341 (Archive_member): Moved from Archive.
9342 (Should_include): Moved from archive.cc.
9343 (Lib_group): New.
9344 (Add_lib_group_symbols): New.
9345 * dynobj.cc (do_should_include_member): New.
9346 * dynobj.h (do_should_include_member): New.
9347 * gold.cc (queue_initial_tasks): Update call to queue.
9348 * main.cc (main): Print lib group stats.
9349 * object.cc (do_should_include_member): New.
9350 * object.h: Include archive.h.
9351 (Object::should_include_member): New.
9352 (Object::do_should_include_member): New.
9353 (Sized_relobj::do_should_include_member): New.
9354 * options.cc (General_options::parse_start_lib): New.
9355 (General_options::parse_end_lib): New.
9356 (Input_arguments::add_file): Handle lib groups.
9357 (Input_arguments::start_group): Check we are not in a lib.
9358 (Input_arguments::start_lib): New.
9359 (Input_arguments::end_lib): New.
9360 * options.h (General_options): Add start_lib and end_lib.
9361 (Input_argument::lib_): New.
9362 (Input_argument::lib): New.
9363 (Input_argument::is_lib): New.
9364 (Input_file_lib): New.
9365 (Input_arguments::in_lib_): New.
9366 (Input_arguments::in_lib): New.
9367 (Input_arguments::start_lib): New.
9368 (Input_arguments::end_lib_): New.
9369 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9370 in unused members as preempted.
9371 (Sized_pluginobj::do_should_include_member): New.
9372 * plugin.h (Sized_pluginobj::do_should_include_member): New.
9373 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9374 return the blocker.
9375 (Read_symbols::do_whole_lib_group): New.
9376 (Read_symbols::do_lib_group): New.
9377 (Read_symbols::do_read_symbols): Handle lib groups.
9378 (Read_symbols::get_name): Handle lib groups.
9379 * readsyms.h (Read_symbols): Add an archive member pointer.
9380 (Read_symbols::do_whole_lib_group): New.
9381 (Read_symbols::do_lib_group): New.
9382 (Read_symbols::member_): New.
9383 * script.cc (read_input_script): Update call to queue_soon.
9384
9385 2010-03-19 Doug Kwan <dougkwan@google.com>
9386
9387 * arm.cc (Stub_table::Stub_table): Initialize new data members
9388 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9389 (Stub_table::add_reloc_stub): Assign stub offset and update
9390 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9391 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9392 New data members.
9393 (Stub_table::update_data_size_and_addralign): Use
9394 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9395 instead of going over all reloc stubs.
9396 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9397 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9398 Stringpool_template::offset_ to size of Stringpool_char.
9399 (Stringpool_template::new_key_offset): Remove code to initialize
9400 Stringpool_template::offset_.
9401 * stringpool.h (Stringpool_template::set_no_zero_null): Set
9402 Stringpool_template::offset_ to zero.
9403
9404 2010-03-15 Doug Kwan <dougkwan@google.com>
9405
9406 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9407 offset_.
9408 (Stringpool_template::new_key_offset): New method.
9409 (Stringpool_template::add_string): Assign offsets when adding new
9410 strings.
9411 (Stringpool_template::set_string_offsets): Do not set string offsets
9412 when not optimizing.
9413 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9414 member size_.
9415 (Chunked_vector::clear): Clear size_.
9416 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9417 (Chunked_vector::size): Return size_.
9418 (Chunked_vector::push_back): Use size_ to find insert position.
9419 (Chunked_vector::size_): New data member.
9420 (Stringpool_template::set_no_zero_null): Assert string set is empty.
9421 (Stringpool_template::new_key_offset): New method declaration.
9422 (Stringpool_template::offset_): New data member.
9423
9424 2010-03-15 Rafael Espindola <espindola@google.com>
9425
9426 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9427 Add_symbols' constructor.
9428 * readsyms.h (Add_symbols): Remove the input_group member.
9429
9430 2010-03-10 Ian Lance Taylor <iant@google.com>
9431
9432 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9433 target to ask whether a reference to a symbol requires a stack
9434 split.
9435 * target.h (Target::is_call_to_non_split): New function.
9436 (Target::do_is_call_to_non_split): Declare virtual function.
9437 * target.cc: Include "symtab.h".
9438 (Target::do_is_call_to_non_split): New function.
9439 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9440
9441 2010-03-10 Cary Coutant <ccoutant@google.com>
9442
9443 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9444 (File_read::open[1]): Remove initial mapping of whole_file_view_.
9445 (File_read::open[2]): Add whole_file_view_ to list of views.
9446 (File_read::make_view): Remove test of whole_file_view_.
9447 (File_read::find_or_make_view): Create whole_file_view_ if
9448 necessary.
9449 (File_read::clear_views): Replace bool parameter with enum;
9450 adjust all callers. Don't delete views with permanent data;
9451 do delete cached views and views from archives if
9452 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
9453 if clearing the corresponding view.
9454 * fileread.h (File_read::Clear_views_mode): New enum.
9455 (File_read::View::is_permanent_view): New method.
9456 (File_read::clear_views): Replace bool parameter
9457 with enum; adjust all callers.
9458 * options.h (General_options): Change keep_files_mapped option;
9459 add map_whole_files.
9460 * readsyms.cc (Add_symbols::run): Delete sd_ object before
9461 releasing the file.
9462 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9463 the file.
9464
9465 2010-03-10 David S. Miller <davem@davemloft.net>
9466
9467 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9468
9469 2010-03-09 Sriraman Tallam <tmsriram@google.com>
9470
9471 * icf.cc (get_section_contents): Add '@' marker after processing the
9472 merge reloc.
9473
9474 2010-03-08 Doug Kwan <dougkwan@google.com>
9475
9476 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9477 due to a conversion warning.
9478 (Arm_relobj::update_output_local_symbol_count): Check for local
9479 symbol with unset output index.
9480
9481 2010-03-05 Ian Lance Taylor <iant@google.com>
9482
9483 * options.h (class General_options): Add --spare-dynamic-tags.
9484 * output.cc (Output_data_dynamic::set_final_data_size): Implement
9485 --spare-dynamic-tags.
9486
9487 2010-03-05 Ian Lance Taylor <iant@google.com>
9488
9489 * incremental.cc: Include "libiberty.h".
9490
9491 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
9492
9493 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9494 function, is_info_ member.
9495 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9496 (Versions::Versions): Update caller.
9497 (Versions::define_base_version): Likewise.
9498 (Versions::add_def): Likewise.
9499
9500 2010-03-03 Sriraman Tallam <tmsriram@google.com>
9501
9502 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9503 (Scan::possible_function_pointer_reloc): New function.
9504 (Scan::local_reloc_may_be_function_pointer): Change to call
9505 possible_function_pointer_reloc.
9506 (Scan::global_reloc_may_be_function_pointer): Ditto.
9507 * icf.h (Icf::check_section_for_function_pointers): Change to reject
9508 relocations in ".data.rel.ro._ZTV" section.
9509 * testsuite/icf_safe_so_test.sh: Change to pass i386.
9510 * testsuite/icf_safe_so_test.cc: Ditto.
9511 * testsuite/icf_safe_test.cc: Ditto.
9512 * testsuite/icf_safe_test.sh: Ditto.
9513
9514 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9515 Ian Lance Taylor <iant@google.com>
9516
9517 * target-reloc.h (relocate_section): Check the symbol table index
9518 for -1U before setting the local symbol index.
9519 (scan_relocatable_relocs): If copying the relocation, record that
9520 the local symbol is required.
9521 * object.h (Symbol_value::is_output_symtab_index_set): New
9522 function.
9523 (Symbol_value::may_be_discarded_from_output_symtab): New
9524 function.
9525 (Symbol_value::has_output_symtab_entry): New function.
9526 (Symbol_value::needs_output_symtab_entry): Remove.
9527 (Symbol_value::output_symtab_index): Make sure the symbol index is
9528 set.
9529 (Symbol_value::set_output_symtab_index): Make sure the symbol
9530 index is not set. Make sure the new index is valid.
9531 (Symbol_value::set_must_have_output_symtab_entry): New function.
9532 (Symbol_value::has_output_dynsym_entry): New function.
9533 (Symbol_value::set_output_dynsym_index): Make sure the new index
9534 is valid.
9535 (Sized_relobj::set_must_have_output_symtab_entry): New function.
9536 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9537 local symbol if permitted.
9538 (Sized_relobj::do_finalize_local_symbols): Call
9539 is_output_symtab_index_set rather than needs_output_symtab_entry.
9540 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9541 rather than needs_output_symtab_entry. Call
9542 has_output_dynsym_entry rather than needs_output_dynsym_entry.
9543 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9544 is_output_symtab_index_set rather than needs_output_symtab_entry.
9545 * testsuite/discard_locals_relocatable_test.c: New file.
9546 * testsuite/discard_locals_test.sh: Test -r.
9547 * testsuite/Makefile.am (check_DATA): Add
9548 discard_locals_relocatable_test1.syms,
9549 discard_local_relocatable_test2.syms.
9550 (MOSTLYCLEANFILES): Likewise. Also add
9551 discard_locals_relocatable_test1.lout and
9552 discard_locals_relocatable_test2.out.
9553 (discard_locals_relocatable_test1.syms): New target.
9554 (discard_locals_relocatable_test.o): New target.
9555 (discard_locals_relocatable_test1.out): New target.
9556 (discard_locals_relocatable_test2.syms): New target.
9557 (discard_locals_relocatable_test2.out): New target.
9558 (various): Add missing ../ld-new dependencies.
9559 * testsuite/Makefile.in: Rebuild.
9560
9561 2010-03-03 Nick Clifton <nickc@redhat.com>
9562
9563 * po/fi.po: New Finnish translation.
9564
9565 2010-03-01 Doug Kwan <dougkwan@google.com>
9566
9567 * layout.cc (Layout::Layout): Force section types of .init_array*,
9568 .preinit_array* and .fini_array* sections.
9569 * output.cc (Output_section::Input_section_sort_entry::has_priority):
9570 Fix check of return value of std::string::find.().
9571 (Output_section::Input_section_sort_compare::operator()): Remove
9572 comment about .init_array.
9573 (Output_section::Input_section_sort_init_fini_compare::operator()):
9574 New method.
9575 (Output_section::sort_attached_input_sections): Handle .init_array
9576 and .fini_array specially.
9577 * output.h (Output_section::Inut_section_sort_compare): Update
9578 comment.
9579 (Output_section::Input_section_sort_init_fini_compare): New struct.
9580
9581 2010-02-26 Doug Kwan <dougkwan@google.com>
9582
9583 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9584 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9585 * testsuite/debug_msg.sh: Avoid matching source line number for
9586 use of global variable undef_int.
9587
9588 2010-02-26 Doug Kwan <dougkwan@google.com>
9589
9590 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9591 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9592 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9593 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9594 * options.cc (General_options::General_options): Initialize member
9595 fix_v4bx_.
9596 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9597 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9598 and rm_no_fix_v4bx.stdout
9599 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9600 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9601 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9602 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9603 and arm_no_fix_v4bx.
9604 * Makefile.in: Regenerate.
9605 * testsuite/arm_fix_v4bx.s: New file.
9606 * testsuite/arm_fix_v4bx.sh: Ditto.
9607
9608 2010-02-24 Doug Kwan <dougkwan@google.com>
9609
9610 * arm.cc (Target_arm::got_section): Make the .got section the first
9611 non RELRO section in the data segment.
9612 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9613 suffixes of section names.
9614
9615 2010-02-24 Doug Kwan <dougkwan@google.com>
9616
9617 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9618 flags and attributes merging if an input file is a binary file.
9619 * fileread.cc (Input_file::open): Record format of original file.
9620 * fileread.h (Input_file::Format): New enum type.
9621 (Input_file::Input_file): Initialize data member format_.
9622 (Input_file::format): New method definition.
9623 (Input_file::format_):: New data member.
9624
9625 2010-02-24 Doug Kwan <dougkwan@google.com>
9626
9627 * arm.cc (Arm_output_data_got): New class.
9628 (ARM_TCB_SIZE): New constant
9629 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9630 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9631 If user uses a script with a SECTIONS clause, issue only a warning
9632 for a misplaced EXIDX input section. Otherwise, issue an error.
9633 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9634 garbage collection.
9635 (Target_arm::got_mode_index_entry): Handle static linking.
9636 (Target_arm::Scan::local): Ditto.
9637 (Target_arm::Scan::global): Ditto.
9638 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
9639 all incorrectly implemented relocations.
9640 (Target_arm::fix_exidx_coverage): Pass layout to
9641 Arm_output_section::fix_exidx_coverage.
9642 * layout.cc (Layout::section_name_mapping): Remove trailing dots
9643 from ".ARM.exidx." and ".ARM.extab.".
9644
9645 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9646
9647 * arm.cc (Target_arm::do_finalize_sections): Create attribute
9648 section if it does not already exist.
9649 * attributes.cc (Attributes_section_data::Attributes_section_data):
9650 Don't crash if size is zero.
9651
9652 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9653 Ian Lance Taylor <iant@google.com>
9654
9655 * gold.cc (queue_middle_tasks): If no input files were opened,
9656 exit.
9657 * workqueue.h (Task_function::Task_function): Assert that there is
9658 a blocker.
9659
9660 2010-02-22 Doug Kwan <dougkwan@google.com>
9661
9662 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9663 * icf.cc (get_section_contents): Cast snprintf arguments to long long
9664 types to avoid warnings due to different uint64_t implementations
9665 on different hosts.
9666
9667 2010-02-21 Doug Kwan <dougkwan@google.com>
9668
9669 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9670 handling of the maximum backward branch offset.
9671 (Arm_relocate_functions::thumb_branch_common): Ditto.
9672 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9673 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9674 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9675 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9676 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9677 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9678 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9679 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9680 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9681 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9682 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9683 thumb2_bl_out_of_range.o): New rules.
9684 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9685 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9686 thumb2_bl_out_of_range
9687 * testsuite/Makefile.in: Regenerate.
9688 * testsuite/arm_bl_in_range.s: New file.
9689 * testsuite/arm_bl_out_of_range.s: Ditto.
9690 * testsuite/arm_branch_in_range.sh: Ditto.
9691 * testsuite/arm_branch_range.t: Ditto.
9692 * testsuite/thumb2_branch_range.t: Ditto.
9693 * testsuite/thumb_bl_in_range.s: Ditto.
9694 * testsuite/thumb_bl_out_of_range.s: Ditto.
9695 * testsuite/thumb_branch_range.t: Ditto.
9696
9697 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9698
9699 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9700 Add reloc offset information.
9701 * icf.cc (get_section_contents): Change iterators to point to the new
9702 vectors. Add reloc offset information to the contents.
9703 * icf.h (Icf::Sections_reachable_info): New typedef.
9704 (Icf::Sections_reachable_list): New typedef.
9705 (Icf::Offset_info): New typedef.
9706 (Icf::Reloc_info): New struct typedef.
9707 (Icf::Reloc_info_list): New typedef.
9708 (Icf::symbol_reloc_list): Delete method.
9709 (Icf::addend_reloc_list): Delete method.
9710 (Icf::section_reloc_list): Delete method.
9711 (Icf::reloc_info_list): New method.
9712 (Icf::reloc_info_list_): New member.
9713
9714 2010-02-19 Doug Kwan <dougkwan@google.com>
9715
9716 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9717 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9718 * arm.cc (Arm_relocation_functions): New forward declaration.
9719 (Target_arm::Target_arm): Initialize new data members
9720 got_mod_index_offset_ and tls_base_symbol_defined_.
9721 (Target_arm::Relocate::relocate_tls): New method.
9722 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9723 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9724 New methods.
9725 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9726 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9727 (Target_arm::got_mod_index_offset_,
9728 Target_arm::tls_base_symbol_defined_): New data members.
9729 (Target_arm::Scan::local, Target::Scan::global,
9730 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9731 relocations.
9732
9733 2010-02-18 Doug Kwan <dougkwan@google.com>
9734
9735 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9736 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9737 text section as a parameter becuase some broken tools may not set
9738 the link in section header.
9739 (Target_arm::has_got_section): New method.
9740 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9741 without any mapping symbol as data only. Remove warning.
9742 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9743 link in its section header, try to discover the link by inspecting the
9744 REL31 relocation at the beginning of the section.
9745 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9746 in error message.
9747 (Target_arm::Scan::global): Treat any reference to the symbol
9748 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9749
9750 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9751
9752 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9753 (Scan::global_reloc_may_be_function_pointer): New function.
9754 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9755 (Scan::global_reloc_may_be_function_pointer): New function.
9756 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9757 (Scan::global_reloc_may_be_function_pointer): New function.
9758 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9759 (Scan::global_reloc_may_be_function_pointer): New function.
9760 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9761 (Scan::global_reloc_may_be_function_pointer): New function.
9762 (Scan::possible_function_pointer_reloc): New function.
9763 (Target_x86_64::can_check_for_function_pointers): New function.
9764 * gc.h (gc_process_relocs): Scan relocation types to determine if
9765 function pointers were taken for targets that support it.
9766 * icf.cc (Icf::find_identical_sections): Include functions for
9767 folding in safe ICF whose pointer is not taken.
9768 * icf.h (Secn_fptr_taken_set): New typedef.
9769 (fptr_section_id_): New member.
9770 (section_has_function_pointers): New function.
9771 (set_section_has_function_pointers): New function.
9772 (check_section_for_function_pointers): New function.
9773 * options.h: Fix comment for safe ICF option.
9774 * target.h (can_check_for_function_pointers): New function.
9775 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9776 Modify icf_safe_test for X86-64.
9777 * testsuite/Makefile.in: Regenerate.
9778 * testsuite/icf_safe_so_test.cc: New file.
9779 * testsuite/icf_safe_so_test.sh: New file.
9780 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9781 (main): Change to take pointer to function kept_func_3.
9782 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9783 folding is done correctly for X86-64.
9784
9785 2010-02-12 David S. Miller <davem@davemloft.net>
9786
9787 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9788 is_symbolless parameter.
9789 (Output_reloc<SHT_REL>::is_symbolless): New.
9790 (Output_reloc<SHT_REL>::is_symbolless_): New.
9791 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9792 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9793 (Output_reloc<SHT_RELA>::is_symbolless): New.
9794 (Output_data_reloc::add_global): Handle is_symbolless.
9795 (Output_data_reloc::add_global_relative): Likewise.
9796 (Output_data_reloc::add_local): Likewise.
9797 (Output_data_reloc::add_local_relative): Likewise.
9798 (Output_data_reloc::add_symbolless_global_addend): New.
9799 (Output_data_reloc::add_symbolless_local_addend): New.
9800 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9801 is_symbolless.
9802 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9803 instead of ->is_relative_
9804 (Output_reloc::write): Likewise.
9805 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9806 (Output_reloc::write_rel): Simplify.
9807
9808 * sparc.cc (Target_sparc::Scan::local): Use
9809 ->add_symbolless_local_addend as needed.
9810 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9811 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9812 based upon relocation offset.
9813
9814 2010-02-11 Doug Kwan <dougkwan@google.com>
9815
9816 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9817 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9818 beginning of function.
9819 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9820 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9821 parameter is_32bit in calls to should_apply_static_reloc.
9822 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9823 (check_DATA): Add arm_abs_global.stdout.
9824 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9825 arm_abs_global.stdout): New rules.
9826 (MOSTLLYCLEANFILES): Add arm_abs_global
9827 * Makefile.in: Regenerate.
9828 * testsuite/arm_abs_global.s: New file.
9829 * testsuite/arm_abs_global.sh: Ditto.
9830 * testsuite/arm_abs_lib.s: Ditto.
9831
9832 2010-02-11 Ian Lance Taylor <iant@google.com>
9833
9834 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9835 Read_relocs task.
9836 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9837 Allocate_commons_task first.
9838 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9839 task, rather than symtab_lock_.
9840 (Gc_process_relocs::~Gc_process_relocs): New function.
9841 (Gc_process_relocs::is_runnable): Check this_blocker_.
9842 (Gc_process_relocs::locks): Use next_blocker_ rather than
9843 blocker_.
9844 (Scan_relocs::~Scan_relocs): New function.
9845 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9846 symtab_lock_.
9847 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9848 next_blocker_.
9849 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9850 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9851 constructor accordingly.
9852 (class Gc_process_relocs): Likewise.
9853 (class Scan_relocs): Likewise.
9854 * common.h (class Allocate_commons_task): Remove symtab_lock_
9855 field, and corresponding constructor parameter.
9856 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9857 symtab_lock_.
9858 (Allocate_commons_task::locks): Likewise.
9859
9860 2010-02-11 Ian Lance Taylor <iant@google.com>
9861
9862 * gold-threads.h (class Once): Define.
9863 (class Initialize_lock): Rewrite as child of Once.
9864 * gold-threads.cc (class Once_initialize): Define.
9865 (once_pointer_control): New static variable.
9866 (once_pointer, once_arg): New static variables.
9867 (c_run_once): New static function.
9868 (Once::Once, Once::run_once, Once::internal_run): New functions.
9869 (class Initialize_lock_once): Remove.
9870 (initialize_lock_control): Remove.
9871 (initialize_lock_pointer): Remove.
9872 (initialize_lock_once): Remove.
9873 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9874 (Initialize_lock::initialize): Rewrite.
9875 (Initialize_lock::do_run_once): New function.
9876 * archive.cc (Archive::interpret_header): Only clear name if it is
9877 not already empty.
9878 * fileread.cc: Include "gold-threads.h"
9879 (file_counts_lock): New static variable.
9880 (file_counts_initialize_lock): Likewise.
9881 (File_read::release): Only increment counts when using --stats.
9882 Use a lock around the increment.
9883 * parameters.cc (class Set_parameters_target_once): Define.
9884 (set_parameters_target_once): New static variable.
9885 (Parameters::Parameters): Move here from parameters.h.
9886 (Parameters::set_target): Rewrite.
9887 (Parameters::set_target_once): New function.
9888 (Parameters::clear_target): Move here and rewrite.
9889 * parameters.h (class Parameters): Update declarations. Add
9890 set_parameters_target_once_ field.
9891 (Parameters::Parameters): Move to parameters.cc.
9892 (Parameters::clear_target): Likewise.
9893 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9894 task.
9895 (Start_group::~Start_group): New function.
9896 (Start_group::is_runnable): New function.
9897 (Start_group::locks, Start_group::run): New functions.
9898 (Finish_group::run): Change saw_undefined to size_t.
9899 * readsyms.h (class Start_group): Define.
9900 (class Finish_group): Change saw_undefined_ field to size_t.
9901 (Finish_group::Finish_group): Remove saw_undefined and
9902 this_blocker parameters. Change all callers.
9903 (Finish_group::set_saw_undefined): New function.
9904 (Finish_group::set_blocker): New function.
9905 * symtab.h (class Symbol_table): Change saw_undefined to return
9906 size_t. Change saw_undefined_ field to size_t.
9907 * target-select.cc (Set_target_once::do_run_once): New function.
9908 (Target_selector::Target_selector): Initialize set_target_once_
9909 field. Don't initialize lock_ and initialize_lock_ fields.
9910 (Target_selector::instantiate_target): Rewrite.
9911 (Target_selector::set_target): New function.
9912 * target-select.h (class Set_target_once): Define.
9913 (class Target_selector): Update declarations. Make
9914 Set_target_once a friend. Remove lock_ and initialize_lock_
9915 fields. Add set_target_once_ field.
9916
9917 2010-02-10 Ian Lance Taylor <iant@google.com>
9918
9919 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9920 queueing any tasks.
9921 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9922 (queue_middle_tasks): Add all blockers before queueing any tasks.
9923 (queue_final_tasks): Likewise.
9924 * token.h (Task_token::add_blockers): New function.
9925 * object.h (Input_objects::number_of_relobjs): New function.
9926
9927 2010-02-10 Ian Lance Taylor <iant@google.com>
9928
9929 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9930 shared, not if not position independent.
9931 * x86_64.cc (Relocate::relocate_tls): Likewise.
9932 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9933 (tls_pie_pic_test): New target.
9934 * testsuite/Makefile.in: Rebuild.
9935
9936 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9937 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9938 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9939 * testsuite/Makefile.in: Rebuild.
9940
9941 2010-02-09 David S. Miller <davem@davemloft.net>
9942
9943 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9944 R_SPARC_RELATIVE using ->add_local_relative().
9945 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9946
9947 * output.h (Output_data_dynamic::add_section_size): New method
9948 that takes two Output_data objects.
9949 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9950 entry param. Handle it in initializers.
9951 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9952 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9953 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9954 arg.
9955 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9956 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9957 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9958 for dynrel_includes_plt.
9959 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9960 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9961 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9962 before .rela.plt
9963 (Target_sparc::do_finalize_sections): Update to pass true for
9964 dynrel_includes_plt.
9965 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9966 output before .rela.plt
9967 (Target_powerpc::do_finalize_sections): Update to pass true for
9968 dynrel_includes_plt when 32-bit.
9969
9970 2010-02-08 Doug Kwan <dougkwan@google.com>
9971
9972 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9973 method.
9974 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9975 Arm_relobj::scan_section_for_cortex_a8_stubs,
9976 Arm_relobj::do_relocation_section): Instead of calling
9977 Output_section::output_address, use faster
9978 Arm_relobj::simple_input_section_output_address.
9979
9980 2010-02-08 David S. Miller <davem@davemloft.net>
9981
9982 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9983 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9984 relocation helper function.
9985
9986 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9987 just like R_SPARC_GOT{10,13,22}.
9988 (Target_sparc::Scan::local): Likewise.
9989 (Target_sparc::Relocate:relocate): Likewise.
9990
9991 2010-02-06 Ian Lance Taylor <iant@google.com>
9992
9993 * configure.ac: Rewrite targetobjs duplicate removal code to use
9994 only shell constructs.
9995 * configure: Rebuild.
9996
9997 2010-02-05 Doug Kwan <dougkwan@google.com>
9998
9999 PR 11247
10000 * arm.cc (Arm_relobj::section_is_scannable): New method.
10001 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10002 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10003
10004 2010-02-04 Doug Kwan <dougkwan@google.com>
10005
10006 PR 11247
10007 * arm-reloc-property.cc (cstdio): Include.
10008 * configure.ac (targetobjs): Remove duplicates.
10009 * configure: Regenerate.
10010 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10011 big and little endian version for a given address size.
10012
10013 2010-02-03 Doug Kwan <dougkwan@google.com>
10014
10015 * arm-reloc-property.cc
10016 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10017 definition.
10018 * arm-reloc-property.h
10019 (Arm_reloc_property_table::get_implemented_static_reloc_property):
10020 New method definition.
10021 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10022 declaration.
10023 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10024 overflow to N.
10025 (GOT_PREL): Change implemented to Y.
10026 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10027 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10028 (Arm_relocate_functions::movw_abs_nc): Remove method.
10029 (Arm_relocate_functions::movt_abs): Ditto.
10030 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10031 (Arm_relocate_functions::thm_movt_abs): Ditto.
10032 (Arm_relocate_functions::movw_rel_nc): Ditto.
10033 (Arm_relocate_functions::movw_rel): Ditto.
10034 (Arm_relocate_functions::movt_rel): Ditto.
10035 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10036 (Arm_relocate_functions:thm_movw_rel): Ditto.
10037 (Arm_relocate_functions:thm_movt_rel): Ditto.
10038 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10039 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10040 New method definitions.
10041 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10042 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10043 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10044 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10045 (Target_arm::Relocate::relocate): Check for non-static or
10046 unimplemented relocation code and exit early. Change calls to
10047 Target_arm::reloc_uses_thumb_bit and
10048 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10049 instead. Refactor code to handle similar relocations to increase
10050 code sharing. Remove check for unsupported relocation code in switch
10051 statement.
10052 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10053 relocation property table to find out size. Change error message to
10054 print out the name of a relocation code instead of the numeric value.
10055 (Target_arm::scan_reloc_for_stub): Use relocation property table
10056 instead of calling Target_arm::reloc_uses_thumb_bit().
10057
10058 2010-02-02 Doug Kwan <dougkwan@google.com>
10059
10060 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10061 types of relaxed input section.
10062
10063 2010-02-02 Doug Kwan <dougkwan@google.com>
10064
10065 * Makefile.am (HFILES): Add arm-reloc-property.h.
10066 (DEFFILES): New.
10067 (TARGETSOURCES): Add arm-reloc-property.cc
10068 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10069 (libgold_a_SOURCES): $(DEFFILES)
10070 * Makefile.in: Regenerate.
10071 * arm-reloc-property.cc: New file.
10072 * arm-reloc-property.h: New file.
10073 * arm-reloc.def: New file.
10074 * arm.cc: Update comments.
10075 (arm-reloc-property.h): New included header.
10076 (arm_reloc_property_table): New global variable.
10077 (Target_arm::do_select_as_default_target): New method definition.
10078 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10079 arm-reloc-property to targ_extra_obj.
10080 * parameters.cc (set_parameters_target): Call
10081 Target::select_as_default_target().
10082 * target.h (Target::select_as_default_target): New method definition.
10083 (Target::do_select_as_default_target): Same.
10084
10085 2010-02-01 Doug Kwan <dougkwan@google.com>
10086
10087 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10088 first_output_text_section_.
10089 (Arm_exidx_fixup::first_output_text_section): New method definition.
10090 (Arm_exidx_fixup::first_output_text_section_): New data member.
10091 (Arm_exidx_fixup::process_exidx_section): Record the first text
10092 output section seen.
10093 (Arm_output_section::fix_exidx_coverage): Set correct linked section
10094 and entsize in output section header.
10095
10096 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10097
10098 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10099 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10100 (Arm_relocate_functions::thm_alu11): New Method.
10101 (Arm_relocate_functions::thm_pc8): New Method.
10102 (Arm_relocate_functions::thm_pc12): New Method.
10103 (Target_arm::Scan::local): Handle the relocations.
10104 (Target_arm::Scan::global): Likewise.
10105 (Target_arm::Relocate::relocate): Likewise.
10106 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10107
10108 2010-01-29 Doug Kwan <dougkwan@google.com>
10109
10110 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10111 of relocation types as ld.
10112
10113 2010-01-29 Doug Kwan <dougkwan@google.com>
10114
10115 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10116 to public.
10117 (Arm_relocate_functions::thumb_branch_common): Ditto.
10118 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10119 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10120 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10121 Arm_relocate_functions::jump24): Remove.
10122 (Target_arm::Relocate::relocate): Adjust code to call
10123 Arm_relocation_functions::arm_branch_common and
10124 Arm_relocation_functions::thumb_branch_common instead of their removed
10125 wrappers. Merge switch-cases together to reduce source code size.
10126
10127 2010-01-29 Doug Kwan <dougkwan@google.com>
10128
10129 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10130 output_local_symbol_count_needs_update_.
10131 (Arm_relobj::output_local_symbol_count_needs_update,
10132 Arm_relobj::set_output_local_symbol_count_needs_update,
10133 Arm_relobj::update_output_local_symbol_count): New methods.
10134 (Arm_relobj::output_local_symbol_count_needs_update_): New data
10135 member.
10136 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10137 of pointed function as in a R_ARM_PREL31 relocation.
10138 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10139 for output local symbol count updating.
10140 (Target_arm::do_relax): Update output local symbol counts in objects
10141 if necessary.
10142 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10143
10144 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10145
10146 * arm.cc: Added support for the ARM relocations:
10147 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10148 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10149 (Arm_relocate_functions::movw_rel_nc): Renamed (was
10150 movw_prel_nc).
10151 (Arm_relocate_functions::movw_rel): New method.
10152 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10153 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10154 thm_movw_prel_nc).
10155 (Arm_relocate_functions::thm_movw_rel): New method.
10156 (Arm_relocate_functions::thm_movt_rel): Renamed (was
10157 thm_movt_prel).
10158 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10159 relocations.
10160 (Target_arm::Scan::global): Likewise.
10161 (Target_arm::Relocate::relocate): Likewise.
10162 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10163 Likewise.
10164
10165 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10166
10167 * arm.cc: Added support for ARM group relocations.
10168 (Target_arm::reloc_needs_sym_origin): New method.
10169 (Arm_relocate_functions::calc_grp_kn): New method.
10170 (Arm_relocate_functions::calc_grp_residual): New method.
10171 (Arm_relocate_functions::calc_grp_gn): New method.
10172 (Arm_relocate_functions::arm_grp_alu): New Method.
10173 (Arm_relocate_functions::arm_grp_ldr): New Method.
10174 (Arm_relocate_functions::arm_grp_ldrs): New Method.
10175 (Arm_relocate_functions::arm_grp_ldc): New Method.
10176 (Target_arm::Scan::local): Handle the ARM group relocations.
10177 (Target_arm::Scan::global): Likewise.
10178 (Target_arm::Relocate::relocate): Likewise.
10179 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10180 Likewise.
10181
10182 2010-01-26 Doug Kwan <dougkwan@google.com>
10183
10184 * arm.cc (set): Include.
10185 (class Arm_exidx_fixup): Change type of last_input_section_ to const
10186 pointer type.
10187 (Arm_output_section::Text_section_list): New type.
10188 (Arm_output_section::append_text_sections_to_list): New method.
10189 (Arm_output_section::fix_exidx_coverage): Ditto.
10190 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10191 (Arm_relobj::convert_input_section_to_relaxed_section): Use
10192 Relobj::set_section_offset() instead of
10193 Sized_relobj::invalidate_section_offset().
10194 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10195 parameter for section headers. Ignore relocation sections for
10196 unallocated sections and EXIDX sections.
10197 (Target_arm::fix_exidx_coverage): New method.
10198 (Target_arm::output_section_address_less_than): New type.
10199 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10200 linked text section instead of the EXIDX section.
10201 (Arm_output_section::create_stub_group): Add an assertion to check
10202 that this is not an EXIDX output section.
10203 (Arm_output_section::append_text_sections_to_list): New method.
10204 (Arm_output_section::fix_exidx_coverage): Ditto.
10205 (Arm_relobj::scan_sections_for_stubs): Adjust call to
10206 Arm_relobj::section_needs_reloc_stub_scanning.
10207 (Target_arm::do_relax): Fix EXIDX output section coverage in the
10208 first pass.
10209 (Target_arm::fix_exidx_coverage): New method.
10210 * object.h (Relobj::set_output_section): New method.
10211 (Sized_relobj::invalidate_section_offset): Remove method.
10212 (Sized_relobj::do_invalidate_section_offset): Remove method.
10213 (Sized_relobj::do_set_section_offset): Handle offset value -1.
10214
10215 2010-01-25 Doug Kwan <dougkwan@google.com>
10216
10217 * arm.cc (Arm_exidx_merged_section::do_output_offset):
10218 Fix warning due to signed and unsigned comparison on a 32-bit host.
10219
10220 2010-01-22 Doug Kwan <dougkwan@google.com>
10221
10222 * arm.cc (Target_arm::do_relax): Record an output section for section
10223 offset adjustment it contains any stub table that has changed.
10224 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10225 offsets in an output section if necessary.
10226 * output.cc (Output_section::Output_section): Initialize
10227 section_offsets_need_adjustments_.
10228 (Output_section::add_input_section_for_script): Renamed to
10229 Output_section::add_simple_input_section.
10230 (Output_section::save_states): Add a comment.
10231 (Output_section::discard_states): New method defintion.
10232 (Output_section::adjust_section_offsets): Same.
10233 * output.h (Output_section::add_input_section_for_script): Renamed to
10234 Output_section::add_simple_input_section.
10235 (Output_section::discard_states): New method declaration.
10236 (Output_section::adjust_section_offsets): Same.
10237 (Output_section::section_offsets_need_adjustment,
10238 Output_section::set_section_offsets_need_adjustment): New method
10239 definitions.
10240 (Output_section::section_offsets_need_adjustment_): New data member.
10241 * script-sections.cc
10242 (Output_section_element_input::set_section_address): Adjust code for
10243 renaming of Output_section::add_input_section_for_script.
10244 (Orphan_output_section::set_section_address): Same.
10245
10246 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10247
10248 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10249 Fix_v4bx enum values .
10250 * gold/options.h (General_options): New option definitions.
10251 (General_options::fix_v4bx): New method.
10252 (General_options::Fix_v4bx): New enum.
10253 * gold/options.cc (General_options::parse_fix_v4bx): New method.
10254 (General_options::parse_fix_v4bx_interworking): New method.
10255
10256 2010-01-22 Doug Kwan <dougkwan@google.com>
10257
10258 * arm.cc (Arm_exidx_fixup): New class.
10259
10260 2010-01-21 Doug Kwan <dougkwan@google.com>
10261
10262 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10263 classes.
10264 (Arm_exidx_section_offset_map): New type.
10265
10266 2010-01-21 Doug Kwan <dougkwan@google.com>
10267
10268 * arm.cc (Arm_exidx_input_section): New class.
10269 (Arm_relobj::exidx_input_section_by_link,
10270 Arm_relobj::exidx_input_section_by_shndx,
10271 Arm_relobj::make_exidx_input_section): New methods.
10272 (read_arm_attributes_section): Remove.
10273 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10274 information about them.
10275 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10276 to here.
10277
10278 2010-01-20 Doug Kwan <dougkwan@google.com>
10279
10280 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10281 Input_section_specifier to Section_id.
10282 (Target_arm::new_arm_input_section: Adjust code for change of key
10283 type.
10284 (Target_arm::find_arm_input_section): Ditto.
10285 * gc.h (object.h): Include for Section_id nand Section_id_hash.
10286 (Section_id): Remove.
10287 (Garbage_collection::Section_id_hash): Remove.
10288 * icf.h (object.h): Include for Section_id nand Section_id_hash.
10289 (Section_id): Remove.
10290 (Icf::Section_id_hash): Remove.
10291 * object.h (Section_id, Const_section_id, Section_id_hash,
10292 Const_section_id_hash): New type definitions.
10293 * output.cc (Output_section::add_relaxed_input_section): Change to
10294 use Const_section_id instead of Input_section_specifier as key type.
10295 (Output_section::add_merge_input_section): Ditto.
10296 (Output_section::build_relaxation_map): Change to use Section_id
10297 instead of Input_section_specifier as key type.
10298 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10299 Ditto.
10300 (Output_section::convert_input_sections_to_relaxed_sections): Change
10301 to use Const_section_id instead of Input_section_specifier as key type.
10302 (Output_section::find_merge_section): Ditto.
10303 (Output_section::find_relaxed_input_section): Ditto.
10304 * output.h (Input_section_specifier): Remove class.
10305 (Output_section::Output_section_data_by_input_section_map): Change
10306 key type to Const_section_id.
10307 (Output_section::Output_relaxed_input_section_by_input_section_map):
10308 Ditto.
10309 (Output_section::Relaxation_map): Change key type to Section_id.
10310
10311 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10312
10313 * gold/arm.cc: Added support for R_ARM_V4BX relocation
10314 (class Arm_v4bx_stub): New class.
10315 (DEF_STUBS): Updated definition to support v4_veneer_bx.
10316 (Stub_factory::make_arm_v4bx_stub): New method.
10317 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10318 (Stub_table::empty): Handle v4bx stubs.
10319 (Stub_table::add_arm_v4bx_stub): New method.
10320 (Stub_table::find_arm_v4bx_stub): New method.
10321 (Arm_relocate_functions::v4bx): New method.
10322 (Target_arm::fix_v4bx): New method.
10323 (Target_arm::Target_arm): Handle R_ARM_V4BX.
10324 (Stub_table::relocate_stubs): Likewise.
10325 (Stub_table::do_write): Likewise.
10326 (Stub_table::update_data_size_and_addralign): Likewise.
10327 (Stub_table::finalize_stubs): Likewise.
10328 (Target_arm::Scan::local): Likewise.
10329 (Target_arm::Scan::global): Likewise.
10330 (Target_arm::do_finalize_sections): Likewise.
10331 (Target_arm::Relocate::relocate): Likewise.
10332 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10333 Likewise.
10334 (Target_arm::scan_reloc_for_stub): Likewise.
10335 (Target_arm::scan_reloc_section_for_stubs): Likewise.
10336
10337 2010-01-19 Ian Lance Taylor <iant@google.com>
10338
10339 * output.cc (Output_section_headers::do_sized_write): Write large
10340 segment count to sh_info field.
10341 (Output_file_header::do_sized_write): For large segment count,
10342 write PN_XNUM to e_phnum field.
10343
10344 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10345
10346 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10347 (Arm_relocate_functions::thm_jump8): New function.
10348 (Arm_relocate_functions::thm_jump11): New function.
10349 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10350 R_ARM_THM_JUMP11.
10351 (Target_arm::Scan::global): Likewise.
10352 (Target_arm::Relocate::relocate): Likewise.
10353 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10354 Likewise.
10355
10356 2010-01-14 Doug Kwan <dougkwan@google.com>
10357
10358 * arm.cc (map, utility): Include headers.
10359 (Target_arm::apply_cortex_a8_workaround): New method.
10360 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10361 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10362 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10363 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10364 the --[no-]fix-cortex-a8 command line options.
10365 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10366 (Target_arm::relocate_stub): Use addend in instruction template.
10367 * options.h (DEFINE_bool): Set the user-set flag.
10368 (General_options): Add --[no-]-fix-cortex options.
10369 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10370 : Update fast look-up map after conversion.
10371
10372 2010-01-14 Sriraman Tallam <tmsriram@google.com>
10373
10374 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10375 in the first pass of do_layout.
10376
10377 2010-01-13 Doug Kwan <dougkwan@google.com>
10378
10379 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10380 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10381 apparent compiler problem of not folding static constant integral
10382 data members of elfcpp::Elf_sizes<32>.
10383
10384 2010-01-13 Doug Kwan <dougkwan@google.com>
10385
10386 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10387 Arm_relobj::section_needs_cortex_a8_stub_scanning,
10388 Arm_relobj::scan_section_for_cortex_a8_erratum,
10389 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10390 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10391 sections to scan for relocation stubs into a new method
10392 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
10393 relocation and Cortex-A8 stub scanning.
10394 (Target_arm::do_relax): Force stubs to be after stubbed sections
10395 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
10396 the beginning of a new relaxation pass. Update a comment.
10397 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10398
10399 2010-01-12 Ian Lance Taylor <iant@google.com>
10400
10401 * target-reloc.h (visibility_error): New inline function.
10402 (relocate_section): Call visibility_error.
10403 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10404 (MOSTLYCLEANFILES): Likewise.
10405 (protected_4_pic.o, protected_3.err): New targets.
10406 * testsuite/protected_4.cc: New file.
10407
10408 2010-01-12 Doug Kwan <dougkwan@google.com>
10409
10410 * arm.cc (Cortex_a8_reloc): New class.
10411 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10412 and cortex_a8_relocs_info_.
10413 (Target_arm::fix_cortex_a8): New method definition.
10414 (Target_arm::Cortex_a8_relocs_info): New type.
10415 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10416 New data member declarations.
10417 (Target_arm::scan_reloc_for_stub): Record information about
10418 relocations for THUMB branches that might be exempted from the
10419 Cortex-A8 workaround.
10420 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10421 at the beginning of a relaxation pass.
10422
10423 2010-01-12 Doug Kwan <dougkwan@google.com>
10424
10425 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10426 (Arm_relobj::Mapping_symbol_position,
10427 Arm_reloj::Mapping_symbol_position_less,
10428 Arm_relobj::Mapping_symbols_info): New types.
10429 (Target_arm::is_mapping_symbol_name): New method definition.
10430 (Arm_relobj::do_count_local_symbols): Save information about mapping
10431 symbols.
10432
10433 2010-01-11 Doug Kwan <dougkwan@google.com>
10434
10435 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10436 Arm_relocate_functions::thumb32_branch_upper,
10437 Arm_relocate_functions::thumb32_branch_lower,
10438 Arm_relocate_functions::thumb32_cond_branch_offset,
10439 Arm_relocate_functions::thumb32_cond_branch_upper,
10440 Arm_relocate_functions::thumb32_cond_branch_lower,
10441 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10442 branch offset encoding.
10443 (Arm_relocate_functions::thumb_branch_common): Use new branch
10444 offset encoding methods to avoid code duplication.
10445 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10446 (Stub_addend_reader::operator()): Use new branch encoding method
10447 to avoid code duplication.
10448
10449 2010-01-11 Doug Kwan <dougkwan@google.com>
10450
10451 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10452 (Target_arm::do_finalize_sections): Define special EXIDX section
10453 symbols only if referenced.
10454 * gc.h (Garbage_collection::add_reference): New method.
10455 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10456 code duplication.
10457
10458 2010-01-11 Ian Lance Taylor <iant@google.com>
10459
10460 * script.cc (Version_script_info::build_expression_list_lookup):
10461 Change complaing about duplicate wildcard match from error to
10462 warning.
10463
10464 * script.cc (class Lazy_demangler): Recreate--revert part of patch
10465 of 2009-12-30.
10466 (Version_script_info::Version_script_info): Initialize globs_,
10467 default_version_, default_is_global_, and exact_. Don't
10468 initialize globals_ or locals_.
10469 (Version_script_info::build_lookup_tables): Build local symbols
10470 first.
10471 (Version_script_info::unquote): New function.
10472 (Version_script_info::add_exact_match): New function.
10473 (Version_script_info::build_expression_list_lookup): Remove lookup
10474 parameter. Add is_global parameter. Change all callers. Handle
10475 wildcard pattern specially. Unquote pattern. Call
10476 add_exact_match.
10477 (Version_script_info::get_name_to_match): New function.
10478 (Version_script_info::get_symbol_version): New function.
10479 (Version_script_info::get_symbol_version_helper): Remove.
10480 (Version_script_info::check_unmatched_names): Call unquote.
10481 * script.h (class Version_script_info): Change get_symbol_version
10482 to be non-inline and add is_global parameter; change all callers.
10483 Rewrite symbol_is_local. Update declarations. Define struct
10484 Version_tree_match, Exact, Globs. Don't define struct Lookup.
10485 Remove globals_ and locals_ members. Add exact_, globs_,
10486 default_version_, is_global_.
10487 (Version_script_info::Glob): Remove pattern, add expression and
10488 is_global. Update constructor. Change all callers.
10489 * dynobj.cc (Versions::finalize): Mark the version symbol as the
10490 default version.
10491 (Versions::symbol_section_contents): If a symbol is undefined, or
10492 defined in a dynamic object, set the version index to
10493 VER_NDX_LOCAL.
10494 * symtab.cc (Symbol_table::add_from_relobj): Don't call
10495 symbol_is_local.
10496 (Symbol_table::add_from_pluginobj): Likewise.
10497 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10498
10499 2010-01-11 Doug Kwan <dougkwan@google.com>
10500
10501 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10502 (incremental_dump_LDADD): Add linking option for libintl.
10503 * Makefile.in: Regenerate.
10504
10505 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
10506
10507 PR gold/11144
10508 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10509 instead of -Ds.
10510 * testsuite/Makefile.in: Regenerated.
10511
10512 2010-01-10 Doug Kwan <dougkwan@google.com>
10513
10514 * options.h (DEFINE_var): Use parentheses around argument varname__
10515 in macro body to avoid any unintended subsequent substitutions.
10516
10517 2010-01-10 Ian Lance Taylor <iant@google.com>
10518
10519 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10520 candidates before doing symbol resolution.
10521
10522 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10523 ODR candidates if only one is weak.
10524
10525 2010-01-08 Ian Lance Taylor <iant@google.com>
10526
10527 * script.cc (Version_script_info::build_expression_list_lookup):
10528 Don't warn about ambiguous version, just record the ambiguity.
10529 (Version_script_info::get_symbol_version_helper): Give error if
10530 version is ambiguous.
10531
10532 2010-01-08 Doug Kwan <dougkwan@google.com>
10533
10534 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10535 prev_data_size_ and prev_addralign_. Remove initializer for
10536 deleted data member has_been_changed_.
10537 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10538 to determine if the table is empty.
10539 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10540 Remove.
10541 (Stub_table::add_reloc_stub): Define method in class definition
10542 instead of just declaring it there.
10543 (Stub_table::add_cortex_a8_stub): New method definition.
10544 (Stub_table::update_data_size_and_addralign): Ditto.
10545 (Stub_table::finalize_stubs): Ditto.
10546 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10547 (Stub_table::do_addralign_): Return address alignment in the
10548 (Stub_table::do_reset_address_and_file_offset): Define method in
10549 class definition instead of declaring it there. Set current data
10550 size to be the data size of the previous pass.
10551 (Stub_table::set_final_data_size): Use current data size as the
10552 final data size.
10553 (Stub_table::relocate_stub): Change parameter type of stub from
10554 Reloc_stub pointer to Stub pointer.
10555 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10556 (Stub_table::Cortex_a8_stub_list): New typedef.
10557 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10558 Stub_table::prev_addralign_): New data member.
10559 (Arm_relobj::Arm_relobj): Initialize data member
10560 section_has_cortex_a8_workaround_.
10561 (Arm_relobj::section_has_cortex_a8_workaround,
10562 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10563 definitions.
10564 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10565 declarations.
10566 (Target_arm::relocate_stub): Change parameter type of stub from
10567 Reloc_stub pointer to Stub pointer.
10568 (Insn_template::size, Insn_template::alignment): Handle
10569 THUMB16_SPECIAL_TYPE.
10570 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10571 Stub_table::update_data_size_and_addralign,
10572 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10573 definitions.
10574 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10575 (Stub_table::do_write): Ditto.
10576 (Target_arm::do_relax): Adjust code for changes in Stub_table.
10577
10578 2010-01-08 Ian Lance Taylor <iant@google.com>
10579
10580 PR 11108
10581 * symtab.h (class Symbol): Remove fields is_target_special_ and
10582 has_plt_offset_. Add field is_defined_in_discarded_section_.
10583 (Symbol::is_defined_in_discarded_section): New function.
10584 (Symbol::set_is_defined_in_discarded_section): New function.
10585 (Symbol::has_plt_offset): Rewrite.
10586 (Symbol::set_plt_offset): Verify that new offset is not -1U.
10587 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10588 Don't initialize is_target_special_ or has_plt_offset_.
10589 Initialize is_defined_in_discarded_section_.
10590 (Symbol_table::add_from_relobj): If appropriate, set
10591 is_defined_in_discarded_section.
10592 * resolve.cc (Symbol::override_base_with_special): Don't test
10593 is_target_special_. Change has_plt_offset_ to has_plt_offset().
10594 * target-reloc.h (relocate_section): Do special handling for
10595 symbols defined in discarded sections for global symbols as well
10596 as local symbols.
10597
10598 2010-01-08 Ian Lance Taylor <iant@google.com>
10599
10600 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10601 the SHT_SYMTAB case.
10602
10603 2010-01-08 Ian Lance Taylor <iant@google.com>
10604
10605 * object.cc (Sized_relobj::do_layout): Don't get confused if
10606 layout_eh_frame returns NULL.
10607
10608 2010-01-08 Ian Lance Taylor <iant@google.com>
10609
10610 PR 11084
10611 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10612 dynamic symbol table, use the normal symbol table.
10613 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10614 symbol table.
10615
10616 2010-01-08 Ian Lance Taylor <iant@google.com>
10617
10618 PR 11072
10619 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10620 sections.
10621
10622 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10623
10624 * version.cc (print_version): Change to "Copyright 2010".
10625
10626 2010-01-08 Ian Lance Taylor <iant@google.com>
10627
10628 PR 10287
10629 PR 11063
10630 * i386.cc (class Target_i386): Change return type of plt_section
10631 to be non-const.
10632 (class Output_data_plt_i386): Add tls_desc_rel_ field.
10633 (Output_data_plt_i386::Output_data_plt_i386): Initialize
10634 tls_desc_rel_ field.
10635 (Output_data_plt_i386::rel_tls_desc): New function.
10636 (Target_i386::rel_tls_desc_section): New function.
10637 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10638 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10639 R_386_TLS_DESC reloc in rel_tls_desc_section.
10640 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10641 Define struct Tlsdesc_info.
10642 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10643 (Target_x86_64::do_reloc_symbol_index): New function.
10644 (Target_x86_64::add_tlsdesc_info): New function.
10645 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10646 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10647 tlsdesc_rel_ field.
10648 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
10649 all callers.
10650 (Output_data_plt_x86_64::rela_tlsdesc): New function.
10651 (Target_x86_64::rela_tlsdesc_section): New function.
10652 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10653 handling.
10654 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10655 (Target_x86_64::do_reloc_addend): New function.
10656 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10657 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10658 declarations. Define TARGET_CODE. Add arg field to u1_ union.
10659 (Output_reloc::type): New function.
10660 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10661 (Output_reloc::is_target_specific): New function.
10662 (Output_reloc::target_arg): New function.
10663 (class Output_reloc) [SHT_RELA]: Add four new constructors for
10664 absolute relocs and target specific relocs.
10665 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10666 add_target_specific.
10667 (class Output_data_reloc) [SHT_RELA]: Likewise.
10668 * output.cc (Output_reloc::Output_reloc): Add four new versions
10669 for absolute relocs and target specific relocs.
10670 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10671 (Output_reloc::get_symbol_index): Likewise.
10672 (Output_reloc::local_section_offset): Check that local_sym_index_
10673 is not TARGET_CODE or 0.
10674 (Output_reloc::symbol_value): Likewise.
10675 (Output_reloc::write) [SHT_RELA]: Call target for target specific
10676 reloc.
10677 * target.h (class Target): Add reloc_symbol_index and reloc_addend
10678 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
10679 functions.
10680 * layout.cc (add_target_dynamic_tags): Use output section for
10681 DT_PLTRELSZ and DT_JMPREL.
10682
10683 2010-01-07 Ian Lance Taylor <iant@google.com>
10684
10685 PR 11061
10686 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10687 function.
10688 (class Output_data_reloc_generic): Define.
10689 (class Output_data_reloc_base): Change base class to
10690 Output_data_reloc_generic. Change add() method to call
10691 bump_relative_reloc_count for a relative reloc. Remove
10692 sort_relocs_ field.
10693 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10694 to sort_relocs().
10695 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10696 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10697 appropriate.
10698 * layout.h (class Layout): Update declaration.
10699
10700 2010-01-07 Ian Lance Taylor <iant@google.com>
10701
10702 * output.h (class Output_data): Add const version of
10703 output_section and do_output_section.
10704 (class Output_section_data): Add const version of
10705 do_output_section.
10706 (class Output_section): Likewise.
10707 * layout.cc (Layout::add_target_dynamic_tags): New function.
10708 * layout.h (class Layout): Update declarations.
10709 * arm.cc (Target_arm::do_finalize_sections): Use
10710 add_target_dynamic_tags.
10711 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10712 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10713 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10714 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10715
10716 2010-01-07 Ian Lance Taylor <iant@google.com>
10717
10718 PR 11042
10719 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10720 object as needed.
10721
10722 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10723 Ian Lance Taylor <iant@google.com>
10724
10725 PR 11019
10726 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10727 Xindex::read_symtab_xindex.
10728
10729 2010-01-07 Doug Kwan <dougkwan@google.com>
10730
10731 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10732 (Insn_template::thumb16_bcond_insn): New method declaration.
10733 (Insn_template): Fix spelling.
10734 (Stub::thumb16_special): New method declaration.
10735 (Stub::do_write): Define virtual method which was previously pure
10736 virtual.
10737 (Stub::do_thumb16_special): New method declaration.
10738 (Stub::do_fixed_endian_write): New template member.
10739 (Reloc_stub::do_write): Remove.
10740 (Reloc_stub::do_fixed_endian_write): Remove.
10741 (Cortex_a8_stub): New class definition.
10742 (Stub_factory::make_cortex_a8_stub): New method definition.
10743 (Stub_factory::Stub_factory): Add missing static storage class
10744 qualifier for elf32_arm_stub_a8_veneer_blx.
10745
10746 2010-01-07 Ian Lance Taylor <iant@google.com>
10747
10748 PR 10980
10749 * options.h (class General_options): Add --warn-unresolved-symbols
10750 and --error-unresolved-symbols.
10751 * errors.cc (Errors::undefined_symbol): Implement
10752 --warn-unresolved-symbols.
10753
10754 * options.h (class General_options): Add -z text and -z textoff.
10755 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10756
10757 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10758
10759 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10760 (Garbage_collection::cident_sections): New function.
10761 (Garbage_collection::add_cident_section): New function.
10762 (Garbage_collection::cident_sections_): New member.
10763 (gc_process_relocs): Add references to sections whose names are C
10764 identifiers.
10765 * gold.h (cident_section_start_prefix): New constant.
10766 (cident_section_stop_prefix): New constant.
10767 (is_cident): New function.
10768 * layout.cc (Layout::define_section_symbols): Replace string constants
10769 with the newly defined constants.
10770 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10771 C identifiers.
10772 * testsuite/Makefile.am: Add gc_orphan_section_test.
10773 * testsuite/Makefile.in: Regenerate.
10774 * testsuite/gc_orphan_section_test.cc: New file.
10775 * testsuite/gc_orphan_section_test.sh: New file.
10776
10777 2010-01-06 Ian Lance Taylor <iant@google.com>
10778
10779 PR 10980
10780 * options.h (class General_options): Add --warn-shared-textrel.
10781 * layout.cc (Layout::finish_dynamic_section): Implement
10782 --warn-shared-textrel.
10783
10784 PR 10980
10785 * options.h (class General_options): Add --warn-multiple-gp.
10786
10787 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10788
10789 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10790 $(THREADSLIB) and $(LIBDL).
10791 * Makefile.in: Rebuild.
10792
10793 2010-01-06 Ian Lance Taylor <iant@google.com>
10794
10795 PR 10980
10796 * options.cc (General_options::parse_section_start): New function.
10797 (General_options::section_start): New function.
10798 (General_options::General_options): Initialize all members.
10799 * options.h: Include <map>
10800 (class General_options): Add --section-start. Add section_starts_
10801 member.
10802 * layout.cc (Layout::attach_allocated_section_to_segment): If
10803 --section-start was used, set the address of the segment. Remove
10804 local sort_sections.
10805 (Layout::relaxation_loop_body): If the address of the load segment
10806 has been set by --section-start, don't use it.
10807 * output.h (Output_segment::update_flags_for_output_section): New
10808 function.
10809 * output.cc (Output_segment::add_output_section): Call
10810 update_flags_for_output_section.
10811
10812 2010-01-05 Ian Lance Taylor <iant@google.com>
10813
10814 PR 10980
10815 * options.h (class General_options): Add --undefined-version.
10816 * script.cc (struct Version_expression): Add was_matched_by_symbol
10817 field.
10818 (Version_script_info::matched_symbol): New function.
10819 (Version_script_info::get_symbol_version_helper): Call
10820 matched_symbol.
10821 (Version_script_info::check_unmatched_names): New function.
10822 * script.h (class Version_script_info): Update declarations.
10823 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10824
10825 * options.h (class General_options): Use DEFINE_bool_alias for
10826 allow_multiple_definition.
10827 * resolve.cc (Symbol_table::should_override): Don't test
10828 allow_multiple_definition.
10829
10830 PR 10980
10831 * options.h (class General_options): Add --cref.
10832 * main.cc (main): Print cref table if --cref. Don't close mapfile
10833 until after printing cref table.
10834 * cref.cc: Include "symtab.h".
10835 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10836 (Cref_table_compare::operator()): New function.
10837 (Cref_inputs::gather_cref): New function.
10838 (filecol): New static const.
10839 (Cref_inputs::print_cref): New function.
10840 (Cref::print_cref): New function.
10841 * cref.h: Include <cstdio>.
10842 (class Cref): Update declarations.
10843 * mapfile.h (Mapfile::file): New function.
10844 * object.h (class Object): Define Symbols. Declare virtual
10845 do_get_global_symbols.
10846 (Object::get_global_symbols): New function.
10847 * object.cc (Input_objects::add_object): Pass object to cref_ if
10848 --cref.
10849 (Input_objects::archive_start): Likewise.
10850 (Input_objects::archive_stop): Likewise.
10851 (Input_objects::print_cref): New function.
10852 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10853 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10854 --cref.
10855 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10856 function.
10857 * plugin.h (class Sized_pluginobj): Update declarations.
10858
10859 2010-01-05 Ian Lance Taylor <iant@google.com>
10860
10861 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10862 to is_default_version. Rename insdef to insdefault.
10863 (Symbol_table::add_from_relobj): Rename def to is_default_version
10864 and local to is_forced_local.
10865 (Symbol_table::add_from_pluginobj): Likewise.
10866 (Symbol_table::add_from_dynobj): Likewise.
10867 (Symbol_table::define_special_symbol): Rename insdef to
10868 insdefault.
10869
10870 2010-01-04 Ian Lance Taylor <iant@google.com>
10871
10872 PR 10980
10873 * options.h (class General_options): Add
10874 --allow-multiple-definition and -z muldefs.
10875 * resolve.cc (Symbol_table::should_override): Don't warn about a
10876 multiple symbol definition if --allow-multiple-definition or -z
10877 muldefs.
10878
10879 PR 10980
10880 * options.h (class General_options): Add --add-needed and
10881 --copy-dt-needed-entries. Tweak --as-needed help entry.
10882 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10883 error if --copy-dt-needed-entries aka --add-needed is used and
10884 would cause a change in behaviour.
10885
10886 PR 10980
10887 * options.h (class General_options): Add -G as a short version of
10888 --shared. Add no-op options -assert, -g, and -i.
10889
10890 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10891
10892 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10893 check for .text or .gnu.linkonce.t sections.
10894 * icf.cc (Icf::find_identical_sections): Ditto.
10895 Change the detection for mangled function name within the section
10896 name.
10897 * icf.h (is_section_foldable_candidate): New function.
10898
10899 2009-12-30 Ian Lance Taylor <iant@google.com>
10900
10901 PR 10980
10902 * options.h (class General_options): Permit two dashes with
10903 --retain-symbols-file.
10904
10905 2009-12-30 Ian Lance Taylor <iant@google.com>
10906
10907 PR 10979
10908 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10909 don't put the file header and segment headers in the text
10910 segment.
10911
10912 PR 10979
10913 * common.cc (Sort_commons::operator()): Stabilize sort when both
10914 entries are NULL.
10915 (Symbol_table::do_allocate_commons_list): When allocating common
10916 symbols, skip a symbol which is no longer common.
10917 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10918 an object before checking its type.
10919 * testsuite/common_test_2.c: New file.
10920 * testsuite/common_test_3.c: New file.
10921 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10922 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10923 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10924 (common_test_2_pic.o, common_test_2.so): New targets.
10925 (common_test_3_pic.o, common_test_3.so): New targets.
10926 * testsuite/Makefile.in: Rebuild.
10927
10928 PR 10979
10929 * script.cc (read_input_script): If we see a new SECTIONS clause,
10930 and we have added an input section, give an error.
10931 * layout.h (class Layout): Add have_added_input_section function.
10932 Add have_added_input_section_ field.
10933 * layout.cc (Layout::Layout): Initialize
10934 have_added_input_section_.
10935 (Layout::layout): Set have_added_input_section_.
10936 (Layout::layout_eh_frame): Likewise.
10937
10938 2009-12-30 Ian Lance Taylor <iant@google.com>
10939
10940 PR 10931
10941 * options.h (class General_options): Add --sort-common option.
10942 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10943 * common.cc (Sort_common): Add sort_order parameter to
10944 constructor. Add sort_order_ field.
10945 (Sort_commons::operator): Check sort_order_.
10946 (Symbol_table::allocate_commons): Determine the sort order.
10947 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10948 Change all callers.
10949 (Symbol_table::do_allocate_commons_list): Likewise.
10950
10951 2009-12-30 Ian Lance Taylor <iant@google.com>
10952
10953 PR 10916
10954 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10955 symbols from this object, don't change the visibility of an
10956 undefined symbol.
10957 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10958
10959 2009-12-30 Ian Lance Taylor <iant@google.com>
10960
10961 PR 10861
10962 * script.h (class Version_script_info): Define Language enum.
10963 Update declarations. Define Glob, Exact, and Lookup types. Add
10964 new fields globals_, locals_, and is_finalized_.
10965 * script.cc: Various formatting fixes.
10966 (class Parser_closure): Change language_stack_ from a vector of
10967 std::string to one of Version_script_info::Language. Adjust all
10968 uses accordingly.
10969 (class Lazy_demangler): Remove.
10970 (struct Version_expression): Change language from std::string to
10971 Version_script_info::Language.
10972 (Version_script_info::Version_script_info): New function.
10973 (Version_script_info::~Version_script_info): Don't call clear.
10974 (Version_script_info::finalize): New function.
10975 (Version_script_info::build_lookup_tables): New function.
10976 (Version_script_info::build_expression_list_lookup): New
10977 function.
10978 (Version_script_info::get_symbol_version_helper): Rewrite to use
10979 lookup tables.
10980 (Version_script_info::print_expression_list): Adjust to use
10981 Version_script_info::Language.
10982 (script_push_lex_into_version_mode): Check that the version script
10983 has not been finalized.
10984 (version_script_push_lang): Change language string to
10985 Version_script_info::Language.
10986 * options.cc (Command_line::version_script): New function.
10987 * options.h (class General_options): Add finalize_dynamic_list
10988 function. Change version_script from declaration to definition.
10989 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10990 * testsuite/version_script.map: Remove duplicate def of foo.
10991 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10992 version_script.map.
10993 * testsuite/Makefile.in: Rebuild.
10994
10995 2009-12-30 Ian Lance Taylor <iant@google.com>
10996
10997 PR 10843
10998 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10999 if the input symbol index is 0, make the output symbol index 0.
11000
11001 2009-12-30 Ian Lance Taylor <iant@google.com>
11002
11003 PR 10670
11004 * options.h (class General_options): Add -x/--discard-all.
11005 * object.cc (Sized_relobj::do_count_local_symbols): Handle
11006 --discard-all. If the local symbol needs a dynamic entry, check
11007 that before handling --discard-locals.
11008
11009 2009-12-30 Ian Lance Taylor <iant@google.com>
11010
11011 PR 10450
11012 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11013 flags to PF_R.
11014 (Output_segment::add_output_section): Don't change the flags if
11015 the type is PT_TLS.
11016
11017 PR 10450
11018 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11019 GNU hash table if they need a dynamic value. Otherwise, don't add
11020 them if they are defined in a dynamic object or are forced local.
11021
11022 2009-12-29 Ian Lance Taylor <iant@google.com>
11023
11024 PR 10450
11025 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11026 .gnu.hash table for a 32-bit target.
11027
11028 PR 10450
11029 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11030 regular and a dynamic object only needs a dynamic symbol table
11031 entry if it is externally visible.
11032
11033 PR 10450
11034 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11035 constructor. Add global_offset_table_ field.
11036 (Target_i386::got_section): Set global_offset_table_.
11037 (Target_i386::do_finalize_sections): Set global_offset_table_
11038 size.
11039 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11040 in constructor. Add global_offset_table_ field.
11041 (Target_x86_64::got_section): Set global_offset_table_.
11042 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11043 size.
11044
11045 * layout.cc (Layout::Layout): Initialize increase_relro_.
11046 (Layout::get_output_section): Add is_relro, is_last_relro, and
11047 is_first_non_relro parameters. Change all callers.
11048 (Layout::choose_output_section): Likewise.
11049 (Layout::add_output_section_data): Likewise.
11050 (Layout::make_output_section): Likewise.
11051 (Layout::set_segment_offsets): Clear increase_relro when using a
11052 linker script.
11053 * layout.h (class Layout): Add increase_relro method. Add
11054 increase_relro_ field. Update declarations.
11055 * output.cc (Output_section::Output_section): Initialize
11056 is_last_relro_ and is_first_non_relro_.
11057 (Output_segment::add_output_section): Group relro sections is
11058 do_sort is true. Handle is_last_relro and is_first_non_relro.
11059 (Output_segment::maximum_alignment): Remove relro handling.
11060 (Output_segment::set_section_addresses): Add increase_relro
11061 parameter. Change all callers. Add initial alignment to align
11062 relro sections on separate page. Remove old relro handling.
11063 (Output_segment::set_section_list_addresses): Remove in_relro
11064 parameter. Change all callers.
11065 (Output_segment::set_offset): Add increase parameter. Change all
11066 callers. Remove old relro handling.
11067 * output.h (class Output_section): Add new methods: is_last_relro,
11068 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11069 Add is_last_relro_ and is_first_non_relro_ fields.
11070 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11071 Create separate .got.plt section. Call increase_relro.
11072 * x86_64.cc (Target_x86_64::got_section): Likewise.
11073 * testsuite/relro_script_test.t: Add .got.plt.
11074
11075 PR 10450
11076 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11077 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11078 (Layout::finalize): Call set_dynamic_symbol_size.
11079 (Layout::set_dynamic_symbol_size): New function.
11080 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11081 set_dynamic_symbol_size.
11082
11083 PR 10450
11084 * output.h (class Output_section): Add is_entsize_zero_ field.
11085 * output.cc (Output_section::Output_section): Initialize
11086 is_entsize_zero_.
11087 (Output_section::set_entsize): If two different entsizes are
11088 requested, force it to zero.
11089 (Output_section::add_input_section): Set flags for .debug_str
11090 before updating section flags. Set entsize.
11091 (Output_section::update_flags_for_input_section): Set SHF_MERGE
11092 and SHF_STRING if all input sections have those flags.
11093
11094 2009-12-29 Rafael Espindola <espindola@google.com>
11095
11096 * main.cc (main): Fix the sys time reporting.
11097 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11098 reporting.
11099
11100 2009-12-29 Sriraman Tallam <tmsriram@google.com>
11101
11102 * options.cc (General_options::parse_version): Allow -v to exit
11103 without an error if there is nothing to link.
11104
11105 2009-12-29 Ian Lance Taylor <iant@google.com>
11106
11107 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11108 using a version of gcc before 4.1.
11109 * configure: Rebuild.
11110
11111 2009-12-28 Chris Demetriou <cgd@google.com>
11112
11113 * attributes.cc (Output_attributes_section_data::do_write): Use
11114 std::vector::front rather than std::vector::data.
11115
11116 2009-12-28 Ian Lance Taylor <iant@google.com>
11117
11118 * symtab.h (class Symbol_table): Add enum Defined.
11119 * resolve.cc (Symbol_table::should_override): Add defined
11120 parameter. Change all callers. Test whether object is NULL
11121 before calling a method on it.
11122 (Symbol_table::report_resolve_problem): Add defined parameter.
11123 Change all callers.
11124 (Symbol_table::should_override_with_special): Likewise.
11125 * symtab.cc (Symbol_table::define_in_output_data): Add defined
11126 parameter. Change all callers.
11127 (Symbol_table::do_define_in_output_data): Likewise.
11128 (Symbol_table::define_in_output_segment): Likewise.
11129 (Symbol_table::do_define_in_output_segment): Likewise.
11130 (Symbol_table::define_as_constant): Likewise.
11131 (Symbol_table::do_define_as_constant): Likewise.
11132 * script.h (class Symbol_assignment): Add is_defsym parameter to
11133 constructor; change all callers.
11134 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11135 parameter. Change all callers. Add is_defsym_ field.
11136 (class Parser_closure): Add parsing_defsym parameter to
11137 constructor; change all callers. Add parsing_defsym accessor
11138 function. Add parsing_defsym_ field.
11139
11140 2009-12-28 Ian Lance Taylor <iant@google.com>
11141
11142 * gold.cc (queue_middle_tasks): Fix formatting.
11143 * object.cc (Relobj::is_section_name_included): Likewise.
11144
11145 2009-12-23 Ian Lance Taylor <iant@google.com>
11146
11147 * i386.cc (Target_i386::do_calls_non_split): Recognize
11148 -fsplit-stack prologue for a function with a static chain.
11149 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11150 -fsplit-stack prologue when using %r11.
11151
11152 2009-12-21 Sriraman Tallam <tmsriram@google.com>
11153
11154 * options.cc (General_options::parse_version): Make -v continue and do
11155 the link like GNU ld does.
11156
11157 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
11158
11159 * Makefile.am (CCFILES): Add timer.cc.
11160 (HFILES): Add timer.h.
11161 * configure.ac: Check for sysconf and times.
11162 * main.cc: include timer.h.
11163 (main): Use Timer instead of get_run_time.
11164 * timer.cc: New.
11165 * timer.h: New.
11166 * workqueue.cc: include timer.h.
11167 (Workqueue::find_and_run_task):
11168 Report user, sys and wall time.
11169 * Makefile.in: Regenerate.
11170 * config.in: Regenerate.
11171 * configure: Regenerate.
11172
11173 2009-12-16 Doug Kwan <dougkwan@google.com>
11174
11175 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11176 sections.
11177 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11178 relaxed input sections.
11179 * output.cc (Output_section::find_relaxed_input_section): Change
11180 return type to Output_relaxed_input_section pointer. Adjust code
11181 for new type of relaxed_input_section_map_.
11182 * output.h (Output_section::find_relaxed_input_section): Change
11183 return type to Output_relaxed_input_section pointer.
11184 (Output_section::Output_relaxed_input_section_by_input_section_map):
11185 New type.
11186 (Output_section::relaxed_input_section_map_): Change type to
11187 Output_section::Output_relaxed_input_section_by_input_section_map.
11188 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11189 input section.
11190
11191 2009-12-15 Ian Lance Taylor <iant@google.com>
11192
11193 * layout.cc (Layout::create_shstrtab): Only write out after input
11194 sections if we are compressing debug sections.
11195
11196 2009-12-15 Ian Lance Taylor <iant@google.com>
11197
11198 * archive.cc (Archive::add_symbols): Only look up a symbol without
11199 a version if there is, in fact, a version.
11200
11201 2009-12-14 Ian Lance Taylor <iant@google.com>
11202
11203 Revert -Wshadow changes, all changes from:
11204 2009-12-11 Doug Kwan <dougkwan@google.com>
11205 2009-12-11 Nick Clifton <nickc@redhat.com>
11206 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11207
11208 2009-12-11 Doug Kwan <dougkwan@google.com>
11209
11210 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11211 due to -Wshadow.
11212 * attributes.cc (Object_attribute::size): Ditto.
11213 (Attributes_section_data::size): Ditto.
11214 (Attributes_section_data::Attributes_section_data): Ditto.
11215 (Output_attributes_section_data::do_write): Ditto.
11216 * attributes.h (Object_attribute::set_type): Ditto.
11217 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11218
11219 2009-12-11 Nick Clifton <nickc@redhat.com>
11220
11221 * archive.cc: Fix shadowed variable warnings.
11222 * arm.cc: Likewise.
11223 * compressed_output.cc: Likewise.
11224 * compressed_output.h: Likewise.
11225 * configure: Likewise.
11226 * dwarf_reader.cc: Likewise.
11227 * dynobj.cc: Likewise.
11228 * dynobj.h: Likewise.
11229 * ehframe.cc: Likewise.
11230 * ehframe.h: Likewise.
11231 * errors.cc: Likewise.
11232 * expression.cc: Likewise.
11233 * fileread.cc: Likewise.
11234 * fileread.h: Likewise.
11235 * freebsd.h: Likewise.
11236 * i386.cc: Likewise.
11237 * icf.cc: Likewise.
11238 * incremental.h: Likewise.
11239 * layout.cc: Likewise.
11240 * layout.h: Likewise.
11241 * mapfile.cc: Likewise.
11242 * merge.cc: Likewise.
11243 * merge.h: Likewise.
11244 * object.cc: Likewise.
11245 * object.h: Likewise.
11246 * options.h: Likewise.
11247 * output.cc: Likewise.
11248 * output.h: Likewise.
11249 * parameters.cc: Likewise.
11250 * plugin.cc: Likewise.
11251 * powerpc.cc: Likewise.
11252 * reduced_debug_output.cc: Likewise.
11253 * reduced_debug_output.h: Likewise.
11254 * reloc.cc: Likewise.
11255 * reloc.h: Likewise.
11256 * resolve.cc: Likewise.
11257 * script-sections.cc: Likewise.
11258 * script.cc: Likewise.
11259 * script.h: Likewise.
11260 * sparc.cc: Likewise.
11261 * symtab.cc: Likewise.
11262 * symtab.h: Likewise.
11263 * target-select.cc: Likewise.
11264 * target-select.h: Likewise.
11265 * token.h: Likewise.
11266 * workqueue.cc: Likewise.
11267 * workqueue.h: Likewise.
11268 * x86_64.cc: Likewise.
11269
11270 2009-12-10 Doug Kwan <dougkwan@google.com>
11271
11272 * arm.cc (attributes.h): New include.
11273 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11274 (Arm_relobj::~Arm_relobj): Delete object pointed by
11275 attributes_section_data_.
11276 (Arm_relobj::attributes_section_data): New method definition.
11277 (Arm_relobj::attributes_section_data_): New data member declaration.
11278 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11279 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11280 attributes_section_data_.
11281 (Arm_dynobj::attributes_section_data): New method definition.
11282 (Arm_dynobj::attributes_section_data_): New data member declaration.
11283 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
11284 initialization value of may_use_blx_ to false.
11285 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11286 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11287 object attributes to compute results instead of hard-coding.
11288 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11289 Target_arm::get_secondary_compatible_arch,
11290 Target_arm::set_secondary_compatible_arch
11291 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11292 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11293 New method declarations.
11294 (Target_arm::get_aeabi_object_attribute): New method definition.
11295 (Target_arm::attributes_section_data_): New data member declaration.
11296 (read_arm_attributes_section): New template definition.
11297 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11298 (Arm_dynobj::do_read_symbols): Ditto.
11299 (Target_arm::do_finalize_sections): Merge attributes sections from
11300 input. Check for BLX use after attributes section merging.
11301 Fix __exidx_start and __exidx_end visibility. Create an
11302 .ARM.attributes section if necessary.
11303 (Target_arm::get_secondary_compatible_arch,
11304 Target_arm::set_secondary_compatible_arch,
11305 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11306 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11307 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11308 New method definitions.
11309
11310 2009-12-09 Ian Lance Taylor <iant@google.com>
11311
11312 * plugin.cc (Plugin::load): Don't cast from void* to a function
11313 pointer.
11314
11315 2009-12-09 Ian Lance Taylor <iant@google.com>
11316
11317 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11318 information fields.
11319
11320 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
11321
11322 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11323 Replace two_file_shared_1.so with two_file_shared_2.so.
11324 * testsuite/Makefile.in: Regenerated.
11325
11326 2009-12-08 Doug Kwan <dougkwan@google.com>
11327
11328 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11329 (HFILES): Add attributes.h and int_encoding.h.
11330 * Makefile.in: Regenerate.
11331 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11332 function definitions to int_encoding.cc
11333 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11334 prototypes to int_encoding.h
11335 * reduced_debug_output.cc (int_encoding.h): New include.
11336 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11337 function definitions to int_encoding.cc
11338 (insert_into_vector, read_from_pointer): Move template definitions to
11339 int_encoding.h
11340 * attributes.cc: New file.
11341 * attributes.h: New file.
11342 * int_encoding.cc: New file.
11343 * int_encoding.h: New file.
11344
11345 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
11346
11347 PR gold/11055
11348 * incremental-dump.cc (dump_incremental_inputs): New.
11349 (main): Use dump_incremental_inputs.
11350
11351 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
11352
11353 PR gold/10893
11354 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11355 checking elfcpp::STT_FUNC.
11356 (Target_i386::Relocate::relocate): Likewise.
11357 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11358
11359 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11360 symbols from shared libraries into normal FUNC symbols.
11361
11362 * symtab.h (Symbol): Add is_func and use it.
11363
11364 2009-12-05 Doug Kwan <dougkwan@google.com>
11365
11366 * arm.cc (Target_arm::arm_info): Initialize new fields
11367 attributes_section and attributes_vendor.
11368 * i386.cc (Target_i386::i386_info): Same.
11369 * object.cc (Sized_relobj::do_layout): Skip attribute section.
11370 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11371 fields attributes_section and attributes_vendor.
11372 * sparc.cc (Target_sparc::sparc_info): Same.
11373 * target.h (Target::attributes_section, Target::attributes_vendor,
11374 Target::is_attributes_section, Target::attribute_arg_type,
11375 Target::attributes_order): New method definitions.
11376 (Target::Target_info::attributes_section,
11377 Target::Target_info::attributes_vendor): New fields.
11378 (Target::do_attribute_arg_type, Target::do_attributes_order): New
11379 virtual method definitions.
11380 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11381 attributes_section and attributes_vendor.
11382 * testsuite/testfile.cc (Target_test::test_target_info): Same.
11383
11384 2009-12-05 Doug Kwan <dougkwan@google.com>
11385
11386 * arm.cc: Update comments about interworking and stub generation.
11387 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11388 considered as non-PIC.
11389 (Arm_relocate_functions::base_abs): Fix formatting.
11390 (Arm_relocate_functions::got_prel): Fix comment. Change interface
11391 of function to use GOT entry address instead of offset.
11392 (Target_arm::Scan::global): Issue an error if a symbol would need a
11393 PLT does not get one because it is untyped. Remove code to create
11394 dynamic symbols for relative branches.
11395 (Target_arm::Relocate::relocate: Use 0 instead of false since function
11396 takes unsigned integer instead of boolean.
11397
11398 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
11399
11400 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11401 (two_file_test_LDADD): Likewise.
11402 (common_test_1_LDADD): Likewise.
11403 (exception_test_LDADD) Likewise.
11404 (weak_test_LDADD): Likewise.
11405 (many_sections_test_LDADD): Likewise.
11406 (initpri1_LDADD): Likewise.
11407 (script_test_1_LDADD): Likewise.
11408 (script_test_2_LDADD): Likewise.
11409 (justsyms_LDADD): Likewise.
11410 (binary_test_LDADD): Likewise.
11411 (large_LDADD): Likewise.
11412 * testsuite/Makefile.in: Regenerated.
11413
11414 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
11415
11416 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11417 (Symbol_table::override_with_special): Likewise.
11418 (Symbol_table::add_from_object): Likewise.
11419
11420 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11421
11422 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11423 Don't set the data_offset twice.
11424
11425 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
11426
11427 * testsuite/Makefile.in: Regenerate.
11428
11429 2009-12-03 Doug Kwan <dougkwan@google.com>
11430
11431 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11432 (Target_arm::do_finalize_sections): Add parameter for symbol table
11433 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
11434 * i386.cc (Target_i386::do_finalize_sections): Add an additional
11435 parameter for symbol table pointer.
11436 * layout.cc (Layout::finalize): Call Target::finalize_sections with
11437 an additional parameter for a pointer to symbol table.
11438 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11439 parameter for a symbol table pointer.
11440 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11441 * target.h (Target::finalize_sections, Target::do_finalize_sections):
11442 Ditto.
11443 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11444 parameter for a symbol table pointer.
11445
11446 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
11447
11448 * incremental.cc (Incremental_inputs_header)
11449 (Incremental_inputs_header_write, Incremental_inputs_entry)
11450 (Incremental_inputs_entry_write): Move ...
11451 * incremental.h (Incremental_inputs_header)
11452 (Incremental_inputs_header_write, Incremental_inputs_entry)
11453 (Incremental_inputs_entry_write): here.
11454
11455 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11456
11457 * incremental.cc (make_sized_incremental_binary): Set the target.
11458 Error if it is incompatible.
11459 * output.h (Output_file): Add filename method.
11460
11461 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11462
11463 * incremental.cc (Incremental_inputs_entry): Remove unused argument
11464 from the get_* methods.
11465
11466 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11467
11468 * incremental-dump.cc (main): Check that the offeset of a script is 0.
11469 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11470 Write 0 for the data_offset of scripts.
11471
11472 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
11473
11474 * testsuite/Makefile.am: Add the incremental_test.sh test.
11475 * testsuite/incremental_test.sh: New.
11476 * testsuite/incremental_test_1.c: New.
11477 * testsuite/incremental_test_2.c: New.
11478
11479 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
11480
11481 * incremental-dump.cc (main): Fix typos.
11482
11483 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
11484
11485 PR gold/11025
11486 * incremental-dump.cc (main): Use llu to print 64 bit values.
11487
11488 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
11489 H.J. Lu <hongjiu.lu@intel.com>
11490
11491 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11492 $(LIBDL).
11493 (incremental_dump_LDADD): Likewise.
11494 * Makefile.in: Regenerated.
11495
11496 2009-11-25 Doug Kwan <dougkwan@google.com>
11497
11498 Revert:
11499
11500 2009-11-25 Doug Kwan <dougkwan@google.com>
11501
11502 * arm.cc (Target_arm::Target_arm): Move method definition
11503 outside of class definition. Add code to handle
11504 --target1-rel, --target1-abs and --target2= options.
11505 (Target_arm::get_reloc_reloc_type): Change method to be
11506 non-static and const.
11507 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11508 New data member declaration.
11509 (Target_arm::Scan::local, Target_arm::Scan::global,
11510 Target_arm::Relocate::relocate,
11511 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11512 Adjust call to Target_arm::get_real_reloc_type.
11513 (Target_arm::get_real_reloc_type): Use command line options
11514 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11515 * options.h (--target1-rel, --target1-abs, --target2): New
11516 ARM-only options.
11517
11518 2009-11-25 Doug Kwan <dougkwan@google.com>
11519
11520 * arm.cc (Target_arm::Target_arm): Move method definition outside of
11521 class definition. Add code to handle --target1-rel, --target1-abs
11522 and --target2= options.
11523 (Target_arm::get_reloc_reloc_type): Change method to be non-static
11524 and const.
11525 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11526 member declaration.
11527 (Target_arm::Scan::local, Target_arm::Scan::global,
11528 Target_arm::Relocate::relocate,
11529 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11530 call to Target_arm::get_real_reloc_type.
11531 (Target_arm::get_real_reloc_type): Use command line options to
11532 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11533 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11534 options.
11535
11536 2009-11-25 Doug Kwan <dougkwan@google.com>
11537
11538 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11539 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11540 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11541 formatting.
11542 (Arm_relocate_functions::thm_call): Replace body with a call to
11543 Arm_relocate_functions::thumb_branch_common.
11544 (Arm_relocate_functions::thm_jump24,
11545 Arm_relocate_functions::thm_xpc22): New method definitions.
11546 (Arm_relocate_functions::thumb_branch_common): New method definition.
11547 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11548 operator.
11549 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11550 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11551
11552 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11553
11554 * Makefile.am: Build incremental-dump
11555 * Makefile.in: Regenerate.
11556 * incremental-dump.cc: New.
11557 * incremental.cc (Incremental_inputs_header_data,
11558 Incremental_inputs_entry_data): Move to incremental.h
11559 * incremental.h: (Incremental_inputs_header_data,
11560 Incremental_inputs_entry_data): Move from incremental.cc
11561
11562 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11563
11564 * incremental.cc (Incremental_inputs_header,
11565 Incremental_inputs_header_write, Incremental_inputs_entry,
11566 Incremental_inputs_entry_write): Add a typedef with the data type.
11567
11568 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11569
11570 * incremental.cc (Incremental_inputs_header,
11571 Incremental_inputs_header_write, Incremental_inputs_entry,
11572 Incremental_inputs_entry_write): Update comment about which
11573 type has the filed descriptions.
11574
11575 2009-11-15 Doug Kwan <dougkwan@google.com>
11576
11577 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11578 (Arm_relocate_functions::arm_branch_common): Change method defintion
11579 in class definition to a method declaration and update list of formal
11580 parameters.
11581 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11582 Arm_relocation_functions::jump24): Adjust call to
11583 Arm_relocate_functions::arm_branch_common. Update list of formal
11584 parameters.
11585 (Arm_relocate_functions::xpc25): New method definition.
11586 (Arm_relocate_functions::arm_branch_common): Move method defintion
11587 out from class definition. Use stubs for mode-switching and extending
11588 branch ranges.
11589 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11590 specially. Change code to enable use of stubs in ARM branches.
11591
11592 2009-11-10 Doug Kwan <dougkwan@google.com>
11593
11594 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11595 in method declaration.
11596 (Target_arm::relocate_stub): New method declaration.
11597 (Target_arm::default_target): Change to return a pointer instead of
11598 a const reference.
11599 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11600 Target_arm::default_target.
11601 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11602 method definition.
11603 (Target_arm::relocate_section): Adjust view.
11604 (Target_arm::relocate_stub): New method definition.
11605
11606 2009-11-10 Doug Kwan <dougkwan@google.com>
11607
11608 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11609 a format warning.
11610 * incremental.cc (open_incremental_binary): Initialized local
11611 variables to avoid warnings.
11612 * object.cc (make_elf_object): Ditto.
11613 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11614 a format warning.
11615
11616 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11617
11618 PR gold/10930
11619 * testsuite/plugin_test.c: Include "config.h".
11620
11621 2009-11-09 Doug Kwan <dougkwan@google.com>
11622
11623 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11624 (arm_symbol_value): Remove.
11625 (Arm_relocate_functions::arm_branch_common,
11626 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11627 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11628 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11629 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11630 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11631 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11632 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11633 Arm_relocate_functions::thm_mobw_abs_nc,
11634 Arm_relocate_functions::thm_mov_abs,
11635 Arm_relocate_functions::movw_prel_nc,
11636 Arm_relocate_functions::thm_movt_abs,
11637 Arm_relocate_functions::movt_prel,
11638 Arm_relocate_functions::thm_movw_prel_nc,
11639 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11640 (Target_arm::Relocate::relocate): Only decompose address into two
11641 parts if relocation type uses the thumb-bit and pass the actual
11642 bit instead of a flag indicating that the thumb-bit is used. Adjust
11643 calls to methods in Arm_relocate_functions for this change.
11644
11645 2009-11-08 Ian Lance Taylor <iant@google.com>
11646
11647 PR 10925
11648 * reloc.cc: Instantiate
11649 Sized_relobj::initialize_input_to_output_maps and
11650 Sized_relobj:free_input_to_output_maps.
11651
11652 2009-11-06 Ian Lance Taylor <iant@google.com>
11653
11654 PR 10876
11655 * defstd.cc (in_segment): Set only_if_ref true for "end".
11656
11657 2009-11-06 Doug Kwan <dougkwan@google.com>
11658
11659 * arm.cc (class Reloc_stub): Correct a comment.
11660 (Target_arm::Target_arm): Initialize arm_input_section_map_.
11661 (Target_arm::scan_section_for_stubs): New method declaration.
11662 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11663 Change methods from private to protected.
11664 (Target_arm::do_may_relax): New method definition.
11665 (Target_arm::do_relax, Target_arm::group_sections,
11666 Target_arm::scan_reloc_for_stub,
11667 Target_arm::scan_reloc_section_for_stubs): New method declarations.
11668 (Target_arm::arm_input_section_map_): New data member declaration.
11669 (Target_arm::scan_reloc_for_stub,
11670 Target_arm::scan_reloc_section_for_stubs,
11671 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11672 Target_arm::do_relax): New method definitions.
11673
11674 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
11675
11676 * configure.ac: Check for (struct stat)::st_mtim
11677 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11678 * config.in: Regenerate.
11679 * configure: Regenerate.
11680
11681 2009-11-05 Ian Lance Taylor <iant@google.com>
11682
11683 PR 10910
11684 * output.cc (Output_segment::add_output_section): Add missing
11685 return statement.
11686
11687 2009-11-04 Ian Lance Taylor <iant@google.com>
11688
11689 PR 10880
11690 * object.h (class Object): Add is_needed and set_is_needed
11691 methods. Add is_needed_ field. Make bool fields into bitfields.
11692 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11693 defined in a dynamic object and referenced by a regular object,
11694 set is_needed for the dynamic object.
11695 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11696 if the file is marked with as_needed and it is not needed.
11697
11698 2009-11-04 Ian Lance Taylor <iant@google.com>
11699
11700 PR 10887
11701 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11702 tags if data is discarded by linker script.
11703 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11704 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11705 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11706 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11707
11708 2009-11-04 Ian Lance Taylor <iant@google.com>
11709
11710 * layout.cc (Layout::get_output_section): Add is_interp and
11711 is_dynamic_linker_section parameters. Change all callers.
11712 (Layout::choose_output_section): Likewise.
11713 (Layout::make_output_section): Likewise.
11714 (Layout::add_output_section_data): Add is_dynamic_linker_section
11715 parameter. Change all callers.
11716 * layout.h (class Layout): Update declarations.
11717 * output.h (class Output_section): Add is_interp, set_is_interp,
11718 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11719 Add is_interp_, is_dynamic_linker_section_ fields. Change
11720 generate_code_fills_at_write_ to a bitfield.
11721 * output.cc (Output_section::Output_sections): Initialize new
11722 fields.
11723 (Output_segment::add_output_section): Add do_sort parameter.
11724 Change all callers.
11725
11726 2009-11-03 Ian Lance Taylor <iant@google.com>
11727
11728 PR 10860
11729 * options.h (class General_options): Add --warn-common.
11730 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11731 merging two common symbols.
11732 (Symbol_table::should_override): Handle --warn-common when merging
11733 a common symbol with a defined symbol. Use report_resolve_problem
11734 for multiple definitions.
11735 (Symbol_table::report_resolve_problem): New function.
11736 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11737
11738 2009-11-03 Doug Kwan <dougkwan@google.com>
11739
11740 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11741 stub_factory_.
11742 (Target_arm::stub_factory): New method definition.
11743 (Target_arm::new_arm_input_section,
11744 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11745 Target_arm::reloc_uses_thumb_bit): New method declarations.
11746 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11747 New type definitions.
11748 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11749 member declarations.
11750 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11751 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11752 New method definitions.
11753
11754 2009-11-03 Ian Lance Taylor <iant@google.com>
11755
11756 * options.h (class General_options): Add --warn_constructors.
11757
11758 2009-11-03 Ian Lance Taylor <iant@google.com>
11759
11760 PR 10893
11761 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11762 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11763
11764 2009-11-03 Ian Lance Taylor <iant@google.com>
11765
11766 PR 10895
11767 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11768 --msgid-bugs-address.
11769 (install-pdf): New target.
11770 (install-data_yes): Look up one directory to find mkinstalldirs.
11771
11772 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11773
11774 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11775 tree.
11776
11777 2009-10-30 Doug Kwan <dougkwan@google.com>
11778
11779 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11780
11781 2009-10-30 Doug Kwan <dougkwan@google.com>
11782
11783 * arm.cc (Stub_addend_reader): New struct template definition
11784 and partial specializations.
11785 (Stub_addend_reader::operator()): New method definition for a
11786 partially specialized template.
11787
11788 2009-10-30 Doug Kwan <dougkwan@google.com>
11789
11790 * arm.cc (Arm_relobj::processor_specific_flags): New method
11791 definition.
11792 (Arm_relobj::do_read_symbols): New method declaration.
11793 (Arm_relobj::processor_specific_flags_): New data member declaration.
11794 (Arm_dynobj): New class definition.
11795 (Target_arm::do_finalize_sections): Add input_objects parameter.
11796 (Target_arm::do_adjust_elf_header): New method declaration.
11797 (Target_arm::are_eabi_versions_compatible,
11798 (Target_arm::merge_processor_specific_flags): New method declaration.
11799 (Target_arm::do_make_elf_object): New overloaded method definitions
11800 and declaration.
11801 (Arm_relobj::do_read_symbols): New method definition.
11802 (Arm_dynobj::do_read_symbols): Ditto.
11803 (Target_arm::do_finalize_sections): Add input_objects parameters.
11804 Merge processor-specific flags from all input objects.
11805 (Target_arm::are_eabi_versions_compatible,
11806 Target_arm::merge_processor_specific_flags,
11807 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11808 New method definitions.
11809 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11810 Input_objects pointer type parameter.
11811 * layout.cc (Layout::finalize): Pass input objects to target's.
11812 finalize_sections function.
11813 * output.cc (Output_file_header::do_sized_write): Set ELF file
11814 header's processor-specific flags.
11815 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11816 Input_objects pointer type parameter.
11817 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11818 * target.h (Input_objects): New forward class declaration.
11819 (Target::processor_specific_flags,
11820 Target::are_processor_specific_flags_sect): New method definitions.
11821 (Target::finalize_sections): Add input_objects parameter.
11822 (Target::Target): Initialize processor_specific_flags_ and
11823 are_processor_specific_flags_set_.
11824 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11825 parameter.
11826 (Target::set_processor_specific_flags): New method definition.
11827 (Target::processor_specific_flags_,
11828 Target::are_processor_specific_flags_set_): New data member
11829 declarations.
11830 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11831 Input_objects pointer type parameter.
11832
11833 2009-10-30 Doug Kwan <dougkwan@google.com>
11834
11835 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11836
11837 2009-10-28 Ian Lance Taylor <iant@google.com>
11838
11839 * object.h (class Relobj): Drop options parameter from
11840 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11841 do_scan_relocs, do_relocate. Change all callers.
11842 (class Sized_relobj): Drop options parameters from
11843 do_gc_process_relocs, do_scan_relocs, do_relocate,
11844 do_relocate_sections, relocate_sections, emit_relocs_scan,
11845 emit_relocs_scan_reltype. Change all callers.
11846 (struct Relocate_info): Remove options field and all references to
11847 it.
11848 * reloc.h (class Read_relocs): Remove options constructor
11849 parameter and options_ field. Change all callers.
11850 (class Gc_process_relocs, class Scan_relocs): Likewise.
11851 (class Relocate_task): Likewise.
11852 * target-reloc.h (scan_relocs): Remove options parameter. Change
11853 all callers.
11854 (scan_relocatable_relocs): Likewise.
11855 * target.h (class Sized_target): Remove options parameter from
11856 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11857 all callers.
11858 * gc.h (gc_process_relocs): Remove options parameter. Change all
11859 callers.
11860 * arm.cc: Update functions to remove options parameters.
11861 * i386.cc: Likewise.
11862 * powerpc.cc: Likewise.
11863 * sparc.cc: Likewise.
11864 * x86_64.cc: Likewise.
11865 * testsuite/testfile.cc: Likewise.
11866
11867 2009-10-28 Doug Kwan <dougkwan@google.com>
11868
11869 * arm.cc (Arm_relobj): New class definition.
11870 (Arm_relobj::scan_sections_for_stubs,
11871 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11872 New method definitions.
11873
11874 2009-10-28 Cary Coutant <ccoutant@google.com>
11875
11876 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11877 (Plugin::cleanup_done_): New member.
11878 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11879 (Plugin_manager::cleanup_done_): Remove.
11880 (Plugin_manager::add_input_file): Edit error message.
11881 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11882 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11883
11884 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11885
11886 * fileread.cc: (File_read::View::~View): Use the new
11887 data_ownership_ filed.
11888 (File_read::~File_read): Dispose the new whole_file_view_.
11889 (File_read::open): Mmap the whole file if needed.
11890 (File_read::open): Use whole_file_view_ instead of contents_.
11891 (File_read::find_view): Use whole_file_view_ if applicable.
11892 (File_read::do_read): Use whole_file_view_ instead of contents_.
11893 (File_read::make_view): Use whole_file_view_ instead of contents_,
11894 update File_read::View::View call.
11895 (File_read::find_or_make_view): Update File_read::View::View
11896 call.
11897 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11898 remove contents_
11899 (File_read::View::Data_ownership): New enum.
11900 (File_read::View::View): Replace bool mapped_ with Data_ownership
11901 argument.
11902 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11903 (File_read::View::data_ownership_): New field.
11904 (File_read::contents_): Remove (replaced by whole_file_view_).
11905 (File_read::whole_file_view_): New field.
11906 * options.h (class General_options): Add --keep-files-mapped.
11907
11908 2009-10-27 Cary Coutant <ccoutant@google.com>
11909
11910 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11911 * testsuite/Makefile.am (plugin_test_5): New test case.
11912 * testsuite/Makefile.in: Regenerate.
11913
11914 2009-10-25 Doug Kwan <dougkwan@google.com>
11915
11916 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11917 from private to protected to allow access by child class.
11918 (Sized_relobj::do_relocate_sections): New method declaration.
11919 (Sized_relobj::relocate_sections): Virtualize.
11920 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11921 Sized_relobj::relocate_sections. Instantiate template explicitly
11922 for different target sizes and endianity.
11923
11924 2009-10-24 Doug Kwan <dougkwan@google.com>
11925
11926 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11927 (Arm_input_section::as_arm_input_section): New method.
11928 (Arm_output_section): New class definition.
11929 (Arm_output_section::create_stub_group,
11930 Arm_output_section::group_sections): New method definitions.
11931
11932 2009-10-22 Doug Kwan <dougkwan@google.com>
11933
11934 * arm.cc (Arm_input_section): New class definition.
11935 (Arm_input_section::init, Arm_input_section:do_write,
11936 Arm_input_section::set_final_data_size,
11937 Arm_input_section::do_reset_address_and_file_offset): New method
11938 definitions.
11939
11940 2009-10-21 Doug Kwan <dougkwan@google.com>
11941
11942 * arm.cc (Stub_table, Arm_input_section): New forward class
11943 declarations.
11944 (Stub_table): New class defintion.
11945 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11946 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11947 New method definition.
11948
11949 2009-10-21 Doug Kwan <dougkwan@google.com>
11950
11951 * arm.cc: Update copyright comments.
11952 (Target_arm): New forward class template declaration.
11953 (Arm_address): New type.
11954 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11955 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11956 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11957 constants.
11958 (Insn_template): Same.
11959 (DEF_STUBS): New macro.
11960 (Stub_type): New enum type.
11961 (Stub_template): New class definition.
11962 (Stub): Same.
11963 (Reloc_stub): Same.
11964 (Stub_factory): Same.
11965 (Target_arm::Target_arm): Initialize may_use_blx_ and
11966 should_force_pic_veneer_.
11967 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11968 Target_arm::should_force_pic_veneer,
11969 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11970 Target_arm::using_thumb_only, Target_arm:;default_target): New
11971 method defintions.
11972 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11973 New data member declarations.
11974 (Insn_template::size, Insn_template::alignment): New method defintions.
11975 (Stub_template::Stub_template): New method definition.
11976 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11977 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11978 (Stub_factory::Stub_factory): New method definition.
11979 * gold.h (string_hash): New template.
11980 * output.h (Input_section_specifier::hash_value): Use
11981 gold::string_hash.
11982 (Input_section_specifier::string_hash): Remove.
11983 * stringpool.cc (Stringpool_template::string_hash): Use
11984 gold::string_hash.
11985
11986 2009-10-20 Doug Kwan <dougkwan@google.com>
11987
11988 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11989 symbols of relaxed input sections.
11990 * output.h (Output_section::find_relaxed_input_section): Make
11991 method public.
11992
11993 2009-10-16 Doug Kwan <dougkwan@google.com>
11994
11995 * dynobj.cc (Versions::Versions): Initialize version_script_.
11996 Only insert base version symbol definition for a shared object
11997 if version script defines any version versions.
11998 (Versions::define_base_version): New method definition.
11999 (Versions::add_def): Check that base version is not needed.
12000 (Versions::add_need): Define base version lazily.
12001 * dynobj.h (Versions::define_base_version): New method declaration.
12002 (Versions::needs_base_version_): New data member declaration.
12003 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12004 (check_DATA): Add no_version_test.stdout.
12005 (libno_version_test.so, no_version_test.o no_version_test.stdout):
12006 New make rules.
12007 * testsuite/Makefile.in: Regenerate.
12008 * testsuite/no_version_test.c: New file.
12009 * testsuite/no_version_test.sh: Ditto.
12010
12011 2009-10-16 Doug Kwan <dougkwan@google.com>
12012
12013 * expression.cc (class Segment_start_expression): New class definition.
12014 (Segment_start_expression::value): New method definition.
12015 (script_exp_function_segment_start): Return a new
12016 Segment_start_expression.
12017 * gold/script-c.h (script_saw_segment_start_expression): New function
12018 prototype.
12019 * script-sections.cc (Script_sections::Script_sections): Initialize
12020 SAW_SEGMENT_START_EXPRESSION_ to false.
12021 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12022 and -Tbbs options to specify section addresses if given in
12023 command line and no SEGMENT_START expression is seen in a script.
12024 * script-sections.h (Script_sections::saw_segment_start_expression,
12025 Script_sections::set_saw_segment_start_expression): New method
12026 definition.
12027 (Script_sections::saw_segment_start_expression_): New data member
12028 declaration.
12029 * script.cc (script_saw_segment_start_expression): New function.
12030 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12031 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12032 script_test_7.sh and script_test_8.sh.
12033 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12034 script_test_8.stdout.
12035 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12036 (script_test_6, script_test_6.stdout, script_test_7,
12037 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12038 * Makefile.in: Regenerate.
12039 * testsuite/script_test_6.sh: New file.
12040 * testsuite/script_test_6.t: Same.
12041 * testsuite/script_test_7.sh: Same.
12042 * testsuite/script_test_7.t: Same.
12043 * testsuite/script_test_8.sh: Same.
12044
12045 2009-10-16 Doug Kwan <dougkwan@google.com>
12046
12047 * output.cc (Output_segment::set_section_list_address): Cast
12048 expressions to unsigned long long type to avoid format warnings.
12049
12050 2009-10-15 Ian Lance Taylor <iant@google.com>
12051
12052 * script.cc (Script_options::add_symbol_assignment): Always add a
12053 dot assignment to script_sections_.
12054 * script-sections.cc (Script_sections::add_dot_assignment):
12055 Initialize if necessary.
12056
12057 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12058 program headers with no load segment if there is a linker script.
12059
12060 * layout.cc (Layout::set_segment_offsets): Align the file offset
12061 to the segment aligment for -N or -n with no load segment.
12062 * output.cc (Output_segment::add_output_section): Don't crash if
12063 the first section is a TLS section.
12064 (Output_segment::set_section_list_addresses): Print an error
12065 message if the address moves backward in a linker script.
12066 * script-sections.cc
12067 (Output_section_element_input::set_section_addresses): Don't
12068 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12069 (Orphan_output_section::set_section_addresses): Likewise.
12070
12071 2009-10-15 Doug Kwan <dougkwan@google.com>
12072
12073 * layout.cc (Layout::finish_dynamic_section): Generate tags
12074 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12075 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12076 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12077
12078 2009-10-14 Ian Lance Taylor <iant@google.com>
12079
12080 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12081 fields.
12082 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12083 data_shdr fields of relinfo.
12084 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12085 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12086 R_386_TLS_LDO_32, adjust based on section flags.
12087 (Target_i386::Relocate::fix_up_ldo): Remove.
12088
12089 2009-10-13 Ian Lance Taylor <iant@google.com>
12090
12091 Add support for -pie.
12092 * options.h (class General_options): Add -pie and
12093 --pic-executable.
12094 (General_options::output_is_position_independent): Test -pie.
12095 (General_options::output_is_executable): Return true if not shared
12096 and not relocatable.
12097 (General_options::output_is_pie): Remove.
12098 * options.cc (General_options::finalize): Reject incompatible uses
12099 of -pie.
12100 * gold.cc (queue_middle_tasks): A -pie link is not static.
12101 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12102 * symtab.cc (Symbol::final_value_is_known): Return false if
12103 output_is_position_independent.
12104 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12105 output_is_position_independent.
12106 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12107 output_is_position_independent.
12108 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12109 output_is_position_independent.
12110 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12111 two_file_pie_test.
12112 (basic_pie_test.o, basic_pie_test): New targets.
12113 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12114 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12115 (two_file_pie_test): New target.
12116 * testsuite/Makefile.in: Rebuild.
12117 * README: Remove note saying that -pie is not supported.
12118
12119 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
12120
12121 * options.h (class General_options): Add -init and -fini.
12122 * layout.cc (Layout::finish_dynamic_section): Emit
12123 given init and fini functions.
12124
12125 2009-10-13 Sriraman Tallam <tmsriram@google.com>
12126
12127 * gc.h (gc_process_relocs): Check if icf is enabled using new
12128 function.
12129 * gold.cc (queue_initial_tasks): Likewise.
12130 (queue_middle_tasks): Likewise.
12131 * object.cc (do_layout): Likewise.
12132 * symtab.cc (is_section_folded): Likewise.
12133 * main.cc (main): Likewise.
12134 * reloc.cc (Read_relocs::run): Likewise.
12135 (Sized_relobj::do_scan_relocs): Likewise.
12136 * icf.cc (is_function_ctor_or_dtor): New function.
12137 (Icf::find_identical_sections): Check if function is ctor or dtor when
12138 safe icf is chosen.
12139 * options.h (General_options::icf): Change option to be an enum.
12140 (Icf_status): New enum.
12141 (icf_enabled): New method.
12142 (icf_safe_folding): New method.
12143 (set_icf_status): New method.
12144 (icf_status_): New variable.
12145 * (options.cc) (General_options::finalize): Set icf_status_.
12146 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12147 icf_test and icf_keep_unique_test to use the --icf enum flag.
12148 * testsuite/icf_safe_test.sh: New file.
12149 * testsuite/icf_safe_test.cc: New file.
12150
12151 2009-10-12 Sriraman Tallam <tmsriram@google.com>
12152
12153 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12154 includes to gc.h and icf.h.
12155 * arm.cc: Include gc.h.
12156 * gold.cc: Likewise.
12157 * i386.cc: Likewise.
12158 * powerpc.cc: Likewise.
12159 * sparc.cc: Likewise.
12160 * x86_64.cc: Likewise.
12161 * gc.h: Include icf.h.
12162
12163 2009-10-11 Ian Lance Taylor <iant@google.com>
12164
12165 * plugin.cc: Include "gold.h" before other header files.
12166
12167 2009-10-10 Chris Demetriou <cgd@google.com>
12168
12169 * options.h (Input_file_argument::Input_file_type): New enum.
12170 (Input_file_argument::is_lib_): Replace with...
12171 (Input_file_argument::type_): New member.
12172 (Input_file_argument::Input_file_argument): Take Input_file_type
12173 'type' rather than boolean 'is_lib' as second argument.
12174 (Input_file_argument::is_lib): Use type_.
12175 (Input_file_argument::is_searched_file): New function.
12176 (Input_file_argument::may_need_search): Handle is_searched_file.
12177 * options.cc (General_options::parse_library): Support -l:filename.
12178 (General_options::parse_just_symbols): Update for Input_file_argument
12179 changes.
12180 (Command_line::process): Likewise.
12181 * archive.cc (Archive::get_file_and_offset): Likewise.
12182 * plugin.cc (Plugin_manager::release_input_file): Likewise.
12183 * script.cc (read_script_file, script_add_file): Likewise.
12184 * fileread.cc (Input_file::Input_file): Likewise.
12185 (Input_file::will_search_for): Handle is_searched_file.
12186 (Input_file::open): Likewise.
12187 * readsyms.cc (Read_symbols::get_name): Likewise.
12188 * testsuite/Makefile.am (searched_file_test): New test.
12189 * testsuite/Makefile.in: Regenerate.
12190 * testsuite/searched_file_test.cc: New file.
12191 * testsuite/searched_file_test_lib.cc: New file.
12192
12193 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12194 Ian Lance Taylor <iant@google.com>
12195
12196 * descriptor.cc: Include <cstdio> and "binary-io.h".
12197 (Descriptors::open): Open the files in binary mode always.
12198 * script.cc (Lex::get_token): Treat \r as whitespace.
12199
12200 2009-10-09 Ian Lance Taylor <iant@google.com>
12201
12202 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12203
12204 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12205 Ian Lance Taylor <iant@google.com>
12206
12207 * configure.ac: Check for readv function also.
12208 * fileread.cc (readv): Define if not HAVE_READV.
12209 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12210 does not exist.
12211 * config.in: Regenerate.
12212 * configure: Regenerate.
12213
12214 2009-10-09 Doug Kwan <dougkwan@google.com>
12215
12216 * layout.cc (Layout::make_output_section): Call target hook to make
12217 ordinary output section.
12218 (Layout::finalize): Adjust parameter list of call the
12219 Target::may_relax().
12220 * layout.h (class Layout::section_list): New method.
12221 * merge.h (Output_merge_base::entsize): Change visibility to public.
12222 (Output_merge_base::is_string, Output_merge_base::do_is_string):
12223 New methods.
12224 (Output_merge_string::do_is_string): New method.
12225 * object.cc (Sized_relobj::do_setup): renamed from
12226 Sized_relobj::set_up.
12227 * object.h (Sized_relobj::adjust_shndx,
12228 Sized_relobj::initializ_input_to_output_maps,
12229 Sized_relobj::free_input_to_output_maps): Change visibilities to
12230 protected.
12231 (Sized_relobj::setup): Virtualize.
12232 (Sized_relobj::do_setup): New method declaration.
12233 (Sized_relobj::invalidate_section_offset,
12234 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12235 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12236 * options.cc (parse_int): New function.
12237 * options.h (parse_int): New declaration.
12238 (DEFINE_int): New macro.
12239 (stub_group_size): New option.
12240 * output.cc (Output_section::Output_section): Initialize memebers
12241 merge_section_map_, merge_section_by_properties_map_,
12242 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12243 (Output_section::add_input_section): Handled deferred code-fill
12244 generation and remove an old comment.
12245 (Output_section::add_relaxed_input_section): New method definition.
12246 (Output_section::add_merge_input_section): Use merge section by
12247 properties map to speed to search. Update merge section maps
12248 as appropriate.
12249 (Output_section::build_relaxation_map): New method definition.
12250 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12251 Same.
12252 (Output_section::relax_input_section): Renamed to
12253 Output_section::convert_input_sections_to_relaxed_sections and change
12254 interface to take a vector of pointers to relaxed sections.
12255 (Output_section::find_merge_section,
12256 Output_section::find_relaxed_input_section): New method definitions.
12257 (Output_section::is_input_address_mapped,
12258 Output_section::output_offset, Output_section::output_address):
12259 Use output section data maps to speed up searching.
12260 (Output_section::find_starting_output_address): Add comments.
12261 (Output_section::do_write,
12262 Output_section::write_to_postprocessing_buffer): Do code-fill
12263 generation as appropriate.
12264 (Output_section::get_input_sections): Invalidate relaxed input section
12265 map.
12266 (Output_section::restore_states): Adjust type of checkpoint .
12267 Invalidate relaxed input section map.
12268 * output.h (Output_merge_base): New class declaration.
12269 (Input_section_specifier): New class defintion.
12270 (class Output_relaxed_input_section) Change base class to
12271 Output_section_data_build.
12272 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12273 base class initializer.
12274 (Output_section::add_relaxed_input_section): New method declaration.
12275 (Output_section::Input_section): Change visibility to protected.
12276 (Output_section::Input_section::relobj,
12277 Output_section::Input_section::shndx): Handle relaxed input sections.
12278 Output_section::input_sections) Change visibility to protected. Also
12279 define overload to return a non-const pointer.
12280 (Output_section::Merge_section_properties): New class defintion.
12281 (Output_section::Merge_section_by_properties_map,
12282 Output_section::Output_section_data_by_input_section_map,
12283 Output_section::Relaxation_map): New types.
12284 (Output_section::relax_input_section): Rename method to
12285 Output_section::convert_input_sections_to_relaxed_sections and change
12286 interface to take a vector of relaxed section pointers.
12287 (Output_section::find_merge_section,
12288 Output_section::find_relaxed_input_section,
12289 Output_section::build_relaxation_map,
12290 Output_section::convert_input_sections_in_list_to_relaxed_sections):
12291 New method declarations.
12292 (Output_section::merge_section_map_
12293 Output_section::merge_section_by_properties_map_,
12294 Output_section::relaxed_input_section_map_,
12295 Output_section::is_relaxed_input_section_map_valid_,
12296 Output_section::generate_code_fills_at_write_): New data members.
12297 * script-sections.cc
12298 (Output_section_element_input::set_section_addresses): Call
12299 current_data_size and addralign methods of relaxed input sections.
12300 (Orphan_output_section::set_section_addresses): Call current_data_size
12301 and addralign methods of relaxed input sections.
12302 * symtab.cc (Symbol_table::compute_final_value): Extract template
12303 from the body of Symbol_table::sized_finalize_symbol.
12304 (Symbol_table::sized_finalized_symbol): Call
12305 Symbol_table::compute_final_value.
12306 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12307 (Symbol_table::compute_final_value): New templated method declaration.
12308 * target.cc (Target::do_make_output_section): New method defintion.
12309 * target.h (Target::make_output_section): New method declaration.
12310 (Target::relax): Add more parameters for input objects, symbol table
12311 and layout. Adjust call to do_relax.
12312 (Target::do_make_output_section): New method declaration.
12313 (Target::do_relax): Add parameters for input objects, symbol table
12314 and layout.
12315
12316 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12317
12318 * pread.c: Include stdio.h.
12319
12320 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12321
12322 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12323 defined.
12324
12325 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12326
12327 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12328 Change read_shndx type to unsigned int.
12329 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12330 int.
12331 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12332 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12333 Change read_shndx type to unsigned int.
12334 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12335 int.
12336 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12337 * layout.cc (Layout::create_symtab_sections): Cast the result of
12338 local_symcount * symsize to off_t in the gold_assert.
12339
12340 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12341
12342 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12343 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12344 R_ARM_BASE_ABS.
12345 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12346 (Arm_relocate_functions::thm_abs5): New function.
12347 (Arm_relocate_functions::abs12): New function.
12348 (Arm_relocate_functions::abs16): New function.
12349 (Arm_relocate_functions::base_abs): New function.
12350 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12351 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
12352 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12353 R_ARM_BASE_ABS.
12354 (Scan::global): Likewise.
12355 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12356 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12357 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12358 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12359 R_ARM_BASE_ABS.
12360
12361 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12362
12363 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12364 (Arm_relocate_functions::movt_prel): New function.
12365 (Arm_relocate_functions::thm_movw_prel_nc): New function.
12366 (Arm_relocate_functions::thm_movt_prel): New function.
12367 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12368 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12369 (Scan::global, Relocate::relocate): Likewise.
12370 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12371
12372 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12373
12374 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12375 Incremental_checker.
12376 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12377 unsigned int.
12378 (class Incremental_inputs_header): New class.
12379 (Incremental_inputs_header_writer): Edit comment.
12380 (Incremental_inputs_entry): New class.
12381 (Incremental_inputs_entry_writer): Edit comment.
12382 (Sized_incremental_binary::do_find_incremental_inputs_section):
12383 Add *strtab_shndx parameter, fill it.
12384 (Sized_incremental_binary::do_check_inputs): New method.
12385 (Incremental_checker::can_incrementally_link_output_file): Use
12386 Sized_incremental_binary::check_inputs.
12387 (Incremental_inputs::report_command_line): Save command line in
12388 command_line_.
12389 * incremental.h:
12390 (Incremental_binary::find_incremental_inputs_section): New
12391 method.
12392 (Incremental_binary::do_find_incremental_inputs_section): Add
12393 strtab_shndx parameter.
12394 (Incremental_binary::do_check_inputs): New pure virtual method.
12395 (Sized_incremental_binary::do_check_inputs): Declare.
12396 (Incremental_checker::Incremental_checker): Add incremental_inputs
12397 parameter, use it to initialize incremental_inputs_.
12398 (Incremental_checker::incremental_inputs_): New field.
12399 (Incremental_checker::command_line): New method.
12400 (Incremental_checker::inputs): New method.
12401 (Incremental_checker::command_line_): New field.
12402
12403 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
12404
12405 * incremental.cc: Include <cstdarg> and "target-select.h".
12406 (vexplain_no_incremental): New function.
12407 (explain_no_incremental): New function.
12408 (Incremental_binary::error): New method.
12409 (Sized_incremental_binary::do_find_incremental_inputs_section): New
12410 method.
12411 (make_sized_incremental_binary): New function.
12412 (open_incremental_binary): New function.
12413 (can_incrementally_link_file): Add checks if output is ELF and has
12414 inputs section.
12415 * incremental.h: Include "elfcpp_file.h" and "output.h".
12416 (Incremental_binary): New class.
12417 (Sized_incremental_binary): New class.
12418 (open_incremental_binary): Declare.
12419 * object.cc (is_elf_object): Use
12420 elfcpp::Elf_recognizer::is_elf_file.
12421 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12422 * output.h (Output_file::filesize): New method.
12423
12424 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12425
12426 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12427 New function.
12428 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12429 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12430 function.
12431 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12432 function.
12433 (Arm_relocate_functions::movw_abs_nc): New function.
12434 (Arm_relocate_functions::movt_abs): New function.
12435 (Arm_relocate_functions::thm_movw_abs_nc): New function.
12436 (Arm_relocate_functions::thm_movt_abs): New function.
12437 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12438 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12439 (Scan::global): Likewise.
12440 (Relocate::relocate): Likewise.
12441 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12442
12443 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12444
12445 * arm.cc (Arm_relocate_functions::got_prel) New function.
12446 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12447 (Relocate::relocate): Likewise.
12448 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12449
12450 2009-10-06 Ian Lance Taylor <iant@google.com>
12451
12452 * options.h (class General_options): Define
12453 split_stack_adjust_size parameter.
12454 * object.h (class Object): Add uses_split_stack_ and
12455 has_no_split_stack_ fields. Add uses_split_stack and
12456 has_no_split_stack accessor functions. Declare
12457 handle_split_stack_section.
12458 (class Reloc_symbol_changes): Define.
12459 (class Sized_relobj): Define Function_offsets. Declare
12460 split_stack_adjust, split_stack_adjust_reltype, and
12461 find_functions.
12462 * object.cc (Object::handle_split_stack_section): New function.
12463 (Sized_relobj::do_layout): Call handle_split_stack_section.
12464 * dynobj.cc (Sized_dynobj::do_layout): Call
12465 handle_split_stack_section.
12466 * reloc.cc (Sized_relobj::relocate_sections): Call
12467 split_stack_adjust for executable sections in split_stack
12468 objects. Pass reloc_map to relocate_section.
12469 (Sized_relobj::split_stack_adjust): New function.
12470 (Sized_relobj::split_stack_adjust_reltype): New function.
12471 (Sized_relobj::find_functions): New function.
12472 * target-reloc.h: Include "object.h".
12473 (relocate_section): Add reloc_symbol_changes parameter. Change
12474 all callers.
12475 * target.h (class Target): Add calls_non_split method. Declare
12476 do_calls_non_split virtual method. Declare match_view and
12477 set_view_to_nop.
12478 * target.cc: Include "elfcpp.h".
12479 (Target::do_calls_non_split): New function.
12480 (Target::match_view): New function.
12481 (Target::set_view_to_nop): New function.
12482 * gold.cc (queue_middle_tasks): Give an error if mixing
12483 split-stack and non-split-stack objects with -r.
12484 * i386.cc (Target_i386::relocate_section): Add
12485 reloc_symbol_changes parameter.
12486 (Target_i386::do_calls_non_split): New function.
12487 * x86_64.cc (Target_x86_64::relocate_section): Add
12488 reloc_symbol_changes parameter.
12489 (Target_x86_64::do_calls_non_split): New function.
12490 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12491 parameter.
12492 * powerpc.cc (Target_powerpc::relocate_section): Add
12493 reloc_symbol_changes parameter.
12494 * sparc.cc (Target_sparc::relocate_section): Add
12495 reloc_symbol_changes parameter.
12496 * configure.ac: Call AM_CONDITIONAL for the default target.
12497 * configure: Rebuild.
12498 * testsuite/Makefile.am (TEST_AS): New variable.
12499 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12500 (check_DATA): Add split_i386 and split_x86_64 files.
12501 (SPLIT_DEFSYMS): Define.
12502 (split_i386_[1234n].o): New targets.
12503 (split_i386_[124]): New targets.
12504 (split_i386_[1234r].stdout): New targets.
12505 (split_x86_64_[1234n].o): New targets.
12506 (split_x86_64_[124]): New targets.
12507 (split_x86_64_[1234r].stdout): New targets.
12508 (MOSTLYCLEANFILES): Add new executables.
12509 * testsuite/split_i386.sh: New file.
12510 * testsuite/split_x86_64.sh: New file.
12511 * testsuite/split_i386_1.s: New file.
12512 * testsuite/split_i386_2.s: New file.
12513 * testsuite/split_i386_3.s: New file.
12514 * testsuite/split_i386_4.s: New file.
12515 * testsuite/split_i386_n.s: New file.
12516 * testsuite/split_x86_64_1.s: New file.
12517 * testsuite/split_x86_64_2.s: New file.
12518 * testsuite/split_x86_64_3.s: New file.
12519 * testsuite/split_x86_64_4.s: New file.
12520 * testsuite/split_x86_64_n.s: New file.
12521 * testsuite/testfile.cc (Target_test): Update relocation_section
12522 function.
12523 * testsuite/Makefile.in: Rebuild.
12524
12525 2009-10-06 Ian Lance Taylor <iant@google.com>
12526
12527 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12528 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12529 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
12530 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12531 the address on ldo_addrs_.
12532 (Target_i386::Relocate::fix_up_ldo): New function.
12533
12534 2009-10-06 Rafael Espindola <espindola@google.com>
12535
12536 * plugin.cc (add_input_library): New.
12537 (Plugin::load): Add add_input_library to tv.
12538 (Plugin_manager::add_input_file): Add the is_lib argument.
12539 (add_input_file): Update call to Plugin_manager::add_input_file.
12540 (add_input_library): New.
12541 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12542
12543 2009-09-30 Doug Kwan <dougkwan@google.com>
12544
12545 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12546 symbol and call Symbol::may_need_copy_reloc to determine if
12547 a copy reloc is needed.
12548 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12549 nocopyreloc is given in command line.
12550 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12551 given in command line.
12552 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12553 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12554 of the removed Target_i386::may_need_copy_reloc.
12555 * options.h (copyreloc): New option with default value false.
12556 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12557 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12558 instead of the removed Target_powerpc::may_need_copy_reloc.
12559 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12560 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12561 instead of the removed Target_sparc::may_need_copy_reloc.
12562 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12563 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12564 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12565 instead of the removed Target_x86_64::may_need_copy_reloc.
12566
12567 2009-09-30 Ian Lance Taylor <iant@google.com>
12568
12569 * object.h (class Object): Remove target_ field, and target,
12570 sized_target, and set_target methods.
12571 (Object::sized_target): Remove.
12572 (class Sized_relobj): Update declarations. Remove sized_target.
12573 * object.cc (Sized_relobj::setup): Remove target parameter.
12574 Change all callers.
12575 (Input_objects::add_object): Don't do anything with the target.
12576 (make_elf_sized_object): Add punconfigured parameter. Change all
12577 callers. Set or test parameter target.
12578 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12579 Change all callers.
12580 * parameters.cc (Parameters::set_target): Change parameter type to
12581 be non-const.
12582 (Parameters::default_target): Remove.
12583 (set_parameters_target): Change parameter type to be non-const.
12584 (parameters_force_valid_target): New function.
12585 (parameters_clear_target): New function.
12586 * parameters.h (class Parameters): Update declarations. Remove
12587 default_target method. Add sized_target and clear_target
12588 methods. Change target_ to be non-const.
12589 (set_parameters_target): Update declaration.
12590 (parameters_force_valid_target): Declare.
12591 (parameters_clear_target): Declare.
12592 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12593 as NULL if we aren't searching.
12594 (Add_symbols::run): Don't check for compatible target.
12595 * fileread.cc (Input_file::open_binary): Call
12596 parameters_force_valid_target.
12597 * gold.cc (queue_middle_tasks): Likewise.
12598 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12599 set_target on object.
12600 * dynobj.h (class Sized_dynobj): Update declarations.
12601 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12602 make_elf_object returns NULL.
12603 (Archive::include_member): Don't check whether object target is
12604 compatible.
12605 * output.cc (Output_section::add_input_section): Get target from
12606 parameters.
12607 (Output_section::relax_input_section): Likewise.
12608 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12609 parameters.
12610 (Sized_relobj::do_scan_relocs): Likewise.
12611 (Sized_relobj::relocate_sections): Likewise.
12612 * resolve.cc (Symbol_table::resolve): Likewise.
12613 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12614 parameter. Change all callers.
12615 (Symbol_table::add_from_object): Get target from parameters.
12616 (Symbol_table::add_from_relobj): Don't check object target.
12617 (Symbol_table::add_from_dynobj): Likewise.
12618 (Symbol_table::define_special_symbol): Get target from
12619 parameters.
12620 * symtab.h (class Symbol_table): Update declaration.
12621 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12622 parameter. Change all callers. Clear parameter target.
12623 (Binary_test): Test target here.
12624 * testsuite/object_unittest.cc (gold_testsuite): Remove
12625 target_test_pointer parameter. Change all callers.
12626 (Object_test): Test target here.
12627
12628 2009-09-26 Ian Lance Taylor <iant@google.com>
12629
12630 * testsuite/initpri1.c: Don't try to use constructor priorities if
12631 compiling with gcc before 4.3.
12632
12633 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
12634
12635 * testsuite/retain_symbols_file_test.sh (check_present): Change
12636 output file name to retain_symbols_file_test.stdout.
12637 (check_absent): Likewise.
12638
12639 2009-09-18 Craig Silverstein <csilvers@google.com>
12640
12641 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12642 * options.cc: Include <cerrno> and <fstream>.
12643 (General_options::finalize): Parse -retain-symbols-file tag.
12644 * options.h: New flag.
12645 (General_options): New method should_retain_symbol, new
12646 variable symbols_to_retain.
12647 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12648 should_retain_symbol map.
12649 * testsuite/Makefile.am (retain_symbols_file_test): New test.
12650 * testsuite/Makefile.in: Regenerate.
12651 * testsuite/retain_symbols_file_test.sh: New file.
12652
12653 2009-09-18 Nick Clifton <nickc@redhat.com>
12654
12655 * po/es.po: Updated Spanish translation.
12656
12657 2009-09-17 Doug Kwan <dougkwan@google.com>
12658
12659 * debug.h (DEBUG_RELAXATION): New constant.
12660 (DEBUG_ALL): Add DEBUG_RELAXATION.
12661 (debug_string_to_enum): Add relaxation debug option.
12662 * layout.cc
12663 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12664 Layout::Relaxation_debug_check::read_sections,
12665 Layout::Relaxation_debug_check::read_sections): New method definitions.
12666 (Layout::Layout): Initialize data members
12667 record_output_section_data_from_scrips_,
12668 script_output_section_data_list_ and relaxation_debug_check_.
12669 (Layout::save_segments, Layout::restore_segments,
12670 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12671 Layout::relaxation_loop_body): New method definitions.
12672 (Layout::finalize): Support relaxation. Move section layout code to
12673 Layout::relaxation_loop_body.
12674 (Layout::set_asection_address_from_script): Move code for orphan
12675 section placement out.
12676 (Layout::place_orphan_sections_in_script): New method definition.
12677 * layout.h (Output_segment_headers, Output_file_header):
12678 New forward class declarations.
12679 (Layout::~Layout): Define.
12680 (Layout::new_output_section_data_from_script): New method definition.
12681 (Layout::place_orphan_sections_in_script): New method declaration.
12682 (Layout::Segment_states): New type declaration.
12683 (Layout::save_segments, Layout::restore_segments,
12684 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12685 Layout::relaxation_loop_body): New method declarations.
12686 (Layout::Output_section_data_list): New type declaration.
12687 (Layout::Relaxation_debug_check): New class definition.
12688 (Layout::record_output_section_data_from_script_,
12689 Layout::script_output_section_data_list_, Layout::segment_states_,
12690 Layout::relaxation_debug_check_): New data members.
12691 * output.cc: (Output_section_headers::do_size): New method definition.
12692 (Output_section_headers::Output_section_headers): Move size
12693 computation to Output_section_headers::do_size.
12694 (Output_segment_headers::do_size): New method definition.
12695 (Output_file_header::Output_file_header): Move size computation to
12696 Output_file_header::do_size and call it.
12697 (Output_file_header::do_size): New method definition.
12698 (Output_data_group::Output_data_group): Adjust call to
12699 Output_section_data.
12700 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12701 (Output_symtab_xindex::do_write): Add array bound check.
12702 (Output_section::Input_section::print_to_mapfile): Handle
12703 RELAXED_INPUT_SECTION_CODE.
12704 (Output_section::Output_section): Initialize data member checkpoint_.
12705 (Output_section::~Output_section): Delete checkpoint object pointed
12706 by checkpoint_.
12707 (Output_section::add_input_section): Always add an Input_section if
12708 relaxing.
12709 (Output_section::add_merge_input_section): Add assert.
12710 (Output_section::relax_input_section): New method definition.
12711 (Output_section::set_final_data_size): Set load address to zero for
12712 an unallocated section.
12713 (Output_section::do_address_and_file_offset_have_reset_values):
12714 New method definition.
12715 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12716 Handle relaxed input section.
12717 (Output_section::sort_attached_input_sections): Checkpoint input
12718 section list lazily.
12719 (Output_section::get_input_sections): Change type of input_sections to
12720 list of Simple_input_section pointers. Checkpoint input section list
12721 lazily. Also handle relaxed input sections.
12722 (Output_section::add_input_section_for_script): Take a reference to
12723 a Simple_input_section object instead of Relobj pointer and section
12724 index as parameter. Handle relaxed input sections.
12725 (Output_section::save_states, Output_section::restore_states): New
12726 method definitions.
12727 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12728 (Output_data::is_data_size_fixed): New method definition.
12729 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12730 if it is fixed.
12731 (Output_data::address_and_file_offset_have_reset_values): New method
12732 definition.
12733 (Output_data::do_address_and_file_offset_have_reset_values): New method
12734 definition.
12735 (Output_data::set_data_size): Check that data size is not fixed.
12736 (Output_data::fix_data_size): New method definition.
12737 (Output_data::is_data_size_fixed_): New data member.
12738 (Output_section_headers::set_final_data_size): New method definition.
12739 (Output_section_headers::do_size): New method declaration.
12740 (Output_segment_headers::set_final_data_size): New method definition.
12741 (Output_segment_headers::do_size): New method declaration.
12742 (Output_file_header::set_final_data_size)::New method definition.
12743 (Output_file_header::do_size)::New method declaration.
12744 (Output_section_data::Output_section_data): Add new parameter
12745 is_data_size_fixed and use it to fix data size.
12746 (Output_data_const::Output_data_const): Adjust call to base class
12747 constructor and fix data size.
12748 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12749 base class constructor and fix data size.
12750 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12751 base class constructor and fix data size.
12752 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12753 class constructor and fix data size.
12754 (Output_data_group::set_final_data_size): New method definition.
12755 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12756 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12757 class constructor and fix data size.
12758 (Output_relaxed_input_section): New class definition.
12759 (Output_section::Simple_input_section): New class definition.
12760 (Output_section::get_input_sections): Adjust parameter list.
12761 (Output_section::add_input_section_for_script): Same.
12762 (Output_section::save_states, Output_section::restore_states,
12763 Output_section::do_address_and_file_offset_have_reset_values,
12764 (Output_section::Input_section::Input_section): Handle
12765 RELAXED_INPUT_SECTION_CODE. Add new overload for
12766 Output_relaxed_input_section.
12767 (Output_section::Input_section::is_input_section,
12768 Output_section::Input_section::set_output_section): Handle relaxed
12769 input section.
12770 (Output_section::Input_section::is_relaxed_input_section,
12771 Output_section::Input_section::output_section_data,
12772 Output_section::Input_section::relaxed_input_section): New method
12773 definitions.
12774 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12775 value.
12776 (Output_section::Input_section::u1_): Update comments.
12777 (Output_section::Input_section::u2_): Add new union member poris.
12778 (Output_section::Checkpoint_output_section): New classs definition.
12779 (Output_section::relax_input_section): New method declaration.
12780 (Output_section::checkpoint_): New data member.
12781 (Output_segment): Update comments.
12782 (Output_segment::Output_segment): Un-privatize copy constructor.
12783 (Output_segment::operator=): Un-privatize.
12784 * script-sections.cc (Output_section_element::Input_section_list):
12785 Change element type to Output_section::Simple_input_section.
12786 (Output_section_element_dot_assignment::set_section_addresses):
12787 Register output section data for relaxation clean up.
12788 (Output_data_exression::Output_data_expression): Adjust call to base
12789 constructor to fix data size.
12790 (Output_section_element_data::set_section_addresses): Register
12791 Output_data_expression object for relaxation clean up.
12792 (struct Input_section_info): Replace Relobj pointer and section index
12793 pair with Output_section::Simple_input_section and Convert struct to a
12794 class.
12795 (Input_section_sorter::operator()): Adjust access to
12796 Input_section_info data member to use accessors.
12797 (Output_section_element_input::set_section_addresses): Use layout
12798 parameter. Adjust code to use Output_section::Simple_input_section
12799 and Input_secction_info classes. Register filler for relaxation
12800 clean up.
12801 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12802 and section index pair with Output_section::Simple_input_section
12803 class. Adjust code accordingly.
12804 (Phdrs_element::release_segment): New method definition.
12805 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12806 segment list.
12807 (Script_sections::release_segments): New method definition.
12808 * gold/script-sections.h (Script_sections::release_segments): New
12809 method declaration.
12810 * gold/target.h (Target::may_relax, Target::relax,
12811 Target::do_may_relax, Target::do_relax): New method definitions.
12812
12813 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12814
12815 * arm.cc (has_signed_unsigned_overflow): New function.
12816 (Arm_relocate_functions::abs8): New function.
12817 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12818 (Target_arm::Scan::global): Likewise.
12819 (Target_arm::relocate::relocate): Likewise.
12820 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12821 Likewise.
12822
12823 2009-09-16 Cary Coutant <ccoutant@google.com>
12824
12825 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12826 * testsuite/Makefile.in: Regenerate.
12827
12828 2009-09-11 Nick Clifton <nickc@redhat.com>
12829
12830 * po/gold.pot: Updated by the Translation project.
12831
12832 2009-09-08 Cary Coutant <ccoutant@google.com>
12833
12834 * output.cc (Output_file::open): Add execute permission to empty file.
12835 * testsuite/Makefile.am (permission_test): New test.
12836 * testsuite/Makefile.in: Regenerate.
12837
12838 2009-09-02 Ian Lance Taylor <iant@google.com>
12839
12840 * output.cc (Output_file::resize): Call map_no_anonymous rather
12841 than map.
12842
12843 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12844
12845 * gold.cc: Include "incremental.h".
12846 (queue_initial_tasks): Call Incremental_checker methods.
12847 * incremental.cc: Include "output.h".
12848 (Incremental_checker::can_incrementally_link_output_file): New
12849 method.
12850 * incremental.h (Incremental_checker): New class.
12851
12852 * output.cc (Output_file::open_for_modification): New method.
12853 (Output_file::map_anonymous): Changed return type to bool. Record
12854 map in base_ field.
12855 (Output_file::map_no_anonymous): New method, broken out of map.
12856 (Output_file::map): Use map_no_anonymous and map_anonymous.
12857 * output.h (class Output_file): Update declarations.
12858
12859 2009-08-24 Cary Coutant <ccoutant@google.com>
12860
12861 * options.h (Command_line::Pre_options): New class.
12862 (Command_line::pre_options): New member.
12863 * options.cc (gold::options::ready_to_register): New variable.
12864 (One_option::register_option): Do nothing if not registering options.
12865 Assert if same short option registered twice.
12866 (General_options::General_options): Turn off option registration when
12867 done constructing.
12868 (Command_line::Pre_options::Pre_options): New constructor.
12869
12870 2009-08-24 Cary Coutant <ccoutant@google.com>
12871
12872 * options.h (General_options::no_keep_memory): Remove incorrect
12873 short option.
12874
12875 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12876
12877 * Makefile.am (am__skiplex, am__skipyacc): New.
12878 * Makefile.in: Regenerate.
12879
12880 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12881
12882 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12883 (INCLUDES): ... this.
12884 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12885 (AM_CPPFLAGS): Renamed from ...
12886 (INCLUDE): ... this.
12887 * Makefile.in, testsuite/Makefile.in: Regenerate.
12888
12889 * Makefile.in: Regenerate.
12890 * aclocal.m4: Likewise.
12891 * config.in: Likewise.
12892 * configure: Likewise.
12893 * testsuite/Makefile.in: Likewise.
12894
12895 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12896 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12897 * Makefile.in: Regenerate.
12898 * testsuite/Makefile.in: Regenerate.
12899
12900 2009-08-19 Cary Coutant <ccoutant@google.com>
12901
12902 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12903 symbols in shared libraries overridden by hidden or internal symbols
12904 in the main program.
12905
12906 2009-08-19 Chris Demetriou <cgd@google.com>
12907
12908 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12909 checking source file names in error messages.
12910
12911 2009-08-18 Doug Kwan <dougkwan@google.com>
12912
12913 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12914 an elcpp::Ehdr as parameter. Adjust call to set_target.
12915 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12916 an elfcpp::Ehdr as parameter.
12917 * object.cc (Object::set_target): Remove the version that looks up
12918 a target and sets it.
12919 (Sized_relobj::setup): Take a Target object instead of
12920 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12921 (make_elf_sized_object): Find target and ask target to
12922 make an ELF object.
12923 * object.h: (Object::set_target): Remove the version that looks up
12924 a target and sets it.
12925 (Sized_relobj::setup): Take a Target object instead of
12926 an elfcpp:Ehdr as parameter.
12927 * target.cc: Include dynobj.h.
12928 (Target::do_make_elf_object_implementation): New.
12929 (Target::do_make_elf_object): New.
12930 * target.h (Target::make_elf_object): New template declaration.
12931 (Target::do_make_elf_object): New method declarations.
12932 (Target::do_make_elf_object_implementation): New template declaration.
12933
12934 2009-08-14 Ian Lance Taylor <iant@google.com>
12935
12936 * gold.h (FUNCTION_NAME): Define.
12937 (gold_unreachable): Use FUNCTION_NAME.
12938
12939 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12940
12941 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12942 symbol in the --keep-unique list is not found.
12943
12944 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12945
12946 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12947 been maked as --keep-unique.
12948 (Icf::unfold_section): New function.
12949 * icf.h (Icf::unfold_section): New function.
12950 * options.h (General_options::keep_unique): New option.
12951 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12952 * testsuite/Makefile.in: Regenerate.
12953 * testsuite/icf_keep_unique_test.sh: New file.
12954 * testsuite/icf_keep_unique_test.cc: New file.
12955
12956 2009-08-12 Cary Coutant <ccoutant@google.com>
12957
12958 PR 10471
12959 * resolve.cc (Symbol_table::resolve): Check for references from
12960 dynamic objects to hidden and internal symbols.
12961 * testsuite/Makefile.am (hidden_test.sh): New test.
12962 * testsuite/Makefile.in: Regenerate.
12963 * testsuite/hidden_test.sh: New script.
12964 * testsuite/hidden_test_1.c: New test source.
12965 * testsuite/hidden_test_main.c: New test source.
12966
12967 2009-08-11 Doug Kwan <dougkwan@google.com>
12968
12969 * arm.cc: Update comments.
12970 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12971 segment to locate the .ARM.exidx section if present.
12972
12973 2009-08-09 Doug Kwan <dougkwan@google.com>
12974
12975 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12976 patch.
12977
12978 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12979 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12980 compiler warnings.
12981
12982 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12983
12984 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12985 valid tls_segment only for non-debug-section relocations.
12986 * testsuite/Makefile.am: Add gc_tls_test.
12987 * testsuite/Makefile.in: Regenerate.
12988 * testsuite/gc_tls_test.cc: New file.
12989 * testsuite/gc_tls_test.sh: New file.
12990
12991 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12992
12993 * icf.cc: New file.
12994 * icf.h: New file.
12995 * Makefile.am (CCFILES): Add icf.cc.
12996 (HFILES): Add icf.h
12997 * Makefile.in: Regenerate.
12998 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12999 * gc.h (gc_process_relocs): Populate lists used by icf to contain
13000 section, symbol and addend information for the relocs.
13001 * gold.cc (queue_middle_tasks): Call identical code folding.
13002 * gold.h: Add defines for multimap.
13003 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13004 to the call of finalize_local_symbols.
13005 * main.cc (main): Create object of class Icf.
13006 * object.cc (Sized_relobj::do_layout): Allow this function to be
13007 called twice during icf.
13008 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13009 to sections marked as identical by icf.
13010 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13011 when available.
13012 (Sized_relobj::do_section_entsize): New function.
13013 * object.h (Object::section_entsize): New function.
13014 (Object::do_section_entsize): New pure virtual function.
13015 (Relobj::finalize_local_symbols): Add new parameter.
13016 (Relobj::do_section_entsize): New function.
13017 * options.h (General_options::icf): New option.
13018 (General_options::icf_iterations): New option.
13019 (General_options::print_icf_sections): New option.
13020 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13021 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13022 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13023 icf.
13024 * symtab.cc (Symbol_table::is_section_folded): New function.
13025 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
13026 to sections marked as identical by icf.
13027 * symtab.h (Symbol_table::set_icf): New function.
13028 (Symbol_table::icf): New function.
13029 (Symbol_table::is_section_folded): New function.
13030 (Symbol_table::icf_): New data member.
13031 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13032 * testsuite/Makefile.am: Add commands to build icf_test.
13033 * testsuite/Makefile.in: Regenerate.
13034 * testsuite/icf_test.sh: New file.
13035 * testsuite/icf_test.cc: New file.
13036
13037 2009-07-24 Chris Demetriou <cgd@google.com>
13038
13039 * layout.cc (is_compressible_debug_section): Fix incorrect
13040 comment about compressed section names.
13041
13042 2009-07-20 Ian Lance Taylor <ian@airs.com>
13043
13044 PR 10419
13045 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13046
13047 2009-07-16 Ian Lance Taylor <iant@google.com>
13048
13049 PR 10400
13050 * layout.h: #include <map>.
13051 (class Kept_section): Change from struct to class. Add accessors
13052 and setters. Add section size to Comdat_group mapping. Change
13053 Comdat_group to std::map. Add is_comdat_ field. Add
13054 linkonce_size field in union.
13055 (class Layout): Update declaration of find_or_add_kept_section.
13056 Don't declare find_kept_object.
13057 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13058 parameter. Add object, shndx, is_comdat, and is_group_name
13059 parameters. Change all callers. Adjust for new Kept_section.
13060 (Layout::find_kept_object): Remove.
13061 * object.cc (Sized_relobj::include_section_group): Update use of
13062 Kept_section. Rename secnum to shndx. Only record
13063 Kept_comdat_section if sections are the same size.
13064 (Sized_relobj::include_linkonce_section): Update use of
13065 Kept_section. Only record Kept_comdat_section if sections are the
13066 same size. Set size of linkonce section.
13067 (Sized_relobj::map_to_kept_section): Update call to
13068 get_kept_comdat_section.
13069 * object.h (class Sized_relobj): Rename fields in
13070 Kept_comdat_section to drop trailing underscores; change object
13071 field to Relobj*. Change Kept_comdat_section_table to store
13072 struct rather than pointer.
13073 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13074 Add kept_object and kept_shndx parameters. Change all callers.
13075 (Sized_relobj::get_kept_comdat_section): Change return type to
13076 bool. Add kept_object and kept_shndx parameters. Change all
13077 callers.
13078 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13079 Layout::find_or_add_kept_section.
13080
13081 2009-07-09 Ian Lance Taylor <iant@google.com>
13082
13083 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13084 Reserve space in the hash table.
13085
13086 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
13087
13088 * fileread.cc (File_read::get_mtime): New method.
13089 * fileread.h (Timespec): New structure.
13090 (File_read::get_mtime): New method.
13091 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13092 Renamed from timestamp_nsec.
13093 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13094 Elf_Xword.
13095 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13096 timestamp_nsec.
13097 (Incremental_inputs::report_archive): Save mtime; style fix.
13098 (Incremental_inputs::report_obejct): Save mtime; style fix.
13099 (Incremental_inputs::report_script): Save mtime; style fix.
13100 (Incremental_inputs::finalize_inputs): Style fix.
13101 (Incremental_inputs::finalize): Style fix.
13102 (Incremental_inputs::create_input_section_data): Store inputs
13103 mtime.
13104 * incremental.h (Incremental_inputs::report_script): Add mtime
13105 argument.
13106 (Incremental_inputs::Input_info::Input_info): Intialize only one
13107 union member.
13108 (Incremental_inputs::Input_info::archive): Move to nameless
13109 union.
13110 (Incremental_inputs::Input_info::obejct): Move to nameless union.
13111 (Incremental_inputs::Input_info::script): Move to nameless union.
13112 (Incremental_inputs::mtime): New field.
13113 * script.cc (read_input_script): Pass file mtime to
13114 Incremental_input.
13115 * script.h (Script_info::inputs): Style fix.
13116
13117 2009-07-01 Ian Lance Taylor <ian@airs.com>
13118
13119 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13120 instead of 32.
13121
13122 2009-06-24 Ian Lance Taylor <iant@google.com>
13123
13124 PR 10156
13125 * layout.cc (Layout::choose_output_section): If we find an
13126 existing section, update the flags.
13127 (Layout::create_notes): New function, broken out of
13128 Layout::finalize.
13129 (Layout::finalize): Don't create note sections.
13130 (Layout::create_note): Don't crash if linker script discards
13131 section.
13132 (Layout::create_gold_note): Likewise.
13133 (Layout::create_build_id): Likewise. Don't set
13134 after_input_sections on the section.
13135 (Layout::create_executable_stack_info): Remove target parameter.
13136 Change caller.
13137 * layout.h (class Layout): Declare create_notes. Update
13138 declaration of create_executable_stack_info.
13139 * gold.cc (queue_middle_tasks): Call create_notes.
13140 * output.cc (Output_section::update_flags_for_input_section): Move
13141 here from output.h. If SHF_ALLOC flag is newly set, mark address
13142 invalid.
13143 * output.h (Output_data::mark_address_invalid): New function.
13144 (class Output_section): Only declare, not define,
13145 update_flags_for_input_section. Remove set_flags.
13146
13147 2009-06-24 Ian Lance Taylor <iant@google.com>
13148
13149 * script-sections.cc (Output_section_definition::
13150 set_section_addresses): Rename shadowing local load_address to
13151 laddr.
13152
13153 2009-06-24 Ian Lance Taylor <iant@google.com>
13154
13155 PR 10244
13156 * reloc.cc (relocate_sections): Skip empty relocation sections.
13157
13158 2009-06-23 Ian Lance Taylor <iant@google.com>
13159
13160 PR 10156
13161 * layout.cc (Layout::create_note): Use choose_output_section
13162 rather than make_output_section.
13163
13164 2009-06-23 Ian Lance Taylor <iant@google.com>
13165
13166 PR 10237
13167 * options.cc (General_options::parse_V): Set printed_version_.
13168 (General_options::General_options): Initialize printed_version_.
13169 * options.h (class General_options): Add printed_version_ field.
13170 * gold.cc (queue_initial_tasks): If there are no input files,
13171 don't give a fatal error if we printed the version information.
13172 (queue_middle_tasks): If using -r with a shared object, give a
13173 fatal error rather than an ordinary error.
13174
13175 2009-06-23 Ian Lance Taylor <iant@google.com>
13176
13177 PR 10219
13178 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13179 (Layout::make_output_section): Set have_stabstr_section_ if we see
13180 a .stab*str section.
13181 (Layout::finalize): Call link_stabs_sections.
13182 (Layout::link_stabs_sections): New file.
13183 * layout.h (class Layout): Add have_stabstr_section_ field.
13184 Declare link_stabs_sections.
13185
13186 2009-06-23 Doug Kwan <dougkwan@google.com>
13187
13188 * Makefile.am (libgold_a_LIBADD): New.
13189 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13190 * Makefile.in: Regenerate.
13191 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13192 * configure: Regenerate.
13193 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13194 * fileread.cc: Include sys/state.h
13195 * gold.h: Declare memmem and strndup if found missing.
13196 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13197
13198 2009-06-23 Ian Lance Taylor <iant@google.com>
13199
13200 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13201 * configure: Rebuild.
13202
13203 2009-06-23 Ian Lance Taylor <iant@google.com>
13204
13205 PR 10147
13206 * object.cc (Object::section_contents): Don't try to get a view if
13207 the section has length zero.
13208 (Object::handle_gnu_warning_section): If the section is empty, use
13209 the name of the section as the warning.
13210
13211 2009-06-23 Ian Lance Taylor <iant@google.com>
13212
13213 PR 10133
13214 * stringpool.h (class Stringpool_template): Add optimize_ field.
13215 (Stringpool_template::set_optimize): New function.
13216 * stringpool.cc (Stringpool_template::Stringpool_template):
13217 Initialize optimize_ field.
13218 (Stringpool_template::set_string_offsets): Test local optimize
13219 fild rather than parameter.
13220 * layout.cc (Layout::Layout): Call set_optimize on the section
13221 name stringpool.
13222
13223 2009-06-22 Ian Lance Taylor <iant@google.com>
13224
13225 PR 10030
13226 * yyscript.y: Parse TARGET.
13227 * script.cc (script_set_target): New function.
13228 * script-c.h (script_set_target): Declare.
13229 * options.cc (General_options::string_to_object_format): Rename
13230 from string_to_object_format in anonymous namespace. Change
13231 callers.
13232 * options.h (class General_options): Declare
13233 string_to_object_format.
13234
13235 2009-06-22 Ian Lance Taylor <iant@google.com>
13236
13237 * script-sections.cc (Script_sections::create_segments): Don't put
13238 program headers in a PT_LOAD segment if -n or -N.
13239
13240 2009-06-22 Ian Lance Taylor <iant@google.com>
13241
13242 PR 10141
13243 * options.h (class General_options): Add -z lazy and -z now. Sort
13244 -z options into alphabetical order.
13245 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13246
13247 2009-06-21 Ian Lance Taylor <iant@google.com>
13248
13249 * layout.cc (Layout::make_output_section): Call
13250 Target::new_output_section.
13251 (Layout::attach_allocated_section_to_segment): Put large section
13252 sections in a separate load segment with the large segment flag
13253 set.
13254 (Layout::segment_precedes): Sort large data segments after other
13255 load segments.
13256 (align_file_offset): New static function.
13257 (Layout::set_segment_offsets): Use align_file_offset.
13258 * output.h (class Output_section): Add is_small_section_ and
13259 is_large_section_ fields.
13260 (Output_section::is_small_section): New function.
13261 (Output_section::set_is_small_section): New function.
13262 (Output_section::is_large_section): New function.
13263 (Output_section::set_is_large_section): New function.
13264 (Output_section::is_large_data_section): New function.
13265 (class Output_segment): Add is_large_data_segment_ field.
13266 (Output_segment::is_large_data_segment): New function.
13267 (Output_segment::set_is_large_data_segment): New function.
13268 * output.cc (Output_section::Output_section): Initialize new
13269 fields.
13270 (Output_segment::Output_segment): Likewise.
13271 (Output_segment::add_output_section): Add assertion that large
13272 data sections always go in large data segments. Force small data
13273 sections to the end of the list of data sections. Force small BSS
13274 sections to the start of the list of BSS sections. For large BSS
13275 sections to the end of the list of BSS sections.
13276 * symtab.h (class Symbol): Declare is_common_shndx.
13277 (Symbol::is_defined): Check Symbol::is_common_shndx.
13278 (Symbol::is_common): Likewise.
13279 (class Symbol_table): Define enum Commons_section_type. Update
13280 declarations. Add small_commons_ and large_commons_ fields.
13281 * symtab.cc (Symbol::is_common_shndx): New function.
13282 (Symbol_table::Symbol_table): Initialize new fields.
13283 (Symbol_table::add_from_object): Put small and large common
13284 symbols in the right list.
13285 (Symbol_table::sized_finalized_symbol): Check
13286 Symbol::is_common_shndx.
13287 (Symbol_table::sized_write_globals): Likewise.
13288 * common.cc (Symbol_table::do_allocate_commons): Allocate new
13289 common symbol lists. Don't call do_allocate_commons_list if the
13290 list is empty.
13291 (Symbol_table::do_allocate_commons_list): Remove is_tls
13292 parameter. Add comons_section_type parameter. Change all
13293 callers. Handle small and large common symbols.
13294 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13295 Symbol::is_common_shndx.
13296 * resolve.cc (symbol_to_bits): Likewise.
13297 * target.h (Target::small_common_shndx): New function.
13298 (Target::small_common_section_flags): New function.
13299 (Target::large_common_shndx): New function.
13300 (Target::large_common_section_flags): New function.
13301 (Target::new_output_section): New function.
13302 (Target::Target_info): Add small_common_shndx, large_common_shndx,
13303 small_common_section_flags, and large_common_section_flags
13304 fields.
13305 (Target::do_new_output_section): New virtual function.
13306 * arm.cc (Target_arm::arm_info): Initialize new fields.
13307 * i386.cc (Target_i386::i386_info): Likewise.
13308 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13309 Likewise.
13310 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13311 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13312 (Target_x86_64::do_new_output_section): New function.
13313 * configure.ac: Define conditional MCMODEL_MEDIUM.
13314 * testsuite/Makefile.am (check_PROGRAMS): Add large.
13315 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13316 (large_LDFLAGS): Define.
13317 * testsuite/large.c: New file.
13318 * testsuite/testfile.cc (Target_test::test_target_info):
13319 Initialize new fields.
13320 * configure, testsuite/Makefile.in: Rebuild.
13321
13322 2009-06-05 Doug Kwan <dougkwan@google.com>
13323
13324 * Makefile.am (CCFILES): Add target.cc.
13325 * Makefile.in: Regenerate.
13326 * i386.cc (class Target_i386): Define new virtual method to
13327 override do_is_local_label_name in parent.
13328 * object.cc (Sized_relobj::do_count_local_symbols): Discard
13329 local symbols if --discard-locals or -X is given.
13330 * options.h (class General_options): Declare new options
13331 '--discard-locals' and '-X' for discarding locals.
13332 * target.h (class Target): Define new methods is_local_label_name.
13333 Declare new virtual method do_is_local_label_name.
13334 * target.cc: New file.
13335 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13336 (check_SCRIPTS): Add discard_locals_test.sh.
13337 (check_DATA): Add discard_local_tests.syms.
13338 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13339 (discard_local_tests.syms, discard_locals_test.o): New make rules.
13340 * testsuite/Makefile.in: Regenerate.
13341 * testsuite/discard_locals_test.c: New file.
13342 * testsuite/discard_locals_test.sh: Same.
13343
13344 2009-06-05 Doug Kwan <dougkwan@google.com>
13345
13346 * object.cc (Sized_relobj::Sized_relobj): Initialize
13347 discarded_eh_frame_shndx_ to -1U.
13348 (Sized_relobj::do_layout): Record index of a discard .eh_frame
13349 section.
13350 (Sized_relobj::do_count_local_symbols): Skip local symbols in
13351 a discarded .eh_frame section.
13352 (Sized_relobj::do_finalize_local_symbols): Ditto.
13353 * object.h (class Sized_relobj): Declare new member
13354 discarded_eh_frame_shndx_.
13355 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13356 (local_labels_test.o, local_labels_test): New rules.
13357 * testsuite/Makefile.in: Regenerate.
13358
13359 2009-06-04 Doug Kwan <dougkwan@google.com>
13360
13361 * layout.cc (Layout::section_name_mapping): Add mapping for
13362 special ARM sections.
13363
13364 2009-06-03 Doug Kwan <dougkwan@google.com>
13365
13366 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13367 (utils::has_overflow): Same.
13368
13369 2009-06-03 Ian Lance Taylor <iant@google.com>
13370
13371 * layout.cc (Layout::section_name_mapping): New array, replacing
13372 Layout::linkonce_mapping.
13373 (Layout::section_name_mapping_count): New variable, replacing
13374 Layout::linkonce_mapping_count.
13375 (Layout::linkonce_output_name): Remove.
13376 (Layout::output_section_name): Rewrite.
13377 * layout.h (class Layout): Rename Linkonce_mapping to
13378 Section_name_mapping, linkonce_mapping to section_name_mapping,
13379 linkonce_mapping_count to section_name_mapping_count. Don't
13380 declare linkonce_output_name.
13381
13382 2009-06-03 Doug Kwan <dougkwan@google.com>
13383
13384 * gold/arm.cc (namespace utils): New.
13385 (Target_arm::reloc_is_non_pic): Define new method.
13386 (class Arm_relocate_functions): New.
13387 (Target_arm::Relocate::relocate): Handle relocation types used by
13388 Android.
13389
13390 2009-06-03 Ian Lance Taylor <iant@google.com>
13391
13392 * arm.cc (Target_arm::scan::global): Use || instead of |.
13393
13394 2009-06-02 Doug Kwan <dougkwan@google.com>
13395
13396 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
13397 issued_non_pic_error_.
13398 (class Target_arm::Scan): Declare new method check_non_pic.
13399 Define new method symbol_needs_plt_entry.
13400 Declare new data member issued_non_pic_error_.
13401 (class Target_arm::Relocate): Declare new method
13402 should_apply_static_reloc.
13403 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13404 (Target_arm::Scan::check_non_pic): Define new method.
13405 (Target_arm::Scan::local): Handle a small subset of reloc types used
13406 by Android.
13407 (Target_arm::Scan::local): Same.
13408 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13409
13410 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
13411
13412 * incremental.cc (Incremental_inputs::report_command_line): Filter
13413 out --incremental-* options.
13414
13415 2009-05-29 Doug Kwan <dougkwan@google.com>
13416
13417 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13418 template class.
13419 (class Target_arm): Update comment.
13420 (Target_arm::Target_arm): Initialize new data members GOT_,
13421 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13422 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13423 and Target_arm::rel_dyn_section.
13424 Declare new_enum Target_arm::Got_type.
13425 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13426 and DYNBSS_.
13427 Update commments for member do_dynsym_value.
13428 (Target_arm::got_size, Target_arm::plt_section,
13429 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13430 new methods inside class defintion.
13431 (Target_arm::got_section): Define new method.
13432 (Target_arm::rel_dyn_section): Same.
13433 (Output_data_plt_arm): New template class.
13434 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13435 (Output_data_plt_arm:do_adjust_output_section): Define new method.
13436 (Output_data_plt_arm::add_entry): Same.
13437 (Output_data_plt_arm::first_plt_entry): Define new
13438 static data member for PLT instruction template.
13439 (Output_data_plt_arm::plt_entry): Same.
13440 (Output_data_plt_arm::do_write): Define new method.
13441 (Target_arm::make_plt_entry): Same.
13442 (Target_arm::do_finalize_sections): Same.
13443 (Target_arm::do_dynsym_value): Same.
13444
13445 2009-05-28 Doug Kwan <dougkwan@google.com>
13446
13447 * Makefile.am (TARGETSOURCES): Add arm.cc.
13448 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13449 * Makefile.in: Regenerate.
13450 * arm.cc: New file.
13451 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13452
13453 2009-05-26 Doug Kwan <dougkwan@google.com>
13454
13455 * options.cc (General_options::parse_exclude_libs). Fix a comment.
13456 (General_options::check_excluded_libs): Strip off directories in
13457 archive name before matching like GNU ld does.
13458 * testsuite/Makefile.am (MOSTLYCLEANFILES,
13459 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13460 (exclude_libs_test_LDFLAGS): Add linker option
13461 -Wl,--exclude-libs,libexclude_libs_test_3
13462 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13463 an explicit archive without using -l.
13464 (alt/libexclude_libs_test_3.a): New make rule.
13465 * testsuite/Makefile.in: Regenerate.
13466 * testsuite/exclude_libs_test.c : Declare lib3_default().
13467 (main): Call it.
13468 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13469 * exclude_libs_test_3.c: New file.
13470
13471 2009-05-26 Nick Clifton <nickc@redhat.com>
13472
13473 * po/id.po: New Indonesian translation.
13474 * po/gold.pot: Updated template file.
13475
13476 2009-05-22 Sriraman Tallam <tmsriram@google.com>
13477
13478 * testsuite/Makefile.am: Add -ffunction-sections to compile
13479 gc_comdat_test files. Add -Wl,--gc-sections to build
13480 gc_comdat_test.
13481 * testsuite/Makefile.in: Regenerate.
13482 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13483
13484 2009-05-21 Sriraman Tallam <tmsriram@google.com>
13485
13486 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13487 kept comdat section was garbage collected.
13488 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13489 * testsuite/Makefile.in: Regenerate.
13490 * testsuite/gc_comdat_test.sh: New file.
13491 * testsuite/gc_comdat_test_1.cc: New file.
13492 * testsuite/gc_comdat_test_2.cc: New file.
13493
13494 2009-05-19 Doug Kwan <dougkwan@google.com>
13495
13496 * archive.cc (Archive::Archive): Move constructor from archive.h
13497 to here. Initialize no_export_.
13498 (Archive::get_elf_object_for_member): Set no_export flag of object.
13499 * archive.h (Archive::Archive): Move constructor body to
13500 archive.cc.
13501 (Archive::no_export): New method.
13502 (Archive::no_export_): New field.
13503 * object.h (Object::Object): Initialize no_export_ to false.
13504 (Object::no_export, Object::set_no_export): New methods.
13505 (Object::no_export_): New field.
13506 * options.cc (General_options::parse_exclude_libs): New method.
13507 (General_options::check_excluded_libs) Same.
13508 * options.h (exclude_libs): New option.
13509 (General_options::check_excluded_libs): New method declaration.
13510 (General_options::excluded_libs_): New field.
13511 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13512 default or protected visibility if an object has no-export flag set.
13513 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13514 (check_SCRIPTS): Add exclude_libs_test.sh.
13515 (check_DATA): Add exclude_libs_test.syms.
13516 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13517 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13518 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13519 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13520 (exclude_libs_test.syms, libexclude_libs_test_1.a,
13521 libexclude_libs_test_2.a): New rules.
13522 * testsuite/Makefile.in: Regenerate.
13523 * testsuite/exclude_libs_test.c: New file.
13524 * testsuite/exclude_libs_test.sh: Ditto.
13525 * testsuite/exclude_libs_test_1.c: Ditto.
13526 * testsuite/exclude_libs_test_2.c: Ditto.
13527
13528 2009-05-15 Ian Lance Taylor <iant@google.com>
13529
13530 * configure.ac: Check for declarations for cases where libiberty.h
13531 checks HAVE_DECL_xxx.
13532 * configure, config.in: Rebuild.
13533
13534 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
13535
13536 * gold.h (Incremental_argument_list): Remove (invalid) forward
13537 declaration.
13538 * incremental.cc (Incremental_inputs::report_achive): New method.
13539 (Incremental_inputs::report_object): New method.
13540 (Incremental_inputs::report_script): New method.
13541 (Incremental_inputs::finalize_inputs): New method.
13542 (Incremental_inputs::finalize): Call finalize_inputs().
13543 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13544 Create inputs entries.
13545 * incremental.h (Incremental_input_type): New enum.
13546 (Incremental_inputs::Incremental_input): Initialize new fields.
13547 (Incremental_inputs::report_inputs): New method.
13548 (Incremental_inputs::report_achive): New method.
13549 (Incremental_inputs::report_object): New method.
13550 (Incremental_inputs::report_script): New method.
13551 (Incremental_inputs::finalize_inputs): New method.
13552 (Incremental_inputs::Input_info): New struct.
13553 (Incremental_inputs::Input_info_map): New typedef.
13554 (Incremental_inputs::lock_): New field.
13555 (Incremental_inputs::Inputs_): New field.
13556 (Incremental_inputs::Inputs_map): New field.
13557 * main.cc (main): Call Incremental_input::report_inputs.
13558 * options.h (Input_argument_list): Typedef moved from
13559 Input_arguments.
13560 (Input_file_group::Files): Remove, use ::Input_argument_list.
13561 (Input_file_group::Input_argument_list): Remove, use
13562 ::Input_argument_list.
13563 * plugin.cc (Plugin_manager::add_input_file): Add error in
13564 incremental build.
13565 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13566 functions.
13567 * script.cc (read_input_script): Call
13568 Incremental_input::report_script.
13569 * script.h (Script_info): New class.
13570
13571 2009-04-27 Ian Lance Taylor <iant@google.com>
13572
13573 * x86_64.cc (do_adjust_output_section): Set entsize to
13574 plt_entry_size.
13575
13576 2009-04-23 Elliott Hughes <enh@google.com>
13577
13578 * output.cc (Output_file::close): After short writes, continue
13579 writing from the correct offset in the buffer being written.
13580
13581 2009-04-23 Chris Demetriou <cgd@google.com>
13582
13583 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13584 * configure: Regenerate.
13585 * config.in: Regenerate.
13586 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13587 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13588
13589 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
13590
13591 * incremental.cc (Incremental_inputs_header_data): Renamed from
13592 Incremental_input_header_data.
13593 (Incremental_inputs_header_data::data_size): New field.
13594 (Incremental_inputs_header_data::put_input_file_count): Renamed
13595 from input_file_count.
13596 (Incremental_inputs_header_data::put_command_line_offset): Renamed
13597 from command_line_offset.
13598 (Incremental_inputs_header_data::put_reserved): Renamed from
13599 put_reserved.
13600 (Incremental_inputs_entry_data): Renamed from
13601 Incremental_input_entry_data.
13602 (Incremental_inputs_entry_data::data_size): New field.
13603 (Incremental_inputs::report_command_line): New method.
13604 (Incremental_inputs::finalize): New method.
13605 (Incremental_inputs::create_incremental_inputs_data): New method.
13606 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13607 * incremental.h: New file.
13608 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13609 (Layout::finalize): Create incremental inputs section in
13610 incremental builds.
13611 (Layout::create_incremental_info_sections): New method.
13612 * layout.h (Layout::incremental_inputs): New method.
13613 (Layout::create_incremental_info_sections): New method.
13614 (Layout::incremental_inputs_): New field.
13615 * main.cc (main): Notify Incremental_input of the command line.
13616
13617 2009-04-01 Ian Lance Taylor <iant@google.com>
13618 Mikolaj Zalewski <mikolajz@google.com>
13619
13620 * gold.h (reserve_unordered_map): Define, three versions, one for
13621 each version of Unordered_map.
13622 * layout.cc (Layout::Layout): Remove options parameter. Add
13623 number_of_input_files parameter. Don't initialize options_.
13624 Initialize number_of_input_files_ and resized_signatures_. Move
13625 sections_are_attached_.
13626 (Layout::layout_group): Reserve space for group_signatures_.
13627 (Layout::find_or_add_kept_section): Change name parameter to be a
13628 reference. Resize signatures_ map when it gets large enough.
13629 (Layout::layout_eh_frame): Use parameters->options() instead of
13630 this->options_.
13631 (Layout::make_output_section): Likewise.
13632 (Layout::attach_allocated_section_to_segment): Likewise.
13633 (Layout::finalize, Layout::create_executable_stack): Likewise.
13634 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13635 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13636 * layout.h (class Layout): Update declarations. Remove options_
13637 field. Add number_of_input_files_ and resized_signatures_
13638 fields. Move sections_are_attached_ field.
13639 * main.cc (main): Pass number of input files to Layout
13640 constructor. Don't pass options.
13641
13642 2009-03-30 Ian Lance Taylor <iant@google.com>
13643
13644 * ffsll.c (ffsll): Correct implementation.
13645
13646 2009-03-27 Ian Lance Taylor <iant@google.com>
13647
13648 * ffsll.c: New file.
13649 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13650 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13651 * ftruncate.c (ftruncate): Declare before definition.
13652 * mremap.c (mremap): Likewise.
13653 * pread.c (pread): Likewise.
13654 * configure, Makefile.in, config.in: Rebuild.
13655
13656 * mremap.c: New file.
13657 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13658 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13659 (mremap): Declare if HAVE_MREMAP is not defined.
13660 * configure, Makefile.in, config.in: Rebuild.
13661
13662 2009-03-27 Cary Coutant <ccoutant@google.com>
13663
13664 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13665 position independent.
13666 * sparc.cc (Target_sparc::check_non_pic): Likewise.
13667 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13668
13669 2009-03-24 Cary Coutant <ccoutant@google.com>
13670
13671 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13672 an executable.
13673 (needs_dynamic_reloc): Likewise.
13674
13675 2009-03-24 Ian Lance Taylor <iant@google.com>
13676
13677 * yyscript.y (file_cmd): Recognize EXTERN.
13678 (extern_name_list, extern_name_list_body): New nonterminals.
13679 * script.cc (script_add_extern): Define.
13680 * script-c.h (script_add_extern): Declare.
13681
13682 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13683
13684 * object.cc (is_elf_object): Define.
13685 * object.h (is_elf_object): Declare.
13686 * archive.cc (Archive::get_elf_object_for_member): Call
13687 is_elf_object.
13688 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13689
13690 2009-03-24 Elliott Hughes <enh@google.com>
13691
13692 * output.cc (Output_file::map_anonymous): Define.
13693 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13694 try an anonymous one. Report the size if the mmap fails.
13695 * output.h (class Output_file): Declare map_anonymous.
13696
13697 2009-03-24 Ian Lance Taylor <iant@google.com>
13698
13699 * target-select.cc (instantiate_target): Don't acquire the lock if
13700 the instantiated_target_ field has already been set.
13701
13702 2009-03-23 Ian Lance Taylor <iant@google.com>
13703
13704 * gold-threads.h (class Initialize_lock): Define.
13705 * gold-threads.cc (class Initialize_lock_once): Define.
13706 (initialize_lock_control): New static variable.
13707 (initialize_lock_pointer): New static variable.
13708 (initialize_lock_once): New static function.
13709 (Initialize_lock::Initialize_lock): Define.
13710 (Initialize_lock::initialize): Define.
13711 * target-select.h: Include "gold-threads.h".
13712 (class Target_selector): Add lock_ and initialize_lock_ fields.
13713 Don't define instantiate_target, just declare it.
13714 * target-select.cc (Target_selector::Target_selector): Initialize
13715 new fields.
13716 (Target_selector::instantiate_target): Define.
13717 * descriptors.h: Include "gold-threads.h".
13718 (class Descriptors): Add initialize_lock_ field.
13719 * descriptors.cc (Descriptors::Descriptors): Initialize new
13720 field.
13721 (Descriptors::open): Use initialize_lock_ field
13722 * errors.h (class Errors): Add initialize_lock_ field.
13723 * errors.cc (Errors::Errors): Initialize new field.
13724 (Errors::initialize_lock): Use initialize_lock_ field.
13725 * powerpc.cc (class Target_selector_powerpc): Remove
13726 instantiated_target_ field. In do_recognize call
13727 instantiate_target rather than do_instantiate_target. In
13728 do_instantiate_target just allocate a new target.
13729 * sparc.cc (class Target_selector_sparc): Likewise.
13730
13731 * freebsd.h: New file.
13732 * i386.cc: Include "freebsd.h".
13733 (Target_i386): Derive from Target_freebsd rather than
13734 Sized_target.
13735 (Target_selector_i386): Derive from Target_selector_freebsd rather
13736 than Target_selector.
13737 * x86_64.cc: Include "freebsd.h".
13738 (Target_x86_64): Derive from Target_freebsd rather than
13739 Sized_target.
13740 (Target_selector_x86_64): Derive from Target_selector_freebsd
13741 rather than Target_selector.
13742 * target.h (class Target): Add adjust_elf_header and
13743 do_adjust_elf_header.
13744 * output.cc (Output_file_header:: do_sized_write): Call target
13745 adjust_elf_header routine.
13746 * configure.tgt: Set targ_osabi.
13747 * configure.ac: Define GOLD_DEFAULT_OSABI.
13748 * parameters.cc (Parameters::default_target): Pass
13749 GOLD_DEFAULT_OSABI to select_target.
13750 * target-select.h (class Target_selector): Make instantiate_target
13751 protected rather than private.
13752 * Makefile.am (HFILES): Add freebsd.h.
13753 * configure, Makefile.in, config.in: Rebuild.
13754
13755 * merge.cc (do_add_input_section): Correct pend value. Change
13756 message about last entry not being null terminated from error to
13757 warning.
13758
13759 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13760
13761 * incremental.cc: New file.
13762 * Makefile.am (CCFILES): Add incremental.cc.
13763 * Makefile.in: Rebuild.
13764
13765 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13766
13767 * layout.cc (Layout::output_section_name): Preserve names
13768 of '.note.' sections.
13769
13770 2009-03-19 Ian Lance Taylor <iant@google.com>
13771
13772 * descriptors.cc (Descriptors::open): Check that the options are
13773 valid before using them.
13774
13775 2009-03-18 Ian Lance Taylor <iant@google.com>
13776
13777 * script-sections.h: Include <list>.
13778 (class Script_sections): Change Sections_elements from std::vector
13779 to std::list. Typedef public Elements_iterator. Add
13780 orphan_section_placement_, data_segment_align_start_, and
13781 saw_data_segment_align_ fields. Remove data_segment_align_index_
13782 field.
13783 * script-sections.cc (class Orphan_section_placement): New class.
13784 (class Sections_element): Add virtual functions is_relro and
13785 orphan_section_init. Remove virtual function place_orphan_here.
13786 (class Output_section_definition): Add is_relro and
13787 orphan_section_init. Remove place_orphan_here.
13788 (class Orphan_output_section): Likewise.
13789 (Script_sections::Script_sections): Update for field changes.
13790 (Script_sections::data_segment_align): Set saw_data_segment_align_
13791 and data_segment_align_start_, not data_segment_align_index.
13792 (Script_sections::data_segment_relro_end): Check
13793 saw_data_segment_align_. Use data_segment_align_start_ rather
13794 than data_segment_align_index_.
13795 (Script_sections::place_orphan): Rewrite to use
13796 Orphan_section_placement.
13797
13798 2009-03-17 Ian Lance Taylor <iant@google.com>
13799
13800 * archive.cc (Archive::add_symbols): Check for a version attached
13801 to the symbol name in the archive map.
13802 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13803 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13804 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13805 (ver_test_11.a): New target.
13806 * testsuite/Makefile.in: Rebuild.
13807
13808 * configure.ac: Check for chsize and posix_fallocate. Replace
13809 ftruncate.
13810 * ftruncate.c: New file, from gnulib.
13811 * output.cc (posix_fallocate): Define dummy version if not
13812 HAVE_POSIX_FALLOCATE.
13813 (Output_file::map): Call posix_fallocate rather than lseek and
13814 write.
13815 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13816 * configure, Makefile.in, config.in: Rebuild.
13817
13818 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13819
13820 * layout.h (Layout::create_note): Add section_name parameter.
13821 * layout.cc (Layout::create_note): Likewise.
13822 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13823
13824 2009-03-17 Ian Lance Taylor <iant@google.com>
13825
13826 * descriptors.cc: Include "options.h".
13827 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13828 (Descriptors::open): Always use O_CLOEXEC when opening a new
13829 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13830 then set FD_CLOEXEC.
13831
13832 * sparc.cc (class Target_sparc): Add has_got_section.
13833 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13834 make sure we have a GOT section.
13835
13836 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13837 (Target_sparc::Scan::local): Likewise.
13838 (Target_sparc::Scan::global): Likewise.
13839 (Target_sparc::Relocate::relocate): Likewise.
13840 (Target_sparc::Relocate::relocate_tls): Likewise.
13841
13842 * symtab.cc (Symbol_table::define_default_version): New function,
13843 broken out of add_from_object.
13844 (Symbol_table::add_from_object): Call define_default_version.
13845 (Symbol_table::define_special_symbol): Add resolve_oldsym
13846 parameter. Change all callers. If the version for a symbol comes
13847 from a version script, resolve it with the symbol with the same
13848 name with no version. Also add the symbol without a version if
13849 appropriate.
13850 (do_define_in_output_data): If resolving with oldsym, don't delete
13851 sym.
13852 (do_define_in_output_segment): Likewise.
13853 (do_define_as_constant): Likewise.
13854 * symtab.h (class Symbol_table): Update declarations.
13855
13856 2009-03-13 Ian Lance Taylor <iant@google.com>
13857
13858 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13859 (Read_symbols::requeue): New function.
13860 (Read_symbols::do_read_symbols): If make_elf_object fails because
13861 the target type is not configured, and the file was searched for,
13862 issue a warning and retry with the next directory.
13863 (Add_symbols::run): If the file has an incompatible format, and
13864 it was searched for, requeue the Read_symbols task. On error,
13865 release the object.
13866 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13867 dirindex parameter to constructor. Change all callers. Declare
13868 incompatible_warning and requeue.
13869 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13870 input_argument_ and input_group_ fields. Add them to
13871 constructor. Change all callers.
13872 (class Read_script): Add dirindex_ field. Add it to constructor.
13873 Change all callers.
13874 * archive.cc (Archive::setup): Remove input_objects parameter.
13875 Change all callers.
13876 (Archive::get_file_and_offset): Likewise.
13877 (Archive::read_all_symbols): Likewise.
13878 (Archive::read_symbols): Likewise.
13879 (Archive::get_elf_object_for_member): Remove input_objects
13880 parameter. Add punconfigured parameter. Change all callers.
13881 (Archive::add_symbols): Change return type to bool. Check return
13882 value of include_member.
13883 (Archive::include_all_members): Likewise.
13884 (Archive::include_member): Change return type to bool. Return
13885 false if first included object has incompatible target. Set
13886 included_member_ field.
13887 (Add_archive_symbols::run): If add_symbols returns false, requeue
13888 Read_symbols task.
13889 * archive.h (class Archive): Add included_member_ field.
13890 Initialize it in constructor. Add input_file and searched_for
13891 methods. Update declarations.
13892 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13893 input_argument_ fields. Add them to constructor. Change all
13894 callers.
13895 * script.cc: Include "target-select.h".
13896 (class Parser_closure): Add skip_on_incompatible_target_ and
13897 found_incompatible_target_ fields. Add
13898 skip_on_incompatible_target parameter to constructor. Change all
13899 callers. Add methods skip_on_incompatible_target,
13900 clear_skip_on_incompatible_target, found_incompatible_target, and
13901 set_found_incompatible_target.
13902 (read_input_script): Add dirindex parameter. Change all callers.
13903 If parser finds an incompatible target, requeue Read_symbols
13904 task.
13905 (script_set_symbol): Clear skip_on_incompatible_target in
13906 closure.
13907 (script_add_assertion, script_parse_option): Likewise.
13908 (script_start_sections, script_add_phdr): Likewise.
13909 (script_check_output_format): New function.
13910 * script.h (read_input_script): Update declaration.
13911 * script-c.h (script_check_output_format): Declare.
13912 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13913 (ignore_cmd): Remove OUTPUT_FORMAT.
13914 * fileread.cc (Input_file::Input_file): Add explicit this.
13915 (Input_file::will_search_for): New function.
13916 (Input_file::open): Add pindex parameter. Change all callers.
13917 * fileread.h (class Input_file): Add input_file_argument method.
13918 Declare will_search_for. Update declarations.
13919 * object.cc (make_elf_object): Add punconfigured parameter.
13920 Change all callers.
13921 * object.h (class Object): Make input_file public. Add
13922 searched_for method.
13923 (make_elf_object): Update declaration.
13924 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13925 restart search.
13926 * dirsearch.h (class Dirsearch): Update declaration.
13927 * options.h (class General_options): Add --warn-search-mismatch.
13928 * parameters.cc (Parameters::is_compatible_target): New function.
13929 * parameters.h (class Parameters): Declare is_compatible_target.
13930 * workqueue.cc (Workqueue::add_blocker): New function.
13931 * workqueue.h (class Workqueue): Declare add_blocker.
13932
13933 * fileread.cc (Input_file::open): Remove options parameter.
13934 Change all callers.
13935 (Input_file::open_binary): Likewise.
13936 * script.cc (read_input_script): Likewise.
13937 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13938 options parameter from constructor. Change all callers.
13939 (class Read_script): Likewise.
13940 * fileread.h (class Input_file): Update declarations.
13941 * script.h (read_input_script): Update declaration.
13942
13943 2009-03-10 Nick Clifton <nickc@redhat.com>
13944
13945 * po/es.po: New Spanish translation.
13946
13947 2009-03-06 Cary Coutant <ccoutant@google.com>
13948
13949 * options.cc (parse_short_option): Keep dash_z from registering itself.
13950
13951 2009-03-03 Ian Lance Taylor <iant@google.com>
13952
13953 PR 9918
13954 * target-reloc.h (relocate_section): Pass output_section to
13955 relocate.
13956 * i386.cc (Target_i386::should_apply_static_reloc): Add
13957 output_section parameter. Change all callers.
13958 (Target_i386::Relocate::relocate): Add output_section parameter.
13959 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13960 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13961 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13962 * testsuite/two_file_shared.sh: New script.
13963 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13964 (check_DATA): Add two_file_shared.dbg.
13965 (two_file_shared.dbg): New target.
13966 * testsuite/Makefile.in: Rebuild.
13967
13968 2009-03-01 Ian Lance Taylor <iant@google.com>
13969
13970 * configure.ac: Check for byteswap.h.
13971 * configure: Rebuild.
13972 * config.in: Rebuild.
13973
13974 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13975
13976 * layout.cc (Layout::find_or_add_kept_section): New function.
13977 (Layout::add_comdat): Removed.
13978 * layout.h (struct Kept_section): Move out of class Layout.
13979 Remove trailing underscores from field names. Add group_sections
13980 field. Rename group_ field to is_group. Change all uses.
13981 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13982 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13983 comdat_groups_ field.
13984 (Sized_relobj::include_section_group): Use
13985 find_or_add_kept_section and Kept_section::group_sections.
13986 (Sized_relobj::include_linkonce_section): Likewise.
13987 * object.cc (class Sized_relobj): Don't define Comdat_group or
13988 Comdat_group_table. Remove find_comdat_group and
13989 add_comdat_group. Remove comdat_groups_ field.
13990 * plugin.cc (include_comdat_group): Use
13991 Layout::find_or_add_kept_section.
13992
13993 2009-02-28 Ian Lance Taylor <iant@google.com>
13994
13995 * README: --gc-sections and map files are now supported. Document
13996 some build requirements.
13997
13998 PR 6992
13999 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14000 relocatable link set the value of the section symbol to zero.
14001 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14002 relocatable link don't include the section address in the local
14003 symbol value.
14004
14005 2009-02-27 Ian Lance Taylor <iant@google.com>
14006
14007 PR 6811
14008 * options.h (class Search_directory): Add is_system_directory.
14009 (class General_options): Declare is_in_system_directory.
14010 * options.cc (get_relative_sysroot): Make static.
14011 (get_default_sysroot): Make static.
14012 (General_optoins::is_in_system_directory): New function.
14013 * fileread.cc (Input_file::is_in_system_directory): New function.
14014 * fileread.h (class Input_file): Declare is_in_system_directory.
14015 * object.h (class Object): Add is_in_system_directory.
14016 (class Input_objects): Remove system_library_directory_ field.
14017 * object.cc (Input_objects::add_object): Don't set
14018 system_library_directory_.
14019 (input_objects::found_in_system_library_directory): Remove.
14020 * symtab.cc (Symbol_table::write_globals): Remove input_objects
14021 parameter. Change all callers.
14022 (Symbol_table::sized_write_globals): Likewise.
14023 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14024 Call Object::is_in_system_directory.
14025 * symtab.h (class Symbol_table): Update declarations.
14026
14027 PR 5990
14028 * descriptors.h (Open_descriptor): Add is_on_stack field.
14029 * descriptors.cc (Descriptors::open): If the descriptor is on the
14030 top of the stack, remove it. Initialize is_on_stack field.
14031 (Descriptors::release): Only add pod to stack if it is not on the
14032 stack already.
14033 (Descriptors::close_some_descriptor): Clear stack_next and
14034 is_on_stack fields.
14035
14036 PR 7091
14037 * output.cc (Output_section::find_starting_output_address): Rename
14038 from starting_output_address; add PADDR parameter; change return
14039 type.
14040 * output.h (class Output_section): Declare
14041 find_starting_output_address instead of starting_output_address.
14042 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14043 section symbol for which we can't find a merge section.
14044
14045 PR 9836
14046 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14047 hidden or internal, force the symbol to be local.
14048 * resolve.cc (Symbol::override_visibility): Define.
14049 (Symbol::override_base): Use override_visibility.
14050 (Symbol_table::resolve): Likewise.
14051 (Symbol::override_base_with_special): Likewise.
14052 (Symbol_table::override_with_special): If the visibility is hidden
14053 or internal, force the symbol to be local.
14054 * symtab.h (class Symbol): Add set_visibility and
14055 override_visibility.
14056 * testsuite/ver_test_1.sh: New file.
14057 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14058 (check_DATA): Add ver_test_1.syms.
14059 (ver_test_1.syms): New target.
14060 * testsuite/Makefile.in: Rebuild.
14061
14062 2009-02-25 Cary Coutant <ccoutant@google.com>
14063
14064 * layout.cc (Layout::choose_output_section): Don't rename sections
14065 when using a linker script that has a SECTIONS clause.
14066 * Makefile.in: Regenerate.
14067
14068 * testsuite/Makefile.am (script_test_5.sh): New test case.
14069 * testsuite/Makefile.in: Regenerate.
14070 * testsuite/script_test_5.cc: New file.
14071 * testsuite/script_test_5.sh: New file.
14072 * testsuite/script_test_5.t: New file.
14073
14074 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14075
14076 * archive.cc (Archive::include_member): Update calls to add_symbols.
14077 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14078 the Layout argument.
14079 * dynobj.h (do_add_symbols): Add the Layout argument.
14080 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14081 Layout argument.
14082 * object.h (Object::add_symbols): Add the Layout argument.
14083 (Object::do_add_symbols): Add the Layout argument.
14084 (Sized_relobj::do_add_symbols): Add the Layout argument.
14085 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14086 Unify the two versions.
14087 (Add_plugin_symbols): Remove.
14088 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14089 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14090 (Add_plugin_symbols): Remove.
14091 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14092 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14093 (Add_symbols::run): Make it work with Pulginobj.
14094
14095 2009-02-06 Ian Lance Taylor <iant@google.com>
14096
14097 * object.cc (Sized_relobj::do_layout): Make info message start
14098 with lower case letter.
14099
14100 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
14101
14102 * binary.cc: Fix file comment.
14103
14104 * options.h (enum Incremental_disposition): Define.
14105 (class General_options): Add new options: --incremental,
14106 --incremental_changed, --incremental_unchanged,
14107 --incremental_unknown. Add incremental_disposition_ and
14108 implicit_incremental_ fields.
14109 (General_options::incremental_disposition): New function.
14110 (class Position_dependent_options): Add incremental_disposition
14111 option.
14112 (Position_dependent_options::copy_from_options): Set incremental
14113 dispositions.
14114 * options.cc (General_options::parse_incremental_changed): New
14115 function.
14116 (General_options::parse_incremental_unchanged): New function.
14117 (General_options::parse_incremental_unknown): New function.
14118 (General_options::General_options): Initialize new fields
14119 incremental_disposition_ and implicit_incremental_.
14120 (General_options::finalize): Check for uasge of --incremental-*
14121 without --incremental.
14122
14123 2009-02-06 Chris Demetriou <cgd@google.com>
14124
14125 * gold.h (gold_undefined_symbol): Change to take only a Symbol
14126 pointer and to report location as the file name associated with
14127 the symbol.
14128 (gold_undefined_symbol_at_location): New function to replace the
14129 old gold_undefined_symbol functionality.
14130 * target-reloc.h (relocate_section): Update to use
14131 gold_undefined_symbol_at_location.
14132 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14133 Call gold_undefined_symbol function rather than gold_error.
14134 * errors.h (Errors::undefined_symbol): Take location as a
14135 string, rather than calculating it from a relocation.
14136 * errors.cc (Errors::fatal): Print "fatal error:" before the
14137 formatted message.
14138 (Errors::error, Errors::error_at_location): Print "error: "
14139 before the formatted message.
14140 (Errors::undefined_symbol): Take location as a string, rather
14141 than calculating it from a relocation.
14142 (gold_undefined_symbol_at_location): New function akin to
14143 old gold_undefined_symbol, calculates location from relocation.
14144 (gold_undefined_symbol): Change to take only a Symbol pointer
14145 and to report location as the file name associated with the symbol.
14146 * testsuite/debug_msg.sh: Update for changed error messages.
14147 * testsuite/undef_symbol.sh: Likewise.
14148
14149 2009-02-04 Duncan Sands <baldrick@free.fr>
14150
14151 PR 9812
14152 * reduced_debug_output.h
14153 (Output_reduced_debug_abbrev_section::failed): Use format for
14154 gold_warning.
14155 (Output_reduced_debug_info_section::faild): Likewise.
14156
14157 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
14158
14159 * script.cc (Lazy_demangler): New class.
14160 (Version_script_info::get_symbol_version_helper): Demangle a
14161 symbol only once.
14162
14163 2009-01-29 Cary Coutant <ccoutant@google.com>
14164
14165 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14166 to __tls_get_addr.
14167 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14168
14169 2009-01-28 Ian Lance Taylor <iant@google.com>
14170
14171 * version.cc (version_string): Bump to 1.9.
14172
14173 * gold.h: Include <cstring> and <stdint.h>.
14174 * version.cc: Include <cstdio>.
14175 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14176 warning.
14177 * reduced_debug_output.cc (insert_into_vector): Rename from
14178 Insert_into_vector; change all callers. Use Swap_unaligned to
14179 avoid aliasing issue; remove union since it is unnecessary.
14180
14181 2009-01-27 Sriraman Tallam <tmsriram@google.com>
14182
14183 * Makefile.am (CCFILES): Add gc.cc.
14184 (HFILES): Add gc.h.
14185 * Makefile.in: Regenerate.
14186 * gold.cc (Gc_runner): New class.
14187 (queue_initial_tasks): Call garbage collection related tasks
14188 when corresponding options are invoked.
14189 (queue_middle_gc_tasks): New function.
14190 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14191 processed early before laying out sections during garbage collection.
14192 * gold.h (queue_middle_gc_tasks): New function.
14193 (is_prefix_of): Move from "layout.cc".
14194 * i386.cc (Target_i386::gc_process_relocs): New function.
14195 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14196 * main.cc (main): Create object of class "Garbage_collection".
14197 * object.cc (Relobj::copy_symbols_data): New function.
14198 (Relobj::is_section_name_included): New function.
14199 (Sized_relobj::do_layout): Allow this function to be called twice
14200 during garbage collection and defer layout of section during the
14201 first call.
14202 * object.h (Relobj::get_symbols_data): New function.
14203 (Relobj::is_section_name_included): New function.
14204 (Relobj::copy_symbols_data): New function.
14205 (Relobj::set_symbols_data): New function.
14206 (Relobj::get_relocs_data): New function.
14207 (Relobj::set_relocs_data): New function.
14208 (Relobj::is_output_section_offset_invalid): New pure virtual function.
14209 (Relobj::gc_process_relocs): New function.
14210 (Relobj::do_gc_process_relocs): New pure virtual function.
14211 (Relobj::sd_): New data member.
14212 (Sized_relobj::is_output_section_offset_invalid): New function.
14213 (Sized_relobj::do_gc_process_relocs): New function.
14214 * options.h (General_options::gc_sections): Modify to not be a no-op.
14215 (General_options::print_gc_sections): New option.
14216 * plugin.cc (Plugin_finish::run): Remove function call to
14217 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
14218 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14219 * reloc.cc (Read_relocs::run): Add task to process relocs and
14220 determine unreferenced sections when doing garbage collection.
14221 (Gc_process_relocs): New class.
14222 (Sized_relobj::do_gc_process_relocs): New function.
14223 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14224 sections that are garbage collected.
14225 * reloc.h (Gc_process_relocs): New class.
14226 * sparc.cc (Target_sparc::gc_process_relocs): New function.
14227 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14228 symbols whose corresponding sections are garbage collected.
14229 (Symbol_table::Symbol_table): Add new parameter for the garbage
14230 collection object.
14231 (Symbol_table::gc_mark_undef_symbols): New function.
14232 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14233 (Symbol_table::gc_mark_dyn_syms): New function.
14234 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14235 as garbage.
14236 (Symbol_table::add_from_object): Likewise.
14237 (Symbol_table::add_from_relobj): When building shared objects, do not
14238 treat externally visible symbols as garbage.
14239 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14240 table information for static and relocatable links.
14241 * symtab.h (Symbol_table::set_gc): New function.
14242 (Symbol_table::gc): New function.
14243 (Symbol_table::gc_mark_undef_symbols): New function.
14244 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14245 (Symbol_table::gc_mark_dyn_syms): New function.
14246 (Symbol_table::gc_): New data member.
14247 * target.h (Sized_target::gc_process_relocs): New pure virtual
14248 function.
14249 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14250 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14251
14252 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
14253
14254 * options.h (General_options::gc_sections): Define as a no-op for now.
14255 (General_options::no_keep_memory): Ditto.
14256 (General_options::Bshareable): Define.
14257 * options.cc (General_options::finalize): Honor -Bshareable.
14258
14259 2009-01-20 Andreas Schwab <schwab@suse.de>
14260
14261 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14262 read the value in the contents, since we don't use it. Use the
14263 template endianness when writing.
14264 (Relocate::relocate): Use it for R_PPC_REL16_HA.
14265
14266 2009-01-19 Andreas Schwab <schwab@suse.de>
14267
14268 * configure.tgt (powerpc64-*): Fix targ_obj.
14269
14270 2009-01-15 Ian Lance Taylor <iant@google.com>
14271
14272 * object.cc (Sized_relobj::write_local_symbols): Don't write out
14273 local symbols when stripping all symbols.
14274
14275 2009-01-14 Cary Coutant <ccoutant@google.com>
14276
14277 * output.cc (Output_reloc): Add explicit instantiations.
14278
14279 2009-01-14 Cary Coutant <ccoutant@google.com>
14280
14281 * archive.cc (Archive::get_elf_object_for_member): Remove call
14282 to File_read::claim_for_plugin.
14283 * descriptors.cc (Descriptors::open): Remove reference to
14284 is_claimed.
14285 (Descriptors::claim_for_plugin): Remove.
14286 * descriptors.h (Descriptors::claim_for_plugin): Remove.
14287 (Descriptors::is_claimed): Remove.
14288 (claim_descriptor_for_plugin): Remove.
14289 * fileread.cc (File_read::claim_for_plugin): Remove.
14290 * fileread.h (File_read::claim_for_plugin): Remove.
14291 (File_read::descriptor): Reopen descriptor if necessary.
14292 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
14293 (Plugin_manager::all_symbols_read): Add task parameter. Change
14294 all callers.
14295 (Plugin_manager::get_input_file): New function.
14296 (Plugin_manager::release_input_file): New function.
14297 (Pluginobj::Pluginobj): Add filesize parameter and initialize
14298 corresponding data member.
14299 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14300 and pass to base constructor. Change all callers.
14301 (get_input_file, release_input_file): New functions.
14302 (make_sized_plugin_object): Add filesize parameter. Change all callers.
14303 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14304 (Plugin_manager::all_symbols_read): Add task parameter.
14305 (Plugin_manager::get_input_file): New function.
14306 (Plugin_manager::release_input_file): New function.
14307 (Plugin_manager::task_): New data member.
14308 (Pluginobj::Pluginobj): Add filesize parameter.
14309 (Pluginobj::filename): New function.
14310 (Pluginobj::descriptor): New function.
14311 (Pluginobj::filesize): New function.
14312 (Pluginobj::filesize_): New data member.
14313 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14314 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14315 File_read::claim_for_plugin; use Object::unlock to unlock the file.
14316
14317 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14318 with archive libraries.
14319 * testsuite/Makefile.in: Regenerate.
14320 * testsuite/plugin_test.c (struct sym_info): New type.
14321 (get_input_file, release_input_file): New static variables.
14322 (onload): Capture new transfer vector entries.
14323 (claim_file_hook): Stop reading at end of file according to filesize.
14324 Factor out parsing of readelf output into separate function.
14325 (all_symbols_read_hook): Exercise get_input_file and release_input_file
14326 APIs and get the source file name from the symbol table. Convert
14327 source file name to corresponding object file name. Print info
14328 message when adding new input files.
14329 (parse_readelf_line): New function.
14330 * testsuite/plugin_test_1.sh: Add checks for new info messages.
14331 * testsuite/plugin_test_2.sh: Likewise.
14332 * testsuite/plugin_test_3.sh: Likewise.
14333 * testsuite/plugin_test_4.sh: New test case.
14334
14335 2009-01-07 Ian Lance Taylor <iant@google.com>
14336
14337 * version.cc (version_string): Bump to 1.8.
14338
14339 2008-12-23 Cary Coutant <ccoutant@google.com>
14340
14341 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14342 * plugin.cc (Plugin_manager::finish): Rename as
14343 layout_deferred_objects. Move cleanup to separate function.
14344 (Plugin_manager::cleanup): New function.
14345 (Plugin_finish::run): Call layout_deferred_objects and cleanup
14346 separately.
14347 * plugin.h (Plugin_manager::finish): Rename as
14348 layout_deferred_objects.
14349 (Plugin_manager::cleanup): New function.
14350 (Plugin_manager::cleanup_done): New field.
14351
14352 2008-12-23 Cary Coutant <ccoutant@google.com>
14353
14354 * plugin.cc (is_visible_from_outside): New function.
14355 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14356 so we don't return "IR only" status for exported symbols or -r links.
14357
14358 * testsuite/Makefile.am (plugin_test_3): New test case.
14359 * testsuite/Makefile.in: Regenerate.
14360 * testsuite/plugin_test_3.sh: New file.
14361
14362 2008-12-22 Cary Coutant <ccoutant@google.com>
14363
14364 * object.cc (Sized_relobj::layout_section): New function.
14365 (Sized_relobj::do_layout): Defer layout of input sections until after
14366 plugin has provided replacement files.
14367 (Sized_relobj::do_layout_deferred_sections): New function.
14368 * object.h (Relobj::set_section_offset): Remove virtual keyword.
14369 (Relobj::layout_deferred_sections): New function.
14370 (Relobj::do_layout_deferred_sections): New function.
14371 (Sized_relobj::do_layout_deferred_sections): New function.
14372 (Sized_relobj::layout_section): New function.
14373 (Sized_relobj::Deferred_layout): New structure.
14374 (Sized_relobj::deferred_layout_): New field.
14375 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14376 Change all callers. Layout deferred sections.
14377 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
14378 references.
14379 (Plugin_hook::run): Move code from do_plugin_hook inline.
14380 (Plugin_hook::do_plugin_hook): Remove.
14381 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14382 (Plugin_manager::finish): Renamed, was cleanup.
14383 (Plugin_manager::should_defer_layout): New function.
14384 (Plugin_manager::add_deferred_layout_object): New function.
14385 (Plugin_manager::Deferred_layout_list): New type.
14386 (Plugin_manager::deferred_layout_objects_): New field.
14387 (Plugin_hook::do_plugin_hook): Remove.
14388
14389 2008-12-17 Ian Lance Taylor <iant@google.com>
14390
14391 * options.h (class General_options): Add --no case for
14392 --export-dynamic.
14393
14394 2008-12-16 Cary Coutant <ccoutant@google.com>
14395
14396 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14397 vector.
14398 (Plugin_manager::claim_file): Create plugin object even if
14399 plugin did not call the add_symbols callback.
14400 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14401 asking for more symbols than were added.
14402 * testsuite/Makefile.am (plugin_test_1): Add test case with
14403 no global symbols.
14404 (empty.syms): New target.
14405 * testsuite/Makefile.in: Regenerate.
14406 * testsuite/plugin_test.c (claim_file_hook): Add new debug
14407 message. Don't call add_symbols if no globals.
14408 (all_symbols_read_hook): Don't provide replacement for empty
14409 claimed file.
14410
14411 2008-12-12 Ian Lance Taylor <iant@google.com>
14412
14413 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14414 r_type == 0 for a local symbol with r_sym == 0.
14415 (scan_relocatable_relocs): Pass r_sym to
14416 local_non_section_strategy.
14417 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14418 r_sym parameter.
14419
14420 * configure.ac: Update test for TLS descriptors: they are
14421 supported as of glibc 2.9.
14422 * configure: Rebuild.
14423
14424 2008-12-11 Ian Lance Taylor <iant@google.com>
14425
14426 PR 7091
14427 * target-reloc.h (Default_scan_relocatable_relocs): For each
14428 function, map r_type == 0 to RELOC_DISCARD.
14429
14430 2008-12-10 Cary Coutant <ccoutant@google.com>
14431
14432 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14433 object to override a kept COMDAT group from a plugin object.
14434
14435 2008-12-09 Ian Lance Taylor <iant@google.com>
14436
14437 PR 7088
14438 * yyscript.y (file_cmd): Handle INPUT.
14439
14440 * testsuite/initpri1.c: Change all declarations to be full
14441 prototypes by adding void, to avoid compiler warnings.
14442
14443 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
14444
14445 * options.cc (General_options::parse_plugin_opt): New.
14446 (General_options::add_plugin): The argument now is just the filename.
14447 (General_options::add_plugin_option): New.
14448 * options.h (plugin_opt): New.
14449 (add_plugin): Change argument name.
14450 (add_plugin_option): New.
14451 * plugin.cc (Plugin::load): Don't parse the plugin option.
14452 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14453 (Plugin::add_option): New.
14454 (Plugin::args_): Change type.
14455 (Plugin::filename_): New.
14456 (Plugin_manager::add_plugin_option): New.
14457 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14458 * testsuite/Makefile.in: Regenerate.
14459
14460 2008-12-05 Cary Coutant <ccoutant@google.com>
14461
14462 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14463 Handle --strip-lto-sections option.
14464 * options.h (strip_lto_sections): New option.
14465
14466 2008-12-01 Cary Coutant <ccoutant@google.com>
14467
14468 * plugin.cc (ld_plugin_message): Change format parameter to const.
14469 Fix mismatch between new[] and delete.
14470
14471 2008-11-14 Cary Coutant <ccoutant@google.com>
14472
14473 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14474 instead of -1U.
14475
14476 2008-11-05 Craig Silverstein <csilvers@google.com>
14477
14478 * options.cc (General_options::parse_dynamic_list): New function.
14479 * options.h (General_options): New flags dynamic_list,
14480 dynamic_list_data, dynamic_list_cpp_new, and
14481 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
14482 (General_options::in_dynamic_list): New function.
14483 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14484 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14485 (Lex::can_continue_name): Likewise.
14486 (yylex): Likewise.
14487 (read_script_file): New parameter script_options.
14488 (read_dynamic_list): New function.
14489 (Script_options::define_dynamic_list): New function.
14490 (dynamic_list_keyword_parsecodes): New variable.
14491 (dynamic_list_keywords): New variable.
14492 * script.h (Script_options::define_dynamic_list): New function
14493 prototype.
14494 (read_dynamic_list): New function prototype.
14495 * symtab.cc (strprefix): New macro.
14496 (Symbol::should_add_dynsym_entry): Support dynamic_list,
14497 dynamic_list_data, dynamic_list_cpp_new, and
14498 dynamic_list_cpp_typeinfo.
14499 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14500 (dynamic_list_expr): New rule.
14501 (dynamic_list_nodes): Likewise.
14502 (dynamic_list_node): Likewise.
14503 * testsuite/Makefile.am (dynamic_list): New test.
14504 * testsuite/Makefile.in: Regenerated.
14505 * testsuite/dynamic_list.t: New file.
14506 * testsuite/dynamic_list.sh: New file.
14507
14508 2008-11-05 Craig Silverstein <csilvers@google.com>
14509
14510 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14511 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14512 (t11_last): Likewise.
14513 * testsuite/ver_test_6.c (main): Likewise.
14514
14515 2008-10-07 Cary Coutant <ccoutant@google.com>
14516
14517 * options.c (General_options::finalize): Add check for -static and
14518 -shared.
14519 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14520 is not empty.
14521
14522 2008-10-02 Cary Coutant <ccoutant@google.com>
14523
14524 * plugin.cc (make_sized_plugin_object): Fix conditional
14525 compilation to work when not all targets are enabled.
14526
14527 2008-09-29 Cary Coutant <ccoutant@google.com>
14528
14529 * archive.cc (Archive::get_file_and_offset): Use filename instead
14530 of name to get library path.
14531 (Archive::include_member): Unlock external member of a thin archive.
14532
14533 * testsuite/Makefile.am (TEST_AR): New variable.
14534 (thin_archive_test_1): New test.
14535 (thin_archive_test_2): New test.
14536 * testsuite/Makefile.in: Regenerate.
14537 * testsuite/thin_archive_main.cc: New file.
14538 * testsuite/thin_archive_test_1.cc: New file.
14539 * testsuite/thin_archive_test_2.cc: New file.
14540 * testsuite/thin_archive_test_3.cc: New file.
14541 * testsuite/thin_archive_test_4.cc: New file.
14542
14543 2008-09-29 Cary Coutant <ccoutant@google.com>
14544
14545 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14546 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14547 instead of -1U.
14548 (Sized_relobj::do_finalize_local_symbols): Likewise.
14549 (Sized_relobj::map_to_kept_section): Likewise.
14550 * object.h (Sized_relobj::invalid_address): New constant.
14551 (Sized_relobj::do_output_section_offset): Check for invalid_address
14552 and return -1ULL.
14553 * output.cc (Output_reloc::local_section_offset): Use constant
14554 invalid_address instead of -1U.
14555 (Output_reloc::get_address): Likewise.
14556 (Output_section::output_address): Change -1U to -1ULL.
14557 * output.h (Output_reloc::invalid_address): New constant.
14558 * reloc.cc (Sized_relobj::write_sections): Use constant
14559 invalid_address instead of -1U.
14560 (Sized_relobj::relocate_sections): Likewise.
14561 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14562 values for merge sections.
14563 * target-reloc.h (relocate_for_relocatable): Use constant
14564 invalid_address instead of -1U.
14565
14566 2008-09-19 Cary Coutant <ccoutant@google.com>
14567
14568 Add plugin functionality for link-time optimization (LTO).
14569 * configure.ac (plugins): Add --enable-plugins option.
14570 * configure: Regenerate.
14571 * config.in: Regenerate.
14572 * Makefile.am (LIBDL): New variable.
14573 (CCFILES): Add plugin.cc.
14574 (HFILES): Add plugin.h.
14575 (ldadd_var): Add LIBDL.
14576 * Makefile.in: Regenerate.
14577
14578 * archive.cc: Include "plugin.h".
14579 (Archive::setup): Don't preread archive symbols when using a plugin.
14580 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
14581 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14582 files.
14583 (Archive::include_member): Add symbols from plugin objects.
14584 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14585 * descriptors.cc (Descriptors::open): Check for file descriptors
14586 abandoned by plugins.
14587 (Descriptors::claim_for_plugin): New function.
14588 * descriptors.h (Descriptors::claim_for_plugin): New function.
14589 (Open_descriptor::is_claimed): New field.
14590 (claim_descriptor_for_plugin): New function.
14591 * fileread.cc (File_read::claim_for_plugin): New function.
14592 * fileread.h (File_read::claim_for_plugin): New function.
14593 (File_read::descriptor): New function.
14594 * gold.cc: Include "plugin.h".
14595 (queue_initial_tasks): Add task to call plugin hooks for generating
14596 new object files.
14597 * main.cc: Include "plugin.h".
14598 (main): Load plugin libraries.
14599 * object.h (Pluginobj): Declare.
14600 (Object::pluginobj): New function.
14601 (Object::do_pluginobj): New function.
14602 (Object::set_target): New function.
14603 * options.cc: Include "plugin.h".
14604 (General_options::parse_plugin): New function.
14605 (General_options::General_options): Initialize plugins_ field.
14606 (General_options::add_plugin): New function.
14607 * options.h (Plugin_manager): Declare.
14608 (General_options): Add --plugin option.
14609 (General_options::has_plugins): New function.
14610 (General_options::plugins): New function.
14611 (General_options::add_plugin): New function.
14612 (General_options::plugins_): New field.
14613 * plugin.cc: New file.
14614 * plugin.h: New file.
14615 * readsyms.cc: Include "plugin.h".
14616 (Read_symbols::do_read_symbols): Check for archive before checking
14617 for ELF file. Call plugin hooks to claim files.
14618 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14619 from a real object file; force override when processing replacement
14620 files.
14621 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14622 (Symbol::init_base_object): Likewise.
14623 (Symbol::init_base_output_data): Likewise.
14624 (Symbol::init_base_output_segment): Likewise.
14625 (Symbol::init_base_constant): Likewise.
14626 (Symbol::init_base_undefined): Likewise.
14627 (Symbol::output_section): Assert that object is not a plugin.
14628 (Symbol_table::add_from_pluginobj): New function.
14629 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14630 undefined.
14631 (Symbol_table::sized_write_globals): Likewise.
14632 (Symbol_table::add_from_pluginobj): Instantiate template.
14633 * symtab.h (Sized_pluginobj): Declare.
14634 (Symbol::in_real_elf): New function.
14635 (Symbol::set_in_real_elf): New function.
14636 (Symbol::in_real_elf_): New field.
14637 (Symbol_table::add_from_pluginobj): New function.
14638
14639 * testsuite/Makefile.am (AM_CFLAGS): New variable.
14640 (LIBDL): New variable.
14641 (LDADD): Add LIBDL.
14642 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14643 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14644 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14645 (MOSTLYCLEANFILES): Likewise.
14646 * testsuite/Makefile.in: Regenerate.
14647 * testsuite/plugin_test.c: New file.
14648 * testsuite/plugin_test_1.sh: New file.
14649 * testsuite/plugin_test_2.sh: New file.
14650
14651 2008-09-16 Ian Lance Taylor <iant@google.com>
14652
14653 * target-reloc.h (relocate_section): Check whether a symbol is
14654 defined by the ABI before reporting an undefined symbol error.
14655 * target.h (Target::is_defined_by_abi): Make parameter const.
14656 (Target::do_is_defined_by_abi): Likewise.
14657 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14658 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14659 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14660 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14661 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14662 * testsuite/Makefile.in: Rebuild.
14663
14664 * fileread.cc (make_view): Add casts to avoid warning.
14665
14666 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14667
14668 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14669 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14670
14671 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14672
14673 * options.h (General_options::output_is_executable): New.
14674 (General_options::output_is_pie): New.
14675 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14676 for shared libraries.
14677 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14678
14679 2008-09-11 Chris Demetriou <cgd@google.com>
14680
14681 * options.h (origin): New -z option.
14682 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14683 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14684 in DT_FLAGS_1.
14685
14686 2008-09-05 Cary Coutant <ccoutant@google.com>
14687
14688 * fileread.cc (File_read::make_view): Add check for attempt to map
14689 beyond end of file.
14690
14691 2008-09-05 Cary Coutant <ccoutant@google.com>
14692
14693 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14694 explicit instantiations.
14695
14696 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14697
14698 PR gold/6858
14699 * options.cc (General_options::finalize): Allow undefined symbols
14700 in shlibs if linking -shared.
14701
14702 PR gold/6859
14703 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14704 symbols as not needing a dynsym entry.
14705
14706 2008-08-20 Craig Silverstein <csilvers@google.com>
14707
14708 * fileread.cc (File_read::open): Do not lock the file unless it
14709 was successfully opened.
14710
14711 2008-08-14 Cary Coutant <ccoutant@google.com>
14712
14713 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14714 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14715 * testsuite/tls_test.cc (struct int128): 128-bit struct
14716 for testing TLS relocs with non-zero addend.
14717 (v12): New TLS variable.
14718 (t12): New test.
14719 (t_last): Add check for v12.
14720 * testsuite/tls_test.h (t12): New function.
14721 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14722
14723 2008-08-13 Ian Lance Taylor <iant@google.com>
14724
14725 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14726 set tls_segment_ or relro_segment_.
14727 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14728 when appropriate.
14729 * output.h (Output_section::clear_is_relro): New function.
14730 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14731 sections specially even when output_data_ is empty.
14732 (Output_segment::maximum_alignment): When first section is relro,
14733 only force alignment for PT_LOAD segments.
14734 * script.cc (script_data_segment_align): New function.
14735 (script_data_segment_relro_end): New function.
14736 * script-c.h (script_data_segment_align): Declare.
14737 (script_data_segment_relro_end): Declare.
14738 * script-sections.h (class Script_sections): Declare
14739 data_segment_align and data_segment_relro_end. Add fields
14740 segment_align_index_ and saw_relro_end_.
14741 * script-sections.cc (class Sections_element): Add set_is_relro
14742 virtual function. Add new bool* parameter to place_orphan_here.
14743 Add get_output_section virtual function.
14744 (class Output_section_definition): Add set_is_relro. Add new
14745 bool* parameter to place_orphan_here. Add get_output_section.
14746 Add is_relro_ field.
14747 (Output_section_definition::Output_section_definition): Initialize
14748 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14749 and is_relro_ fields.
14750 (Output_section_definition::place_orphan_here): Add is_relro
14751 parameter.
14752 (Output_section_definition::set_section_addresses): Set relro for
14753 output section.
14754 (Output_section_definition::alternate_constraint): Likewise.
14755 (class Orphan_output_section): Add new bool* parameter to
14756 place_orphan_here. Add get_output_section.
14757 (Orphan_output_section::place_orphan_here): Add is_relro
14758 parameter.
14759 (Script_sections::Script_sections): Initialize
14760 data_segment_align_index_ and saw_relro_end_.
14761 (Script_sections::data_segment_align): New function.
14762 (Script_sections::data_segment_relro_end): New function.
14763 (Script_sections::place_orphan): Set or clear is_relro.
14764 (Script_sections::set_section_addresses): Force alignment of first
14765 TLS section.
14766 * yyscript.y (exp): Call script_data_segment_align and
14767 script_data_segment_relro_end.
14768 * testsuite/relro_script_test.t: New file.
14769 * testsuite/relro_test.cc (using_script): Declare.
14770 (t1, t2): Test using_script.
14771 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14772 (relro_script_test_SOURCES): Define.
14773 (relro_script_test_DEPENDENCIES): Define.
14774 (relro_script_test_LDFLAGS): Define.
14775 (relro_script_test_LDADD): Define.
14776 (relro_script_test.so): New target.
14777 * testsuite/Makefile.in: Rebuild.
14778
14779 2008-08-06 Cary Coutant <ccoutant@google.com>
14780
14781 * archive.cc (Archive::total_archives, Archive::total_members)
14782 (Archive::total_members_loaded): New variables.
14783 (Archive::setup): Add parameter. Add option to preread
14784 archive symbols.
14785 (Archive::read_armap): Add counter.
14786 (Archive::get_file_and_offset): New function.
14787 (Archive::get_elf_object_for_member): New function.
14788 (Archive::read_all_symbols): New function.
14789 (Archive::read_symbols): New function.
14790 (Archive::add_symbols): Add counters.
14791 (Archive::include_all_members): Use armap to find members if it's
14792 already built.
14793 (Archive::include_member): Skip reading symbols if already read.
14794 Factored code into Archive::get_file_and_offset and
14795 Archive::get_elf_object_for_member. Changed call to
14796 Mapfile::report_include_archive_member.
14797 (Archive::print_stats): New function.
14798 * archive.h: Declare Object and Read_symbols_data classes.
14799 (Archive::Archive): Add initializers for new members.
14800 (Archive::setup): Add parameter.
14801 (Archive::print_stats): New function.
14802 (Archive::total_archives, Archive::total_members)
14803 (Archive::total_members_loaded): New variables.
14804 (Archive::get_file_and_offset): New function.
14805 (Archive::get_elf_object_for_member): New function.
14806 (Archive::read_all_symbols): New function.
14807 (Archive::read_symbols): New function.
14808 (Archive::Archive_member): New class.
14809 (Archive::members_): New member.
14810 (Archive::num_members_): New member.
14811 * main.cc: Include archive.h.
14812 (main): Call Archive::print_stats.
14813 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14814 archive parameter; member_name is now the fully-decorated name.
14815 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14816 * options.h: (General_options): Add --preread-archive-symbols option.
14817 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14818 Archive::setup.
14819
14820 2008-08-04 Ian Lance Taylor <iant@google.com>
14821
14822 * symtab.h (Symbol::use_plt_offset): New function.
14823 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14824 * powerpc.cc (Relocate::relocate): Likewise.
14825 * sparc.cc (Relocate::relocate): Likewise.
14826 * x86_64.cc (Relocate::relocate): Likewise.
14827 * testsuite/weak_plt.sh: New test.
14828 * testsuite/weak_plt_main.cc: New test.
14829 * testsuite/weak_plt_shared.cc: New test.
14830 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14831 (check_PROGRAMS): Add weak_plt.
14832 (check_DATA): Add weak_plt_shared.so.
14833 (weak_plt_main_pic.o, weak_plt): New targets.
14834 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14835 * testsuite/Makefile.in: Rebuild.
14836
14837 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14838 gcctestdir/ld.
14839 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14840 * testsuite/Makefile.in: Rebuild.
14841
14842 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14843
14844 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14845 * Makefile.in: Regenerate.
14846 * po/POTFILES.in: Regenerate.
14847
14848 2008-07-29 Ian Lance Taylor <iant@google.com>
14849
14850 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14851 symbols before other symbols.
14852 * testsuite/script_test_2.cc (test_addr): Declare.
14853 (test_addr_alias): Declare.
14854 (main): Check that test_addr and test_addr_alias have the right
14855 values.
14856 * testsuite/script_test_2.t: Define test_addr_alias and
14857 test_addr.
14858
14859 2008-07-24 Ian Lance Taylor <iant@google.com>
14860
14861 PR 5990
14862 * descriptors.cc: New file.
14863 * descriptors.h: New file.
14864 * gold-threads.h (class Hold_optional_lock): New class.
14865 * fileread.cc: Include "descriptors.h".
14866 (File_read::~File_read): Release descriptor rather than closing
14867 it.
14868 (File_read::open) [file]: Call open_descriptor rather than open.
14869 Set is_descriptor_opened_.
14870 (File_read::open) [memory]: Assert that descriptor is not open.
14871 (File_read::reopen_descriptor): New function.
14872 (File_read::release): Release descriptor.
14873 (File_read::do_read): Make non-const. Reopen descriptor.
14874 (File_read::read): Make non-const.
14875 (File_read::make_view): Reopen descriptor.
14876 (File_read::do_readv): Likewise.
14877 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14878 Update declarations.
14879 * layout.cc: Include "descriptors.h".
14880 (Layout::create_build_id): Use open_descriptor rather than open.
14881 * output.cc: Include "descriptors.h".
14882 (Output_file::open): Use open_descriptor rather than open.
14883 * archive.cc (Archive::const_iterator): Change Archive to be
14884 non-const.
14885 (Archive::begin, Archive::end): Make non-const.
14886 (Archive::count_members): Likewise.
14887 * archive.h (class Archive): Update declarations.
14888 * object.h (Object::read): Make non-const.
14889 * Makefile.am (CCFILES): Add descriptors.cc.
14890 (HFILES): Add descriptors.h.
14891 * Makefile.in: Rebuild.
14892
14893 PR 6716
14894 * gold.h: Always include <clocale>. Add Solaris workarounds
14895 following code in binutils/sysdep.h.
14896
14897 PR 6048
14898 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14899 this->eh_frame_hdr_ is NULL before using it.
14900
14901 * dynobj.cc (Versions::Versions): Update comment.
14902
14903 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14904 the base version name.
14905
14906 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14907 array size plus one.
14908 (Stringpool_template::set_string_offsets): Subtract one from key
14909 before using it as an array index.
14910 (Stringpool_template::get_offset_with_length): Likewise.
14911 (Stringpool_template::write_to_buffer): Likewise.
14912 * stringpool.h (Stringpool_template::get_offset_from_key):
14913 Likewise.
14914
14915 2008-07-23 Ian Lance Taylor <iant@google.com>
14916
14917 PR 6658
14918 * object.h (Merged_symbol_value::value): Do our best to handle a
14919 negative addend.
14920
14921 PR 6647
14922 * script.cc (Version_script_info::get_versions): Don't add empty
14923 version tag to return value.
14924 (Version_script_info::get_symbol_version_helper): Change return
14925 type to bool. Add pversion parameter. Change all callers.
14926 (script_register_vers_node): Don't require a non-NULL tag.
14927 * script.h (class Version_script_info): Update declarations.
14928 (Version_script_info::get_symbol_version): Change return type to
14929 bool. Add version parameter. Change all callers.
14930 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14931 handling. Handle an empty version from a version script.
14932 (Symbol_table::define_special_symbol): Likewise.
14933 * testsuite/ver_test_10.script: New file.
14934 * testsuite/ver_test_10.sh: New file.
14935 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14936 (check_DATA): Add ver_test_10.syms.
14937 (ver_test_10.syms, ver_test_10.so): New target.
14938 * testsuite/Makefile.in: Rebuild.
14939
14940 2008-07-23 Simon Baldwin <simonb@google.com>
14941
14942 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14943 to zero for undefined symbols from dynamic libraries.
14944
14945 2008-07-23 Ian Lance Taylor <iant@google.com>
14946
14947 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14948 Change all callers.
14949 * symtab.h (class Symbol_table): Update declaration.
14950 * testsuite/ver_test_9.cc: New file.
14951 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14952 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14953 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14954 (ver_test_9.so, ver_test_9.o): New targets.
14955 * testsuite/Makefile.in: Rebuild.
14956
14957 2008-07-22 Ian Lance Taylor <iant@google.com>
14958
14959 * options.h (class General_options): Define --check-sections.
14960 * layout.cc (Layout::set_segment_offsets): Handle
14961 --check-sections.
14962
14963 * options.h (class General_options): Define -n/--nmagic and
14964 -N/--omagic.
14965 * options.cc (General_options::finalize): For -n/--nmagic or
14966 -N/--omagic, set -static.
14967 * layout.cc (Layout::attach_allocated_section_to_segment): If
14968 -N/--omagic, don't put read-only and read-write sections in
14969 different segments.
14970 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14971 finding a read-only segment.
14972 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14973 don't set the minimum segment alignment to the common page size,
14974 and don't set the file offset to the address modulo the page size.
14975 * script-sections.cc (Script_sections::create_segments): If
14976 -n/--omagic, don't put read-only and read-write sections in
14977 different segments.
14978
14979 * cref.cc: New file.
14980 * cref.h: New file.
14981 * options.h (class General_options): Add --print-symbol-counts.
14982 * main.cc (main): Issue defined symbol report if requested.
14983 * archive.cc (Archive::interpret_header): Make into a const member
14984 function.
14985 (Archive::add_symbols): Call Input_objects::archive_start and
14986 archive_stop.
14987 (Archive::const_iterator): Define new class.
14988 (Archive::begin, Archive::end): New functions.
14989 (Archive::include_all_members): Rewrite to use iterator.
14990 (Archive::count_members): New function.
14991 * archive.h (class Archive): Update declarations.
14992 (Archive::filename): New function.
14993 * object.cc: Include "cref.h".
14994 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14995 (Sized_relobj::do_get_global_symbol_counts): New function.
14996 (Input_objects::add_object): Add object to cross-referencer.
14997 (Input_objects::archive_start): New function.
14998 (Input_objects::archive_stop): New function.
14999 (Input_objects::print_symbol_counts): New function.
15000 * object.h: Declare Cref and Archive.
15001 (Object::get_global_symbol_counts): New function.
15002 (Object::do_get_global_symbol_counts): New pure virtual function.
15003 (class Sized_relobj): Add defined_count_ field. Update
15004 declarations.
15005 (class Input_objects): Add cref_ field. Update constructor.
15006 Update declarations.
15007 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15008 defined_count_.
15009 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15010 symbol counts.
15011 (Sized_dynobj::do_get_global_symbol_counts): New function.
15012 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15013 defined_count_. Update declarations. Define Symbols typedef.
15014 * symtab.cc (Symbol_table::add_from_relobj): Add defined
15015 parameter. Change all callers.
15016 (Symbol_table::add_from_dynobj): Add sympointers and defined
15017 parameters. Change all callers.
15018 * symtab.h (class Symbol_table): Update declarations.
15019 * Makefile.am (CCFILES): Add cref.cc.
15020 (HFILES): Add cref.h.
15021 * Makefile.in: Rebuild.
15022
15023 2008-07-22 Simon Baldwin <simonb@google.com>
15024
15025 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15026 to zero when writing undefined symbols.
15027
15028 2008-07-22 Ian Lance Taylor <iant@google.com>
15029
15030 * output.cc (Output_section::add_input_section): Don't try to
15031 merge empty merge sections.
15032
15033 2008-07-21 Craig Silverstein <csilvers@google.com>
15034
15035 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15036 Include symbol version in error message.
15037
15038 2008-07-20 Chris Demetriou <cgd@google.com>
15039
15040 * configure.ac (gold_cv_c_random_seed): New configured variable.
15041 (RANDOM_SEED_CFLAGS): New substituted variable.
15042 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15043 * configure: Rebuild.
15044 * Makefile.in: Likewise.
15045 * testsuite/Makefile.in: Likewise.
15046
15047 2008-07-18 Ian Lance Taylor <iant@google.com>
15048
15049 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15050 where we see NAME/NULL and NAME/VERSION as separate symbols.
15051 * testsuite/ver_test_main.cc (main): Call t4.
15052 (t4, t4_2a): Define.
15053 * testsuite/ver_test_2.cc (t4_2): Define.
15054 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15055 * testsuite/ver_test_4.cc (t4_2a): Define.
15056 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15057 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15058
15059 2008-07-17 Ian Lance Taylor <iant@google.com>
15060
15061 * dynobj.cc (Versions::add_def): If we give an error about a
15062 missing version, go ahead and create the version anyhow.
15063
15064 2008-07-10 Ian Lance Taylor <iant@google.com>
15065
15066 Handle output sections with more than 0x7fffffff bytes.
15067 * object.h (class Relobj): Change map_to_output_ to
15068 output_sections_, and just keep a section pointer. Change all
15069 uses. Move comdat group support to Sized_relobj.
15070 (Relobj::is_section_specially_mapped): Remove.
15071 (Relobj::output_section): Remove poff parameter. Change all
15072 callers.
15073 (Relobj::output_section_offset): New function.
15074 (Relobj::set_section_offset): Rewrite.
15075 (Relobj::map_to_output): Remove.
15076 (Relobj::output_sections): New function.
15077 (Relobj::do_output_section_offset): New pure virtual function.
15078 (Relobj::do_set_section_offset): Likewise.
15079 (class Sized_relobj): Add section_offsets_ field. Add comdat
15080 group support from Relobj. Update declarations.
15081 (Sized_relobj::get_output_section_offset): New function.
15082 (Sized_relobj::do_output_section_offset): New function.
15083 (Sized_relobj::do_set_section_offset): New function.
15084 * object.cc (Relobj::output_section_address): Remove.
15085 (Sized_relobj::Sized_relobj): Initialize new fields.
15086 (Sized_relobj::include_section_group): Cast find_kept_object to
15087 Sized_relobj.
15088 (Sized_relobj::include_linkonce_section): Likewise.
15089 (Sized_relobj::do_layout): Use separate arrays for output section
15090 and output offset.
15091 (Sized_relobj::do_count_local_symbols): Change map_to_output to
15092 output_sections.
15093 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15094 output_sections and section_offsets.
15095 (Sized_relobj::write_local_symbols): Likewise.
15096 (map_to_kept_section): Compute output address directly.
15097 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15098 output_sections and section_offsets.
15099 (Sized_relobj::write_sections): Likewise.
15100 (Sized_relobj::relocate_sections): Likewise.
15101 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15102 * output.h (class Output_reloc): Update declarations. Change
15103 u2_.relobj to Sized_relobj*.
15104 (class Output_data_reloc): Change add functions to use
15105 Sized_relobj*.
15106 * output.cc (Output_reloc::Output_reloc): Change relobj to
15107 Sized_relobj*.
15108 (Output_reloc::local_section_offset): Change return type to
15109 Elf_Addr. Use get_output_section_offset.
15110 (Output_reloc::get_address): Likewise.
15111 (Output_section::is_input_address_mapped): Don't call
15112 is_section_specially_mapped.
15113 (Output_section::output_offset): Likewise.
15114 (Output_section::output_address): Likewise.
15115 (Output_section::starting_output_address): Likewise.
15116 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15117 parameter to Sized_relobj*.
15118 (Copy_relocs::need_copy_reloc): Likewise.
15119 (Copy_relocs::save): Likewise.
15120 * copy-relocs.h (class Copy_relocs): Update declarations.
15121 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15122 Sized_relobj*. Change relobj_ field to Sized_relobj*.
15123 * target-reloc.h (relocate_for_relocatable): Change
15124 offset_in_output_section type to Elf_Addr. Change code that uses
15125 it as well.
15126 * layout.cc (Layout::layout): Always set *off.
15127 * mapfile.cc (Mapfile::print_input_section): Use
15128 output_section_offset.
15129 * i386.cc (Target_i386::copy_reloc): Change object parameter to
15130 Sized_relobj*.
15131 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15132 * sparc.cc (Target_sparc::copy_reloc): Likewise.
15133 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15134
15135 2008-07-03 Ian Lance Taylor <iant@google.com>
15136
15137 * layout.cc (Layout::include_section): Do not discard unrecognized
15138 SHT_STRTAB sections.
15139
15140 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
15141
15142 * script.cc (Lex::can_continue_name): Make '?' allowable in
15143 version-script names.
15144 * testsuite/version_script.map: Change glob pattern to use '?'
15145
15146 2008-06-30 Manish Singh <yosh@gimp.org>
15147
15148 PR 6585
15149 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15150 Correct typo.
15151
15152 2008-06-30 Ian Lance Taylor <iant@google.com>
15153
15154 PR 6660
15155 PR 6682
15156 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15157 versions]: Don't try to read the value in the contents, since we
15158 don't use it. Use the template endianness when writing.
15159
15160 2008-06-25 Cary Coutant <ccoutant@google.com>
15161
15162 * fileread.cc (File_read::make_view): Assert on zero-length view.
15163 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15164 symbol table when there are no symbols to read.
15165
15166 2008-06-23 Craig Silverstein <csilvers@google.com>
15167
15168 * version.cc (version_string): Bump to 1.7
15169
15170 2008-06-18 Craig Silverstein <csilvers@google.com>
15171
15172 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15173 constant 0xFFFF to type Valtype.
15174 (Powerpc_relocate_functions::rel16_ha): Likewise.
15175
15176 2008-06-17 Ian Lance Taylor <iant@google.com>
15177
15178 * output.h (Output_section::Input_section): Initialize p2align_ to
15179 zero for Output_section_data constructors.
15180 (Output_section::Input_section::addralign): If not an input
15181 section, return the alignment of the Output_section_data.
15182 * testsuite/copy_test.cc: New file.
15183 * testsuite/copy_test_1.cc: New file.
15184 * testsuite/copy_test_2.cc: New file.
15185 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15186 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15187 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15188 (copy_test_1_pic.o, copy_test_1.so): New targets.
15189 (copy_test_2_pic.o, copy_test_2.so): New targets.
15190 * testsuite/Makefile.in: Rebuild.
15191
15192 * script-sections.cc (Script_sections::place_orphan): Initialize
15193 local variable exact.
15194
15195 2008-06-13 David Edelsohn <edelsohn@gnu.org>
15196
15197 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15198
15199 2008-06-12 David Edelsohn <edelsohn@gnu.org>
15200 David S. Miller <davem@davemloft.net>
15201
15202 * powerpc.cc: New file.
15203 * Makefile.am (TARGETSOURCES): Add powerpc.cc
15204 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15205 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15206 * Makefile.in: Rebuild.
15207
15208 2008-06-09 Ian Lance Taylor <iant@google.com>
15209
15210 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15211 <exception>.
15212 (throwing, orig_terminate): New static variables.
15213 (terminate_handler): New static function.
15214 (t2): Set terminate handler.
15215
15216 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
15217
15218 PR 6584
15219 * binary.cc (Binary_to_elf::sized_convert): Fix .data
15220 alignment.
15221
15222 2008-05-30 Cary Coutant <ccoutant@google.com>
15223
15224 * archive.cc (Archive::include_all_members) Correct to step
15225 over symbol table and extended name table in thin archives.
15226
15227 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
15228
15229 PR 6407
15230 * target-reloc.h (relocate_for_relocatable): Fix new_offset
15231 calculation.
15232
15233 2008-05-28 Caleb Howe <cshowe@google.com>
15234
15235 * reduced_debug_output.cc: New file.
15236 * reduced_debug_output.h: New file.
15237 * options.h (class General_options): Add --strip-debug-non-line.
15238 * options.cc (General_options::finalize): Add strip_debug_non_line
15239 to the strip heirarchy.
15240 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15241 fields.
15242 * layout.cc: Include "reduced_debug_output.h".
15243 (Layout::Layout): Initialize new fields.
15244 (line_only_debug_sections): New static array.
15245 (is_lines_only_debug_sections): New static inline function.
15246 (Layout::include_section): Handle --strip-debug-non-line.
15247 (Layout::make_output_section): If --strip-debug-non-line, build
15248 new output sections for .debug_abbrev and .debug_info.
15249 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15250 gold. Warn about possible overflow.
15251 (read_signed_LEB_128): Likewise.
15252 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15253 (read_signed_LEB_128): Declare.
15254 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15255 (HFILES): Add reduced_debug_output.h.
15256 * Makefile.in: Rebuild.
15257
15258 2008-05-21 Ian Lance Taylor <iant@google.com>
15259
15260 * mapfile.cc: New file.
15261 * mapfile.h: New file.
15262 * options.h (class General_options): Add -M/--print-map and -Map.
15263 * options.cc (General_options::finalize): Make -M equivalent to
15264 -Map -.
15265 * main.cc: Include <cstdio> and "mapfile.h".
15266 (main): Open mapfile if requested.
15267 * gold.cc (class Middle_runner): Add mapfile_ field. Update
15268 constructor. Change caller.
15269 (queue_initial_tasks): Add mapfile parameter. Change caller.
15270 (queue_middle_tasks): Likewise.
15271 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15272 declarations.
15273 * archive.cc: Include "mapfile.h".
15274 (Archive::add_symbols): Add mapfile parameter. Change all
15275 callers. Pass mapfile, symbol, and reason to include_member.
15276 (Archive::include_all_members): Add mapfile parameter. Change all
15277 callers.
15278 (Archive::include_member): Add mapfile, sym, and why parameters.
15279 Change all callers. Report inclusion to map file.
15280 * archive.h: Include "fileread.h".
15281 (class Archive): Update declarations.
15282 (Archive::file): New const method.
15283 (class Add_archive_symbols): Add mapfile_ field. Update
15284 constructor. Change all callers.
15285 * readsyms.h (class Read_symbols): Likewise.
15286 (class Finish_group): Likewise.
15287 (class Read_script): Likewise.
15288 * common.cc: Include "mapfile.h".
15289 (Symbol_table::allocate_commons): Add mapfile parameter. Change
15290 all callers.
15291 (Symbol_table::do_allocate_commons): Likewise.
15292 (Symbol_table::do_allocate_commons_list): Likewise. Report common
15293 symbol allocation to mapfile.
15294 * common.h (class Allocate_commons_task): Add mapfile_ field.
15295 Update constructor. Change all callers.
15296 * symtab.h (class Symbol_table): Update declarations.
15297 * layout.cc: Include "mapfile.h".
15298 (Layout_task_runner::run): Print information to mapfile.
15299 (Layout::create_gold_note): Change Output_data_fixed_space to
15300 Output_data_zero_fill.
15301 (Layout::create_build_id): Likewise.
15302 (Layout::print_to_mapfile): New function.
15303 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
15304 constructor. Change caller.
15305 (class Layout): Declare print_to_mapfile.
15306 * output.cc (Output_section::Input_section::print_to_mapfile): New
15307 function.
15308 (Output_section::add_input_section): If producing a map, always
15309 add to input_sections_ list.
15310 (Output_section::do_print_to_mapfile): New function.
15311 (Output_segment::print_sections_to_mapfile): New function.
15312 (Output_segment::print_section_list_to_mapfile): New function.
15313 * output.h: Include "mapfile.h".
15314 (Output_data::print_to_mapfile): New function.
15315 (Output_data::do_print_to_mapfile): New virtual function.
15316 (Output_segment_headers::do_print_to_mapfile): New function.
15317 (Output_file_header::do_print_to_mapfile): New function.
15318 (Output_data_const::do_print_to_mapfile): New function.
15319 (class Output_data_const_buffer): Add map_name_ field. Update
15320 constructor. Change all callers. Add do_print_to_mapfile
15321 function.
15322 (class Output_data_fixed_space): Likewise.
15323 (class Output_data_space): Likewise.
15324 (class Output_data_zero_fill): New class.
15325 (Output_data_strtab::do_print_to_mapfile): New function.
15326 (Output_data_reloc_base::do_print_to_mapfile): New function.
15327 (Output_relocatable_relocs::do_print_to_mapfile): New function.
15328 (Output_data_group::do_print_to_mapfile): New function.
15329 (Output_data_got::do_print_to_mapfile): New function.
15330 (Output_data_dynamic::do_print_to_mapfile): New function.
15331 (Output_symtab_xindex::do_print_to_mapfile): New function.
15332 (class Output_section): Declare do_print_to_mapflie. Declare
15333 print_to_mapfile in Input_section.
15334 (class Output_segment): Declare new functions.
15335 * object.h (Sized_relobj::symbol_count): New function.
15336 * script-sections.cc
15337 (Output_section_element_dot_assignment::set_section_addresses):
15338 Change Output_data_fixed_space to Output_data_zero_fill.
15339 (Output_data_expression::do_print_to_mapfile): New function.
15340 * script.cc (read_input_script): Add mapfile parameter. Change
15341 all callers.
15342 * script.h (read_input_script): Update declaration.
15343 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15344 (Eh_frame::do_print_to_mapfile): New function.
15345 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15346 (Output_merge_string::do_print_to_mapfile): New function.
15347 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15348 function.
15349 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15350 function.
15351 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15352 function.
15353 * Makefile.am (CCFILES): Add mapfile.cc.
15354 (HFILES): Add mapfile.h.
15355 * Makefile.in: Rebuild.
15356
15357 2008-05-19 Ian Lance Taylor <iant@google.com>
15358
15359 * options.h (class General_options): Add -z relro.
15360 * layout.cc (Layout::Layout): Initialize relro_segment_.
15361 (Layout::add_output_section_data): Return the output section.
15362 (Layout::make_output_section): Rcognize relro sections and mark
15363 them appropriately.
15364 (Layout::attach_allocated_section_to_segment): Put relro sections
15365 in a PT_GNU_RELRO segment.
15366 (Layout::create_initial_dynamic_sections): Mark the .dynamic
15367 section as relro.
15368 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15369 PT_TLS segments.
15370 (Layout::linkonce_mapping): Map d.rel.ro.local to
15371 .data.rel.ro.local.
15372 (Layout::output_section_name): Us .data.rel.ro.local for any
15373 section which begins with that.
15374 * layout.h (class Layout): Update add_output_section_data
15375 declaration. Add relro_segment_ field.
15376 * output.cc (Output_section::Output_section): Initialize is_relro_
15377 and is_relro_local_ fields.
15378 (Output_segment::add_output_section): Group relro sections.
15379 (Output_segment::is_first_section_relro): New function.
15380 (Output_segment::maximum_alignment): If there is a relro section,
15381 align the segment to the common page size.
15382 (Output_segment::set_section_addresses): Track whether we are
15383 looking at relro sections. If the last section is a relro
15384 section, align to the common page size.
15385 (Output_segment::set_section_list_addresses): Add in_relro
15386 parameter. Change all callers. Align to the page size when
15387 moving from relro to non-relro section.
15388 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15389 segment.
15390 * output.h (class Output_section): Add is_relro_ and
15391 is_relro_local_ fields.
15392 (Output_section::is_relro): New function.
15393 (Output_section::set_is_relro): New function.
15394 (Output_section::is_relro_local): New function.
15395 (Output_section::set_is_relro_local): New function.
15396 (class Output_segment): Update declarations.
15397 * i386.cc (Target_i386::got_section): Mark .got section as relro.
15398 * sparc.cc (Target_sparc::got_section): Likewise.
15399 * x86_64.cc (Target_x86_64::got_section): Likewise.
15400 * testsuite/relro_test_main.cc: New file.
15401 * testsuite/relro_test.cc: New file.
15402 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15403 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15404 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15405 (relro_test.so, relro_test_pic.o): New targets.
15406 * testsuite/Makefile.in: Rebuild.
15407
15408 2008-05-16 Ian Lance Taylor <iant@google.com>
15409
15410 * output.cc (Output_segment::add_output_section): Remove front
15411 parameter.
15412 * output.h (class Output_segment): Remove
15413 add_initial_output_section and overloaded add_output_section.
15414 Update declaration of remaining add_output_section.
15415 * layout.cc (Layout::create_interp): Call add_output_section
15416 rather than add_initial_output_section.
15417 (Layout::finish_dynamic_section): Likewise.
15418
15419 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15420 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
15421 know the dynamic type.
15422 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15423 field. Initialize it in constructor.
15424 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15425 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15426 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15427 reloc.
15428
15429 * output.cc (Output_reloc::get_address): Change return type to
15430 Elf_Addr.
15431 * output.h (class Output_reloc): Update get_address declaration.
15432 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15433 for section addresses.
15434
15435 2008-05-09 Ian Lance Taylor <iant@google.com>
15436
15437 PR 6493
15438 * gold.cc (gold_nomem): Use return value of write.
15439
15440 2008-05-08 Ian Lance Taylor <iant@google.com>
15441
15442 * symtab.c (Symbol::init_base_output_data): Add version
15443 parameter. Change all callers.
15444 (Symbol::init_base_output_segment): Likewise.
15445 (Symbol::init_base_constant): Likewise.
15446 (Symbol::init_base_undefined): Likewise.
15447 (Sized_symbol::init_output_data): Likewise.
15448 (Sized_symbol::init_output_segment): Likewise.
15449 (Sized_symbol::init_constant): Likewise.
15450 (Sized_symbol::init_undefined): Likewise.
15451 (Symbol_table::do_define_in_output_data): If the new symbol has a
15452 version, mark it as the default.
15453 (Symbol_table::do_define_in_output_segment): Likewise.
15454 (Symbol_table::do_define_as_constant): Likewise.
15455 * symtab.h (class Symbol): Update declarations.
15456 (class Sized_symbol): Likewise.
15457 * resolve.cc (Symbol::override_version): New function.
15458 (Symbol::override_base): Call override_version.
15459 (Symbol::override_base_with_special): Likewise.
15460 * testsuite/ver_script_8.script: New file.
15461 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15462 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15463 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15464 (ver_test_8_1.so, ver_test_8_2.so): New targets.
15465
15466 2008-05-06 Ian Lance Taylor <iant@google.com>
15467
15468 PR 6049
15469 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15470 functions.
15471 (class General_options): Remove existing --undefined, and add
15472 --no-undefined instead. Add new --undefined as synonym for -u.
15473 * archive.cc (Archive::add_symbols): Check whether symbol was
15474 named with -u.
15475 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15476 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15477 all uses. Add IS_UNDEFINED. Update declarations to split
15478 different versions of init_base. Declare init_base_undefined.
15479 (Symbol::is_defined): Handle IS_UNDEFINED.
15480 (Symbol::is_undefined): Likewise.
15481 (Symbol::is_weak_undefined): Call is_undefined.
15482 (Symbol::is_absolute): Handle IS_CONSTANT.
15483 (class Sized_symbol): Update declarations to split different
15484 versions of init. Declare init_undefined.
15485 (class Symbol_table): Declare new functions.
15486 * symtab.cc (Symbol::init_base_object): Rename from init_base.
15487 Change all callers.
15488 (Symbol::init_base_output_data): Likewise.
15489 (Symbol::init_base_output_segment): Likewise.
15490 (Symbol::init_base_constant): Likewise.
15491 (Symbol::init_base_undefined): New function.
15492 (Sized_symbol::init_object): Rename from init. Change all
15493 callers.
15494 (Sized_symbol::init_output_data): Likewise.
15495 (Sized_symbol::init_output_segment): Likewise.
15496 (Sized_symbol::init_constant): Likewise.
15497 (Sized_symbol::init_undefined): New function.
15498 (Symbol_table::add_undefined_symbols_from_command_line): New
15499 function.
15500 (Symbol_table::do_add_undefined_symbols_from_command_line): New
15501 function.
15502 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15503 (Symbol::output_section): Likewise.
15504 (Symbol::set_output_section): Likewise.
15505 (Symbol_table::sized_finalize_symbol): Likewise.
15506 (Symbol_table::sized_write_globals): Likewise.
15507 * resolve.cc (Symbol_table::should_override): Likewise.
15508 (Symbol::override_base_with_special): Likewise.
15509
15510 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15511 symbol, change it to have default visibility.
15512 * testsuite/protected_1.cc: New file.
15513 * testsuite/protected_2.cc: New file.
15514 * testsuite/protected_3.cc: New file.
15515 * testsuite/protected_main_1.cc: New file.
15516 * testsuite/protected_main_2.cc: New file.
15517 * testsuite/protected_main_3.cc: New file.
15518 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15519 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15520 (protected_1_LDFLAGS, protected_1_LDADD): Define.
15521 (protected_1.so): New target.
15522 (protected_1_pic.o, protected_2_pic.o): New targets.
15523 (protected_3_pic.o): New target.
15524 (check_PROGRAMS): Add protected_2.
15525 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15526 (protected_2_LDFLAGS, protected_2_LDADD): Define.
15527 * testsuite/Makefile.in: Rebuild.
15528
15529 * options.h (DEFINE_var): Add set_user_set_##varname__.
15530 (DEFINE_bool_alias): New macro.
15531 (class General_options): Define -Bstatic using DEFINE_bool_alias
15532 rather than DEFINE_special. Add --undefined as an alias for -z
15533 defs.
15534 * options.cc (General_options::parse_Bstatic): Remove.
15535
15536 * options.h (class General_options): Add --fatal-warnings.
15537 * main.cc (main): Implement --fatal-warnings.
15538 * errors.h (Errors::warning_count): New function.
15539
15540 * options.h (class General_options): Add -Bsymbolic-functions.
15541 * symtab.h (Symbol::is_preemptible): Check for
15542 -Bsymbolic-functions.
15543
15544 2008-05-05 Ian Lance Taylor <iant@google.com>
15545
15546 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15547 as noVARNAME rather than no-VARNAME.
15548 (class General_options): Add option -z combreloc.
15549 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15550 get_address.
15551 (Output_reloc::sort_before) [SHT_REL]: New function.
15552 (Output_reloc::sort_before) [SHT_RELA]: New function.
15553 (class Output_data_reloc_base): Add sort_relocs_ field. Define
15554 Sort_relocs_comparison.
15555 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15556 parameter. Change all callers.
15557 (Output_data_reloc::Output_data_reloc) [both versions]: Add
15558 sort_relocs parameter. Change all callers.
15559 * output.cc (Output_reloc::get_address): New function, broken out
15560 of write_rel.
15561 (Output_reloc::write_rel): Call it.
15562 (Output_reloc::compare): New function.
15563 (Output_data_reloc_base::do_write): Optionally sort relocs.
15564
15565 * configure.ac: If targ_extra_obj is set, link it in.
15566 * configure.tgt: Initialize all variables.
15567 (x86_64*): Set targ_extra_obj and targ_extra_size.
15568 * configure: Rebuild.
15569
15570 * object.cc (Sized_relobj::include_section_group): Adjust section
15571 indexes read from group data. Build vector to pass to
15572 layout_group.
15573 * layout.cc (Layout::layout_group): Add flags and shndxes
15574 parameters. Remove contents parameter. Change caller. Update
15575 explicit instantiations.
15576 * layout.h (class Layout): Update layout_group declaration.
15577 * output.cc (Output_data_group::Output_data_group): Add flags and
15578 input_shndxes parameters. Remove contents parameter. Change
15579 caller.
15580 (Output_data_group::do_write): Change input_sections_ to
15581 input_shndxes_.
15582 * output.h (class Output_data_group): Update constructor
15583 declaration. Rename input_sections_ to input_shndxes_.
15584 * testsuite/many_sections_test.cc: Add template.
15585
15586 2008-04-30 Cary Coutant <ccoutant@google.com>
15587
15588 * target-reloc.h (relocate_section): Fix dead-pointer bug.
15589
15590 * layout.cc (Layout::include_section): Refactored check for debug
15591 info section.
15592 (Layout::add_comdat): Add new parameters. Change type
15593 of signature parameter. Add object and shndx to signatures table.
15594 (Layout::find_kept_object): New function.
15595 * layout.h: Include <cstring>.
15596 (Layout::is_debug_info_section): New function.
15597 (Layout::add_comdat): Add new parameters.
15598 (Layout::find_kept_object): New function.
15599 (Layout::Kept_section): New struct.
15600 (Layout::Signatures): Change type of map range.
15601 * object.cc (Relobj::output_section_address): New function.
15602 (Sized_relobj::include_section_group): Add new parameters. Change
15603 calls to Layout::add_comdat. Change to build table of kept comdat
15604 groups and table mapping discarded sections to kept sections.
15605 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15606 (Sized_relobj::do_layout): Change calls to include_section_group and
15607 include_linkonce_section.
15608 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15609 value to zero when section is discarded.
15610 (Sized_relobj::map_to_kept_section): New function.
15611 * object.h (Relobj::output_section_address): New function.
15612 (Relobj::Comdat_group): New type.
15613 (Relobj::find_comdat_group): New function.
15614 (Relobj::Comdat_group_table): New type.
15615 (Relobj::Kept_comdat_section): New type.
15616 (Relobj::Kept_comdat_section_table): New type.
15617 (Relobj::add_comdat_group): New function.
15618 (Relobj::set_kept_comdat_section): New function.
15619 (Relobj::get_kept_comdat_section): New function.
15620 (Relobj::comdat_groups_): New field.
15621 (Relobj::kept_comdat_sections_): New field.
15622 (Symbol_value::input_value): Update comment.
15623 (Sized_relobj::map_to_kept_section) New function.
15624 (Sized_relobj::include_linkonce_section): Add new parameter.
15625 * target-reloc.h (Comdat_behavior): New type.
15626 (get_comdat_behavior): New function.
15627 (relocate_section): Add code to map a discarded section to the
15628 corresponding kept section when applying a relocation.
15629
15630 2008-04-30 Craig Silverstein <csilvers@google.com>
15631
15632 * dwarf_reader.cc (next_generation_count): New static var.
15633 (Addr2line_cache_entry): New struct.
15634 (addr2line_cache): New static var.
15635 (Dwarf_line_info::one_addr2line): Added caching.
15636 (Dwarf_line_info::clear_addr2line_cache): New function.
15637 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15638 cache-size parameter.
15639 (Dwarf_line_info::one_addr2line_cache): New function.
15640 * symtab.cc (Symbol_table::detect_odr_violations): Pass
15641 new cache-size argument to one_addr2line(), and clear cache.
15642
15643 2008-04-28 Cary Coutant <ccoutant@google.com>
15644
15645 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15646 R_386_PC8 relocations.
15647
15648 2008-04-23 Ian Lance Taylor <iant@google.com>
15649
15650 * object.cc (Sized_relobj::include_section_group): Check for
15651 invalid section group.
15652
15653 * object.cc (make_elf_object): Correct test for 64-bit ELF file
15654 header size.
15655
15656 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15657 than read for file header.
15658 * archive.cc (Archive::include_member): Likewise.
15659
15660 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
15661
15662 * aclocal.m4: Regenerate.
15663 * configure: Regenerate.
15664
15665 2008-04-19 Ian Lance Taylor <iant@google.com>
15666
15667 * version.cc (version_string): Bump to 1.6.
15668
15669 * testsuite/Makefile.am (many_sections_r_test): New target.
15670 (many_sections_r_test_SOURCES): Remove.
15671 (many_sections_r_test_DEPENDENCIES): Remove.
15672 (many_sections_r_test_LDFLAGS): Remove.
15673 (many_sections_r_test_LDADD): Remove.
15674
15675 * object.cc (Sized_relobj::do_add_symbols): Always pass
15676 local_symbol_count_ to add_from_relobj.
15677
15678 * testsuite/Makefile.am (many_sections_check.h): Only check one in
15679 every thousand variables.
15680 * testsuite/Makefile.in: Rebuild.
15681
15682 * object.cc (Xindex::initialize_symtab_xindex): New function.
15683 (Xindex::read_symtab_xindex): New function.
15684 (Xindex::sym_xindex_to_shndx): New function.
15685 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15686 available.
15687 (Sized_relobj::do_initialize_xindex): New function.
15688 (Sized_relobj::do_read_symbols): Adjust section links.
15689 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15690 parameter. Change all callers.
15691 (Sized_relobj::include_section_group): Adjust section links and
15692 symbol section indexes.
15693 (Sized_relobj::do_layout): Adjust section links.
15694 (Sized_relobj::do_count_local_symbols): Adjust section links and
15695 symbol section indexes.
15696 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15697 ordinary and special symbols.
15698 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15699 dynsym_xindex parameters. Change all callers. Adjust section
15700 links. Use SHN_XINDEX when needed.
15701 (Sized_relobj::get_symbol_location_info): Adjust section links.
15702 Don't get fooled by special symbols.
15703 * object.h (class Xindex): Define.
15704 (class Object): Add xindex_ parameter. Declare virtual functoin
15705 do_initialize_xindex.
15706 (Object::adjust_sym_shndx): New function.
15707 (Object::set_xindex): New protected function.
15708 (class Symbol_value): Add is_ordinary_shndx_ field.
15709 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15710 (Symbol_value::value): Assert ordinary section.
15711 (Symbol_value::initialize_input_to_output_map): Likewise.
15712 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15713 Change all callers.
15714 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15715 all callers.
15716 (class Sized_relobj): Update declarations.
15717 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15718 parameter. Change all callers.
15719 (Sized_relobj::adjust_shndx): New function.
15720 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15721 field.
15722 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15723 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15724 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15725 (Sized_dynobj::read_dynsym_section): Adjust section links.
15726 (Sized_dynobj::read_dynamic): Likewise.
15727 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15728 section links.
15729 (Sized_dynobj::do_initialize_xindex): New function.
15730 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15731 do_initialize_xindex.
15732 (Sized_dynobj::adjust_shndx): New function.
15733 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15734 dynsym_xindex_ fields.
15735 (Layout::finalize): Add a call to set_section_indexes before
15736 creating the symtab sections.
15737 (Layout::set_section_indexes): Don't do anything if the section
15738 already has a section index.
15739 (Layout::create_symtab_sections): Add shnum parameter. Change
15740 caller. Create .symtab_shndx section if needed.
15741 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15742 caller.
15743 (Layout::allocated_output_section_count): New function.
15744 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15745 needed.
15746 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15747 fields. Update declarations.
15748 (Layout::symtab_xindex): New function.
15749 (Layout::dynsym_xindex): New function.
15750 (class Write_symbols_task): Add layout_ field.
15751 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15752 Change caller.
15753 * output.cc (Output_section_headers::Output_section_headers): Add
15754 shstrtab_section parameter. Change all callers.
15755 (Output_section_headers::do_sized_write): Store overflow values
15756 for section count and section string table section index in
15757 section header zero.
15758 (Output_file_header::do_sized_write): Check for overflow of
15759 section count and section string table section index.
15760 (Output_symtab_xindex::do_write): New function.
15761 (Output_symtab_xindex::endian_do_write): New function.
15762 * output.h (class Output_section_headers): Add shstrtab_section_.
15763 Update declarations.
15764 (class Output_symtab_xindex): Define.
15765 (Output_section::has_out_shndx): New function.
15766 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15767 field.
15768 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15769 Change all callers.
15770 (Sized_symbol::init): Likewise.
15771 (Symbol::output_section): Check for ordinary symbol.
15772 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15773 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15774 callers.
15775 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15776 Change all callers. Simplify handling of symbols from sections
15777 not included in the link.
15778 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15779 distinction.
15780 (Weak_alias_sorter::operator()): Assert that symbols are
15781 ordinary.
15782 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15783 distinction.
15784 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15785 parameters. Change all callers.
15786 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15787 symbol distinction. Use SHN_XINDEX when needed.
15788 (Symbol_table::write_section_symbol): Add symtab_xindex
15789 parameter. Change all callers.
15790 (Symbol_table::sized_write_section_symbol): Likewise. Use
15791 SHN_XINDEX when needed.
15792 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15793 declarations.
15794 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15795 (Symbol::is_defined): Check is_ordinary.
15796 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15797 (Symbol::is_absolute, Symbol::is_common): Likewise.
15798 (class Sized_symbol): Update declarations.
15799 (class Symbol_table): Update declarations.
15800 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15801 parameters. Change all callers.
15802 (Sized_symbol::override): Likewise.
15803 (Symbol_table::override): Likewise.
15804 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15805 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15806 is_ordinary, and orig_st_shndx parameters. Change all callers.
15807 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15808 to be in an ordinary section.
15809 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15810 object and is_ordinary parameters. Change all callers.
15811 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15812 Change all callers. Don't add undefined or non-ordinary symbols
15813 to reloc_map_.
15814 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15815 Change all callers.
15816 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15817 declarations.
15818 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15819 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15820 (Sized_relobj::relocate_sections): Likewise.
15821 * target-reloc.h (scan_relocs): Adjust section symbol index.
15822 (scan_relocatable_relocs): Likewise.
15823 * i386.cc (Scan::local): Check for ordinary symbols.
15824 * sparc.cc (Scan::local): Likewise.
15825 * x86_64.cc (Scan::local): Likewise.
15826 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15827 to symbol_section_and_value.
15828 * testsuite/many_sections_test.cc: New file.
15829 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15830 (check_PROGRAMS): Add many_sections_test.
15831 (many_sections_test_SOURCES): Define.
15832 (many_sections_test_DEPENDENCIES): Define.
15833 (many_sections_test_LDFLAGS): Define.
15834 (BUILT_SOURCES): Add many_sections_define.h.
15835 (many_sections_define.h): New target.
15836 (BUILT_SOURCES): Add many_sections_check.h.
15837 (many_sections_check.h): New target.
15838 (check_PROGRAMS): Add many_sections_r_test.
15839 (many_sections_r_test_SOURCES): Define.
15840 (many_sections_r_test_DEPENDENCIES): Define.
15841 (many_sections_r_test_LDFLAGS): Define.
15842 (many_sections_r_test_LDADD): Define.
15843 (many_sections_r_test.o): New target.
15844 * testsuite/Makefile.in: Rebuild.
15845
15846 2008-04-17 Cary Coutant <ccoutant@google.com>
15847
15848 * errors.cc (Errors::info): New function.
15849 (gold_info): New function.
15850 * errors.h (Errors::info): New function.
15851 * gold.h (gold_info): New function.
15852 * object.cc (Input_objects::add_object): Print trace output.
15853 * options.cc (options::parse_set): New function.
15854 (General_options::parse_wrap): Deleted.
15855 (General_options::General_options): Deleted initializer.
15856 * options.h (options::String_set): New typedef.
15857 (options::parse_set): New function.
15858 (DEFINE_set): New macro.
15859 (General_options::wrap): Changed to use DEFINE_set. Changed
15860 callers of any_wrap_symbols and is_wrap_symbol.
15861 (General_options::trace, General_options::trace_symbol):
15862 New options.
15863 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15864 (General_options::wrap_symbols_): Deleted.
15865 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15866
15867 2008-04-17 David S. Miller <davem@davemloft.net>
15868
15869 * options.cc (General_options::parse_V): New function.
15870 * options.h: Add entries for -V and -Qy.
15871
15872 2008-04-17 Ian Lance Taylor <iant@google.com>
15873
15874 * common.cc (Symbol_table::allocate_commons): Remove options
15875 parameter. Change caller.
15876 (Symbol_table::do_allocate_commons): Remove options parameter.
15877 Change caller. Just call do_allocate_commons_list twice.
15878 (Symbol_table::do_allocate_commons_list): New function, broken out
15879 of do_allocate_commons.
15880 * common.h (class Allocate_commons_task): Remove options_ field.
15881 Update constructor.
15882 * symtab.cc (Symbol_table::Symbol_table): Initialize
15883 tls_commons_.
15884 (Symbol_table::add_from_object): Put TLS common symbols on
15885 tls_commons_ list.
15886 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15887 which are IN_OUTPUT_DATA.
15888 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15889 allocate_commons and do_allocate_commons declarations. Declare
15890 do_allocate_commons_list.
15891 * gold.cc (queue_middle_tasks): Update creation of
15892 Allocate_commons_task to not pass options.
15893 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15894 (TLS_TEST_C_FLAGS): New variable.
15895 (tls_test_c_pic.o): New target.
15896 (tls_test_shared.so): Link in tls_test_c_pic.o.
15897 (tls_test_c_pic_ie.o): New target.
15898 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15899 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15900 (tls_test_c.o): New target.
15901 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15902 (tls_pic_test_LDADD): Likewise.
15903 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15904 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15905 (tls_test_c_gnu2.o): New target.
15906 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15907 tls_test_c_gnu2.o.
15908 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15909 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15910 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15911 * testsuite/tls_test.cc: Include "config.h".
15912 (t_last): Call t11_last.
15913 * testsuite/tls_test.h (t11, t11_last): Declare.
15914 * testsuite/tls_test_c.c: New file.
15915 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15916 * configure.ac: Check for OpenMP support.
15917 * configure, config.in, Makefile.in: Rebuild.
15918 * testsuite/Makefile.in: Rebuild.
15919
15920 2008-04-16 Cary Coutant <ccoutant@google.com>
15921
15922 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15923 (Target_i386::tls_base_symbol_defined_): New field.
15924 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15925 (Target_i386::Scan::global): Likewise.
15926 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15927 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15928 (Target_x86_64::tls_base_symbol_defined_): New field.
15929 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15930 (Target_x86_64::Scan::global): Likewise.
15931
15932 2008-04-16 Cary Coutant <ccoutant@google.com>
15933
15934 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15935 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15936 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15937 building shared libraries.
15938 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15939 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15940 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15941 * testsuite/Makefile.in: Rebuild.
15942 * testsuite/weak_undef.h: New file.
15943 * testsuite/weak_undef_file1.cc: Add extra test cases.
15944 * testsuite/weak_undef_file2.cc: Likewise.
15945 * testsuite/weak_undef_test.cc: Likewise.
15946
15947 2008-04-16 David S. Miller <davem@davemloft.net>
15948
15949 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15950 Add issued_non_pic_error_ field. Declare check_non_pic.
15951 (Target_sparc::Scan::check_non_pic): New function.
15952 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15953 (Target_sparc::Scan::global): Likewise.
15954
15955 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15956 * configure: Rebuild.
15957
15958 * options.h (DEFINE_enable): New macro.
15959 (new_dtags): New enable option.
15960 (initfirst, interpose, loadfltr, nodefaultlib,
15961 nodelete, nodlopen, nodump): New -z options.
15962 * layout.cc (Layout:finish_dynamic_section): If new
15963 dtags enabled, emit DT_RUNPATH. Also, emit a
15964 DT_FLAGS_1 containing any specified -z flags.
15965
15966 2008-04-16 Ian Lance Taylor <iant@google.com>
15967
15968 * copy-relocs.cc: New file.
15969 * copy-relocs.h: New file.
15970 * reloc.cc: Remove Copy_relocs code.
15971 * reloc.h: Likewise.
15972 * reloc-types.h (struct Reloc_types) [both versions]: Add
15973 get_reloc_addend_noerror.
15974 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15975 variants of add_global which take an addend which must be zero.
15976 * i386.cc: Include "copy-relocs.h".
15977 (class Target_i386): Change type of copy_relocs_ to variable,
15978 update initializer.
15979 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15980 Change all callers.
15981 (Target_i386::do_finalize_sections): Change handling of
15982 copy_relocs_.
15983 * sparc.cc: Include "copy-relocs.h".
15984 (class Target_sparc): Change type of copy_relocs_ to variable,
15985 update initializer.
15986 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15987 Change all callers.
15988 (Target_sparc::do_finalize_sections): Change handling of
15989 copy_relocs_.
15990 * x86_64.cc: Include "copy-relocs.h".
15991 (class Target_x86_64): Change type of copy_relocs_ to variable,
15992 update initializer.
15993 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15994 class. Change all callers.
15995 (Target_x86_64::do_finalize_sections): Change handling of
15996 copy_relocs_.
15997 * Makefile.am (CCFILES): Add copy-relocs.cc.
15998 (HFILES): Add copy-relocs.h.
15999
16000 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16001
16002 * testsuite/script_test_4.sh: Permit leading zeroes.
16003
16004 2008-04-15 Ian Lance Taylor <iant@google.com>
16005
16006 * script-sections.cc (Script_sections::create_segments): Use
16007 header_size_adjustment even when there is enough room for the
16008 headers.
16009 * testsuite/script_test_4.sh: New file.
16010 * testsuite/script_test_4.t: New file.
16011 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16012 (check_DATA): Add script_test_4.stdout.
16013 (MOSTLYCLEANFILES): Likewise.
16014 (script_test_4): New target.
16015 (script_test_4.stdout): New target.
16016 * testsuite/Makefile.in: Rebuild.
16017
16018 * sparc.cc: Add definitions for Output_data_plt_sparc class
16019 constants.
16020
16021 2008-04-14 David S. Miller <davem@davemloft.net>
16022
16023 * sparc.cc: New file.
16024 * Makefile.am (TARGETSOURCES): Add sparc.cc
16025 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16026 * configure.tgt: Document targ_extra_size and
16027 targ_extra_big_endian. Add entries for sparc-* and
16028 sparc64-*.
16029 * configure.ac: Handle targ_extra_size and
16030 targ_extra_big_endian.
16031 * Makefile.in: Rebuild.
16032 * configure: Likewise.
16033 * po/POTFILES.in: Likewise.
16034 * po/gold.pot: Likewise.
16035
16036 2008-04-14 Ian Lance Taylor <iant@google.com>
16037
16038 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16039 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16040 in the name/type/flags to section mapping. Don't call
16041 allocate_output_section.
16042 (Layout::choose_output_section): Change parameter from adjust_name
16043 to is_input_section. Don't permit input sections after sections
16044 are attached to segments. Don't call allocate_output_section.
16045 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16046 not write_enable_output_section.
16047 (Layout::make_output_section): Don't push to
16048 unattached_section_list_ nor call attach_to_segment. Call
16049 attach_section_to_segment if sections are attached.
16050 (Layout::attach_sections_to_segments): New function.
16051 (Layout::attach_section_to_segment): New function.
16052 (Layout::attach_allocated_section_to_segment): Rename from
16053 attach_to_segment. Remove flags parameter.
16054 (Layout::allocate_output_section): Remove function.
16055 (Layout::write_enable_output_section): Remove function.
16056 * layout.h (class Layout): Update for above changes. Add new
16057 field sections_are_attached_.
16058 * output.h (Output_section::update_flags_for_input_section): New
16059 function.
16060 * output.cc (Output_section::add_input_section): Call
16061 update_flags_for_input_section.
16062 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16063
16064 2008-04-11 Cary Coutant <ccoutant@google.com>
16065
16066 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16067 thought unnecessary.
16068 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16069
16070 2008-04-11 Ian Lance Taylor <iant@google.com>
16071
16072 * output.h (class Output_section_data): Remove inline definition
16073 of set_addralign.
16074 * output.cc (Output_section_data::set_addralign): New function.
16075
16076 2008-04-11 Cary Coutant <ccoutant@google.com>
16077
16078 Add support for TLS descriptors for i386 and x86_64.
16079 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16080 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16081 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16082 GOT_TYPE_TLS_DESC.
16083 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16084 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16085 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16086 relocations.
16087 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16088 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16089 Fix problem with initial-exec relocations.
16090 (Target_i386::Relocate::relocate_tls): Likewise.
16091 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16092 relaxation.
16093 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16094 support for section-plus-offset dynamic table entries.
16095 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16096 (Output_data_dynamic::Dynamic_entry): Add support for
16097 section-plus-offset dynamic table entries.
16098 (Output_data_dynamic::Classification): Likewise.
16099 (Output_data_dynamic::classification_): Renamed offset_.
16100 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16101 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16102 (Target_x86_64::make_plt_section): New function.
16103 (Target_x86_64::reserve_tlsdesc_entries): New function.
16104 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16105 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16106 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16107 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16108 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16109 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16110 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16111 add extra PLT entry for TLS descriptors.
16112 (Output_data_plt_x86_64::got_): New field.
16113 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16114 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16115 fields.
16116 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16117 descriptors.
16118 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16119 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16120 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16121 R_386_TLS_DESC_CALL relocations.
16122 (Target_x86_64::Scan::global): Likewise.
16123 (Target_x86_64::do_finalize_sections): Add dynamic table entries
16124 for TLS descriptors.
16125 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16126 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16127 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16128 GD-to-IE relaxation.
16129 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16130 and TLS_DESCRIPTORS.
16131 * Makefile.in: Rebuild.
16132 * configure: Rebuild.
16133 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16134 (tls_test_shared2.so): New target.
16135 (tls_shared_gd_to_ie_test_SOURCES): New variable.
16136 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16137 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16138 (tls_shared_gd_to_ie_test_LDADD): New variable.
16139 (tls_shared_gnu2_gd_to_ie_test): New target.
16140 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16141 New targets.
16142 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16143 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16144 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16145 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16146 (tls_shared_gnu2_test): New target.
16147 (tls_test_gnu2_shared.so): New target.
16148 (tls_shared_gnu2_test_SOURCES): New variable.
16149 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16150 (tls_shared_gnu2_test_LDFLAGS): New variable.
16151 (tls_shared_gnu2_test_LDADD): New variable.
16152 * testsuite/Makefile.in: Rebuild.
16153 * testsuite/Makefile.
16154
16155 2008-04-11 Ian Lance Taylor <iant@google.com>
16156
16157 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16158 justsyms.t.
16159 * testsuite/Makefile.in: Rebuild.
16160
16161 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16162 long.
16163 * testsuite/script_test_2.cc (main): Adjust test.
16164
16165 2008-04-11 David S. Miller <davem@davemloft.net>
16166 Ian Lance Taylor <iant@google.com>
16167
16168 * options.h (General_options): Add entries for '-Y' and
16169 '-relax'.
16170 * options.cc (General_options:finalize): If -Y was used, add those
16171 entries to the library path instead of the default "/lib" and
16172 "/usr/lib".
16173
16174 2008-04-11 David S. Miller <davem@davemloft.net>
16175
16176 * testsuite/justsyms.t: Start at 0x100.
16177 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16178 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16179 long.
16180 * testsuite/script_test_2.cc: Adjust string and section length
16181 checks.
16182
16183 2008-04-09 Ian Lance Taylor <iant@google.com>
16184
16185 PR gold/5996
16186 * script-sections.cc (Sections_element::allocate_to_segment): Add
16187 orphan parameter.
16188 (Output_section_definition::allocate_to_segment): Likewise.
16189 (Orphan_output_section::allocate_to_segment): Likewise.
16190 (Script_sections::attach_sections_using_phdrs_clause): Don't
16191 propagate non-PT_LOAD segments to orphan sections.
16192 * testsuite/Makefile.am (script_test_3.stdout): Generate using
16193 readelf rather than objdump.
16194 * testsuite/script_test_3.sh: Adjust accordingly. Test that
16195 .interp section and PT_INTERP segment are the same size.
16196 * testsuite/Makefile.in: Rebuild.
16197
16198 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16199 aliases for symbols defined in the same object.
16200 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16201 (weak_alias_test_SOURCES): New variable.
16202 (weak_alias_test_DEPENDENCIES): New variable.
16203 (weak_alias_test_LDFLAGS): New variable.
16204 (weak_alias_test_LDADD): New variable.
16205 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16206 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16207 (weak_alias_test_3.o): New target.
16208 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16209 * testsuite/weak_alias_test_main.cc: New file.
16210 * testsuite/weak_alias_test_1.cc: New file.
16211 * testsuite/weak_alias_test_2.cc: New file.
16212 * testsuite/weak_alias_test_3.cc: New file.
16213
16214 2008-04-08 Ian Lance Taylor <iant@google.com>
16215
16216 * options.h (class General_options): Add --noinhibit-exec option.
16217 * main.cc (main): Check --noinhibit-exec.
16218
16219 * options.h (class General_options): Define --wrap as a special
16220 option. Add wrap_symbols_ field.
16221 (General_options::any_wrap_symbols): New function.
16222 (General_options::is_wrap_symbol): New function.
16223 * options.cc (General_options::parse_wrap): New function.
16224 (General_options::General_options): Initialize wrap_symbols_.
16225 * symtab.cc (Symbol_table::wrap_symbol): New function.
16226 (Symbol_table::add_from_object): Handle --wrap.
16227 * symtab.h (class Symbol_table): Declare wrap_symbol.
16228 * target.h (Target::wrap_char): New function.
16229 (Target::Target_info): Add wrap_char field.
16230 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16231 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16232 * testsuite/testfile.cc (Target_test::test_target_info):
16233 Likewise.
16234
16235 * errors.cc (Errors::undefined_symbol): Mention symbol version if
16236 there is one.
16237
16238 * layout.h (class Layout): Add added_eh_frame_data_ field.
16239 * layout.cc (Layout::Layout): Initialize new field.
16240 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16241 output section until we find a section we merged successfully.
16242 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16243 that the size be non-zero.
16244
16245 * merge.cc (Object_merge_map::get_output_offset): Remove inline
16246 qualifier.
16247
16248 2008-04-08 Craig Silverstein <csilvers@google.com>
16249
16250 * configure.ac: Export new conditional variable HAVE_ZLIB.
16251 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16252 on HAVE_ZLIB.
16253 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16254 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16255
16256 2008-04-07 Ian Lance Taylor <iant@google.com>
16257
16258 * version.cc (version_string): Set to "1.5".
16259
16260 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16261 Add issued_non_pic_error_ field. Declare check_non_pic.
16262 (Target_x86_64::Scan::check_non_pic): New function.
16263 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16264 (Target_x86_64::Scan::global): Likewise.
16265
16266 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16267 addend parameter. Change caller. Handle merge sections.
16268 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16269 Address to Addend. Don't add in the result of
16270 local_section_offset, pass down the addend and use the returned
16271 value.
16272 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16273 Update declarations of local_section_offset and symbol_value.
16274 * testsuite/two_file_test_1.cc (t18): New function.
16275 * testsuite/two_file_test_2.cc (f18): New function.
16276 * testsuite/two_file_test_main.cc (main): Call t18.
16277 * testsuite/two_file_test.h (t18, f18): Declare.
16278
16279 * configure.ac: Don't test for objdump, c++filt, or readelf.
16280 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16281 conditionals.
16282 (TEST_READELF): New variable.
16283 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16284 (check_PROGRAMS): Add two_file_strip_test.
16285 (two_file_strip_test): New target.
16286 (check_PROGRAMS): Add two_file_same_shared_strip_test.
16287 (two_file_same_shared_strip_test_SOURCES): New variable.
16288 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16289 (two_file_same_shared_strip_test_LDFLAGS): New variable.
16290 (two_file_same_shared_strip_test_LDADD): New variable.
16291 (two_file_shared_strip.so): New target.
16292 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16293 (ver_test_5.syms, ver_test_7.syms): Likewise.
16294 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16295 (strip_test_3.stdout): Use TEST_OBJDUMP.
16296 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16297
16298 2008-04-04 Cary Coutant <ccoutant@google.com>
16299
16300 * symtab.h (Symbol::is_weak_undefined): New function.
16301 (Symbol::is_strong_undefined): New function.
16302 (Symbol::is_absolute): New function.
16303 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16304 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16305 absolute symbols.
16306 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16307 (weak_undef_test): New target.
16308 * testsuite/Makefile.in: Rebuild.
16309 * testsuite/weak_undef_file1.cc: New file.
16310 * testsuite/weak_undef_file2.cc: New file.
16311 * testsuite/weak_undef_test.cc: New file.
16312
16313 2008-04-03 Craig Silverstein <csilvers@google.com>
16314
16315 * compressed_output.h (class Output_compressed_section): Use
16316 unsigned buffer.
16317 * compressed_output.cc (zlib_compress): Use unsigned buffers,
16318 add zlib header.
16319 (zlib_compressed_suffix): Removed.
16320 (Output_compressed_section::set_final_data_size): Use unsigned
16321 buffers.
16322 * testsuite/Makefile.am (flagstest_compress_debug_sections):
16323 Fix linker invocation.
16324 (flagstest_o_specialfile_and_compress_debug_sections):
16325 Likewise.
16326 * testsuite/Makefile.in: Regenerated.
16327
16328 2008-04-02 David S. Miller <davem@davemloft.net>
16329
16330 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16331 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16332
16333 2008-04-02 Craig Silverstein <csilvers@google.com>
16334
16335 * TODO: New file.
16336
16337 2008-04-02 Ian Lance Taylor <iant@google.com>
16338
16339 * fileread.cc (File_read::find_view): Add byteshift and vshifted
16340 parameters. Update for new key type to views_. Change all
16341 callers.
16342 (File_read::read): Adjust for byteshift in returned view.
16343 (File_read::add_view): New function, broken out of
16344 find_and_make_view.
16345 (File_read::make_view): New function, broken out of
16346 find_and_make_view.
16347 (File_read::find_or_make_view): Add offset and aligned
16348 parameters. Rewrite accordingly. Change all callers.
16349 (File_read::get_view): Add offset and aligned parameters. Adjust
16350 for byteshift in return value.
16351 (File_read::get_lasting_view): Likewise.
16352 * fileread.h (class File_read): Update declarations.
16353 (class File_read::View): Add byteshift_ field. Add byteshift to
16354 constructor. Add byteshift method.
16355 * archive.h (Archive::clear_uncached_views): New function.
16356 (Archive::get_view): Add aligned parameter. Change all callers.
16357 * object.h (Object::get_view): Add aligned parameter. Change all
16358 callers.
16359 (Object::get_lasting_view): Likewise.
16360
16361 * fileread.cc (File_read::release): Don't call clear_views if
16362 there are multiple objects.
16363 * fileread.h (File_read::clear_uncached_views): New function.
16364 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16365 on the archive.
16366
16367 2008-03-31 Cary Coutant <ccoutant@google.com>
16368
16369 Add thin archive support.
16370 * archive.cc (Archive::armagt): New const.
16371 (Archive::setup): Remove task parameter and calls to unlock.
16372 (Archive::unlock_nested_archives): New function.
16373 (Archive::read_header): Add nested_off parameter. Change
16374 all callers.
16375 (Archive::interpret_header): Likewise.
16376 (Archive::include_all_members): Change to handle thin
16377 archives.
16378 (Archive::include_member): Likewise.
16379 * archive.h (Archive::Archive): Add new parameters and
16380 initializers.
16381 (Archive::armagt): New const.
16382 (Archive::setup): Remove task parameter.
16383 (Archive::unlock_nested_archives): New function.
16384 (Archive::read_header): Add nested_off parameter.
16385 (Archive::interpret_header): Likewise.
16386 (Archive::Nested_archive_table): New typedef.
16387 (Archive::is_thin_archive_): New field.
16388 (Archive::nested_archives_): New field.
16389 (Archive::options_): New field.
16390 (Archive::dirpath_): New field.
16391 (Archive::task_): New field.
16392 * readsyms.cc (Read_symbols::do_read_symbols): Add check
16393 for thin archives. Pass additional parameters to
16394 Archive::Archive. Unlock the archive file after calling
16395 Archive::setup.
16396
16397 2008-03-29 Ian Lance Taylor <iant@google.com>
16398
16399 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16400 version symbol to be local.
16401 * testsuite/ver_test_4.sh: New file.
16402 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16403 (check_DATA): Add ver_test_4.syms.
16404 (ver_test_4.syms): New target.
16405 * testsuite/Makefile.in: Rebuild.
16406
16407 * output.cc
16408 (Output_section::Input_section_sort_entry::has_priority): New
16409 function.
16410 (Output_section::Input_section_sort_entry::match_file_name): New
16411 function.
16412 (Output_section::Input_section_sort_entry::match_section_name):
16413 Remove.
16414 (Output_section::Input_section_sort_entry::match_section_name_prefix):
16415 Remove.
16416 (Output_section::Input_section_sort_entry::match_section_file):
16417 Remove.
16418 (Output_section::Input_section_sort_compare::operator()): Rewrite
16419 using new Input_section_sort_entry functions. Sort crtbegin and
16420 crtend first. Sort sections with no priority before sections with
16421 a priority.
16422 * testsuite/initpri1.c (d3): Check j != 4.
16423 (cd5): New constructor/destructor function.
16424 (main): Check j != 2.
16425
16426 * symtab.cc (Symbol_table::add_from_object): If we don't use the
16427 new symbol when resolving, don't call set_is_default.
16428 * testsuite/ver_test_7.cc: New file.
16429 * testsuite/ver_test_7.sh: New file.
16430 * testsuite/Makefile.am (ver_test_7.so): New target.
16431 (ver_test_7.o): New target.
16432 (check_SCRIPTS): Add ver_test_7.sh.
16433 (check_DATA): Add ver_test_7.syms.
16434 (ver_test_7.syms): New target.
16435
16436 2008-03-28 Ian Lance Taylor <iant@google.com>
16437
16438 * layout.cc (Layout::layout): If we see an input section with a
16439 name that needs sorting, set the must_sort flag for the output
16440 section.
16441 (Layout::make_output_section): If the name of the output section
16442 indicates that it might require sorting, set the may_sort flag.
16443 * output.h (Output_section::may_sort_attached_input_sections): New
16444 function.
16445 (Output_section::set_may_sort_attached_input_sections): New
16446 function.
16447 (Output_section::must_sort_attached_input_sections): New
16448 function.
16449 (Output_section::set_must_sort_attached_input_sections): New
16450 function.
16451 (class Output_section): Declare Input_section_sort_entry. Define
16452 Input_section_sort_compare. Declare
16453 sort_attached_input_sections. Add new fields:
16454 may_sort_attached_input_sections_,
16455 must_sort_attached_input_sections_,
16456 attached_input_sections_are_sorted_.
16457 * output.cc (Output_section::Output_section): Initialize new
16458 fields.
16459 (Output_section::add_input_section): Add an entry to
16460 input_sections_ if may_sort or must_sort are true.
16461 (Output_section::set_final_data_size): Call
16462 sort_attached_input_sections if necessary.
16463 (Output_section::Input_section_sort_entry): Define new class.
16464 (Output_section::Input_section_sort_compare::operator()): New
16465 function.
16466 (Output_section::sort_attached_input_sections): New function.
16467 * configure.ac: Check whether the compiler supports constructor
16468 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
16469 * testsuite/initpri1.c: New file.
16470 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16471 CONSTRUCTOR_PRIORITY.
16472 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16473 (initpri1_LDFLAGS): New variable.
16474 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16475
16476 2008-03-27 Ian Lance Taylor <iant@google.com>
16477
16478 * common.cc (Sort_commons::operator): Correct sorting algorithm.
16479 * testsuite/common_test_1.c: New file.
16480 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16481 (common_test_1_SOURCES): New variable.
16482 (common_test_1_DEPENDENCIES): New variable.
16483 (common_test_1_LDFLAGS): New variable.
16484
16485 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16486 and commons_ correctly when NAME/VERSION does not override
16487 NAME/NULL.
16488 * testsuite/ver_test_6.c: New file.
16489 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16490 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16491 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16492
16493 2008-03-26 Ian Lance Taylor <iant@google.com>
16494
16495 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16496 of an undefined symbol from a version script.
16497 * testsuite/Makefile.am (ver_test_5.so): New target.
16498 (ver_test_5.o): New target.
16499 (check_SCRIPTS): Add ver_test_5.sh.
16500 (check_DATA): Add ver_test_5.syms.
16501 (ver_test_5.syms): New target.
16502 * testsuite/ver_test_5.cc: New file.
16503 * testsuite/ver_test_5.script: New file.
16504 * testsuite/ver_test_5.sh: New file.
16505 * Makefile.in, testsuite/Makefile.in: Rebuild.
16506
16507 PR gold/5986
16508 Fix problems building gold with gcc 4.3.0.
16509 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16510 (gold_error_at_location, gold_warning_at_location): Use it.
16511 * configure.ac: Check whether we can compile and use a template
16512 function with a printf attribute.
16513 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16514 when jumping over bytes.
16515 * object.cc: Instantiate Object::read_section_data.
16516 * debug.h: Include <cstring>
16517 * dwarf_reader.cc: Include <algorithm>
16518 * main.cc: Include <cstring>.
16519 * options.cc: Include <cstring>.
16520 * output.cc: Include <cstring>.
16521 * script.cc: Include <cstring>.
16522 * script.h: Include <string>.
16523 * symtab.cc: Include <cstring> and <algorithm>.
16524 * target-select.cc: Include <cstring>.
16525 * version.cc: Include <string>.
16526 * testsuite/testmain.cc: Include <cstdlib>.
16527 * configure, config.in: Rebuild.
16528
16529 2008-03-25 Ian Lance Taylor <iant@google.com>
16530
16531 * options.cc: Include "../bfd/bfdver.h".
16532 (options::help): Print bug reporting address.
16533
16534 * version.cc (print_version): Adjust output for current value of
16535 BFD_VERSION_STRING.
16536
16537 * NEWS: New file.
16538
16539 * options.cc (options::help): Print list of supported targets.
16540 * target-select.h: Include <vector>.
16541 (class Target_selector): Make machine_, size_, and is_big_endian_
16542 fields const. Add bfd_name_ and instantiated_target_ fields.
16543 (Target_selector::Target_selector): Add bfd_name parameter.
16544 (Target_selector::recognize): Make non-virtual, call
16545 do_recognize.
16546 (Target_selector::recognize_by_name): Make non-virtual, call
16547 do_recognize_by_name.
16548 (Target_selector::supported_names): New function.
16549 (Target_selector::bfd_name): New function.
16550 (Target_selector::do_instantiate_target): New pure virtual
16551 function.
16552 (Target_selector::do_recognize): New virtual function.
16553 (Target_selector::do_recognize_by_name): New virtual function.
16554 (Target_selector::instantiate_target): New private function.
16555 (supported_target_names): Declare.
16556 * target-select.cc (Target_selector::Target_selector): Update for
16557 new parameter and fields.
16558 (select_target_by_name): Check that the name matches before
16559 calling recognize_by_name.
16560 (supported_target_names): New function.
16561 * i386.cc (class Target_selector_i386): Update Target_selector
16562 constructor call. Remove recognize and recognize_by_name. Add
16563 do_instantiate_target.
16564 * x86_64.cc (class Target_selector_x86_64): Likewise.
16565 * testsuite/testfile.cc (class Target_selector_test): Update for
16566 changes to Target_selector.
16567
16568 * README: Rewrite, with some notes on unsupported features.
16569
16570 2008-03-24 Cary Coutant <ccoutant@google.com>
16571
16572 * i386.cc (Target_i386::Got_type): New enum declaration.
16573 (Target_i386::Scan::local): Updated callers of Output_data_got
16574 member functions.
16575 (Target_i386::Scan::global): Likewise.
16576 (Target_i386::Relocate::relocate): Likewise.
16577 (Target_i386::Relocate::relocate_tls): Likewise.
16578 * object.h (Got_offset_list): New class.
16579 (Sized_relobj::local_has_got_offset): Added got_type parameter.
16580 (Sized_relobj::local_got_offset): Likewise.
16581 (Sized_relobj::set_local_got_offset): Likewise.
16582 (Sized_relobj::local_has_tls_got_offset): Removed.
16583 (Sized_relobj::local_tls_got_offset): Removed.
16584 (Sized_relobj::set_local_tls_got_offset): Removed.
16585 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16586 * output.cc (Output_data_got::add_global): Added got_type parameter.
16587 (Output_data_got::add_global_with_rel): Likewise.
16588 (Output_data_got::add_global_with_rela): Likewise.
16589 (Output_data_got::add_global_pair_with_rel): New function.
16590 (Output_data_got::add_global_pair_with_rela): New function.
16591 (Output_data_got::add_local): Added got_type parameter.
16592 (Output_data_got::add_local_with_rel): Likewise.
16593 (Output_data_got::add_local_with_rela): Likewise.
16594 (Output_data_got::add_local_pair_with_rel): New function.
16595 (Output_data_got::add_local_pair_with_rela): New function.
16596 (Output_data_got::add_global_tls): Removed.
16597 (Output_data_got::add_global_tls_with_rel): Removed.
16598 (Output_data_got::add_global_tls_with_rela): Removed.
16599 (Output_data_got::add_local_tls): Removed.
16600 (Output_data_got::add_local_tls_with_rel): Removed.
16601 (Output_data_got::add_local_tls_with_rela): Removed.
16602 * output.h (Output_data_got::add_global): Added got_type parameter.
16603 (Output_data_got::add_global_with_rel): Likewise.
16604 (Output_data_got::add_global_with_rela): Likewise.
16605 (Output_data_got::add_global_pair_with_rel): New function.
16606 (Output_data_got::add_global_pair_with_rela): New function.
16607 (Output_data_got::add_local): Added got_type parameter.
16608 (Output_data_got::add_local_with_rel): Likewise.
16609 (Output_data_got::add_local_with_rela): Likewise.
16610 (Output_data_got::add_local_pair_with_rel): New function.
16611 (Output_data_got::add_local_pair_with_rela): New function.
16612 (Output_data_got::add_global_tls): Removed.
16613 (Output_data_got::add_global_tls_with_rel): Removed.
16614 (Output_data_got::add_global_tls_with_rela): Removed.
16615 (Output_data_got::add_local_tls): Removed.
16616 (Output_data_got::add_local_tls_with_rel): Removed.
16617 (Output_data_got::add_local_tls_with_rela): Removed.
16618 * resolve.cc (Symbol::override_base_with_special): Removed
16619 reference to has_got_offset_ field.
16620 * symtab.cc (Symbol::init_fields): Replaced initialization
16621 of got_offset_ with got_offsets_. Removed initialization
16622 of has_got_offset_
16623 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16624 (Symbol::got_offset): Likewise.
16625 (Symbol::set_got_offset): Likewise.
16626 (Symbol::has_tls_got_offset): Removed.
16627 (Symbol::tls_got_offset): Removed.
16628 (Symbol::set_tls_got_offset): Removed.
16629 (Symbol::got_offset_): Removed.
16630 (Symbol::tls_mod_got_offset_): Removed.
16631 (Symbol::tls_pair_got_offset_): Removed.
16632 (Symbol::got_offsets_): New field.
16633 (Symbol::has_got_offset): Removed.
16634 (Symbol::has_tls_mod_got_offset): Removed.
16635 (Symbol::has_tls_pair_got_offset): Removed.
16636 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16637 (Target_x86_64::Scan::local): Updated callers of Output_data_got
16638 member functions.
16639 (Target_x86_64::Scan::global): Likewise.
16640 (Target_x86_64::Relocate::relocate): Likewise.
16641 (Target_x86_64::Relocate::relocate_tls): Likewise.
16642
16643 2008-03-25 Ben Elliston <bje@au.ibm.com>
16644
16645 * yyscript.y: Fix spelling error in comment.
16646
16647 2008-03-24 Ian Lance Taylor <iant@google.com>
16648
16649 * options.h (class General_options): Define build_id option.
16650 * layout.h (class Layout): Declare write_build_id, create_note,
16651 create_build_id. Add build_id_note_ member.
16652 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16653 "libiberty.h", "md5.h", "sha1.h".
16654 (Layout::Layout): Initialize eh_frame_data_,
16655 eh_frame_hdr_section_, and build_id_note_.
16656 (Layout::finalize): Call create_build_id.
16657 (Layout::create_note): New function, broken out of
16658 Layout::create_gold_note.
16659 (Layout::create_gold_note): Call create_note.
16660 (Layout::create_build_id): New function.
16661 (Layout::write_build_id): New function.
16662 (Close_task_runner::run): Call write_build_id.
16663
16664 * x86_64.cc: Correct license to GPLv3.
16665
16666 2008-03-23 Ian Lance Taylor <iant@google.com>
16667
16668 * options.cc: Include "demangle.h".
16669 (parse_optional_string): New function.
16670 (parse_long_option): Handle takes_optional_argument.
16671 (parse_short_option): Update dash_z initializer. Handle
16672 takes_optional_argument.
16673 (General_options::General_options): Initialize do_demangle_.
16674 (General_options::finalize): Set do_demangle_. Handle demangling
16675 style.
16676 * options.h (parse_optional_string): Declare.
16677 (struct One_option): Add optional_arg field. Update constructor.
16678 Update call constructor calls. Add takes_optional_argument
16679 function.
16680 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16681 (DEFINE_optional_string): Define.
16682 (General_options::demangle): Change from DEFINE_bool to
16683 DEFINE_optional_string.
16684 (General_options::no_demangle): New function.
16685 (General_options::do_demangle): New function.
16686 (General_options::set_do_demangle): New function.
16687 (General_options::execstack_status_): Move definition to end of
16688 class definition.
16689 (General_options::static_): Likewise.
16690 (General_options::do_demangle_): New field.
16691 * object.cc (big_endian>::get_symbol_location_info): Call
16692 Options::do_demangle, not Options::demangle.
16693 * symtab.cc (demangle): Likewise.
16694
16695 2008-03-22 Ian Lance Taylor <iant@google.com>
16696
16697 * gold.h: Include <cstddef> and <sys/types.h>
16698 * options.h: Include <cstring>.
16699
16700 2008-03-21 Ian Lance Taylor <iant@google.com>
16701
16702 * Added source code to GNU binutils.
16703 \f
16704 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16705
16706 Copying and distribution of this file, with or without modification,
16707 are permitted in any medium without royalty provided the copyright
16708 notice and this notice are preserved.
16709
16710 Local Variables:
16711 mode: change-log
16712 left-margin: 8
16713 fill-column: 74
16714 version-control: never
16715 End:
This page took 0.373411 seconds and 5 git commands to generate.