* layout.cc (Layout::special_ordering_of_input_section): New
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-12-20 Ian Lance Taylor <iant@google.com>
2
3 * layout.cc (Layout::special_ordering_of_input_section): New
4 function.
5 (Layout::layout): If input section requires special ordering, must
6 sort input sections.
7 (Layout::make_output_section): May sort .text input sections.
8 (Layout::is_section_name_prefix_grouped): Remove.
9 * layout.h (class Layout): Declare
10 special_ordering_of_input_section. Don't declare
11 is_section_name_prefix_grouped.
12 * output.cc (Output_section::add_input_section): Revert last
13 change.
14 (Output_section::Input_section_sort::match_file_name): Don't crash
15 if called on output section data.
16 (Output_section::Input_section_sort_compare): Sort based on
17 special ordering.
18 (Output_section::Input_section_sort_section_order_index_compare):
19 Revert last patch.
20 (Output_section::sort_attached_input_sections): Likewise.
21
22 2012-12-18 Sriraman Tallam <tmsriram@google.com>
23
24 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
25 * layout.h (Layout::is_section_name_prefix_grouped): New function.
26 * output.cc (Output_section::add_input_section): Check if section
27 name contains special prefix. Keep input sections to sort such
28 sections.
29 (Output_section::Input_section_sort_section_order_index_compare
30 ::operator()): Group sections according to prefixes.
31 (Output_section::sort_attached_input_sections): Add condition to
32 Input_section_entry constructor call.
33 * testsuite/Makefile.am (text_section_grouping): New test.
34 * testsuite/Makefile.in: Regenerate.
35 * testsuite/text_section_grouping.cc: New file.
36 * testsuite/text_section_grouping.sh: New file.
37
38 2012-12-17 Nick Clifton <nickc@redhat.com>
39
40 * Makefile.am: Add copyright notice.
41 * NEWS: Likewise.
42 * README: Likewise.
43 * configure.ac: Likewise.
44 * ftruncate.c: Likewise.
45 * Makefile.in: Regenerate.
46
47 2012-12-14 Cary Coutant <ccoutant@google.com>
48
49 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
50 --no-as-needed flag.
51 (exception_separate_shared_12_test): Likewise.
52 (incremental_copy_test): Likewise.
53 * testsuite/Makefile.in: Regenerate.
54
55 2012-12-14 Cary Coutant <ccoutant@google.com>
56
57 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
58 (Dwp_output_file::Dwp_index::enter_set): Add assert.
59
60 2012-12-12 Alan Modra <amodra@gmail.com>
61
62 * powerpc.cc (class Track_tls): New.
63 (class Relocate, class Scan): Inherit Track_tls.
64 (Target_powerpc::Scan::local, global): Track tls optimization
65 and avoid creating plt entry for __tls_get_addr if all uses
66 are optimized away.
67 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
68
69 2012-12-12 Alan Modra <amodra@gmail.com>
70
71 * options.h (General_options): Add --toc-sort/--no-toc-sort.
72 Replace no_toc_optimize with toc_optimize.
73 * output.h (Output_section::input_sections): Provide non-const variant.
74 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
75 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
76 accessors.
77 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
78 (class Sort_toc_sections): New.
79 (Target_powerpc::do_finalize_sections): Sort toc sections.
80 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
81
82 2012-12-10 Roland McGrath <mcgrathr@google.com>
83
84 * testsuite/binary_unittest.cc (read_all): New function.
85 (Sized_binary_test): Use it instead of ::read.
86 * fileread.cc (do_read): Don't assume pread always reads the whole
87 amount in a single call.
88
89 2012-12-10 Alan Modra <amodra@gmail.com>
90
91 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
92 Set EM_PPC64 or EM_PPC here.
93 (Target_selector_powerpc::do_recognize): Delete.
94
95 2012-12-10 Alan Modra <amodra@gmail.com>
96
97 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
98 stub_table_.
99 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
100
101 2012-12-07 Roland McGrath <mcgrathr@google.com>
102
103 * testsuite/binary_unittest.cc (Sized_binary_test):
104 Use open_descriptor rather than ::open.
105
106 2012-12-07 Alan Modra <amodra@gmail.com>
107
108 * powerpc.cc (Stub_table::do_write): Delete redundant Address
109 typedef and invalid_address constant.
110 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
111 instantiate constants.
112
113 2012-12-06 Roland McGrath <mcgrathr@google.com>
114
115 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
116 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
117 * aclocal.m4: Regenerate.
118 * configure: Regenerate.
119 * Makefile.in: Regenerate.
120 * testsuite/Makefile.in: Regenerate.
121
122 2012-12-07 Alan Modra <amodra@gmail.com>
123
124 * options.h (General_options): Add no_toc_optimize.
125 * powerpc.cc (ok_lo_toc_insn): New function.
126 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
127
128 2012-12-06 Alan Modra <amodra@gmail.com>
129
130 * options.h (General_options): Add plt_align, plt_static_chain,
131 plt_thread_safe. Update stub_group_size help text.
132 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
133 for new plt_thread_safe_ var.
134 (use_plt_offset): Correct comments.
135 (Target_powerpc::do_relax): Look for thread creation symbols to
136 determine default plt_thread_safe value. Clear plt call stubs
137 as well as branch stubs each iteration.
138 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
139 insn constants.
140 (l, hi, ha, write_insn): Move earlier.
141 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
142 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
143 plt stubs too.
144 (Stub_table::update_size): Adjust.
145 (Stub_table::prev_size, set_prev_size): Delete.
146 (Stub_table::stub_align): Let --plt-align affect result.
147 (Stub_table::plt_call_size): Calculate sizes for various stubs.
148 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
149 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
150 (Stub_table::do_write): Support more stub variants.
151
152 2012-12-04 Alan Modra <amodra@gmail.com>
153
154 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
155 (Target_powerpc::do_define_standard_symbols): New function.
156
157 2012-12-03 Alan Modra <amodra@gmail.com>
158
159 * output.h: Formatting, whitespace.
160
161 2012-12-03 Alan Modra <amodra@gmail.com>
162
163 * layout.h (Layout::get_executable_sections): Declare.
164 * layout.cc (Layout::get_executable_sections): New function.
165 * arm.cc (Target_arm::group_sections): Use it.
166 (Arm_output_section::group_sections): Delete now redundant test.
167 * output.cc (Output_reloc::Output_reloc): Add is_relative.
168 param to handle relative relocs.
169 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
170 (Output_data_reloc::add_absolute): Adjust.
171 (Output_data_reloc::add_relative): New function.
172 (Output_data::reset_data_size): New function.
173 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
174 (Output_section::set_addralign): New function.
175 (Output_section::checkpoint_set_addralign): New function.
176 (Output_section::clear_section_offsets_need_adjustment): New function.
177 (Output_section::input_sections): Make public.
178 * powerpc.cc (class Output_data_brlt_powerpc): New.
179 (class Stub_table, class Stub_control): New.
180 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
181 stub_table_, set_stub_table, stub_table): New vectors and accessor
182 functions.
183 (Target_powerpc::do_may_relax, do_relax, push_branch,
184 new_stub_table, stub_tables, brlt_section, group_sections,
185 add_branch_lookup_table, find_branch_lookup_table,
186 write_branch_lookup_table, make_brlt_section): New functions.
187 (Target_powerpc::struct Sort_sections, class Branch_info): New.
188 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
189 branch_info_): New vars.
190 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
191 make call stubs here.
192 (Output_data_glink): Remove all call stub handling from this class.
193 (Target_powerpc::Scan::local, global): Save interesting branch
194 relocs and relocs for ifunc. Adjust calls to plt entry functions.
195 (Target_powerpc::do_finalize_sections): Only make reg save/restore
196 functions on final link.
197 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
198 Handle long branch destinations too.
199 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
200 do_plt_address_for_local): Adjust lookup of plt call stubs.
201
202 2012-11-30 Alan Modra <amodra@gmail.com>
203
204 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
205 relocs against protected symbols when building 32-bit shared libs.
206
207 2012-11-30 Alan Modra <amodra@gmail.com>
208
209 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
210 param. Call got_section() to make .got. Update all callers
211 and their callers and so on.
212
213 2012-11-30 Alan Modra <amodra@gmail.com>
214
215 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
216 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
217 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
218 value if it already exists.
219
220 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
221
222 PR gold/14858
223 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
224
225 2012-11-14 Roland McGrath <mcgrathr@google.com>
226
227 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
228 than bfc instruction for data sandboxing.
229
230 2012-11-08 Alan Modra <amodra@gmail.com>
231
232 * po/POTFILES.in: Regenerate.
233
234 2012-11-05 Alan Modra <amodra@gmail.com>
235
236 * configure.ac: Apply 2012-09-10 change to config.in here.
237 * configure: Regenerate.
238
239 2012-11-05 Alan Modra <amodra@gmail.com>
240
241 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
242 (struct Opd_ent): Use "Address" rather than "Offset".
243 (Output_data_got_powerpc::got_base_offset): Return Valtype.
244 (Target_powerpc::got_section): Make public.
245 (Target_powerpc::scan_relocs): Move code setting symbols..
246 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
247 Create _SDA_BASE_ only when referenced.
248
249 2012-11-02 Roland McGrath <mcgrathr@google.com>
250
251 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
252 from last change.
253
254 2012-11-01 Roland McGrath <mcgrathr@google.com>
255
256 * target.h (Sized_target::relocate_relocs): Use Elf_Off
257 for offset_in_output_section parameter.
258 (Sized_target::relocate_special_relocatable): Likewise.
259 * arm.cc (Target_arm::relocate_relocs): Likewise.
260 (Target_arm::relocate_special_relocatable): Likewise.
261 * i386.cc (Target_i386::relocate_relocs): Likewise.
262 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
263 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
264 * target-reloc.h (relocate_relocs): Likewise.
265 * testsuite/testfile.cc (Target_test): Likewise.
266 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
267 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
268
269 * system.h: Move inclusion of <clocale> to after <libintl.h> in
270 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
271
272 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
273 parameter, which is unused in the [!F_SETFD] case.
274
275 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
276 SYMNDX to off_t before comparing it to this->data_size().
277 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
278 * incremental.cc (Output_section_incremental_inputs::do_write):
279 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
280
281 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
282
283 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
284
285 * gold.cc (Target_arm::do_adjust_elf_header): Add the
286 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
287 in EABI_VER5.
288
289 2012-10-29 Cary Coutant <ccoutant@google.com>
290
291 * dwp.cc (usage): Add file and exit status parameters;
292 add --help and --version options.
293 (print_version): New function.
294 (main): Add --help and --version options.
295
296 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
297
298 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
299 final_layout_sequence.txt.
300 * testsuite/Makefile.in: Regenerated.
301
302 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
303
304 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
305 COMPILE generated by automake.
306 (LINK1): Likewise.
307 (CXXCOMPILE1): Likewise.
308 (CXXLINK1): Likewise.
309 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
310 (LINK): Likewise.
311 (CXXCOMPILE): Likewise.
312 (CXXLINK): Likewise.
313 * testsuite/Makefile.in: Regenerated.
314
315 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
316
317 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
318 on bad fwrite return.
319
320 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
321
322 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
323 on val.
324
325 2012-10-23 Cary Coutant <ccoutant@google.com>
326
327 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
328 * testsuite/Makefile.in: Regenerate.
329 * testsuite/dwp_test.h: New source file.
330 * testsuite/dwp_test_1.cc: New source file.
331 * testsuite/dwp_test_1.s: New source file.
332 * testsuite/dwp_test_1.sh: New source file.
333 * testsuite/dwp_test_1b.cc: New source file.
334 * testsuite/dwp_test_1b.s: New source file.
335 * testsuite/dwp_test_2.cc: New source file.
336 * testsuite/dwp_test_2.s: New source file.
337 * testsuite/dwp_test_2.sh: New source file.
338 * testsuite/dwp_test_main.cc: New source file.
339 * testsuite/dwp_test_main.s: New source file.
340
341 2012-10-23 Cary Coutant <ccoutant@google.com>
342
343 * dwp.h: New header file.
344 * dwp.cc: New source file.
345 * gold.h: Move shared declarations to system.h.
346 * system.h: New header file.
347 * Makefile.am: Add dwp.
348 * Makefile.in: Regenerate.
349
350 2012-10-23 Cary Coutant <ccoutant@google.com>
351
352 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
353 Dwarf_info_reader::read_from_pointer.
354 (Dwarf_pubnames_table::read_header): Likewise.
355 (Dwarf_pubnames_table::next_name): Likewise.
356 (Dwarf_die::read_attributes): Likewise.
357 (Dwarf_die::skip_attributes): Likewise.
358 (Dwarf_info_reader::read_from_pointer): New function template.
359 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
360 (Dwarf_pubnames_table): Likewise.
361 (Dwarf_info_reader::read_from_pointer): New function template.
362 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
363 Dwarf_pubnames_table ctor.
364
365 2012-10-23 Cary Coutant <ccoutant@google.com>
366
367 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
368 abbrev_shndx.
369 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
370 abbrev_shndx_.
371 (Dwarf_info_reader::set_abbrev_shndx): New method.
372 (Dwarf_info_reader::abbrev_shndx_): New data member.
373
374 2012-10-23 Cary Coutant <ccoutant@google.com>
375
376 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
377 from object, not parameters.
378 (Dwarf_info_reader::parse): Likewise.
379 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
380 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
381 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
382 methods.
383
384 2012-10-23 Cary Coutant <ccoutant@google.com>
385
386 * fileread.cc (Input_file::Input_file): New constructor.
387 * fileread.h (class Input_file): Add new constructor.
388
389 2012-10-18 Alan Modra <amodra@gmail.com>
390
391 PR gold/14727
392 * object.cc (Relobj::is_section_name_included): Also match
393 .sdata personality section.
394
395 2012-10-18 Alan Modra <amodra@gmail.com>
396
397 * target-reloc.h (class Default_comdat_behavior): New, package up..
398 (get_comdat_behaviour): ..this.
399 (relocate_section): Add Relocate_comdat_behavior template arg,
400 adjust code to suit.
401 * arm.cc (Target_arm::relocate_section): Adjust to suit.
402 (Target_arm::scan_reloc_section): Likewise.
403 * i386.cc (Target_i386::relocate_section): Likewise.
404 * sparc.cc (Target_sparc::relocate_section): Likewise.
405 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
406 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
407 * powerpc.cc (class Relocate_comdat_behavior): New.
408 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
409 gold::relocate_section with new template arg.
410
411 2012-10-18 Alan Modra <amodra@gmail.com>
412
413 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
414 dynamic relocs for GOT_TPREL got entries, without symbol if
415 resolving locally.
416 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
417 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
418 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
419
420 2012-10-17 Alan Modra <amodra@gmail.com>
421
422 PR gold/14726
423 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
424
425 2012-10-16 Sriraman Tallam <tmsriram@google.com>
426
427 * layout.cc (Layout::include_section): Keep sections marked
428 SHF_EXCLUDE when doing relocatable links.
429
430 2012-10-16 Alan Modra <amodra@gmail.com>
431
432 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
433 (Target_powerpc::do_finalize_sections): Call it.
434 (Output_data_save_res): New class and supporting functions.
435 (Target_powerpc::symval_for_branch): Only look up .opd entry for
436 normal symbols defined in object files.
437
438 2012-10-12 Alan Modra <amodra@gmail.com>
439
440 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
441 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
442 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
443 section if scan_opd_relocs not yet called.
444 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
445
446 2012-10-12 Alan Modra <amodra@gmail.com>
447
448 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
449 add_local_ifunc_entry): Revert last change.
450 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
451
452 2012-10-05 Alan Modra <amodra@gmail.com>
453
454 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
455 do_plt_address_for_global): New functions.
456 (Output_data_got_powerpc::do_write): Don't segfault when linking
457 statically.
458 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
459 add_local_ifunc_entry): Return true on adding entry..
460 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
461 glink->add_entry call. Remove unused symtab param. Adjust calls.
462 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
463 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
464 set up symbols here.
465 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
466 syms here. Do so even when no .iplt. Don't segfault when linking
467 statically.
468 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
469 new variants without reloc param.
470 (Glink_sym_ent::Glink_sym_ent): Likewise.
471 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
472 reloc when refs will resolve to plt call stub.
473 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
474 R_PPC_PLTREL24 to resolve locally.
475 (Target_powerpc::Scan::global): Correct ifunc handling.
476 (Target_powerpc::Relocate::relocate): Correct local sym glink
477 lookup. Don't destroy "value" when we have a plt call stub,
478 and when checking plt call validity.
479 (Target_powerpc::do_dynsym_value): Simplify.
480
481 2012-10-05 Alan Modra <amodra@gmail.com>
482
483 * i386.cc (Output_data_plt_i386::address_for_global,
484 address_for_local): Add plt offset to returned value. Adjust uses.
485 * sparc.cc (Output_data_plt_sparc::address_for_global,
486 address_for_local): Likewise.
487 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
488 address_for_local): Likewise.
489 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
490 address_for_local): Likewise.
491 * target.h (Target::plt_address_for_global, plt_address_for_local):
492 Update comment.
493 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
494 (Output_data_got::Got_entry::write): Nor here.
495 * output.h: Comment fix.
496
497 2012-10-02 Jiong Wang <jiwang@tilera.com>
498
499 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
500 global_offset_table_ value for larget got.
501 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
502
503 2012-09-29 Alan Modra <amodra@gmail.com>
504
505 * powerpc.cc (Target_powerpc::iplt_): New output section.
506 (Target_powerpc::iplt_section, make_iplt_section,
507 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
508 (Target_powerpc::make_plt_entry): Handle ifunc syms.
509 Target_powerpc::plt_entry_count): Count iplt entries too.
510 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
511 reloc section in constructor. New params.
512 (Target_powerpc::make_plt_section): Create reloc section here instead.
513 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
514 functions.
515 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
516 (Output_data_glink::add_entry, find_entry): New functions to
517 deal with local syms.
518 (Glink_sym_ent): Add support for local syms.
519 (Output_data_glink::do_write): Handle ifunc plt entries.
520 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
521 (Target_powerpc::Scan::local, global): Handle ifunc syms.
522 (Target_powerpc::Relocate::relocate): Likewise.
523 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
524
525 2012-09-25 Alan Modra <amodra@gmail.com>
526
527 * object.h (Sized_relobj_file::adjust_local_symbol,
528 do_adjust_local_symbol): New functions.
529 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
530 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
531 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
532 and irregular opd entry spacing.
533 (Powerpc_relobj::do_read_relocs): Add opd size checks.
534 (Global_symbol_visitor_opd): New functor.
535 (Target_powerpc::do_finalize_sections): Omit global symbols defined
536 on deleted opd entries.
537
538 2012-09-15 Jiong Wang <jiwang@tilera.com>
539
540 * tilegx.cc: New file.
541 * Makefile.am (TARGETSOURCES): Add tilegx.cc
542 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
543 * configure.tgt: Add entries for tilegx*.
544 * configure.ac: Likewise.
545 * Makefile.in: Rebuild.
546 * configure: Likewise.
547 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
548 tilegx.
549
550 2012-09-13 Alan Modra <amodra@gmail.com>
551
552 * target-reloc.h (scan_relocs): Call scan.local for relocs
553 against symbols in discarded sections. Pass is_discarded
554 param.
555 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
556 Add is_discarded param.
557 * powerpc (Target_powerpc::Scan::local): Likewise. Use
558 is_discarded to flag opd entry as discarded. Don't emit dyn
559 relocs on such entries.
560 (Target_powerpc::Scan::global): Similarly detect and handle
561 such opd entries.
562 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
563 opd_ent_. Update all uses.
564 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
565 (Target_powerpc::relocate_section): Zero out discarded opd
566 entry relocs.
567
568 2012-09-12 Ian Lance Taylor <iant@google.com>
569
570 PR gold/14570
571 * output.cc: Rename Output_data_got template parameter from size
572 to got_size for all functions. Compile all variants of
573 Output_data_got.
574 (Output_data_got::Got_entry::write): Correct use of size for
575 symbol value. Use local_is_tls rather than casting to
576 Sized_relobj_file.
577 * object.h (class Object): Add local_is_tls and do_local_is_tls.
578 (class Sized_relobj_file): Add do_local_is_tls.
579 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
580
581 2012-09-11 Alan Modra <amodra@gmail.com>
582
583 PR gold/14566
584 * layout.cc (Layout::set_segment_offsets): When using
585 common-page-size alignment, ensure we are on a new max-page-size
586 page.
587 * output.cc (Output_segment::set_section_addresses): Use
588 abi_pagesize, not common_pagesize for relro boundary.
589 (Output_segment::set_offset): Likewise.
590
591 2012-09-11 Alan Modra <amodra@gmail.com>
592
593 * output.h (Output_data_got::add_global_tls, add_local_tls,
594 add_local_tls_pair): New functions.
595 (Output_data_got::add_local_pair_with_rel): Remove second
596 reloc param. Expand comment.
597 (Output_data_got::Got_entry): Rename use_plt_offset_ to
598 use_plt_or_tls_offset_, similarly for constructor param.
599 (Output_data_got::Got_entry::write): Add got_index param.
600 * output.cc (Output_data_got::add_global_tls, add_local_tls,
601 add_local_tls_pair): New functions.
602 (Output_data_got::Got_entry::write): Handle tls symbols
603 with use_plt_or_tls_offset_ set specially.
604 (Output_data_got::add_local_pair_with_rel): Only one reloc.
605 (Output_data_got::do_write): Replace iterator with index, pass
606 index to entry write function.
607 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
608 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
609 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
610 call.
611 * i386.cc (Target_i386::Scan::local): Likewise.
612 * sparc.cc (Target_sparc::Scan::local): Likewise.
613 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
614 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
615 do_tls_offset_for_global): New functions.
616 (Target_powerpc::Scan::local): Correct TLS relocations and got
617 entry values.
618 (Target_powerpc::Scan::global): Don't emit unnecessary
619 dynamic relocations on TLS GOT entries.
620
621 2012-09-10 Matthias Klose <doko@ubuntu.com>
622
623 * config.in: Disable sanity check for kfreebsd.
624
625 2012-09-10 Sterling Augustine <saugustine@google.com>
626
627 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
628 (Gdb_index::pubtypes_read): New parameter.
629 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
630 to calls.
631 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
632 pubtypes_object_.
633
634 2012-09-09 Alan Modra <amodra@gmail.com>
635
636 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
637 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
638 * gc.h (gc_process_relocs): Call target gc_add_reference.
639 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
640 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
641 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
642 unnecessary cast.
643 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
644 to cater for when we don't need code offset. Update use.
645 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
646 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
647 set_opd_valid): New functions.
648 (Target_powerpc::do_gc_add_reference): New function.
649 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
650 stashed refs.
651 (Target_powerpc::do_gc_mark_symbol): New function.
652
653 2012-09-06 Cary Coutant <ccoutant@google.com>
654
655 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
656 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
657 (Dwarf_die::skip_attributes): Likewise.
658 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
659 * testsuite/gdb_index_test.cc (inline_func_1): New function.
660 (main): Call it.
661 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
662
663 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
664
665 * testsuite/script_test_3.t: Add .got.plt output section
666 statement.
667 * testsuite/script_test_4.t: Likewise.
668
669 2012-09-05 Alan Modra <amodra@gmail.com>
670
671 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
672 update all uses and lose "enum" when using type.
673
674 2012-09-05 Alan Modra <amodra@gmail.com>
675
676 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
677 * configure: Regenerate.
678 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
679 (plugin_final_layout.stdout): Likewise.
680 (memory_test): Set page sizes to 0x1000.
681 * testsuite/Makefile.in: Regenerate.
682 * testsuite/discard_locals_test.sh: Add FIXME comment.
683 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
684 * testsuite/pr14265.t: Add .got output section statement.
685 * testsuite/script_test_2.t: Likewise.
686 * testsuite/script_test_3.t: Likewise.
687 * testsuite/script_test_4.t: Likewise.
688 * testsuite/script_test_5.t: Likewise.
689 * testsuite/script_test_6.t: Likewise.
690 * testsuite/script_test_7.t: Likewise.
691 * testsuite/script_test_9.t: Likewise.
692
693 2012-09-05 Alan Modra <amodra@gmail.com>
694
695 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
696 (Powerpc_relocate_functions::Status): New typedef.
697 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
698 (Target_powerpc::Scan::local): Handle REL64.
699 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
700 for REL32 and REL64.
701 (Target_powerpc::symval_for_branch): New function, extracted from..
702 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
703 checks. Report overflow errors.
704
705 2012-09-05 Alan Modra <amodra@gmail.com>
706
707 * object.h (Sized_relobj_file::emit_relocs): Delete.
708 (Sized_relobj_file::emit_relocs_reltype): Delete.
709 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
710 relocate_relocs for --emit-relocs.
711 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
712 * output.h: Update comment.
713 (Output_segment::first_section): New function.
714 (Output_segment::first_section_load_address): Use first_section.
715 * output.cc (Output_segment::first_section): New function extracted..
716 (Output_segment::first_section_load_address): ..from here. Delete.
717 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
718 * target.h (Sized_target::relocate_for_relocatable): Likewise.
719 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
720 adjust call to target.h function.
721 * i386.cc (Target_i386): Likewise.
722 * sparc.cc (Target_sparc): Likewise.
723 * x86_64.cc (Target_x86_64): Likewise.
724 * powerpc.cc (Target_powerpc): Likewise.
725 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
726 first tls section has section symbol for optimised local dynamic
727 output relocs.
728 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
729 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
730 optimised tls code.
731 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
732 Rename to relocate_relocs. Update error message.
733
734 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
735
736 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
737 --just-symbols.
738
739 2012-08-31 Alan Modra <amodra@gmail.com>
740
741 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
742 (Powerpc_relobj::toc_base_offset): New stub function.
743 (Target_powerpc): Add tp_offset, dtp_offset. Rename
744 got_mod_index_offset to tlsld_got_offset. Update all refs.
745 (Target_powerpc::Relocate::enum skip_tls): New.
746 (Target_powerpc::call_tls_get_addr_): New var.
747 (Target_powerpc::is_branch_reloc): Move to file scope.
748 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
749 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
750 New functions.
751 (Target_powerpc::enum Got_type): Delete old values, add new ones.
752 (powerpc_info): Correct common_pagesize for ppc64.
753 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
754 (Powerpc_relocate_functions): Add overflow check enums and functions.
755 Add non-shift version of rela, rela_ua. Delete all rel public
756 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
757 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
758 addr16_ha3, addr14 functions.
759 (Output_data_got_powerpc::add_constant_pair): New function.
760 (Output_data_got_powerpc::got_base_offset): Likewise.
761 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
762 (instruction constants): Sort, add some more.
763 (Output_data_glink::do_write): Add and use Address typedef. Use
764 object->toc_base_offset() stub for 64-bit.
765 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
766 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
767 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
768 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
769 Always treat .opd relocs as against locally defined symbol.
770 Correct condition for RELATIVE relocs.
771 (Target_powerpc::do_finalize_sections): Test for NULL sections.
772 (Target_powerpc::Relocate::relocate): Use plt call stub as value
773 for 32-bit syms with a plt entry. Correct ppc64 toc base
774 calculations. Handle TLS relocs, and more. Add overflow
775 checking and adjust for Powerpc_relocate_functions changes.
776 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
777 Reinstate --emit-relocs code with FIXME.
778
779 2012-08-30 Alan Modra <amodra@gmail.com>
780
781 * layout.cc (Layout::set_segment_offsets): Set p_align to
782 abi_pagesize, not common_pagesize.
783 (Layout::relaxation_loop_body): Similarly use abi_pagesize
784 to determine whether file header can go in segment.
785
786 2012-08-30 Alan Modra <amodra@gmail.com>
787
788 * output.h (Output_reloc::Output_reloc <output section>): Add
789 is_relative param. Adjust calls.
790 (Output_reloc::add_output_section_relative): New functions.
791 * output.cc (Output_reloc::Output_reloc <output section>): Handle
792 is_relative.
793 (Output_reloc::symbol_value): Handle SECTION_CODE.
794
795 2012-08-24 Sriraman Tallam <tmsriram@google.com>
796
797 * gold.cc (queue_middle_tasks): Call layout again when unique
798 segments for sections is desired.
799 * layout.cc (Layout::Layout): Initialize new members.
800 (Layout::get_output_section_flags): New function.
801 (Layout::choose_output_section): Call get_output_section_flags.
802 (Layout::layout): Make output section for mapping to a unique segment.
803 (Layout::insert_section_segment_map): New function.
804 (Layout::attach_allocated_section_to_segment): Make unique segment for
805 output sections marked so.
806 (Layout::segment_precedes): Check for unique segments when sorting.
807 * layout.h (Layout::Unique_segment_info): New struct.
808 (Layout::Section_segment_map): New typedef.
809 (Layout::insert_section_segment_map): New function.
810 (Layout::get_output_section_flags): New function.
811 (Layout::is_unique_segment_for_sections_specified): New function.
812 (Layout::set_unique_segment_for_sections_specified): New function.
813 (Layout::unique_segment_for_sections_specified_): New member.
814 (Layout::section_segment_map_): New member.
815 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
816 Rename is_gc_pass_one to is_pass_one.
817 Rename is_gc_pass_two to is_pass_two.
818 Rename is_gc_or_icf to is_two_pass.
819 Check for which pass based on whether symbols data is present.
820 Make it two pass when unique segments for sections is desired.
821 * output.cc (Output_section::Output_section): Initialize new
822 members.
823 * output.h (Output_section::is_unique_segment): New function.
824 (Output_section::set_is_unique_segment): New function.
825 (Output_section::is_unique_segment_): New member.
826 (Output_section::extra_segment_flags): New function.
827 (Output_section::set_extra_segment_flags): New function.
828 (Output_section::extra_segment_flags_): New member.
829 (Output_section::segment_alignment): New function.
830 (Output_section::set_segment_alignment): New function.
831 (Output_section::segment_alignment_): New member.
832 (Output_segment::Output_segment): Initialize is_unique_segment_.
833 (Output_segment::is_unique_segment): New function.
834 (Output_segment::set_is_unique_segment): New function.
835 (Output_segment::is_unique_segment_): New member.
836 * plugin.cc (allow_unique_segment_for_sections): New function.
837 (unique_segment_for_sections): New function.
838 (Plugin::load): Add new functions to transfer vector.
839 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
840 * Makefile.in: Regenerate.
841 * testsuite/plugin_final_layout.sh: Check if unique segment
842 functionality works.
843 * testsuite/plugin_section_order.c (onload): Check if new interfaces
844 are available.
845 (allow_unique_segment_for_sections): New global.
846 (unique_segment_for_sections): New global.
847 (claim_file_hook): Call allow_unique_segment_for_sections.
848 (all_symbols_read_hook): Call unique_segment_for_sections.
849
850 2012-08-22 Cary Coutant <ccoutant@google.com>
851
852 * layout.cc (Layout::include_section): Don't assert on GROUP
853 sections with --emit-relocs.
854
855 2012-08-21 Cary Coutant <ccoutant@google.com>
856
857 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
858 if --export-dynamic-symbol names an undef symbol.
859
860 2012-08-18 Alan Modra <amodra@gmail.com>
861
862 * powerpc.cc: Formatting and white space.
863 (Powerpc_relobj): Rename got2_section_ to special_.
864 Add opd_ent_shndx_ and opd_ent_off_ vectors.
865 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
866 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
867 (Target_powerpc): Add Address typedef and invalid_address. Use
868 throughout.
869 (Target_powerpc::is_branch_reloc): New function.
870 (Powerpc_relocate_functions): Add Address typedef, use throughout.
871 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
872 for dst_mask, value and addend.
873 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
874 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
875 (Output_data_glink::do_write): Correct toc base. Don't try to use
876 uint16_t for 24-bit offset. Use get_output_section_offset and
877 check return.
878 (Target_powerpc::Scan::local): Handle more relocs.
879 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
880 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
881 Plug in toc restoring insn after plt calls. Translate branches
882 to function descriptor symbols to corresponding entry point.
883 (Target_powerpc::relocate_for_relocatable): Check return from
884 get_output_section_offset.
885 * symtab.h: Comment typo.
886
887 2012-08-14 Ian Lance Taylor <iant@google.com>
888
889 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
890 unsupported_relocal_local to call unsupported_reloc_global.
891
892 2012-08-14 Nick Clifton <nickc@redhat.com>
893
894 PR ld/14265
895 * script-sections.cc (Sections_element::output_section_name): Add
896 keep return parameter.
897 (Output_section_element::match_name): Add keep return parameter.
898 Return the value of the keep_ member.
899 * script-sections.h (class Output_section): Update
900 output_section_name prototype.
901 * layout.cc (Layout::keep_input_section): New public member
902 function.
903 (Layout::choose_output_section): Pass keep parameter to
904 output_section_name.
905 * layout.h (class Layout): Add keep_input_section.
906 * object.cc (Sized_relobj_file::do_layout): Check for kept input
907 sections.
908 * testsuite/Makefile.am: Add a test.
909 * testsuite/Makefile.in: Regenerate.
910 * testsuite/pr14265.c: Source file for the test.
911 * testsuite/pr14265.t: Linker script for the test.
912 * testsuite/pr14265.sh: Shell script for the test.
913
914 2012-08-14 Alan Modra <amodra@gmail.com>
915
916 * target.h (Target::output_section_name): New function.
917 (Target::do_output_section_name): New function.
918 * layout.cc (Layout::choose_output_section): Call the above.
919 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
920
921 2012-08-14 Alan Modra <amodra@gmail.com>
922
923 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
924 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
925 for replace_constant call.
926 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
927 (Output_data_glink::do_print_to_mapfile): New function.
928 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
929 (Target_powerpc::Relocate::relocate): Likewise.
930
931 2012-08-14 Alan Modra <amodra@gmail.com>
932
933 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
934 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
935 (Output_data_glink::add_entry,find_entry): Remove shndx param.
936 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
937 all references to shndx_. Handle special case for R_PPC_PLTREL24
938 here.
939 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
940 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
941 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
942 here.
943 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
944 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
945
946 2012-08-12 Alan Modra <amodra@gmail.com>
947
948 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
949 (glink insn constants): Use uint32_t.
950 (Output_data_glink::add_entry): Use insert, not [] operator.
951
952 2012-08-11 Alan Modra <amodra@gmail.com>
953
954 * object.h (Sized_relobj_file::find_shdr): New function.
955 (Sized_relobj_file::find_special_sections): New function.
956 * object.cc (Sized_relobj_file::find_shdr): New function.
957 (Sized_relobj_file::find_eh_frame): Use find_shdr.
958 (Sized_relobj_file::find_special_sections): New function, split out..
959 (Sized_relobj_file::do_read_symbols): ..from here.
960 * output.h (Output_data_got::replace_constant): New function.
961 (Output_data_got::num_entries): New function.
962 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
963 (Output_data_got::got_offset): Protected rather than private.
964 (Output_data_got::replace_got_entry): New function.
965 * output.cc (Output_data_got::replace_got_entry): New function.
966 * powerpc.cc (class Powerpc_relobj): New.
967 (class Powerpc_relocate_functions): Delete all psymval variants or
968 convert to value,addend type. Delete pcrela, pcrela_unaligned.
969 Implement _ha functions using corresponding _hi function.
970 (Powerpc_relobj::find_special_sections): New function.
971 (Target_powerpc::do_make_elf_object): New function.
972 (class Output_data_got_powerpc): New.
973 (class Output_data_glink): New.
974 (class Powerpc_scan_relocatable_reloc): New.
975 Many more changes througout file.
976
977 2012-08-09 Nick Clifton <nickc@redhat.com>
978
979 * po/vi.po: Updated Vietnamese translation.
980
981 2012-08-07 Ian Lance Taylor <iant@google.com>
982
983 * layout.cc (Layout::add_target_dynamic_tags): If
984 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
985 plt_rel.
986
987 2012-07-30 Nick Clifton <nickc@redhat.com>
988
989 * po/gold.pot: Updated template.
990 * po/es.po: Updated Spanish translation.
991
992 2012-07-18 Cary Coutant <ccoutant@google.com>
993
994 PR gold/14344
995 * configure.ac: Add check for -gpubnames support.
996 * configure: Regenerate.
997 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
998 support; force -gno-pubnames.
999 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1000 support.
1001 (gdb_index_test_4): New test.
1002 * testsuite/Makefile.in: Regenerate.
1003 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1004 * testsuite/gdb_index_test_2.sh: Likewise.
1005 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1006 * testsuite/gdb_index_test_4.sh: New script.
1007 * testsuite/gdb_index_test_comm.sh: New script with common code;
1008 don't look for space after colon.
1009
1010 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1011
1012 * gold.cc (queue_middle_tasks): Update function order only after
1013 deferred objects due to plugins are processed.
1014
1015 2012-07-11 Ian Lance Taylor <iant@google.com>
1016
1017 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1018 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1019 (Target_arm::scan_reloc_for_stub): Likewise.
1020 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1021 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1022 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1023 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1024 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1025
1026 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1027 Ian Lance Taylor <iant@google.com>
1028
1029 PR gold/14309
1030 * configure.ac: Test whether std::tr1::hash<off_t> works.
1031 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1032 needed.
1033 * output.h (class Output_fill): Add virtual destructor.
1034 * configure, config.in: Rebuild.
1035
1036 2012-06-22 Roland McGrath <mcgrathr@google.com>
1037
1038 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1039
1040 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1041
1042 * plugin.cc (Plugin::load): Handle position independent executables.
1043
1044 2012-06-06 Cary Coutant <ccoutant@google.com>
1045
1046 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1047 add .debug_macro.
1048 (lines_only_debug_sections): Likewise.
1049 (gdb_fast_lookup_sections): New static array.
1050 (is_gdb_debug_section): Rename formal parameter.
1051 (is_lines_only_debug_section): Likewise.
1052 (is_gdb_fast_lookup_section): New function.
1053 (Layout::include_section): Check for ".zdebug_" prefix; pass
1054 section name suffix to is_gdb_debug_section, et al.; check for
1055 fast-lookup sections when building .gdb_index.
1056 * options.h (--strip-debug-gdb): Update GDB version number.
1057
1058 2012-06-06 Cary Coutant <ccoutant@google.com>
1059
1060 * configure.ac: Add check for fallocate.
1061 * configure: Regenerate.
1062 * config.in: Regenerate.
1063
1064 * options.h (class General_options): Add --mmap-output-file and
1065 --posix-fallocate options.
1066 * output.cc: (posix_fallocate): Remove; replace with...
1067 (gold_fallocate): New function.
1068 (Output_file::map_no_anonymous): Call gold_fallocate.
1069 (Output_file::map): Check --mmap-output-file option.
1070
1071 2012-06-05 Jing Yu <jingyu@google.com>
1072
1073 * gold.h (textdomain): Add do {} to empty while(0).
1074 (bindtextdomain): Likewise.
1075
1076 2012-06-04 Cary Coutant <ccoutant@google.com>
1077
1078 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1079 has_dynsym_index.
1080
1081 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1082
1083 * symtab.cc (Symbol_table::define_special_symbol):
1084 Initialize *poldsym to prevent uninitialized variable errors.
1085
1086 2012-05-23 Cary Coutant <ccoutant@google.com>
1087
1088 * layout.cc (Layout::section_name_mapping): Add rules to handle
1089 exact match on .data.rel.ro.local or .data.rel.ro.
1090 (Layout::output_section_name): Check for exact matches.
1091
1092 2012-05-23 Cary Coutant <ccoutant@google.com>
1093
1094 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1095 more carefully.
1096
1097 2012-05-22 Cary Coutant <ccoutant@google.com>
1098
1099 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1100 object before exporting symbol.
1101
1102 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1103
1104 * testsuite/tls_test.cc: Include "config.h" first.
1105 * testsuite/tls_test_c.c: Likewise.
1106
1107 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1108 Nick Clifton <nickc@redhat.com>
1109
1110 PR 14072
1111 * configure.in: Add check that sysdep.h has been included before
1112 any system header files.
1113 * configure: Regenerate.
1114 * config.in: Regenerate.
1115
1116 2012-05-14 Cary Coutant <ccoutant@google.com>
1117
1118 * layout.cc (Layout::make_output_section): Mark .tdata section
1119 as RELRO.
1120 * testsuite/relro_test.cc: Add a TLS variable.
1121
1122 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1123
1124 PR gold/14091
1125 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1126 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1127 R_X86_64_64.
1128
1129 2012-05-08 Cary Coutant <ccoutant@google.com>
1130
1131 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1132 (lines_only_debug_sections): Likewise.
1133
1134 2012-05-02 Roland McGrath <mcgrathr@google.com>
1135
1136 * nacl.cc: New file.
1137 * nacl.h: New file.
1138 * Makefile.am (CCFILES, HFILES): Add them.
1139 * Makefile.in: Regenerate.
1140 * i386.cc (Output_data_plt_i386_nacl): New class.
1141 (Output_data_plt_i386_nacl_exec): New class.
1142 (Output_data_plt_i386_nacl_dyn): New class.
1143 (Target_i386_nacl): New class.
1144 (Target_selector_i386_nacl): New class.
1145 (target_selector_i386): Use it instead of Target_selector_i386.
1146 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1147 (Target_x86_64_nacl): New class.
1148 (Target_selector_x86_64_nacl): New class.
1149 (target_selector_x86_64, target_selector_x32): Use it instead of
1150 Target_selector_x86_64.
1151 * arm.cc (Output_data_plt_arm_nacl): New class.
1152 (Target_arm_nacl): New class.
1153 (Target_selector_arm_nacl): New class.
1154 (target_selector_arm, target_selector_armbe): Use it instead of
1155 Target_selector_arm.
1156
1157 * target-select.cc (select_target): Take new Input_file* and off_t
1158 arguments, pass them on to recognize method of selector.
1159 * object.cc (make_elf_sized_object): Update caller.
1160 * parameters.cc (parameters_force_valid_target): Likewise.
1161 * incremental.cc (make_sized_incremental_binary): Likewise.
1162 * target-select.h: Update decl.
1163 (Target_selector::recognize): Take new Input_file* argument,
1164 pass it on to do_recognize.
1165 (Target_selector::do_recognize): Take new Input_file* argument.
1166 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1167 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1168 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1169 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1170
1171 * target.h (Target::Target_info): New members isolate_execinstr
1172 and rosegment_gap.
1173 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1174 * arm.cc (Target_arm::arm_info): Update initializer.
1175 * i386.cc (Target_i386::i386_info): Likewise.
1176 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1177 * sparc.cc (Target_sparc::sparc_info): Likewise.
1178 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1179 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1180 * layout.cc (Layout::attach_allocated_section_to_segment):
1181 Take new const Target* argument. If target->isolate_execinstr(), act
1182 like --rosegment.
1183 (Layout::find_first_load_seg): Take new const Target* argument;
1184 if target->isolate_execinstr(), reject PF_X segments.
1185 (Layout::relaxation_loop_body): Update caller.
1186 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1187 reset file offset to zero when we hit LOAD_SEG, and then do a second
1188 loop over the segments before LOAD_SEG to reassign offsets after
1189 addresses have been determined. Handle target->rosegment_gap().
1190 (Layout::attach_section_to_segment): Take new const Target* argument;
1191 pass it to attach_allocated_section_to_segment.
1192 (Layout::make_output_section): Update caller.
1193 (Layout::attach_sections_to_segments): Take new const Target* argument;
1194 pass it to attach_section_to_segment.
1195 * gold.cc (queue_middle_tasks): Update caller.
1196 * layout.h (Layout): Update method decls with new arguments.
1197
1198 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1199 Target_info pointer to use.
1200 (Target_arm::do_make_data_plt): New virtual method.
1201 (Target_arm::make_data_plt): New method that calls it.
1202 (Target_arm::make_plt_entry): Use it.
1203 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1204 for the section alignment.
1205 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1206 method.
1207 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1208 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1209 method.
1210 (Output_data_plt_arm::get_plt_entry_size): Call it.
1211 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1212 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1213 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1214 method.
1215 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1216 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1217 method instead of sizeof(plt_entry).
1218 (Output_data_plt_arm::add_entry): Likewise.
1219 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1220 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1221 than static method.
1222 (Target_arm::plt_entry_size): Likewise.
1223 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1224 Move to ...
1225 (Output_data_plt_arm_standard): ... here, new class.
1226 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1227 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1228 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1229
1230 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1231 Take additional argument for the PLT entry size.
1232 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1233 Use get_plt_entry_size method rather than plt_entry_size variable.
1234 (Output_data_plt_x86_64::reserve_slot): Likewise.
1235 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1236 (Output_data_plt_x86_64::add_entry): Likewise.
1237 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1238 (Output_data_plt_x86_64::address_for_global): Likewise.
1239 (Output_data_plt_x86_64::address_for_local): Likewise.
1240 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1241 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1242 Make method non-static.
1243 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1244 method.
1245 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1246 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1247 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1248 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1249 virtual method.
1250 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1251 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1252 virtual method.
1253 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1254 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1255 virtual method.
1256 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1257 (Output_data_plt_x86_64::plt_entry_size)
1258 (Output_data_plt_x86_64::first_plt_entry)
1259 (Output_data_plt_x86_64::plt_entry)
1260 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1261 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1262 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1263 (Output_data_plt_x86_64_standard): ... here, new class.
1264 (Target_x86_64::Target_x86_64): Take optional argument for the
1265 Target_info pointer to use.
1266 (Target_x86_64::do_make_data_plt): New virtual method.
1267 (Target_x86_64::make_data_plt): New method to call it.
1268 (Target_x86_64::init_got_plt_for_update): Use that.
1269 Call this->plt_->add_eh_frame method here.
1270 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1271 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1272 rather than static method.
1273 (Target_x86_64::plt_entry_size): Likewise.
1274 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1275 rather than plt_entry_size variable. Move guts of PLT filling to...
1276 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1277 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1278 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1279
1280 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1281 additional argument for the section alignment.
1282 Don't do add_eh_frame_for_plt here.
1283 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1284 non-static. Use get_plt_entry_size method rather than plt_entry_size
1285 variable.
1286 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1287 method.
1288 (Output_data_plt_i386::get_plt_entry_size): Call it.
1289 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1290 (Output_data_plt_i386::add_eh_frame): New method to call it.
1291 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1292 method.
1293 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1294 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1295 method.
1296 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1297 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1298 method instead of plt_entry_size.
1299 (Output_data_plt_i386::plt_entry_size)
1300 (Output_data_plt_i386::plt_eh_frame_fde_size)
1301 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1302 (Output_data_plt_i386_standard): ... here, new class.
1303 (Output_data_plt_i386_exec): New class.
1304 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1305 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1306 (Output_data_plt_i386::exec_plt_entry): Move to ...
1307 (Output_data_plt_i386_exec::plt_entry): ... here.
1308 (Output_data_plt_i386_dyn): New class.
1309 (Output_data_plt_i386::first_plt_entry): Move to ...
1310 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1311 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1312 (Output_data_plt_i386_dyn::plt_entry): ... here.
1313 (Target_i386::Target_i386): Take optional argument for the Target_info
1314 pointer to use.
1315 (Target_i386::do_make_data_plt): New virtual method.
1316 (Target_i386::make_data_plt): New method to call it.
1317 (Target_i386::make_plt_section): Use that.
1318 Call this->plt_->add_eh_frame method here.
1319 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1320 rather than plt_entry_size variable.
1321 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1322 (Output_data_plt_i386::address_for_local): Likewise.
1323 (Output_data_plt_i386::do_write): Likewise.
1324 Move guts of PLT filling to...
1325 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1326 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1327 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1328 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1329
1330 2012-05-01 Cary Coutant <ccoutant@google.com>
1331
1332 * dwarf_reader.cc (Dwarf_die::read_attributes)
1333 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1334 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1335 * reduced_debug_output.cc
1336 (Output_reduced_debug_info_section::get_die_end): Remove
1337 DW_FORM_GNU_ref_index. Add default case.
1338
1339 2012-04-26 Mark Wielaard <mjw@redhat.com>
1340
1341 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1342 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1343 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1344 DW_AT_high_pc as offset from DW_AT_low_pc.
1345
1346 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1347 * testsuite/Makefile.in: Regenerate.
1348 * testsuite/gdb_index_test_3.c: New test source file.
1349 * testsuite/gdb_index_test_3.sh: New test source file.
1350
1351 2012-04-25 Ian Lance Taylor <iant@google.com>
1352
1353 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1354 pointer.
1355 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1356 as a class, not a struct.
1357 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1358 (Target_arm::apply_cortex_a8_workaround): Likewise.
1359 * gc.h: Declare Reloc_types as a struct, not a class.
1360 * object.h: Declare Symbols_data as a struct.
1361 * reloc.h: Declare Read_relocs_data as a struct.
1362 * target.h: Declare Relocate_info as a struct.
1363
1364 2012-04-24 David S. Miller <davem@davemloft.net>
1365
1366 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1367 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1368 and R_SPARC_WPLT30.
1369
1370 2012-04-24 Cary Coutant <ccoutant@google.com>
1371
1372 * incremental-dump.cc (find_input_containing_global): Replace
1373 magic number with symbolic constant.
1374 (dump_incremental_inputs): Update version number.
1375 * incremental.cc (Output_section_incremental_inputs): Update version
1376 number; import symbolic constants from Incremental_inputs_reader.
1377 (Incremental_inputs::create_data_sections): Align relocations
1378 section correctly for 64-bit targets.
1379 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1380 constants; add padding.
1381 (Output_section_incremental_inputs::write_header): Add assert for
1382 header_size.
1383 (Output_section_incremental_inputs::write_input_files): Add assert
1384 for input_entry_size.
1385 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1386 add assert for object_info_size, input_section_entry_size,
1387 global_sym_entry_size.
1388 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1389 for data structure sizes; use them.
1390 (Incremental_input_entry_reader): Import symbolic constants from
1391 Incremental_inputs_reader; use them.
1392
1393 2012-04-23 David S. Miller <davem@davemloft.net>
1394
1395 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1396 and elf_flags_set_.
1397 (Target_sparc::Target_sparc): Initialize new fields.
1398 (Target_sparc::do_make_elf_object): New function.
1399 (Target_sparc::do_adjust_elf_header): New function.
1400
1401 2012-04-23 Cary Coutant <ccoutant@google.com>
1402
1403 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1404 CU range table of gdb index.
1405
1406 2012-04-20 David S. Miller <davem@davemloft.net>
1407
1408 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1409 instead of false.
1410
1411 2012-04-16 David S. Miller <davem@davemloft.net>
1412
1413 * sparc.cc (Target_sparc::got_address): New function.
1414 (Sparc_relocate_functions::gdop_hix22): New function.
1415 (Sparc_relocate_functions::gdop_lox10): New function.
1416 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1417 relocs.
1418 (Target_sparc::Scan::local): Likewise if the global symbol is not
1419 preemptible and is not IFUNC.
1420 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1421 transformations for local and non-preemptible non-IFUNC global
1422 symbols.
1423
1424 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1425 writing out 64-bit part of ranges.
1426
1427 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1428 -fpic and -fpie respectively.
1429 * Makefile.in: Regenerate.
1430
1431 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1432 (Target_sparc::Target_sparc): Initialize new field.
1433 (Target_sparc::do_plt_section_for_global): New function.
1434 (Target_sparc::do_plt_section_for_local): New function.
1435 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1436 (Target_sparc::make_plt_section): New function, broken out of
1437 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1438 (Target_sparc::make_plt_entry): Call make_plt_section.
1439 (Target_sparc::make_local_ifunc_plt_entry): New function.
1440 (Target_sparc::rela_ifunc_section): New function.
1441 (Target_sparc::plt_section): Remove const.
1442 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1443 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1444 and ifunc_count_ fields.
1445 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1446 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1447 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1448 (Output_data_plt_sparc::rela_ifunc): New function.
1449 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1450 (Output_data_plt_sparc::has_ifunc_section): New function.
1451 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1452 (Output_data_plt_sparc::address_for_global): New function.
1453 (Output_data_plt_sparc::address_for_local): New function.
1454 (Output_data_plt_sparc::plt_index_to_offset): New function.
1455 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1456 and entry_count.
1457 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1458 entry_count.
1459 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1460 R_SPARC_JMP_IREL to switch.
1461 (Target_sparc::Scan::check_non_pic): Likewise.
1462 (Target_sparc::Scan::local): Handle IFUNC symbols.
1463 (Target_sparc::Scan::local): Likewise.
1464 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1465 and plt_address_for_local.
1466 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1467 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1468
1469 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1470 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1471 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1472 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1473 global relocs too.
1474 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1475 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1476 calls.
1477 * sparc.cc (Target_sparc::Scan::global): Likewise.
1478 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1479
1480 2012-04-16 Cary Coutant <ccoutant@google.com>
1481
1482 * archive.cc (Library_base::should_include_member): Check for
1483 --export-dynamic-symbol.
1484 * options.h (class General_options): Add --export-dynamic-symbol.
1485 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1486 --export-dynamic-symbol.
1487 (Symbol_table::gc_mark_undef_symbols): Likewise.
1488 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1489
1490 2012-04-12 David S. Miller <davem@davemloft.net>
1491
1492 * sparc.cc (Reloc::wdisp10): New relocation method.
1493 (Reloc::h34): Likewise.
1494 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1495 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1496 R_SPARC_WDISP10.
1497 (Target_sparc::Scan::local): Likewise.
1498 (Target_sparc::Scan::global): Likewise.
1499 (Target_sparc::Relocate::relocate): Likewise.
1500
1501 2012-04-09 Cary Coutant <ccoutant@google.com>
1502
1503 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1504 low_pc == 0.
1505
1506 2012-04-06 Ian Lance Taylor <iant@google.com>
1507
1508 * timer.cc: #include <unistd.h>.
1509
1510 2012-04-06 Roland McGrath <mcgrathr@google.com>
1511
1512 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1513 * config.in: Regenerate.
1514 * configure: Regenerate.
1515
1516 2012-04-05 Nick Clifton <nickc@redhat.com>
1517
1518 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1519 (AM_LC_MESSAGES): Add.
1520 * aclocal.m4: Regenerate.
1521 * config.in: Regenerate.
1522 * configure: Regenerate.
1523
1524 2012-03-21 Cary Coutant <ccoutant@google.com>
1525
1526 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1527 * Makefile.in: Regenerate.
1528 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1529 (Sized_elf_reloc_mapper::symbol_section): New function.
1530 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1531 (make_elf_reloc_mapper): New function.
1532 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1533 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1534 (Dwarf_abbrev_table::do_get_abbrev): New function.
1535 (Dwarf_ranges_table::read_ranges_table): New function.
1536 (Dwarf_ranges_table::read_range_list): New function.
1537 (Dwarf_pubnames_table::read_section): New function.
1538 (Dwarf_pubnames_table::read_header): New function.
1539 (Dwarf_pubnames_table::next_name): New function.
1540 (Dwarf_die::Dwarf_die): New function.
1541 (Dwarf_die::read_attributes): New function.
1542 (Dwarf_die::skip_attributes): New function.
1543 (Dwarf_die::set_name): New function.
1544 (Dwarf_die::set_linkage_name): New function.
1545 (Dwarf_die::attribute): New function.
1546 (Dwarf_die::string_attribute): New function.
1547 (Dwarf_die::int_attribute): New function.
1548 (Dwarf_die::uint_attribute): New function.
1549 (Dwarf_die::ref_attribute): New function.
1550 (Dwarf_die::child_offset): New function.
1551 (Dwarf_die::sibling_offset): New function.
1552 (Dwarf_info_reader::check_buffer): New function.
1553 (Dwarf_info_reader::parse): New function.
1554 (Dwarf_info_reader::do_parse): New function.
1555 (Dwarf_info_reader::do_read_string_table): New function.
1556 (Dwarf_info_reader::lookup_reloc): New function.
1557 (Dwarf_info_reader::get_string): New function.
1558 (Dwarf_info_reader::visit_compilation_unit): New function.
1559 (Dwarf_info_reader::visit_type_unit): New function.
1560 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1561 Sized_elf_reloc_mapper.
1562 (Sized_dwarf_line_info::symbol_section): Remove function.
1563 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1564 (Sized_dwarf_line_info::read_line_mappings): Remove object
1565 parameter, adjust callers.
1566 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1567 * dwarf_reader.h: Include <sys/types.h>.
1568 (class Track_relocs): Remove forward declaration.
1569 (class Elf_reloc_mapper): New class.
1570 (class Sized_elf_reloc_mapper): New class.
1571 (class Dwarf_abbrev_table): New class.
1572 (class Dwarf_range_list): New class.
1573 (class Dwarf_ranges_table): New class.
1574 (class Dwarf_pubnames_table): New class.
1575 (class Dwarf_die): New class.
1576 (class Dwarf_info_reader): New class.
1577 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1578 (Sized_dwarf_line_info::symbol_section): Remove member function.
1579 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1580 base class.
1581 * gdb-index.cc: New source file.
1582 * gdb-index.h: New source file.
1583 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1584 and .debug_types sections, call Layout::add_to_gdb_index.
1585 (Sized_relobj_incr::do_section_name): Implement.
1586 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1587 return type; Implement.
1588 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1589 return type.
1590 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1591 parameter list and return type.
1592 (Sized_incr_dynobj::do_section_contents): Likewise.
1593 * layout.cc: Include gdb-index.h.
1594 (Layout::Layout): Initialize gdb_index_data_.
1595 (Layout::init_fixed_output_section): Check for .gdb_index section.
1596 (Layout::add_to_gdb_index): New function. Instantiate.
1597 * layout.h: Add forward declaration for class Gdb_index.
1598 (Layout::add_to_gdb_index): New member function.
1599 (Layout::gdb_index_data_): New data member.
1600 * main.cc: Include gdb-index.h.
1601 (main): Print statistics for gdb index.
1602 * object.cc (Object::section_contents): Move code into
1603 do_section_contents.
1604 (need_decompressed_section): Check for sections needed when building
1605 gdb index.
1606 (build_compressed_section_map): Likewise.
1607 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1608 gdb index.
1609 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1610 sections; call Layout::add_to_gdb_index.
1611 (Sized_relobj_file::do_decompressed_section_contents): Call
1612 do_section_contents directly.
1613 * object.h (Object::do_section_contents): Adjust parameter list and
1614 return type.
1615 (Object::do_decompressed_section_contents): Call do_section_contents
1616 directly.
1617 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1618 return type.
1619 * options.h (class General_options): Add --gdb-index option.
1620 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1621 list and return type.
1622 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1623 * reloc.h (Track_relocs::checkpoint): New function.
1624 (Track_relocs::reset): New function.
1625
1626 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1627 New test cases.
1628 * testsuite/Makefile.in: Regenerate.
1629 * testsuite/gdb_index_test.cc: New test source file.
1630 * testsuite/gdb_index_test_1.sh: New test source file.
1631 * testsuite/gdb_index_test_2.sh: New test source file.
1632
1633 2012-03-19 Doug Kwan <dougkwan@google.com>
1634
1635 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1636 (Target_arm::do_finalize_sections): Remove code which defines
1637 __exidx_start and __exidx_end. Make symbol table parameter
1638 anonymous as it is not used.
1639 * gold.cc (queue_middle_tasks): Call target hook to define any
1640 target-specific symbols.
1641 * target.h (Target::define_standard_symbols): New method.
1642 (Target::do_define_standard_symbols): Same.
1643 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1644 * testsuite/Makefile.in: Regenerate.
1645 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1646 and __exidx_end.
1647 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1648 relocations are generated for __exidx_start and __exidx_end.
1649
1650 2012-03-16 Doug Kwan <dougkwan@google.com>
1651
1652 * testsuite/Makefile.am: Disable test initpri3b.
1653 * testsuite/Makefile.in: Regenerate.
1654
1655 2012-03-15 Doug Kwan <dougkwan@google.com>
1656
1657 * arm.cc (Target_arm::got_section): Make .got section read-only
1658 if -z now is given.
1659
1660 2012-03-15 Ian Lance Taylor <iant@google.com>
1661
1662 PR gold/13850
1663 * layout.cc (Layout::make_output_section): Correctly mark
1664 SHT_INIT_ARRAY, et. al., as relro.
1665
1666 2012-03-14 Doug Kwan <dougkwan@google.com>
1667
1668 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1669 dynamic relocations for protected symbols in shared objects.
1670
1671 2012-03-13 Ian Lance Taylor <iant@google.com>
1672
1673 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1674 keep the larger alignment.
1675
1676 2012-03-12 Cary Coutant <ccoutant@google.com>
1677
1678 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1679 handling of DW_LNE_define_file.
1680
1681 2012-03-12 Cary Coutant <ccoutant@google.com>
1682
1683 * reduced_debug_output.cc
1684 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1685 codes to switch.
1686
1687 2012-02-29 Cary Coutant <ccoutant@google.com>
1688
1689 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1690
1691 2012-02-29 Cary Coutant <ccoutant@google.com>
1692
1693 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1694 Call Object::decompressed_section_contents.
1695 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1696 New dtor.
1697 (Sized_dwarf_line_info::buffer_start_): New data member.
1698 * merge.cc (Output_merge_data::do_add_input_section): Call
1699 Object::decompressed_section_contents.
1700 (Output_merge_string::do_add_input_section): Likewise.
1701 * object.cc (need_decompressed_section): New function.
1702 (build_compressed_section_map): Decompress sections needed later.
1703 (Sized_relobj_file::do_decompressed_section_contents): New function.
1704 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1705 * object.h (Object::decompressed_section_contents): New function.
1706 (Object::discard_decompressed_sections): New function.
1707 (Object::do_decompressed_section_contents): New function.
1708 (Object::do_discard_decompressed_sections): New function.
1709 (Compressed_section_info): New type.
1710 (Compressed_section_map): Include decompressed section contents.
1711 (Sized_relobj_file::do_decompressed_section_contents): New function.
1712 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1713
1714 2012-02-16 Cary Coutant <ccoutant@google.com>
1715
1716 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1717 * testsuite/Makefile.in: Regenerate.
1718
1719 2012-02-14 Cary Coutant <ccoutant@google.com>
1720
1721 * options.cc (General_options::finalize): Disallow -pie and -static.
1722
1723 2012-02-03 Doug Kwan <dougkwan@google.com>
1724
1725 * arm.cc (Arm_relocate_functions::abs8,
1726 Arm_relocate_functions::abs16): Use
1727 Bits::has_signed_unsigned_overflow32.
1728 (Arm_relocate_functions::thm_abs8): Correct range of
1729 overflow check.
1730 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1731 in assertions.
1732
1733 2012-02-02 Doug Kwan <dougkwan@google.com>
1734
1735 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1736 position independent outputs, not just shared objects.
1737
1738 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1739
1740 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1741 * configure: Regenerated.
1742
1743 2012-01-27 Ian Lance Taylor <iant@google.com>
1744
1745 * reloc.h (Bits): New class with static functions, copied from
1746 namespace utils in arm.cc.
1747 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1748 instead.
1749
1750 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1751
1752 * incremental.cc (write_info_blocks): Correct relocation offset.
1753
1754 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1755
1756 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1757 (Relocate::tls_gd_to_le): Likewise.
1758
1759 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1760
1761 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1762
1763 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1764
1765 * configure.ac: Check if -mcmodel=medium works.
1766 * configure: Regenerated.
1767
1768 2012-01-24 Cary Coutant <ccoutant@google.com>
1769
1770 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1771 definition and ...
1772 (read_unsigned_LEB_128_x): ... this new function.
1773 (read_signed_LEB_128): Replaced with inline definition and ...
1774 (read_signed_LEB_128_x): ... this new function.
1775 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1776 (read_unsigned_LEB_128): Add inline definition.
1777 (read_signed_LEB_128_x): New function.
1778 (read_signed_LEB_128): Add inline definition.
1779 * testsuite/Makefile.am (leb128_unittest): New unit test.
1780 * testsuite/Makefile.in: Regenerate.
1781 * testsuite/leb128_unittest.cc: New unit test.
1782
1783 2012-01-23 Ian Lance Taylor <iant@google.com>
1784
1785 PR gold/13617
1786 * i386.cc (Target_i386::do_code_fill): When using a jmp
1787 instruction, pad with nop instructions.
1788 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1789
1790 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1791
1792 * x86_64.cc (gc_process_relocs): Add typename on types used in
1793 template.
1794 (scan_relocs): Likewise.
1795 (relocate_section): Likewise.
1796 (apply_relocation): Likewise.
1797
1798 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1799
1800 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1801 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1802 under x32.
1803
1804 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1805
1806 * x86_64.cc: Initial support for x32.
1807
1808 2012-01-03 Cary Coutant <ccoutant@google.com>
1809
1810 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1811 Use abstract base class for GOT.
1812 * gold/output.h (class Output_data_got_base): New abstract base class.
1813 (class Output_data_got): Derive from new base class, adjust ctors.
1814 (Output_data_got::reserve_slot): Make virtual; rename to
1815 do_reserve_slot; Adjust callers.
1816 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1817 pointer to abstract base class.
1818 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1819
1820 2011-12-18 Ian Lance Taylor <iant@google.com>
1821
1822 * object.h (Relobj::local_symbol_value): New function.
1823 (Relobj::local_plt_offset): New function.
1824 (Relobj::local_has_got_offset): New function.
1825 (Relobj::local_got_offset): New function.
1826 (Relobj::set_local_got_offset): New function.
1827 (Relobj::do_local_symbol_value): New pure virtual function.
1828 (Relobj::do_local_plt_offset): Likewise.
1829 (Relobj::do_local_has_got_offset): Likewise.
1830 (Relobj::do_local_got_offset): Likewise.
1831 (Relobj::do_set_local_got_offset): Likewise.
1832 (Sized_relobj::do_local_has_got_offset): Rename from
1833 local_has_got_offset.
1834 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1835 (Sized_relobj::do_set_local_got_offset): Rename from
1836 set_local_got_offset.
1837 (Sized_relobj_file::do_local_plt_offset): Rename from
1838 local_plt_offset.
1839 (Sized_relobj_file::do_local_symbol_value): New function.
1840 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1841 local_plt_offset.
1842 * output.cc (Output_data_got::Got_entry::write): Change object to
1843 Relobj. Use local_symbol_value.
1844 (Output_data_got::add_global_with_rel): Change rel_dyn to
1845 Output_data_reloc_generic*. Use add_global_generic.
1846 (Output_data_got::add_global_with_rela): Remove. Change all
1847 callers to use add_global_with_rel.
1848 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1849 Output_data_reloc_generic*. Use add_global_generic.
1850 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1851 callers to use add_global_pair_with_rel.
1852 (Output_data_got::add_local): Change object to Relobj*.
1853 (Output_data_got::add_local_plt): Likewise.
1854 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1855 change rel_dyn to Output_data_reloc_generic*. Use
1856 add_local_generic.
1857 (Output_data_got::add_local_with_rela): Remove. Change all
1858 callers to use all_local_with_rel.
1859 (Output_data_got::add_local_pair_with_rel): Change object to
1860 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1861 add_output_section_generic.
1862 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1863 callers to use add_local_pair_with_rel.
1864 (Output_data_got::reserve_local): Change object to Relobj*.
1865 * output.h: (class Output_data_reloc_generic): Add pure virtual
1866 declarations for add_global_generic, add_local_generic,
1867 add_output_section_generic.
1868 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1869 functions for Output_data_reloc_generic. Update declarations for
1870 changes listed in output.cc.
1871 (class Output_data_got): Change template parameter to got_size.
1872 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1873 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1874 function.
1875 (Sized_relobj_incr::do_local_plt_offset): New function.
1876 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1877 add_global_generic.
1878
1879 2011-12-17 Cary Coutant <ccoutant@google.com>
1880
1881 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1882 * resolve.cc (Symbol_table::resolve): Likewise.
1883 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1884 arrays.
1885 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1886
1887 2011-12-16 Ian Lance Taylor <iant@google.com>
1888
1889 * output.h (Output_data_reloc_generic::add): Only call
1890 add_dynamic_reloc if this is a dynamic reloc section.
1891
1892 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1893
1894 PR gold/13505
1895 * target-reloc.h (apply_relocation): Replace <64, false> with
1896 <size, big_endian>.
1897
1898 2011-11-25 Nick Clifton <nickc@redhat.com>
1899
1900 * po/it.po: New Italian translation.
1901
1902 2011-11-17 Sterling Augustine <saugustine@google.com>
1903
1904 * script.cc (script_include_directive): Implement.
1905 (read_script_file): New local variables name and search_path. Update
1906 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1907 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1908 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1909
1910 2011-11-11 Sterling Augustine <saugustine@google.com>
1911
1912 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1913 (file_or_sections_cmd): Likewise.
1914
1915 2011-11-11 Doug Kwan <dougkwan@google.com>
1916
1917 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1918 if --just-symbols is given.
1919
1920 2011-11-10 Doug Kwan <dougkwan@google.com>
1921
1922 PR gold/13362
1923 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1924 when processing data relocs.
1925 * reloc.h (Relocate_functions::rel_unaligned): New method.
1926 (Relocate_functions::pcrel_unaligned): Ditto.
1927 (Relocate_functions::rel32_unaligned): Ditto.
1928 (Relocate_functions::pcrel32_unaligned): Ditto.
1929
1930 2011-11-09 Doug Kwan <dougkwan@google.com>
1931
1932 PR gold/13362
1933 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1934 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1935 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1936 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1937 (Relocate_functions::rel_unaligned): New.
1938 (Relocate_functions::rel32_unaligned): New.
1939 * target-reloc.h (relocate_for_relocatable): Add code to handle
1940 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1941 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1942 arm_unaligned_reloc_r): New targets.
1943 * testsuite/Makefile.in: Regenerate.
1944 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1945 linking.
1946
1947 2011-11-02 Ian Lance Taylor <iant@google.com>
1948
1949 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1950 NATIVE_LINKER.
1951 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1952 * options.cc (General_options::finalize): Use library search path
1953 from configure script if specified. If not native and no sysroot,
1954 only search TOOLLIBDIR.
1955 * options.h (Search_directory::Search_directory): Change name to
1956 const std::string&.
1957 (General_options::add_to_library_path_with_sysroot): Change arg to
1958 const std::string&.
1959 * configure, Makefile.in, config.in: Rebuild.
1960
1961 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1962
1963 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1964 we are working around the ARM1176 Erratum.
1965 * options.h (General_options::fix_arm1176): Add option.
1966 * testsuite/Makefile.am: Add testcases, and keep current ones
1967 working.
1968 * testsuite/Makefile.in: Regenerate.
1969 * testsuite/arm_fix_1176.s: New file.
1970 * testsuite/arm_fix_1176.sh: Likewise.
1971
1972 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1973
1974 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1975 may_use_blx_.
1976 (Target_arm::may_use_blx): Remove method.
1977 (Target_arm::set_may_use_blx): Likewise.
1978 (Target_arm::may_use_v4t_interworking): New method.
1979 (Target_arm::may_use_v5t_interworking): Likewise.
1980 (Target_arm::may_use_blx_): Remove member variable.
1981 (Arm_relocate_functions::arm_branch_common): Check for v5T
1982 interworking.
1983 (Arm_relocate_functions::thumb_branch_common): Likewise.
1984 (Reloc_stub::stub_type_for_reloc): Likewise.
1985 (Target_arm::do_finalize_sections): Correct interworking checks.
1986 * testsuite/Makefile.am: Add new tests.
1987 * testsuite/Makefile.in: Regenerate.
1988 * testsuite/arm_farcall_arm_arm.s: New test.
1989 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1990 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1991 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1992 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1993 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1994 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1995 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1996
1997 2011-10-31 Cary Coutant <ccoutant@google.com>
1998
1999 PR gold/13023
2000 * expression.cc (Expression::eval_with_dot): Add
2001 is_section_dot_assignment parameter.
2002 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2003 absolute and assigning to dot within a section.
2004 * script-sections.cc
2005 (Output_section_element_assignment::set_section_addresses): Pass
2006 dot_section to set_if_absolute.
2007 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2008 as is_section_dot_assignment flag to eval_with_dot.
2009 (Output_section_element_dot_assignment::set_section_addresses):
2010 Likewise.
2011 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2012 parameter. Also set value if relative to dot_section; set the
2013 symbol's output_section.
2014 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2015 parameter. Adjust all callers.
2016 (Expression::eval_maybe_dot): Likewise.
2017 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2018 Adjust all callers.
2019 * testsuite/script_test_2.t: Test assignment of an absolute value
2020 to dot within an output section element.
2021
2022 2011-10-31 Cary Coutant <ccoutant@google.com>
2023
2024 * options.h (class General_options): Add --[no-]gnu-unique options.
2025 * symtab.cc (Symbol_table::sized_write_globals): Convert
2026 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2027
2028 2011-10-31 Cary Coutant <ccoutant@google.com>
2029
2030 PR gold/13359
2031 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2032 unnecessary assertion.
2033 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2034
2035 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2036
2037 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2038 gc_mark_symbol.
2039 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2040 gc_mark_symbol.
2041 Change to just keep the section associated with symbol.
2042 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2043 they are externally visible and --export-dynamic is turned on.
2044 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2045
2046 2011-10-19 Ian Lance Taylor <iant@google.com>
2047
2048 PR gold/13163
2049 * script-sections.cc
2050 (Output_section_element_dot_assignment::needs_output_section): New
2051 function.
2052
2053 2011-10-19 Ian Lance Taylor <iant@google.com>
2054
2055 PR gold/13204
2056 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2057 --section-start option was seen.
2058 * options.h (General_options::any_section_start): New function.
2059
2060 2011-10-18 David S. Miller <davem@davemloft.net>
2061
2062 PR binutils/13301
2063 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2064 member to track relocation locations that have moved during TLS
2065 reloc optimizations.
2066 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2067 (Target_sparc::Relocate::relocate): Adjust view down by 4
2068 bytes if it matches reloc_adjust_addr_.
2069 (Target_sparc::Relocate::relocate_tls): Always move the
2070 __tls_get_addr call delay slot instruction forward 4 bytes when
2071 performing relaxation.
2072
2073 2011-10-18 Cary Coutant <ccoutant@google.com>
2074
2075 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2076 (Output_file::map_no_anonymous): Check for non-zero
2077 return code from posix_fallocate.
2078
2079 2011-10-17 Cary Coutant <ccoutant@google.com>
2080
2081 PR gold/13245
2082 * plugin.cc (is_visible_from_outside): Check for symbols
2083 referenced from dynamic objects.
2084 * resolve.cc (Symbol_table::resolve): Don't count references
2085 from dynamic objects as references from real ELF files.
2086 * testsuite/plugin_test_2.sh: Adjust expected result.
2087
2088 2011-10-17 Cary Coutant <ccoutant@google.com>
2089
2090 * gold.cc: Include timer.h.
2091 (queue_middle_tasks): Stamp time.
2092 (queue_final_tasks): Likewise.
2093 * main.cc (main): Store timer in parameters. Print timers
2094 for each pass.
2095 * parameters.cc (Parameters::Parameters): Initialize timer_.
2096 (Parameters::set_timer): New function.
2097 (set_parameters_timer): New function.
2098 * parameters.h (Parameters::set_timer): New function.
2099 (Parameters::timer): New function.
2100 (Parameters::timer_): New data member.
2101 (set_parameters_timer): New function.
2102 * timer.cc (Timer::stamp): New function.
2103 (Timer::get_pass_time): New function.
2104 * timer.h (Timer::stamp): New function.
2105 (Timer::get_pass_time): New function.
2106 (Timer::pass_times_): New data member.
2107
2108 2011-10-17 Cary Coutant <ccoutant@google.com>
2109
2110 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2111 task for members of lib groups.
2112
2113 2011-10-17 Cary Coutant <ccoutant@google.com>
2114
2115 PR gold/13288
2116 * fileread.cc (File_read::find_view): Add assert.
2117 (File_read::make_view): Move bounds check (replace with assert)...
2118 (File_read::find_or_make_view): ... to here.
2119
2120 2011-10-12 Cary Coutant <ccoutant@google.com>
2121
2122 * output.cc (Output_file::open_base_file): Handle case where
2123 ::read returns less than requested size.
2124
2125 2011-10-10 Cary Coutant <ccoutant@google.com>
2126
2127 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2128 Initialize defined_count_.
2129 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2130 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2131 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2132 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2133 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2134 * incremental.h (Sized_relobj_incr::defined_count_): New data
2135 member.
2136 (Sized_incr_dynobj::defined_count_): New data member.
2137 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2138 Return zeroes instead of internal error.
2139
2140 2011-10-10 Cary Coutant <ccoutant@google.com>
2141
2142 PR gold/13249
2143 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2144 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2145 * output.h (class Output_reloc): Add use_plt_offset flag.
2146 (Output_reloc::type_): Adjust size of bit field.
2147 (Output_reloc::use_plt_offset_): New bit field.
2148 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2149 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2150 flag. Adjust all callers.
2151 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2152 creating RELATIVE relocations.
2153
2154 2011-10-10 Nick Clifton <nickc@redhat.com>
2155
2156 * po/es.po: Updated Spanish translation.
2157 * po/fi.po: Updated Finnish translation.
2158
2159 2011-10-03 Diego Novillo <dnovillo@google.com>
2160
2161 * options.cc (parse_uint): Fix dereference of RETVAL.
2162
2163 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2164
2165 * layout.h (section_order_map_): New member.
2166 (get_section_order_map): New member function.
2167 * output.cc (Output_section::add_input_section): Check for patterns
2168 only when --section-ordering-file is specified.
2169 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2170 output_sections have been formed.
2171 * layout.cc (Layout_Layout): Initialize section_order_map_.
2172 * plugin.cc (update_section_order): Store order in order_map. Do not
2173 update the order.
2174 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2175 * testsuite/Makefile.in: Regenerate.
2176 * testsuite/plugin_section_order.c: New file.
2177 * testsuite/plugin_final_layout.cc: New file.
2178 * testsuite/plugin_final_layout.sh: New file.
2179
2180 2011-09-29 Cary Coutant <ccoutant@google.com>
2181
2182 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2183 Check for NULL.
2184 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2185 symbols during incremental update.
2186 (Symbol_table::add_from_dynobj): Likewise.
2187
2188 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2189 Ian Lance Taylor <iant@google.com>
2190
2191 * symtab.cc (Symbol_table::define_special_symbol): Always
2192 canonicalize version string.
2193
2194 2011-09-26 Cary Coutant <ccoutant@google.com>
2195
2196 * gold.cc (queue_initial_tasks): Move option checks ...
2197 * options.cc (General_options::finalize): ... to here. Disable
2198 some options; make others fatal.
2199
2200 2011-09-26 Cary Coutant <ccoutant@google.com>
2201
2202 gcc PR lto/47247
2203 * plugin.cc (get_symbols_v2): New function.
2204 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2205 (is_referenced_from_outside): New function.
2206 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2207 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2208 (get_symbols): Pass version parameter.
2209 (get_symbols_v2): New function.
2210 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2211 parameter.
2212 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2213 (onload): Add LDPT_GET_SYMBOLS_V2.
2214 (all_symbols_read_hook): Use get_symbols_v2; check for
2215 LDPR_PREVAILING_DEF_IRONLY_EXP.
2216 * testsuite/plugin_test_3.sh: Update expected results.
2217
2218 2011-09-23 Simon Baldwin <simonb@google.com>
2219
2220 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2221 configuration options.
2222 * configure: Regenerate.
2223 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2224 * Makefile.in: Regenerate.
2225 * testsuite/Makefile.in: Regenerate.
2226
2227 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2228
2229 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2230
2231 2011-09-19 Cary Coutant <ccoutant@google.com>
2232
2233 * incremental.cc (can_incremental_update): Fix typo in comment.
2234 * incremental.h (can_incremental_update): Likewise.
2235
2236 2011-09-18 Cary Coutant <ccoutant@google.com>
2237
2238 * incremental.cc (can_incremental_update): New function.
2239 * incremental.h (can_incremental_update): New function.
2240 * layout.cc (Layout::init_fixed_output_section): Call it.
2241 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2242 * object.cc (Sized_relobj_file::do_layout): Call
2243 can_incremental_update.
2244
2245 2011-09-13 Cary Coutant <ccoutant@google.com>
2246
2247 * configure.ac: Check for glibc support for gnu_indirect_function
2248 support with static linking, setting automake conditional
2249 IFUNC_STATIC.
2250 * Makefile.in: Regenerate.
2251 * configure: Regenerate.
2252
2253 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2254 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2255 for IFUNC_STATIC.
2256 * testsuite/Makefile.in: Regenerate.
2257
2258 2011-09-13 Cary Coutant <ccoutant@google.com>
2259
2260 * incremental.cc (Sized_relobj_incr::do_layout): Call
2261 report_comdat_group for kept comdat sections.
2262 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2263 * testsuite/Makefile.in: Regenerate.
2264 * testsuite/incr_comdat_test_1.cc: New source file.
2265 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2266 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2267 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2268
2269 2011-09-13 Ian Lance Taylor <iant@google.com>
2270
2271 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2272 variable external_symbols_offset.
2273
2274 2011-09-12 Ian Lance Taylor <iant@google.com>
2275
2276 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2277 triggered if object has no symbols.
2278
2279 2011-09-09 David S. Miller <davem@davemloft.net>
2280
2281 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2282 (Output_fill_debug_line::do_write): Likewise.
2283
2284 2011-08-29 Cary Coutant <ccoutant@google.com>
2285
2286 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2287 casts to match formatting specs.
2288 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2289
2290 2011-08-26 Cary Coutant <ccoutant@google.com>
2291
2292 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2293 remaining hole size when allocating.
2294 (Layout::make_output_section): Set fill methods for debug sections.
2295 * layout.h (Free_list::Free_list_node): Move from private to
2296 public.
2297 (Free_list::set_min_hole_size): New function.
2298 (Free_list::begin, Free_list::end): New functions.
2299 (Free_list::min_hole_): New data member.
2300 * output.cc: Include dwarf.h.
2301 (Output_fill_debug_info::do_minimum_hole_size): New function.
2302 (Output_fill_debug_info::do_write): New function.
2303 (Output_fill_debug_line::do_minimum_hole_size): New function.
2304 (Output_fill_debug_line::do_write): New function.
2305 (Output_section::Output_section): Initialize new data member.
2306 (Output_section::set_final_data_size): Ensure patch space is larger
2307 than minimum hole size.
2308 (Output_section::do_write): Fill holes in debug sections.
2309 * output.h (Output_fill): New class.
2310 (Output_fill_debug_info): New class.
2311 (Output_fill_debug_line): New class.
2312 (Output_section::set_free_space_fill): New function.
2313 (Output_section::free_space_fill_): New data member.
2314 * testsuite/Makefile.am (incremental_test_3): Add
2315 --incremental-patch option.
2316 (incremental_test_4): Likewise.
2317 (incremental_test_5): Likewise.
2318 (incremental_test_6): Likewise.
2319 (incremental_copy_test): Likewise.
2320 (incremental_common_test_1): Likewise.
2321 * testsuite/Makefile.in: Regenerate.
2322
2323 2011-08-26 Nick Clifton <nickc@redhat.com>
2324
2325 * po/es.po: Updated Spanish translation.
2326
2327 2011-08-01 Cary Coutant <ccoutant@google.com>
2328
2329 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2330 * gold/testsuite/Makefile.in: Regenerate.
2331 * gold/testsuite/justsyms_exec.c: New source file.
2332 * gold/testsuite/justsyms_lib.c: New source file.
2333
2334 2011-08-01 Cary Coutant <ccoutant@google.com>
2335
2336 * layout.cc (Layout::set_segment_offsets): Don't realign text
2337 segment if -Ttext was specified.
2338 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2339 file type.
2340 * object.h (Sized_relobj_file::e_type): New function.
2341 (Sized_relobj_file::e_type_): New data member.
2342 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2343 base address for ET_EXEC files.
2344 * target.cc (Target::do_make_elf_object_implementation): Allow
2345 ET_EXEC files with --just-symbols option.
2346
2347 2011-07-28 Cary Coutant <ccoutant@google.com>
2348
2349 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2350 Add thread_number parameter.
2351 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2352 * workqueue-threads.cc
2353 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2354 current thread if its thread number is greater than desired thread
2355 count.
2356 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2357 Add thread_number parameter.
2358 (Workqueue::should_cancel_thread): Likewise.
2359 (Workqueue::find_runnable_or_wait): Pass thread_number to
2360 should_cancel_thread.
2361 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2362 parameter.
2363
2364 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2365
2366 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2367 only after checking if it cannot be forced local.
2368 * symtab.h (is_externally_visible): Check if the symbol is not forced
2369 local.
2370
2371 2011-07-15 Ian Lance Taylor <iant@google.com>
2372
2373 * options.h (class General_options): Add --print-output-format.
2374 Move -EL next to -EB, for better --help output.
2375 * target-select.cc: Include <cstdio>, "options.h", and
2376 "parameters.h".
2377 (Target_selector::do_target_bfd_name): New function.
2378 (print_output_format): New function.
2379 * target-select.h (class Target_selector): Update declarations.
2380 (Target_selector::target_bfd_name): New function.
2381 (print_output_format): Declare.
2382 * main.cc: Include "target-select.h".
2383 (main): Handle --print-output-format.
2384 * gold.cc: Include "target-select.h".
2385 (queue_initial_tasks): Handle --print-output-format when there are
2386 no input files.
2387 * parameters.cc (parameters_force_valid_target): Give a better
2388 error message if -EB/-EL does not match target.
2389 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2390 function.
2391
2392 2011-07-15 Ian Lance Taylor <iant@google.com>
2393
2394 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2395 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2396 (Output_data_plt_i386::do_write): Write address of .dynamic
2397 section to first entry in .got.plt section.
2398 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2399 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2400 Initialize layout_.
2401 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2402 section to first entry in .got.plt section.
2403 * layout.h (Layout::dynamic_section): New function.
2404
2405 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2406
2407 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2408 to claim_file call.
2409 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2410 input_section_position_, and input_section_glob_.
2411 (read_layout_from_file): Call function section_ordering_specified.
2412 * layout.h (is_section_ordering_specified): New function.
2413 (section_ordering_specified): New function.
2414 (section_ordering_specified_): New boolean member.
2415 * main.cc(main): Call load_plugins after layout object is defined.
2416 * output.cc (Output_section::add_input_section): Use
2417 function section_ordering_specified to check if section ordering is
2418 needed.
2419 * output.cc (Output_section::add_relaxed_input_section): Use
2420 function section_ordering_specified to check if section ordering is
2421 needed.
2422 (Output_section::update_section_layout): New function.
2423 (Output_section::sort_attached_input_sections): Check if input section
2424 must be reordered.
2425 * output.h (Output_section::update_section_layout): New function.
2426 * plugin.cc (get_section_count): New function.
2427 (get_section_type): New function.
2428 (get_section_name): New function.
2429 (get_section_contents): New function.
2430 (update_section_order): New function.
2431 (allow_section_ordering): New function.
2432 (Plugin::load): Add the new interfaces to the transfer vector.
2433 (Plugin_manager::load_plugins): New parameter.
2434 (Plugin_manager::all_symbols_read): New parameter.
2435 (Plugin_manager::claim_file): New parameter. Save the elf object for
2436 unclaimed objects.
2437 (Plugin_manager::get_elf_object): New function.
2438 (Plugin_manager::get_view): Change to directly use the bool to check
2439 if get_view is called from claim_file_hook.
2440 * plugin.h (input_objects): New function
2441 (Plugin__manager::load_plugins): New parameter.
2442 (Plugin_manager::claim_file): New parameter.
2443 (Plugin_manager::get_elf_object): New function.
2444 (Plugin_manager::in_claim_file_handler): New function.
2445 (Plugin_manager::in_claim_file_handler_): New member.
2446 (layout): New function.
2447 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2448 handler with an extra parameter. Make the elf object before calling
2449 claim_file handler.
2450 * testsuite/plugin_test.c (get_section_count): New function pointer.
2451 (get_section_type): New function pointer.
2452 (get_section_name): New function pointer.
2453 (get_section_contents): New function pointer.
2454 (update_section_order): New function pointer.
2455 (allow_section_ordering): New function pointer.
2456 (onload): Check if the new interfaces exist.
2457
2458 2011-07-13 Ian Lance Taylor <iant@google.com>
2459
2460 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2461 relro section.
2462 * x86_64.cc (Target_x86_64::got_section): Likewise.
2463 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2464 (relro_now_test_SOURCES): New variable.
2465 (relro_now_test_DEPENDENCIES): New variable.
2466 (relro_now_test_LDFLAGS): New variable.
2467 (relro_now_test_LDADD): New variable.
2468 (relro_now_test.so): New target.
2469 * testsuite/Makefile.in: Rebuild.
2470
2471 2011-07-12 Ian Lance Taylor <iant@google.com>
2472
2473 PR gold/12980
2474 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2475 GLOB_DAT relocation rather than a RELATIVE relocation for a
2476 protected symbol when creating a shared library.
2477 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2478 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2479 * testsuite/protected_main_1.cc (main): Test that protected
2480 function has same address.
2481
2482 2011-07-11 Ian Lance Taylor <iant@google.com>
2483
2484 PR gold/12979
2485 * options.h (class General_options): Add -Bgroup.
2486 * options.cc (General_options::finalize): If -Bgroup is set,
2487 default to --unresolved-symbols=report-all.
2488 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2489 * target-reloc.h (issue_undefined_symbol_error): Handle
2490 --unresolved-symbols=report-all.
2491
2492 2011-07-08 Ian Lance Taylor <iant@google.com>
2493
2494 PR gold/11985
2495 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2496 if linker script discards key sections.
2497 (Layout::create_dynamic_symtab): Likewise.
2498 (Layout::assign_local_dynsym_offsets): Likewise.
2499 (Layout::sized_create_version_sections): Likewise.
2500 (Layout::create_interp): Likewise.
2501 (Layout::finish_dynamic_section): Likewise.
2502 (Layout::set_dynamic_symbol_size): Likewise.
2503
2504 2011-07-08 Ian Lance Taylor <iant@google.com>
2505
2506 PR gold/12386
2507 * options.h (class General_options): Add --unresolved-symbols.
2508 * target-reloc.h (issue_undefined_symbol_error): Check
2509 --unresolved-symbols. Add comments.
2510
2511 2011-07-08 Ian Lance Taylor <iant@google.com>
2512
2513 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2514 expression more complex.
2515
2516 2011-07-08 Ian Lance Taylor <iant@google.com>
2517
2518 PR gold/11317
2519 * target-reloc.h (issue_undefined_symbol_error): New inline
2520 function, broken out of relocate_section.
2521 (relocate_section): Call issue_undefined_symbol_error.
2522 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2523 there is no TLS segment if we are about to issue an undefined
2524 symbol error.
2525 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2526
2527 2011-07-08 Ian Lance Taylor <iant@google.com>
2528
2529 PR gold/12279
2530 * resolve.cc (Symbol_table::should_override): Add fromtype
2531 parameter. Change all callers. Give error when linking together
2532 TLS and non-TLS symbol.
2533 (Symbol_table::should_override_with_special): Add fromtype
2534 parameter. Change all callers.
2535 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2536 there is no TLS segment if we have reported some errors.
2537 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2538
2539 2011-07-08 Ian Lance Taylor <iant@google.com>
2540
2541 PR gold/12372
2542 * target.h (Target::plt_address_for_global): New function.
2543 (Target::plt_address_for_local): New function.
2544 (Target::plt_section_for_global): Remove.
2545 (Target::plt_section_for_local): Remove.
2546 (Target::do_plt_address_for_global): New virtual function.
2547 (Target::do_plt_address_for_local): New virtual function.
2548 (Target::do_plt_section_for_global): Remove.
2549 (Target::do_plt_section_for_local): Remove.
2550 (Target::register_global_plt_entry): Add Symbol_table and Layout
2551 parameters.
2552 * output.cc (Output_data_got::Got_entry::write): Use
2553 plt_address_for_global and plt_address_for_local.
2554 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2555 address of output section.
2556 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2557 got_irelative_, and irelative_count_ fields. Update
2558 declarations.
2559 (Output_data_plt_i386::has_irelative_section): New function.
2560 (Output_data_plt_i386::entry_count): Add irelative_count_.
2561 (Output_data_plt_i386::set_final_data_size): Likewise.
2562 (class Target_i386): Add got_irelative_ and rel_irelative_
2563 fields. Update declarations.
2564 (Target_i386::Target_i386): Initialize new fields.
2565 (Target_i386::do_plt_address_for_global): New function replacing
2566 do_plt_section_for_global.
2567 (Target_i386::do_plt_address_for_local): New function replacing
2568 do_plt_section_for_local.
2569 (Target_i386::got_section): Create got_irelative_.
2570 (Target_i386::rel_irelative_section): New function.
2571 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2572 fields. Don't define __rel_iplt_{start,end}.
2573 (Output_data_plt_i386::add_entry): Add symtab and layout
2574 parameters. Change all callers. Use different PLT and GOT for
2575 IFUNC symbols.
2576 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2577 layout parameters. Change all callers. Use different PLT and
2578 GOT.
2579 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2580 (Output_data_plt_i386::rel_irelative): New function.
2581 (Output_data_plt_i386::address_for_global): New function.
2582 (Output_data_plt_i386::address_for_local): New function.
2583 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2584 IRELATIVE GOT when changing IFUNC GOT entries.
2585 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2586 reloc.
2587 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2588 if we didn't create an IRELATIVE GOT.
2589 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2590 plt_address_for_local.
2591 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2592 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2593 got_irelative_, and irelative_count_ fields. Update
2594 declarations.
2595 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2596 Initialize new fields. Remove symtab parameter. Change all
2597 callers.
2598 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2599 irelative_count_.
2600 (Output_data_plt_x86_64::has_irelative_section): New function.
2601 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2602 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2603 fields. Update declarations.
2604 (Target_x86_64::Target_x86_64): Initialize new fields.
2605 (Target_x86_64::do_plt_address_for_global): New function replacing
2606 do_plt_section_for_global.
2607 (Target_x86_64::do_plt_address_for_local): New function replacing
2608 do_plt_section_for_local.
2609 (Target_x86_64::got_section): Create got_irelative_.
2610 (Target_x86_64::rela_irelative_section): New function.
2611 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2612 all callers. Don't create __rel_iplt_{start,end}.
2613 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2614 parameters. Change all callers. Use different PLT and GOT for
2615 IFUNC symbols.
2616 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2617 layout parameters. Change all callers. Use different PLT and
2618 GOT.
2619 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2620 parameters. Change all callers. Use different PLT and GOT for
2621 IFUNC symbols.
2622 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2623 (Output_data_plt_x86_64::rela_irelative): New function.
2624 (Output_data_plt_x86_64::address_for_global): New function.
2625 (Output_data_plt_x86_64::address_for_local): New function.
2626 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2627 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2628 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2629 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2630 parameters.
2631 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2632 reloc.
2633 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2634 symbols if we didn't create an IRELATIVE GOT.
2635 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2636 plt_address_for_local.
2637 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2638 * testsuite/ifuncvar1.c: New test file.
2639 * testsuite/ifuncvar2.c: New test file.
2640 * testsuite/ifuncvar3.c: New test file.
2641 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2642 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2643 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2644 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2645 * testsuite/Makefile.in: Rebuild.
2646
2647 2011-07-07 Cary Coutant <ccoutant@google.com>
2648
2649 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2650 (two_file_test_1_ndebug.o): Likewise.
2651 (two_file_test_1b_ndebug.o): Likewise.
2652 (two_file_test_2_ndebug.o): Likewise.
2653 (two_file_test_main_ndebug.o): Likewise.
2654 (incremental_test_2): Link with no-debug versions.
2655
2656 2011-07-06 Cary Coutant <ccoutant@google.com>
2657
2658 * gold/incremental.cc
2659 (Output_section_incremental_inputs::write_info_blocks): Check for
2660 hidden and internal symbols.
2661
2662 2011-07-06 Cary Coutant <ccoutant@google.com>
2663
2664 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2665 Check disposition for startup file.
2666 (Incremental_inputs::report_command_line): Ignore
2667 --incremental-startup-unchanged option.
2668 * options.cc (General_options::parse_incremental_startup_unchanged):
2669 New function.
2670 (General_options::General_options): Initialize new data member.
2671 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2672 (General_options): Add --incremental-startup-unchanged option.
2673 (General_options::incremental_startup_disposition): New function.
2674 (General_options::incremental_startup_disposition_): New data member.
2675
2676 2011-07-06 Cary Coutant <ccoutant@google.com>
2677
2678 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2679 input file index to Script_info ctor.
2680 (Sized_incremental_binary::do_file_has_changed): Find the
2681 command-line argument for files named in scripts.
2682 * incremental.h (Script_info::Script_info): New ctor
2683 with input file index.
2684 (Script_info::input_file_index): New function.
2685 (Script_info::input_file_index_): New data member.
2686 (Incremental_binary::get_library): Add const.
2687 (Incremental_binary::get_script_info): Add const.
2688 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2689 * testsuite/Makefile.am (incremental_test_5): New test case.
2690 (incremental_test_6): New test case.
2691 * testsuite/Makefile.in: Regenerate.
2692
2693 2011-07-06 Cary Coutant <ccoutant@google.com>
2694
2695 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2696 debug output when command lines differ.
2697
2698 2011-07-06 Cary Coutant <ccoutant@google.com>
2699
2700 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2701 --incremental-patch option.
2702 * layout.cc (Free_list::allocate): Extend allocation beyond original
2703 end if enabled.
2704 (Layout::make_output_section): Mark sections that should get
2705 patch space.
2706 * options.cc (parse_percent): New function.
2707 * options.h (parse_percent): New function.
2708 (DEFINE_percent): New macro.
2709 (General_options): Add --incremental-patch option.
2710 * output.cc (Output_section::Output_section): Initialize new data
2711 members.
2712 (Output_section::add_input_section): Print section name when out
2713 of patch space.
2714 (Output_section::add_output_section_data): Likewise.
2715 (Output_section::set_final_data_size): Add patch space when
2716 doing --incremental-full.
2717 (Output_section::do_reset_address_and_file_offset): Remove patch
2718 space.
2719 (Output_segment::set_section_list_addresses): Print debug output
2720 only if --incremental-update.
2721 * output.h (Output_section::set_is_patch_space_allowed): New function.
2722 (Output_section::is_patch_space_allowed_): New data member.
2723 (Output_section::patch_space_): New data member.
2724 * parameters.cc (Parameters::incremental_full): New function.
2725 * parameters.h (Parameters::incremental_full): New function
2726 * testsuite/Makefile.am (incremental_test_2): Add test for
2727 --incremental-patch option.
2728 * testsuite/Makefile.in: Regenerate.
2729 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2730 (t18): Remove function body.
2731
2732 2011-07-05 Doug Kwan <dougkwan@google.com>
2733
2734 PR gold/12771
2735 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2736 Arm_Address type for relocation result.
2737 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2738 overflow check.
2739 (Arm_relocate_functions::abs32): Use unaligned access.
2740 (Arm_relocate_functions::rel32): Ditto.
2741 (Arm_relocate_functions::prel31): Ditto.
2742 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2743 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2744 static data relocations.
2745 * testsuite/Makefile.in: Regnerate.
2746 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2747
2748 2011-07-05 Ian Lance Taylor <iant@google.com>
2749
2750 PR gold/12392
2751 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2752 symbols if necessary.
2753 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2754
2755 2011-07-05 Ian Lance Taylor <iant@google.com>
2756
2757 PR gold/12952
2758 * resolve.cc (Symbol::override_base_with_special): Simply override
2759 version with special symbol version, ignoring previous version.
2760
2761 2011-07-05 Ian Lance Taylor <iant@google.com>
2762
2763 * object.cc (Sized_relobj_file::include_section_group): Add
2764 information to comment about signature location.
2765
2766 2011-07-02 Ian Lance Taylor <iant@google.com>
2767
2768 PR gold/12957
2769 * options.h (class General_options): Add -f and -F.
2770 * options.cc (General_options::finalize): Fatal error if -f/-F
2771 are used without -shared.
2772 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2773
2774 2011-07-02 Ian Lance Taylor <iant@google.com>
2775
2776 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2777
2778 2011-07-01 Ian Lance Taylor <iant@google.com>
2779
2780 PR gold/12525
2781 PR gold/12952
2782 * resolve.cc (Symbol::override_base_with_special): Don't override
2783 the version if the overriding symbol has a different name.
2784 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2785 all callers. If we give an error about an undefined version,
2786 define the base version if necessary.
2787 * dynobj.h (class Versions): Update declaration.
2788 * testsuite/weak_alias_test_5.cc: New file.
2789 * testsuite/weak_alias_test.script: New file.
2790 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2791 and versioned_alias have the right value, and call t2.
2792 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2793 weak_alias_test_5.so.
2794 (weak_alias_test_LDADD): Likewise.
2795 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2796 * testsuite/Makefile.in: Rebuild.
2797
2798 2011-07-01 Ian Lance Taylor <iant@google.com>
2799
2800 PR gold/12525
2801 * options.h (class General_options): Support -z notext.
2802 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2803 -Wl,-z,notext.
2804 (two_file_shared_nonpic.so): Likewise.
2805 (two_file_shared_mixed.so): Likewise.
2806 (two_file_shared_mixed_1.so): Likewise.
2807 (weak_undef_lib_nonpic.so): Likewise.
2808 (alt/weak_undef_lib_nonpic.so): Likewise.
2809 (tls_test_shared_nonpic.so): Likewise.
2810 * testsuite/Makefile.in: Rebuild.
2811
2812 2011-07-01 Ian Lance Taylor <iant@google.com>
2813
2814 PR gold/12525
2815 * configure.ac: Test whether static linking works, setting
2816 the automake conditional HAVE_STATIC.
2817 * testsuite/Makefile.am: Disable tests using -static if
2818 HAVE_STATIC is not true.
2819 * configure, testsuite/Makefile.in: Rebuild.
2820
2821 2011-07-01 Ian Lance Taylor <iant@google.com>
2822
2823 PR gold/12525
2824 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2825 Assert if we see DW_EH_PE_indirect.
2826 * target.h (Target::ehframe_datarel_base): New function.
2827 (Target::do_ehframe_datarel_base): New target function.
2828 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2829 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2830 function.
2831
2832 2011-07-01 Ian Lance Taylor <iant@google.com>
2833
2834 PR gold/12571
2835 * options.h (class General_options): Add
2836 --ld-generated-unwind-info.
2837 * ehframe.cc (Fde::write): Add address parameter. Change all
2838 callers. If associated with PLT, fill in address and size.
2839 (Cie::set_output_offset): Only add merge mapping if there is an
2840 object.
2841 (Cie::write): Add address parameter. Change all callers.
2842 (Eh_frame::add_ehframe_for_plt): New function.
2843 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2844 input_offset_ fields into union u_, with new plt field.
2845 (Fde::Fde): Adjust for new union field.
2846 (Fde::Fde) [Output_data version]: New constructor.
2847 (Fde::add_mapping): Only add merge mapping if there is an object.
2848 (class Cie): Update declarations.
2849 (class Eh_frame): Declare add_ehframe_for_plt.
2850 * layout.cc (Layout::layout_eh_frame): Break out code into
2851 make_eh_frame_section, and call it.
2852 (Layout::make_eh_frame_section): New function.
2853 (Layout::add_eh_frame_for_plt): New function.
2854 * layout.h (class Layout): Update declarations.
2855 * merge.cc (Merge_map::add_mapping): Add assertion.
2856 * i386.cc: Include "dwarf.h".
2857 (class Output_data_plt_i386): Make first_plt_entry,
2858 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2859 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2860 and plt_eh_frame_fde.
2861 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2862 boundary. Call add_eh_frame_for_plt if appropriate.
2863 * x86_64.cc: Include "dwarf.h".
2864 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2865 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2866 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2867 and plt_eh_frame_fde.
2868 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2869 appropriate.
2870
2871 2011-06-29 Ian Lance Taylor <iant@google.com>
2872
2873 PR gold/12629
2874 * object.cc (Sized_relobj_file::layout_section): Change shdr
2875 parameter to be const.
2876 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2877 out of do_layout.
2878 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2879 appropriate. Call layout_eh_frame_section.
2880 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2881 sections.
2882 * object.h (class Sized_relobj_file): Update declarations.
2883
2884 2011-06-29 Ian Lance Taylor <iant@google.com>
2885
2886 PR gold/12652
2887 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2888 modifier.
2889 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2890
2891 2011-06-29 Ian Lance Taylor <iant@google.com>
2892
2893 PR gold/12675
2894 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2895 SHT_X86_64_UNWIND.
2896 * layout.cc (Layout::layout_eh_frame): Likewise.
2897
2898 2011-06-29 Ian Lance Taylor <iant@google.com>
2899
2900 PR gold/12695
2901 * layout.cc (Layout::symtab_section_shndx): New function.
2902 * layout.h (class Layout): Declare symtab_section_shndx.
2903 * output.cc (Output_section::write_header): Call it.
2904
2905 2011-06-29 Ian Lance Taylor <iant@google.com>
2906
2907 PR gold/12818
2908 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2909 symbols which are not used in a relocation.
2910
2911 2011-06-28 Ian Lance Taylor <iant@google.com>
2912
2913 PR gold/12898
2914 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2915 script create indistinguishable segments.
2916 (Layout::set_segment_offsets): Use stable_sort when sorting
2917 segments. Pass this to Compare_segments constructor.
2918 * layout.h (class Layout): Make segment_precedes non-static.
2919 (class Compare_segments): Change from struct to class. Add
2920 layout_ field. Add constructor.
2921 * script-sections.cc
2922 (Script_sections::attach_sections_using_phdrs_clause): Rename
2923 local orphan to is_orphan. Don't report failure to put empty
2924 section in segment. On attachment failure, report name of
2925 section, and attach to first PT_LOAD segment.
2926
2927 2011-06-28 Ian Lance Taylor <iant@google.com>
2928
2929 PR gold/12934
2930 * target-select.cc (Target_selector::Target_selector): Add
2931 emulation parameter. Change all callers.
2932 (select_target_by_bfd_name): Rename from select_target_by_name.
2933 Change all callers.
2934 (select_target_by_emulation): New function.
2935 (supported_emulation_names): New function.
2936 * target-select.h (class Target_selector): Add emulation_ field.
2937 Update declarations.
2938 (Target_selector::recognize_by_bfd_name): Rename from
2939 recognize_by_name. Change all callers.
2940 (Target_selector::supported_bfd_names): Rename from
2941 supported_names. Change all callers.
2942 (Target_selector::recognize_by_emulation): New function.
2943 (Target_selector::supported_emulations): New function.
2944 (Target_selector::emulation): New function.
2945 (Target_selector::do_recognize_by_bfd_name): Rename from
2946 do_recognize_by_name. Change all callers.
2947 (Target_selector::do_supported_bfd_names): Rename from
2948 do_supported_names. Change all callers.
2949 (Target_selector::do_recognize_by_emulation): New function.
2950 (Target_selector::do_supported_emulations): New function.
2951 (select_target_by_bfd_name): Change name in declaration.
2952 (select_target_by_emulation): Declare.
2953 (supported_emulation_names): Declare.
2954 * parameters.cc (parameters_force_valid_target): Try to find
2955 target based on emulation from -m option.
2956 * options.h (class General_options): Change doc string for -m.
2957 * options.cc (help): Print emulations.
2958 (General_options::parse_V): Likewise.
2959 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2960 Add emulation parameter. Change all callers.
2961
2962 2011-06-28 Ian Lance Taylor <iant@google.com>
2963
2964 * target.h (class Target): Add osabi_ field.
2965 (Target::osabi): New function.
2966 (Target::set_osabi): New function.
2967 (Target::Target): Initialize osabi_.
2968 (Target::do_adjust_elf_header): Make pure virtual.
2969 (Sized_target::do_adjust_elf_header): Declare.
2970 * target.cc (Sized_target::do_adjust_elf_header): New function.
2971 (class Sized_target): Instantiate all versions.
2972 * freebsd.h (class Target_freebsd): Remove.
2973 (Target_selector_freebsd::do_recognize): Call set_osabi on
2974 Target.
2975 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2976 (Target_selector_freebsd::set_osabi): Remove.
2977 * i386.cc (class Target_i386): Inherit from Sized_target rather
2978 than Target_freebsd.
2979 * x86_64.cc (class Target_x86_64): Likewise.
2980
2981 2011-06-28 Ian Lance Taylor <iant@google.com>
2982
2983 * target.h (Target::can_check_for_function_pointers): Rewrite.
2984 Make non-virtual.
2985 (Target::can_icf_inline_merge_sections): Likewise.
2986 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2987 (Target::Target_info): Add can_icf_inline_merge_sections field.
2988 (Target::do_can_check_for_function_pointers): New virtual
2989 function.
2990 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2991 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2992 from can_check_for_function_pointers, move in file.
2993 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2994 section_may_have_icf_unsafe_poineters, move in file.
2995 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2996 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2997 Rename from can_check_for_function_pointers, move in file.
2998 (Target_i386::can_icf_inline_merge_sections): Remove.
2999 (Target_i386::i386_info): Initialize
3000 can_icf_inline_merge_sections.
3001 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3002 Initialize can_icf_inline_merge_sections.
3003 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3004 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3005 Rename from can_check_for_function_pointers, move in file.
3006 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3007 (Target_x86_64::x86_64_info): Initialize
3008 can_icf_inline_merge_sections.
3009 * testsuite/testfile.cc (Target_test::test_target_info):
3010 Likewise.
3011 * icf.cc (get_section_contents): Correct formatting.
3012
3013 2011-06-27 Ian Lance Taylor <iant@google.com>
3014
3015 * symtab.cc (Symbol::versioned_name): New function.
3016 (Symbol_table::add_to_final_symtab): Use versioned_name when
3017 appropriate.
3018 (Symbol_table::sized_write_symbol): Likewise.
3019 * symtab.h (class Symbol): Declare versioned_name.
3020 * stringpool.h (class Stringpool_template): Add variant of add
3021 which takes a std::basic_string.
3022 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3023 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3024 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3025 (ver_test_12.o): New target.
3026 * testsuite/Makefile.in: Rebuild.
3027
3028 2011-06-27 Doug Kwan <dougkwan@google.com>
3029
3030 * arm.cc (Arm_relocate_functions::thm_jump8,
3031 Arm_relocate_functions::thm_jump11): Use a wider signed
3032 type to compute offset.
3033 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3034 arm_thm_jump8.
3035 * testsuite/Makefile.in: Regenerate.
3036 * testsuite/arm_branch_in_range.sh: Check test results of
3037 arm_thm_jump11 and arm_thm_jump8.
3038 * testsuite/arm_thm_jump11.s: New test source file.
3039 * testsuite/arm_thm_jump11.t: New linker script.
3040 * testsuite/arm_thm_jump8.s: New test source file.
3041 * testsuite/arm_thm_jump8.t: New linker script.
3042
3043 2011-06-24 Ian Lance Taylor <iant@google.com>
3044
3045 * layout.cc: Include "object.h".
3046 (ctors_sections_in_init_array): New static variable.
3047 (Layout::is_ctors_in_init_array): New function.
3048 (Layout::layout): Add entry to ctors_sections_in_init_array if
3049 appropriate.
3050 * layout.h (class Layout): Declare is_ctors_in_init_array.
3051 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3052 is_ctors_reverse_view is set.
3053 (Sized_relobj_file::write_sections): Add layout parameter. Change
3054 all callers. Set is_ctors_reverse_view field of View_size.
3055 (Sized_relobj_file::reverse_words): New function.
3056 * object.h (Sized_relobj_file::View_size): Add
3057 is_ctors_reverse_view field.
3058 (class Sized_relobj_file): Update declarations.
3059 * testsuite/initpri3.c: New test.
3060 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3061 initpri3b.
3062 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3063 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3064 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3065 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3066 * testsuite/Makefile.in: Rebuild.
3067
3068 2011-06-24 Cary Coutant <ccoutant@google.com>
3069
3070 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3071 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3072 (debug_msg_cdebug.err): New targets.
3073 * testsuite/Makefile.in: Regenerate.
3074 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3075 Fix checks for link with shared library.
3076
3077 2011-06-24 Doug Kwan <dougkwan@google.com>
3078
3079 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3080 skip empty text sections.
3081 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3082
3083 2011-06-22 Ian Lance Taylor <iant@google.com>
3084
3085 PR gold/12910
3086 * options.h (class General_options): Add --ctors-in-init-array.
3087 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3088 friends as SHT_PROGBITS for merging sections.
3089 (Layout::layout): Remove special handling of .init_array and
3090 friends. Don't sort if doing relocatable link. Sort for .ctors
3091 and .dtors if ctors_in_init_array.
3092 (Layout::make_output_section): Force correct section types for
3093 .init_array and friends. Don't sort if doing relocatable link,
3094 Don't sort .ctors and .dtors if ctors_in_init_array.
3095 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3096 (Layout::output_section_name): Add relobj parameter. Change all
3097 callers. Handle .ctors. and .dtors. in code rather than table.
3098 Handle .ctors and .dtors if ctors_in_init_array.
3099 (Layout::match_file_name): New function, moved from output.cc.
3100 * layout.h (class Layout): Update declarations.
3101 * output.cc: Include "layout.h".
3102 (Input_section_sort_entry::get_priority): New function.
3103 (Input_section_sort_entry::match_file_name): Just call
3104 Layout::match_file_name.
3105 (Output_section::Input_section_sort_init_fini_compare::operator()):
3106 Handle .ctors and .dtors. Sort by explicit priority rather than
3107 by name.
3108 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3109 * testsuite/initpri2.c: New test.
3110 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3111 (check_PROGRAMS): Add initpri2.
3112 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3113 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3114 * configure, testsuite/Makefile.in: Rebuild.
3115
3116 2011-06-19 Ian Lance Taylor <iant@google.com>
3117
3118 PR gold/12880
3119 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3120 .interp section to a PT_INTERP segment even if we have seen a
3121 --dynamic-linker option. Don't do it if we have seen a PHDRS
3122 clause in a linker script.
3123 (Layout::finalize): Don't create a .interp section if we've
3124 already create a PT_INTERP segment.
3125 (Layout::create_interp): Always call choose_output_section (revert
3126 patch of 2011-06-17). Don't create PT_INTERP segment.
3127 * script-sections.cc
3128 (Script_sections::create_note_and_tls_segments): Add a .interp
3129 section to a PT_INTERP segment even if we have seen a
3130 --dynamic-linker option.
3131
3132 2011-06-18 Ian Lance Taylor <iant@google.com>
3133
3134 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3135 merely because a non-PT_LOAD segment has a dynamic reloc.
3136
3137 2011-06-18 Ian Lance Taylor <iant@google.com>
3138
3139 * layout.cc (Layout::finish_dynamic_section): Don't create
3140 DT_FLAGS entry if not needed.
3141
3142 2011-06-18 Ian Lance Taylor <iant@google.com>
3143
3144 PR gold/12745
3145 * layout.cc (Layout::layout_eh_frame): Correct handling of
3146 writable .eh_frame section.
3147
3148 2011-06-17 Ian Lance Taylor <iant@google.com>
3149
3150 PR gold/12893
3151 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3152 symbol is redefined with the exact same object and value.
3153
3154 2011-06-17 Ian Lance Taylor <iant@google.com>
3155
3156 PR gold/12880
3157 * layout.h (class Layout): Add interp_segment_ field.
3158 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3159 (Layout::attach_allocated_section_to_segment): If making shared
3160 library, put .interp section in PT_INTERP segment.
3161 (Layout::finalize): Also call create_interp if -dynamic-linker
3162 option was used.
3163 (Layout::create_interp): Assert that there is no PT_INTERP
3164 segment. If not using a SECTIONS clause, use make_output_section.
3165 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3166 * script-sections.cc
3167 (Script_sections::create_note_and_tls_segments): If making shared
3168 library, put .interp section in PT_INTERP segment.
3169
3170 2011-06-17 Ian Lance Taylor <iant@google.com>
3171
3172 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3173 when making a shared library.
3174
3175 2011-06-17 Ian Lance Taylor <iant@google.com>
3176
3177 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3178 parameter. Change all callers. Don't issue warning about PC32
3179 against locally defined symbol.
3180
3181 2011-06-16 Ian Lance Taylor <iant@google.com>
3182
3183 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3184 occurs in same object.
3185
3186 2011-06-14 Alan Modra <amodra@gmail.com>
3187
3188 * po/POTFILES.in: Regenerate.
3189
3190 2011-06-09 Ian Lance Taylor <iant@google.com>
3191
3192 * script-sections.cc
3193 (Orphan_output_section::set_section_addresses): For a relocatable
3194 link set address to 0.
3195
3196 2011-06-09 Cary Coutant <ccoutant@google.com>
3197
3198 PR gold/12804
3199 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3200 used with --compress-debug-sections.
3201 * gold/object.cc (Sized_relobj_file::do_layout): Report
3202 uncompressed size of compressed input sections.
3203
3204 2011-06-08 Cary Coutant <ccoutant@google.com>
3205
3206 PR gold/12804
3207 * testsuite/two_file_test_2_v1.cc: Change initialization of
3208 v2 to keep it in .data.
3209
3210 2011-06-07 Cary Coutant <ccoutant@google.com>
3211
3212 * common.cc (Symbol_table::do_allocate_commons_list): Call
3213 gold_fallback.
3214 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3215 (Errors::fallback): New function.
3216 (gold_fallback): New function.
3217 * errors.h (Errors::fallback): New function.
3218 * gold.cc (gold_exit): Change status parameter to enum; adjust
3219 all callers.
3220 (queue_initial_tasks): Call gold_fallback.
3221 * gold.h: Include cstdlib.
3222 (Exit_status): New enum type.
3223 (gold_exit): Change status parameter to enum.
3224 (gold_fallback): New function.
3225 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3226 (Layout::create_symtab_sections): Likewise.
3227 (Layout::create_shdrs): Likewise.
3228 * main.cc (main): Adjust call to gold_exit.
3229 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3230 (Output_data_got::add_got_entry_pair): Likewise.
3231 (Output_section::add_input_section): Likewise.
3232 (Output_section::add_output_section_data): Likewise.
3233 (Output_segment::set_section_list_addresses): Likewise.
3234 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3235
3236 2011-06-07 Cary Coutant <ccoutant@google.com>
3237
3238 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3239 for incremental links.
3240 * output.cc (Output_segment::set_section_list_addresses): Remove
3241 FIXME and test for TLS or BSS.
3242
3243 2011-06-07 Cary Coutant <ccoutant@google.com>
3244
3245 * testsuite/Makefile.am: Add incremental_copy_test,
3246 incremental_common_test_1.
3247 * testsuite/Makefile.in: Regenerate.
3248 * testsuite/common_test_1_v1.c: New source file.
3249 * testsuite/common_test_1_v2.c: New source file.
3250 * testsuite/copy_test_v1.cc: New source file.
3251
3252 2011-06-07 Cary Coutant <ccoutant@google.com>
3253
3254 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3255 update, allocate common from bss section's free list.
3256 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3257 linker-defined symbols.
3258 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3259 Skip GOT and PLT entries that are no longer referenced.
3260 (Output_section_incremental_inputs::write_info_blocks): Mark
3261 linker-defined symbols.
3262 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3263 * output.cc (Output_section::allocate): New function.
3264 * output.h (Output_section::allocate): New function.
3265 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3266 linker-defined symbols.
3267 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3268 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3269 (Symbol::init_base_output_data): Likewise.
3270 (Symbol::init_base_output_segment): Likewise.
3271 (Symbol::init_base_constant): Likewise.
3272 (Sized_symbol::init_output_data): Likewise.
3273 (Sized_symbol::init_output_segment): Likewise.
3274 (Sized_symbol::init_constant): Likewise.
3275 (Symbol_table::do_define_in_output_data): Likewise.
3276 (Symbol_table::do_define_in_output_segment): Likewise.
3277 (Symbol_table::do_define_as_constant): Likewise.
3278 * symtab.h (Symbol::is_predefined): New function.
3279 (Symbol::init_base_output_data): Add is_predefined parameter.
3280 (Symbol::init_base_output_segment): Likewise.
3281 (Symbol::init_base_constant): Likewise.
3282 (Symbol::is_predefined_): New data member.
3283 (Sized_symbol::init_output_data): Add is_predefined parameter.
3284 (Sized_symbol::init_output_segment): Likewise.
3285 (Sized_symbol::init_constant): Likewise.
3286 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3287
3288 2011-06-07 Cary Coutant <ccoutant@google.com>
3289
3290 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3291 instead of emit_copy_reloc.
3292 (Copy_relocs::emit_copy_reloc): Refactor.
3293 (Copy_relocs::make_copy_reloc): New function.
3294 (Copy_relocs::add_copy_reloc): Remove.
3295 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3296 section.
3297 (Copy_relocs::make_copy_reloc): New function.
3298 (Copy_relocs::add_copy_reloc): Remove.
3299 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3300 unchanged input files.
3301 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3302 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3303 Reserve BSS space for COPY relocations.
3304 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3305 (Output_section_incremental_inputs::write_info_blocks): Record
3306 whether a symbol is copied from a shared object.
3307 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3308 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3309 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3310 (Incremental_input_entry_reader::get_output_symbol_index): Add
3311 is_copy parameter.
3312 (Incremental_binary::emit_copy_relocs): New function.
3313 (Incremental_binary::do_emit_copy_relocs): New function.
3314 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3315 new data member.
3316 (Sized_incremental_binary::add_copy_reloc): New function.
3317 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3318 (Sized_incremental_binary::Copy_reloc): New struct.
3319 (Sized_incremental_binary::Copy_relocs): New typedef.
3320 (Sized_incremental_binary::copy_relocs_): New data member.
3321 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3322 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3323 * target.h (Sized_target::emit_copy_reloc): New function.
3324 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3325
3326 2011-06-02 Cary Coutant <ccoutant@google.com>
3327
3328 PR gold/12163
3329 * gold/archive.cc (Archive::Archive): Initialize new data member.
3330 (Archive::include_all_members): Return if archive has already been
3331 included.
3332 * gold/archive.h (Archive::include_all_members_): New data member.
3333
3334 2011-06-02 Nick Clifton <nickc@redhat.com>
3335
3336 * dynobj.h: Fix spelling mistake in comment.
3337 * output.cc: Likewise.
3338
3339 2011-05-31 Doug Kwan <dougkwan@google.com>
3340 Asier Llano
3341
3342 PR gold/12826
3343 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3344 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3345 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3346 redundant arm_exidx_test.so.
3347 * testsuite/Makefile.in: Regenerate.
3348 (check_SCRIPTS): Add pr12826.sh
3349 (check_DATA): Add pr12826.stdout
3350 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3351 * testsuite/pr12826.sh: New file.
3352 * testsuite/pr12826_1.s: Ditto.
3353 * testsuite/pr12826_1.s: Ditto.
3354
3355 2011-05-30 Ian Lance Taylor <iant@google.com>
3356
3357 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3358 sections.
3359
3360 2011-05-29 Ian Lance Taylor <iant@google.com>
3361
3362 PR gold/12804
3363 * testsuite/Makefile.am: Use different file name for two_file_test
3364 temporary file for each incremental test.
3365 * testsuite/Makefile.in: Rebuild.
3366
3367 2011-05-29 Ian Lance Taylor <iant@google.com>
3368
3369 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3370 binary input file is empty.
3371
3372 2011-05-27 Ian Lance Taylor <iant@google.com>
3373
3374 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3375 (ver_test_9.so): Likewise.
3376 * testsuite/Makefile.in: Rebuild.
3377
3378 2011-05-26 Cary Coutant <ccoutant@google.com>
3379
3380 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3381 * incremental.cc (Incremental_inputs::report_input_section): Fix
3382 comment, indentation.
3383 (Incremental_inputs::report_comdat_group): New function.
3384 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3385 of data for incremental input file entry.
3386 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3387 group count, COMDAT group signatures.
3388 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3389 an unchanged input file.
3390 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3391 Initialize new data member.
3392 (Incremental_object_entry::add_comdat_group): New function.
3393 (Incremental_object_entry::get_comdat_group_count): New function.
3394 (Incremental_object_entry::get_comdat_signature_key): New function.
3395 (Incremental_object_entry::groups_): New data member.
3396 (Incremental_inputs::report_comdat_group): New function.
3397 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3398 data for incremental input file entry.
3399 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3400 (Incremental_input_entry_reader::get_input_section): Adjust size of
3401 data for incremental input file entry.
3402 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3403 (Incremental_input_entry_reader::get_comdat_group_signature): New
3404 function.
3405 * object.cc (Sized_relobj::include_section_group): Report kept
3406 COMDAT groups for incremental links.
3407
3408 2011-05-24 David Meyer <pdox@google.com>
3409
3410 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3411 with name parameter. Add found_name parameter.
3412 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3413 * dirsearch.h (class Dirsearch): Update declaration.
3414
3415 2011-05-24 Ian Lance Taylor <iant@google.com>
3416
3417 * archive.cc (Library_base::should_include_member): Pull in object
3418 from archive if it defines the entry symbol.
3419 * parameters.cc (Parameters::entry): New function.
3420 * parameters.h (class Parameters): Declare entry.
3421 * output.h (class Output_file_header): Remove entry_ field.
3422 * output.cc (Output_file_header::Output_file_header): Remove entry
3423 parameter. Change all callers.
3424 (Output_file_header::entry): Use parameters->entry.
3425 * gold.cc (queue_middle_tasks): Likewise.
3426 * plugin.cc (Plugin_hook::run): Likewise.
3427
3428 2011-05-24 Cary Coutant <ccoutant@google.com>
3429
3430 * gold.cc (queue_initial_tasks): Pass incremental base filename
3431 to Output_file::open_base_file; don't print error message.
3432 * incremental-dump.cc (main): Adjust call to
3433 Output_file::open_for_modification.
3434 * incremental-dump.cc (main): Likewise.
3435 * incremental.cc (Incremental_inputs::report_command_line):
3436 Ignore --incremental-base option when comparing command lines.
3437 Ignore parameter when given as separate argument.
3438 * options.h (class General_options): Add --incremental-base.
3439 * output.cc (Output_file::Output_file):
3440 (Output_file::open_base_file): Add base_name and writable parameters;
3441 read base file into new file; print error message here.
3442 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3443 callers.
3444 * output.h (Output_file::open_for_modification): Rename to...
3445 (Output_file::open_base_file): ...this; add base_name and
3446 writable parameters; adjust all callers.
3447 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3448 callers.
3449 * testsuite/Makefile.am (incremental_test_4): Test
3450 --incremental-base.
3451 * testsuite/Makefile.in: Regenerate.
3452
3453 2011-05-24 Cary Coutant <ccoutant@google.com>
3454
3455 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3456 incremental_test_4.
3457 * testsuite/Makefile.in: Regenerate.
3458 * testsuite/two_file_test_1_v1.cc: New test source file.
3459 * testsuite/two_file_test_1b_v1.cc: New test source file.
3460 * testsuite/two_file_test_2_v1.cc: New test source file.
3461
3462 2011-05-24 Cary Coutant <ccoutant@google.com>
3463
3464 * dynobj.h (Dynobj::do_dynobj): New function.
3465 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3466 flag and soname for shared objects.
3467 * incremental.cc (Incremental_inputs::report_object): Make
3468 either Incremental_object_entry or Incremental_dynobj_entry; add
3469 soname to string table.
3470 (Incremental_inputs::report_input_section): Add assertion.
3471 (Output_section_incremental_inputs::set_final_data_size): Adjust
3472 type of input file entry for shared libraries; adjust size of
3473 shared library info entry.
3474 (Output_section_incremental_inputs::write_input_files): Write
3475 as_needed flag for shared libraries.
3476 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3477 of input file entry for shared libraries; write soname.
3478 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3479 soname from incremental info.
3480 * incremental.h (enum Incremental_input_flags): Add
3481 INCREMENTAL_INPUT_AS_NEEDED.
3482 (Incremental_input_entry::Incremental_input_entry): Initialize new
3483 data member.
3484 (Incremental_input_entry::set_as_needed): New function.
3485 (Incremental_input_entry::as_needed): New function.
3486 (Incremental_input_entry::do_dynobj_entry): New function.
3487 (Incremental_input_entry::as_needed_): New data member.
3488 (Incremental_object_entry::Incremental_object_entry): Don't check
3489 for shared library.
3490 (Incremental_object_entry::do_type): Likewise.
3491 (class Incremental_dynobj_entry): New class.
3492 (Incremental_input_entry_reader::as_needed): New function.
3493 (Incremental_input_entry_reader::get_soname): New function.
3494 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3495 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3496 size of shared library info entry.
3497 * layout.cc (Layout::finish_dynamic_section): Don't test for
3498 incremental link when adding DT_NEEDED entries.
3499 * object.h (Object::Object): Initialize new data member.
3500 (Object::dynobj): New function.
3501 (Object::set_as_needed): New function.
3502 (Object::as_needed): New function.
3503 (Object::do_dynobj): New function.
3504 (Object::as_needed_): New data member.
3505
3506 2011-05-24 Cary Coutant <ccoutant@google.com>
3507
3508 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3509 info; adjust display of GOT entries.
3510 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3511 vector of input objects; remove file_status_.
3512 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3513 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3514 got_plt reader; call target hooks to reserve GOT entries.
3515 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3516 of input file info header and GOT info entry.
3517 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3518 relocation info.
3519 (Got_plt_view_info::got_descriptor): Remove.
3520 (Got_plt_view_info::sym_index): New data member.
3521 (Got_plt_view_info::input_index): New data member.
3522 (Local_got_offset_visitor::visit): Write input file index.
3523 (Global_got_offset_visitor::visit): Write 0 for input file index.
3524 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3525 with sym_index and input_index.
3526 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3527 incremental info GOT entry; replace got_descriptor with input_index.
3528 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3529 map from input file index to object.
3530 (Sized_relobj_incr::do_layout): Replace direct data member reference
3531 with accessor function.
3532 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3533 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3534 Adjust size of input file info header.
3535 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3536 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3537 (Incremental_input_entry_reader::get_input_section): Adjust size of
3538 input file info header.
3539 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3540 of incremental info GOT entry.
3541 (Incremental_got_plt_reader::get_got_desc): Remove.
3542 (Incremental_got_plt_reader::get_got_symndx): New function.
3543 (Incremental_got_plt_reader::get_got_input_index): New function.
3544 (Sized_incremental_binary::Sized_incremental_binary): Remove
3545 file_status_; add input_objects_.
3546 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3547 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3548 (Sized_incremental_binary::file_is_unchanged): Remove.
3549 (Sized_incremental_binary::set_input_object): New function.
3550 (Sized_incremental_binary::input_object): New function.
3551 (Sized_incremental_binary::file_status_): Remove.
3552 (Sized_incremental_binary::input_objects_): New data member.
3553 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3554 references.
3555 (Sized_relobj_incr::invalid_address): Move to base class.
3556 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3557 class.
3558 (Sized_relobj_incr::do_output_section_offset): Likewise.
3559 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3560 (Sized_relobj_incr::section_offsets_): Likewise.
3561 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3562 function.
3563 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3564 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3565 with accessor function.
3566 (Sized_relobj_file::do_layout): Likewise.
3567 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3568 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3569 (Sized_relobj_file::compute_final_local_value): Replace refs to
3570 section_offsets_ with accessor function.
3571 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3572 * object.h (Relobj::Relobj): Initialize new data members.
3573 (Relobj::add_dyn_reloc): New function.
3574 (Relobj::first_dyn_reloc): New function.
3575 (Relobj::dyn_reloc_count): New function.
3576 (Relobj::first_dyn_reloc_): New data member.
3577 (Relobj::dyn_reloc_count_): New data member.
3578 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3579 references.
3580 (Sized_relobj::Address): New typedef.
3581 (Sized_relobj::invalid_address): Move here from child class.
3582 (Sized_relobj::Sized_relobj): Initialize new data members.
3583 (Sized_relobj::sized_relobj): New function.
3584 (Sized_relobj::is_output_section_offset_invalid): Move here from
3585 child class.
3586 (Sized_relobj::get_output_section_offset): Likewise.
3587 (Sized_relobj::local_has_got_offset): Likewise.
3588 (Sized_relobj::local_got_offset): Likewise.
3589 (Sized_relobj::set_local_got_offset): Likewise.
3590 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3591 (Sized_relobj::clear_got_offsets): New function.
3592 (Sized_relobj::section_offsets): Move here from child class.
3593 (Sized_relobj::do_output_section_offset): Likewise.
3594 (Sized_relobj::do_set_section_offset): Likewise.
3595 (Sized_relobj::Local_got_offsets): Likewise.
3596 (Sized_relobj::local_got_offsets_): Likewise.
3597 (Sized_relobj::section_offsets_): Likewise.
3598 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3599 references.
3600 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3601 class.
3602 (Sized_relobj_file::sized_relobj): New function
3603 (Sized_relobj_file::local_has_got_offset): Move to base class.
3604 (Sized_relobj_file::local_got_offset): Likewise.
3605 (Sized_relobj_file::set_local_got_offset): Likewise.
3606 (Sized_relobj_file::get_output_section_offset): Likewise.
3607 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3608 (Sized_relobj_file::do_output_section_offset): Likewise.
3609 (Sized_relobj_file::do_set_section_offset): Likewise.
3610 (Sized_relobj_file::Local_got_offsets): Likewise.
3611 (Sized_relobj_file::local_got_offsets_): Likewise.
3612 (Sized_relobj_file::section_offsets_): Likewise.
3613 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3614 (all constructors).
3615 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3616 (Output_reloc::get_symbol_index): Likewise.
3617 (Output_reloc::local_section_offset): Likewise.
3618 (Output_reloc::get_address): Likewise.
3619 (Output_reloc::symbol_value): Likewise.
3620 (Output_data_got::reserve_slot): Move to class definition.
3621 (Output_data_got::reserve_local): New function.
3622 (Output_data_got::reserve_slot_for_global): Remove.
3623 (Output_data_got::reserve_global): New function.
3624 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3625 (all constructors, two instantiations).
3626 (Output_reloc::get_relobj): New function (two instantiations).
3627 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3628 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3629 (Output_data_reloc::add_global): Adjust type of relobj.
3630 (Output_data_reloc::add_global_relative): Likewise.
3631 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3632 (Output_data_reloc::add_local): Likewise.
3633 (Output_data_reloc::add_local_relative): Likewise.
3634 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3635 (Output_data_reloc::add_local_section): Likewise.
3636 (Output_data_reloc::add_output_section): Likewise.
3637 (Output_data_reloc::add_absolute): Likewise.
3638 (Output_data_reloc::add_target_specific): Likewise.
3639 (Output_data_got::reserve_slot): Move definition here.
3640 (Output_data_got::reserve_local): New function.
3641 (Output_data_got::reserve_global): New function.
3642 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3643 section_offsets_ with accessor function.
3644 (Sized_relobj_file::write_sections): Likewise.
3645 (Sized_relobj_file::do_relocate_sections): Likewise.
3646 * target.h (Sized_target::reserve_local_got_entry): New function.
3647 (Sized_target::reserve_global_got_entry): New function.
3648 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3649 (Target_x86_64::reserve_global_got_entry): New function.
3650 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3651
3652 2011-05-23 Cary Coutant <ccoutant@google.com>
3653
3654 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3655 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3656 bit when checking got_type.
3657 * incremental.cc (Sized_incremental_binary::setup_readers):
3658 Store symbol table and string table locations; initialize bit vector
3659 of file status flags.
3660 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3661 unchanged files.
3662 (Sized_incremental_binary::do_process_got_plt): New function.
3663 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3664 (Output_section_incremental_inputs::set_final_data_size): Record
3665 file index for each input file.
3666 (Output_section_incremental_inputs::write_got_plt): Store file index
3667 instead of input entry offset for each GOT entry.
3668 * incremental.h
3669 (Incremental_input_entry::Incremental_input_entry): Initialize new
3670 data member.
3671 (Incremental_input_entry::set_offset): Store file index.
3672 (Incremental_input_entry::get_file_index): New function.
3673 (Incremental_input_entry::file_index_): New data member.
3674 (Incremental_binary::process_got_plt): New function.
3675 (Incremental_binary::do_process_got_plt): New function.
3676 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3677 data members.
3678 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3679 (Sized_incremental_binary::set_file_is_unchanged): New function.
3680 (Sized_incremental_binary::file_is_unchanged): New function.
3681 (Sized_incremental_binary::do_process_got_plt): New function.
3682 (Sized_incremental_binary::file_status_): New data member.
3683 (Sized_incremental_binary::main_symtab_loc_): New data member.
3684 (Sized_incremental_binary::main_strtab_loc_): New data member.
3685 * output.cc (Output_data_got::Got_entry::write): Add case
3686 RESERVED_CODE.
3687 (Output_data_got::add_global): Call add_got_entry.
3688 (Output_data_got::add_global_plt): Likewise.
3689 (Output_data_got::add_global_with_rel): Likewise.
3690 (Output_data_got::add_global_with_rela): Likewise.
3691 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3692 (Output_data_got::add_global_pair_with_rela): Likewise.
3693 (Output_data_got::add_local): Call add_got_entry.
3694 (Output_data_got::add_local_plt): Likewise.
3695 (Output_data_got::add_local_with_rel): Likewise.
3696 (Output_data_got::add_local_with_rela): Likewise.
3697 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3698 (Output_data_got::add_local_pair_with_rela): Likewise.
3699 (Output_data_got::reserve_slot): New function.
3700 (Output_data_got::reserve_slot_for_global): New function.
3701 (Output_data_got::add_got_entry): New function.
3702 (Output_data_got::add_got_entry_pair): New function.
3703 (Output_section::add_output_section_data): Edit FIXME.
3704 * output.h
3705 (Output_section_data_build::Output_section_data_build): New
3706 constructor with size parameter.
3707 (Output_data_space::Output_data_space): Likewise.
3708 (Output_data_got::Output_data_got): Initialize new data member; new
3709 constructor with size parameter.
3710 (Output_data_got::add_constant): Call add_got_entry.
3711 (Output_data_got::reserve_slot): New function.
3712 (Output_data_got::reserve_slot_for_global): New function.
3713 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3714 (Output_data_got::add_got_entry): New function.
3715 (Output_data_got::add_got_entry_pair): New function.
3716 (Output_data_got::free_list_): New data member.
3717 * target.h (Sized_target::init_got_plt_for_update): New function.
3718 (Sized_target::register_global_plt_entry): New function.
3719 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3720 Initialize new data member; call init; add constructor with PLT count.
3721 (Output_data_plt_x86_64::init): New function.
3722 (Output_data_plt_x86_64::add_relocation): New function.
3723 (Output_data_plt_x86_64::reserve_slot): New function.
3724 (Output_data_plt_x86_64::free_list_): New data member.
3725 (Target_x86_64::init_got_plt_for_update): New function.
3726 (Target_x86_64::register_global_plt_entry): New function.
3727 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3728 incremental updates.
3729 (Output_data_plt_x86_64::add_relocation): New function.
3730 * testsuite/object_unittest.cc (Object_test): Set default options.
3731
3732 2011-05-16 Ian Lance Taylor <iant@google.com>
3733
3734 * options.h (class General_options): Make -i a synonym for -r.
3735
3736 2011-05-16 Ian Lance Taylor <iant@google.com>
3737
3738 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3739
3740 2011-05-10 Cary Coutant <ccoutant@google.com>
3741
3742 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3743 strip_all (-s).
3744
3745 2011-05-06 Ian Lance Taylor <iant@google.com>
3746
3747 * layout.cc (Layout::layout): If the output section flags change,
3748 update the ordering.
3749
3750 2011-04-25 Cary Coutant <ccoutant@google.com>
3751
3752 * incremental-dump.cc (dump_incremental_inputs): Print local
3753 symbol info for each input file.
3754 * incremental.cc
3755 (Output_section_incremental_inputs::set_final_data_size): Add local
3756 symbol info to input file entries in incremental info.
3757 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3758 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3759 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3760 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3761 implementation.
3762 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3763 (Sized_incr_relobj::do_relocate): Write the local symbols.
3764 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3765 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3766 Adjust size of input file header.
3767 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3768 (Incremental_inputs_reader::get_local_symbol_count): New function.
3769 (Incremental_inputs_reader::get_input_section): Adjust size of input
3770 file header.
3771 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3772 (Sized_incr_relobj::This): New typedef.
3773 (Sized_incr_relobj::sym_size): New const data member.
3774 (Sized_incr_relobj::Local_symbol): New struct.
3775 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3776 (Sized_incr_relobj::do_local_symbol_offset): New function.
3777 (Sized_incr_relobj::local_symbol_count_): New data member.
3778 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3779 (Sized_incr_relobj::local_symbol_index_): New data member.
3780 (Sized_incr_relobj::local_symbol_offset_): New data member.
3781 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3782 (Sized_incr_relobj::local_symbols_): New data member.
3783 * object.h (Relobj::output_local_symbol_count): New function.
3784 (Relobj::local_symbol_offset): New function.
3785 (Relobj::do_output_local_symbol_count): New function.
3786 (Relobj::do_local_symbol_offset): New function.
3787 (Sized_relobj::do_output_local_symbol_count): New function.
3788 (Sized_relobj::do_local_symbol_offset): New function.
3789
3790 2011-04-22 Vladimir Simonov <sv@sw.ru>
3791
3792 * descriptors.cc (set_close_on_exec): New function.
3793 (Descriptors::open): Use set_close_on_exec.
3794 * output.cc (S_ISLNK): Define if not defined.
3795
3796 2011-04-22 Cary Coutant <ccoutant@google.com>
3797
3798 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3799 global symbol map.
3800 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3801 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3802 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3803 relocations.
3804 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3805 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3806 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3807 * incremental.h
3808 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3809 function.
3810 (Incremental_binary::apply_incremental_relocs): New function.
3811 (Incremental_binary::do_apply_incremental_relocs): New function.
3812 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3813 data member.
3814 (Sized_incremental_binary::add_global_symbol): New function.
3815 (Sized_incremental_binary::global_symbol): New function.
3816 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3817 (Sized_incremental_binary::symbol_map_): New data member.
3818 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3819 * target.h (Sized_target::apply_relocation): New function.
3820 * target-reloc.h (apply_relocation): New function.
3821 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3822
3823 2011-04-22 Doug Kwan <dougkwan@google.com>
3824
3825 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3826 flag of a SHT_ARM_EXIDX section.
3827 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3828 * testsuite/Makefile.in: Regenerate.
3829 * testsuite/arm_exidx_test.s: New file.
3830 * testsuite/arm_exidx_test.sh: Same.
3831
3832 2011-04-20 Cary Coutant <ccoutant@google.com>
3833
3834 PR gold/12689
3835 * archive.h (Incremental_archive_entry::Archive_member):
3836 Initialize arg_serial_ (second constructor).
3837
3838 2011-04-17 Ian Lance Taylor <iant@google.com>
3839
3840 * object.cc (Relocate_info::location): Simplify location string.
3841 * errors.cc (Errors::error_at_location): Don't print program
3842 name.
3843 (Errors::warning_at_location): Likewise.
3844 (Errors::undefined_symbol): Likewise.
3845 * testsuite/debug_msg.sh: Update accordingly.
3846
3847 2011-04-14 Cary Coutant <ccoutant@google.com>
3848
3849 * gold/layout.cc (Layout::symtab_section_offset): New function.
3850 * gold/layout.h (Layout::symtab_section_offset): New function.
3851 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3852
3853 2011-04-12 Ian Lance Taylor <iant@google.com>
3854
3855 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3856 with MREMAP_MAYMOVE.
3857 * output.h (class Output_file): Add map_is_allocated_ field.
3858 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3859 not available, provide stubs. If mremap is not available, #define
3860 it to gold_mremap.
3861 (MREMAP_MAYMOVE): Define if not defined.
3862 (Output_file::Output_file): Initialize map_is_allocated_.
3863 (Output_file::resize): Check map_is_allocated_.
3864 (Output_file::map_anonymous): If mmap fails, use malloc.
3865 (Output_file::unmap): Don't do anything for an anonymous map.
3866 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3867 is not available, provide stubs.
3868 (File_read::View::~View): Use free rather than delete[].
3869 (File_read::make_view): Use malloc rather than new[]. If mmap
3870 fails, use malloc.
3871 (File_read::find_or_make_view): Use malloc rather than new[].
3872 * gold.h: Remove HAVE_REMAP code.
3873 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3874 exists. Rename mremap to gold_mremap. If mmap is not available
3875 don't do anything.
3876 * configure, config.in: Rebuild.
3877
3878 2011-04-11 Ian Lance Taylor <iant@google.com>
3879
3880 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3881 initialize local variable v.
3882
3883 2011-04-11 Cary Coutant <ccoutant@google.com>
3884
3885 * archive.cc (Archive::include_member): Adjust call to
3886 report_object.
3887 (Add_archive_symbols::run): Track argument serial numbers.
3888 (Lib_group::include_member): Likewise.
3889 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3890 * archive.h (Incremental_archive_entry::Archive_member):
3891 Initialize arg_serial_.
3892 (Archive_member::arg_serial_): New data member.
3893 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3894 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3895 incremental link.
3896 (Sized_dynobj::do_for_all_local_got_entries): New function.
3897 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3898 function.
3899 * fileread.cc (get_mtime): New function.
3900 * fileread.h (get_mtime): New function.
3901 * gold.cc (queue_initial_tasks): Check for incremental update.
3902 (process_incremental_input): New function.
3903 (queue_middle_tasks): Don't force valid target for incremental
3904 update.
3905 * incremental-dump.cc (find_input_containing_global): Adjust
3906 size of symbol info entry.
3907 (dump_incremental_inputs): Dump argument serial number and
3908 in_system_directory flag; bias shndx by 1; print symbol names
3909 when dumping per-file symbol lists; use new symbol info readers.
3910 * incremental.cc
3911 (Output_section_incremental_inputs:update_data_size): New function.
3912 (Sized_incremental_binary::setup_readers): Setup input readers
3913 for each input file; build maps for files added from libraries
3914 and scripts.
3915 (Sized_incremental_binary::check_input_args): New function.
3916 (Sized_incremental_binary::do_check_inputs): Build map of argument
3917 serial numbers to input arguments.
3918 (Sized_incremental_binary::do_file_has_changed): Rename
3919 do_file_is_unchanged to this; compare file modification times.
3920 (Sized_incremental_binary::do_init_layout): New function.
3921 (Sized_incremental_binary::do_reserve_layout): New function.
3922 (Sized_incremental_binary::do_get_input_reader): Remove.
3923 (Sized_incremental_binary::get_symtab_view): New function.
3924 (Incremental_checker::can_incrementally_link_output_file): Remove.
3925 (Incremental_inputs::report_command_line): Exclude --debug options.
3926 (Incremental_inputs::report_archive_begin): Add parameter; track
3927 argument serial numbers; don't put input file entry for archive
3928 before archive members.
3929 (Incremental_inputs::report_archive_end): Put input file entry
3930 for archive after archive members.
3931 (Incremental_inputs::report_object): Add parameter; track argument
3932 serial numbers and in_system_directory flag.
3933 (Incremental_inputs::report_script): Add parameter; track argument
3934 serial numbers.
3935 (Output_section_incremental_inputs::set_final_data_size): Adjust
3936 size of symbol info entry; check for forwarding symbols.
3937 (Output_section_incremental_inputs::write_input_files): Write
3938 in_system_directory flag and argument serial number.
3939 (Output_section_incremental_inputs::write_info_blocks): Map section
3940 indices between incremental info and original input file; store
3941 input section index for each symbol.
3942 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3943 change operator() to visit().
3944 (class Global_got_offset_visitor): Likewise.
3945 (class Global_symbol_visitor_got_plt):
3946 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3947 classes.
3948 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3949 (Sized_incr_relobj::do_read_symbols): New function.
3950 (Sized_incr_relobj::do_layout): New function.
3951 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3952 (Sized_incr_relobj::do_add_symbols): New function.
3953 (Sized_incr_relobj::do_should_include_member): New function.
3954 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3955 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3956 (Sized_incr_relobj::do_section_size): New function.
3957 (Sized_incr_relobj::do_section_name): New function.
3958 (Sized_incr_relobj::do_section_contents): New function.
3959 (Sized_incr_relobj::do_section_flags): New function.
3960 (Sized_incr_relobj::do_section_entsize): New function.
3961 (Sized_incr_relobj::do_section_address): New function.
3962 (Sized_incr_relobj::do_section_type): New function.
3963 (Sized_incr_relobj::do_section_link): New function.
3964 (Sized_incr_relobj::do_section_info): New function.
3965 (Sized_incr_relobj::do_section_addralign): New function.
3966 (Sized_incr_relobj::do_initialize_xindex): New function.
3967 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3968 (Sized_incr_relobj::do_read_relocs): New function.
3969 (Sized_incr_relobj::do_gc_process_relocs): New function.
3970 (Sized_incr_relobj::do_scan_relocs): New function.
3971 (Sized_incr_relobj::do_count_local_symbols): New function.
3972 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3973 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3974 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3975 (Sized_incr_relobj::do_relocate): New function.
3976 (Sized_incr_relobj::do_set_section_offset): New function.
3977 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3978 (Sized_incr_dynobj::do_read_symbols): New function.
3979 (Sized_incr_dynobj::do_layout): New function.
3980 (Sized_incr_dynobj::do_add_symbols): New function.
3981 (Sized_incr_dynobj::do_should_include_member): New function.
3982 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3983 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3984 (Sized_incr_dynobj::do_section_size): New function.
3985 (Sized_incr_dynobj::do_section_name): New function.
3986 (Sized_incr_dynobj::do_section_contents): New function.
3987 (Sized_incr_dynobj::do_section_flags): New function.
3988 (Sized_incr_dynobj::do_section_entsize): New function.
3989 (Sized_incr_dynobj::do_section_address): New function.
3990 (Sized_incr_dynobj::do_section_type): New function.
3991 (Sized_incr_dynobj::do_section_link): New function.
3992 (Sized_incr_dynobj::do_section_info): New function.
3993 (Sized_incr_dynobj::do_section_addralign): New function.
3994 (Sized_incr_dynobj::do_initialize_xindex): New function.
3995 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3996 (make_sized_incremental_object): New function.
3997 (Incremental_library::copy_unused_symbols): New function.
3998 (Incremental_library::do_for_all_unused_symbols): New function.
3999 * incremental.h (enum Incremental_input_flags): New type.
4000 (class Incremental_checker): Remove.
4001 (Incremental_input_entry::Incremental_input_entry): Add argument
4002 serial number.
4003 (Incremental_input_entry::arg_serial): New function.
4004 (Incremental_input_entry::set_is_in_system_directory): New function.
4005 (Incremental_input_entry::is_in_system_directory): New function.
4006 (Incremental_input_entry::arg_serial_): New data member.
4007 (Incremental_input_entry::is_in_system_directory_): New data member.
4008 (class Script_info): Move here from script.h.
4009 (Script_info::Script_info): Add filename parameter.
4010 (Script_info::filename): New function.
4011 (Script_info::filename_): New data member.
4012 (Incremental_script_entry::Incremental_script_entry): Add argument
4013 serial number.
4014 (Incremental_object_entry::Incremental_object_entry): Likewise.
4015 (Incremental_object_entry::add_input_section): Build list of input
4016 sections with map to original shndx.
4017 (Incremental_object_entry::get_input_section_index): New function.
4018 (Incremental_object_entry::shndx_): New data member.
4019 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4020 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4021 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4022 serial number.
4023 (Incremental_inputs::report_archive_begin): Likewise.
4024 (Incremental_inputs::report_object): Likewise.
4025 (Incremental_inputs::report_script): Likewise.
4026 (class Incremental_global_symbol_reader): New class.
4027 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4028 and store flags and input file type.
4029 (Incremental_input_entry_reader::arg_serial): New function.
4030 (Incremental_input_entry_reader::type): Extract type from flags.
4031 (Incremental_input_entry_reader::is_in_system_directory): New function.
4032 (Incremental_input_entry_reader::get_input_section_count): Call
4033 accessor function for type.
4034 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4035 function for type; adjust size of global symbol entry.
4036 (Incremental_input_entry_reader::get_global_symbol_count): Call
4037 accessor function for type.
4038 (Incremental_input_entry_reader::get_object_count): Likewise.
4039 (Incremental_input_entry_reader::get_object_offset): Likewise.
4040 (Incremental_input_entry_reader::get_member_count): Likewise.
4041 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4042 (Incremental_input_entry_reader::get_member_offset): Likewise.
4043 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4044 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4045 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4046 (Incremental_input_entry_reader::get_global_symbol_reader): New
4047 function.
4048 (Incremental_input_entry_reader::get_output_symbol_index): New
4049 function.
4050 (Incremental_input_entry_reader::type_): Remove.
4051 (Incremental_input_entry_reader::flags_): New data member.
4052 (Incremental_inputs_reader::input_file_offset): New function.
4053 (Incremental_inputs_reader::input_file_index): New function.
4054 (Incremental_inputs_reader::input_file): Call input_file_offset.
4055 (Incremental_inputs_reader::input_file_at_offset): New function.
4056 (Incremental_relocs_reader::get_r_type): Reformat.
4057 (Incremental_relocs_reader::get_r_shndx): Reformat.
4058 (Incremental_relocs_reader::get_r_offset): Reformat.
4059 (Incremental_relocs_reader::data): New function.
4060 (Incremental_binary::Incremental_binary): Initialize new data members.
4061 (Incremental_binary::check_inputs): Add cmdline parameter.
4062 (Incremental_binary::file_is_unchanged): Remove.
4063 (Input_reader::arg_serial): New function.
4064 (Input_reader::get_unused_symbol_count): New function.
4065 (Input_reader::get_unused_symbol): New function.
4066 (Input_reader::do_arg_serial): New function.
4067 (Input_reader::do_get_unused_symbol_count): New function.
4068 (Input_reader::do_get_unused_symbol): New function.
4069 (Incremental_binary::input_file_count): New function.
4070 (Incremental_binary::get_input_reader): Change signature to use
4071 index instead of filename.
4072 (Incremental_binary::file_has_changed): New function.
4073 (Incremental_binary::get_input_argument): New function.
4074 (Incremental_binary::get_library): New function.
4075 (Incremental_binary::get_script_info): New function.
4076 (Incremental_binary::init_layout): New function.
4077 (Incremental_binary::reserve_layout): New function.
4078 (Incremental_binary::output_file): New function.
4079 (Incremental_binary::do_check_inputs): New function.
4080 (Incremental_binary::do_file_is_unchanged): Remove.
4081 (Incremental_binary::do_file_has_changed): New function.
4082 (Incremental_binary::do_init_layout): New function.
4083 (Incremental_binary::do_reserve_layout): New function.
4084 (Incremental_binary::do_input_file_count): New function.
4085 (Incremental_binary::do_get_input_reader): Change signature.
4086 (Incremental_binary::input_args_map_): New data member.
4087 (Incremental_binary::library_map_): New data member.
4088 (Incremental_binary::script_map_): New data member.
4089 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4090 new data members.
4091 (Sized_incremental_binary::output_section): New function.
4092 (Sized_incremental_binary::inputs_reader): Add const.
4093 (Sized_incremental_binary::symtab_reader): Add const.
4094 (Sized_incremental_binary::relocs_reader): Add const.
4095 (Sized_incremental_binary::got_plt_reader): Add const.
4096 (Sized_incremental_binary::get_symtab_view): New function.
4097 (Sized_incremental_binary::Inputs_reader): New typedef.
4098 (Sized_incremental_binary::Input_entry_reader): New typedef.
4099 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4100 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4101 (Sized_incremental_binary::do_file_has_changed): New function.
4102 (Sized_incremental_binary::do_init_layout): New function.
4103 (Sized_incremental_binary::do_reserve_layout): New function.
4104 (Sized_input_reader::Inputs_reader): Remove.
4105 (Sized_input_reader::Input_entry_reader): Remove.
4106 (Sized_input_reader::do_arg_serial): New function.
4107 (Sized_input_reader::do_get_unused_symbol_count): New function.
4108 (Sized_input_reader::do_get_unused_symbol): New function.
4109 (Sized_incremental_binary::do_input_file_count): New function.
4110 (Sized_incremental_binary::do_get_input_reader): Change signature;
4111 use index instead of filename.
4112 (Sized_incremental_binary::section_map_): New data member.
4113 (Sized_incremental_binary::input_entry_readers_): New data member.
4114 (class Sized_incr_relobj): New class.
4115 (class Sized_incr_dynobj): New class.
4116 (make_sized_incremental_object): New function.
4117 (class Incremental_library): New class.
4118 * layout.cc (Free_list::num_lists): New static data member.
4119 (Free_list::num_nodes): New static data member.
4120 (Free_list::num_removes): New static data member.
4121 (Free_list::num_remove_visits): New static data member.
4122 (Free_list::num_allocates): New static data member.
4123 (Free_list::num_allocate_visits): New static data member.
4124 (Free_list::init): New function.
4125 (Free_list::remove): New function.
4126 (Free_list::allocate): New function.
4127 (Free_list::dump): New function.
4128 (Free_list::print_stats): New function.
4129 (Layout_task_runner::run): Resize output file for incremental updates.
4130 (Layout::Layout): Initialize new data members.
4131 (Layout::set_incremental_base): New function.
4132 (Layout::init_fixed_output_section): New function.
4133 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4134 incremental updates.
4135 (Layout::create_gold_note): Do not create gold note section for
4136 incremental updates.
4137 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4138 for incremental updates.
4139 (Layout::set_section_offsets): For incremental updates, allocate space
4140 from free list.
4141 (Layout::create_symtab_sections): Layout with offsets relative to
4142 start of section; for incremental updates, allocate space from free
4143 list.
4144 (Layout::create_shdrs): For incremental updates, allocate space from
4145 free list.
4146 (Layout::finish_dynamic_section): For incremental updates, do not
4147 check --as-needed (fixed in subsequent patch).
4148 * layout.h (class Free_list): New class.
4149 (Layout::set_incremental_base): New function.
4150 (Layout::incremental_base): New function.
4151 (Layout::init_fixed_output_section): New function.
4152 (Layout::allocate): New function.
4153 (Layout::incremental_base_): New data member.
4154 (Layout::free_list_): New data member.
4155 * main.cc (main): Print Free_list statistics.
4156 * object.cc (Relobj::finalize_incremental_relocs): Add
4157 clear_counts parameter; clear counts only when clear_counts is set.
4158 (Sized_relobj::Sized_relobj): Initialize new base class.
4159 (Sized_relobj::do_layout): Don't report special sections.
4160 (Sized_relobj::do_for_all_local_got_entries): New function.
4161 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4162 symtab_off to all symbol table offsets.
4163 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4164 * object.h (class Got_offset_list): Move to top of file.
4165 (Object::Object): Allow case where input_file == NULL.
4166 (Object::~Object): Likewise.
4167 (Object::input_file): Assert that input_file != NULL.
4168 (Object::lock): Allow case where input_file == NULL.
4169 (Object::unlock): Likewise.
4170 (Object::is_locked): Likewise.
4171 (Object::token): Likewise.
4172 (Object::release): Likewise.
4173 (Object::is_incremental): New function.
4174 (Object::get_mtime): New function.
4175 (Object::for_all_local_got_entries): New function.
4176 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4177 (Object::set_is_in_system_directory): New function.
4178 (Object::is_in_system_directory): New function.
4179 (Object::do_is_incremental): New function.
4180 (Object::do_get_mtime): New function.
4181 (Object::do_for_all_local_got_entries): New function.
4182 (Object::is_in_system_directory_): New data member.
4183 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4184 (class Sized_relobj_base): New class.
4185 (class Sized_relobj): Derive from Sized_relobj_base.
4186 (class Sized_relobj::Symbols): Redeclare from base class.
4187 (class Sized_relobj::local_got_offset_list): Remove.
4188 (class Sized_relobj::Output_sections): Redeclare from base class.
4189 (class Sized_relobj::do_for_all_local_got_entries): New function.
4190 (class Sized_relobj::write_local_symbols): Add offset parameter.
4191 (class Sized_relobj::local_symbol_offset_): Update comment.
4192 (class Sized_relobj::local_dynsym_offset_): Update comment.
4193 * options.cc (Input_arguments::add_file): Remove const.
4194 * options.h (Input_file_argument::Input_file_argument):
4195 Initialize arg_serial_ (all constructors).
4196 (Input_file_argument::set_arg_serial): New function.
4197 (Input_file_argument::arg_serial): New function.
4198 (Input_file_argument::arg_serial_): New data member.
4199 (Input_arguments::Input_arguments): Initialize file_count_.
4200 (Input_arguments::add_file): Remove const.
4201 (Input_arguments::number_of_input_files): New function.
4202 (Input_arguments::file_count_): New data member.
4203 (Command_line::number_of_input_files): Call
4204 Input_arguments::number_of_input_files.
4205 * output.cc (Output_segment_headers::Output_segment_headers):
4206 Set current size.
4207 (Output_section::Input_section::current_data_size): New function.
4208 (Output_section::Output_section): Initialize new data members.
4209 (Output_section::add_input_section): Don't do merge sections for
4210 an incremental link; allocate space from free list for an
4211 incremental update.
4212 (Output_section::add_output_section_data): Allocate space from
4213 free list for an incremental update.
4214 (Output_section::update_data_size): New function.
4215 (Output_section::set_fixed_layout): New function.
4216 (Output_section::reserve): New function.
4217 (Output_segment::set_section_addresses): Remove const.
4218 (Output_segment::set_section_list_addresses): Remove const; allocate
4219 space from free list for an incremental update.
4220 (Output_segment::set_offset): Adjust size of RELRO segment for an
4221 incremental update.
4222 * output.h (Output_data::current_data_size): Move here from
4223 child classes.
4224 (Output_data::pre_finalize_data_size): New function.
4225 (Output_data::update_data_size): New function.
4226 (Output_section_headers::update_data_size): new function.
4227 (Output_section_data_build::current_data_size): Move to Output_data.
4228 (Output_data_strtab::update_data_size): New function.
4229 (Output_section::current_data_size): Move to Output_data.
4230 (Output_section::set_fixed_layout): New function.
4231 (Output_section::has_fixed_layout): New function.
4232 (Output_section::reserve): New function.
4233 (Output_section::update_data_size): New function.
4234 (Output_section::has_fixed_layout_): New data member.
4235 (Output_section::free_list_): New data member.
4236 (Output_segment::set_section_addresses): Remove const.
4237 (Output_segment::set_section_list_addresses): Remove const.
4238 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4239 New function.
4240 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4241 New function.
4242 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4243 parameter when calling Add_symbols constructor; store argument
4244 serial number for members of a lib group.
4245 (Add_symbols::locks): Allow case where token == NULL.
4246 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4247 (Read_member::~Read_member): New function.
4248 (Read_member::is_runnable): New function.
4249 (Read_member::locks): New function.
4250 (Read_member::run): New function.
4251 (Check_script::~Check_script): New function.
4252 (Check_script::is_runnable): New function.
4253 (Check_script::locks): New function.
4254 (Check_script::run): New function.
4255 (Check_library::~Check_library): New function.
4256 (Check_library::is_runnable): New function.
4257 (Check_library::locks): New function.
4258 (Check_library::run): New function.
4259 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4260 (Add_symbols::library_): New data member.
4261 (class Read_member): New class.
4262 (class Check_script): New class.
4263 (class Check_library): New class.
4264 * reloc.cc (Read_relocs::is_runnable): Allow case where
4265 token == NULL.
4266 (Read_relocs::locks): Likewise.
4267 (Scan_relocs::locks): Likewise.
4268 (Relocate_task::locks): Likewise.
4269 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4270 to clear counters.
4271 (Sized_relobj::incremental_relocs_scan): Fix comment.
4272 (Sized_relobj::do_relocate): Pass output file offset to
4273 write_local_symbols.
4274 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4275 from class declaration.
4276 * script.cc (read_input_script): Allocate Script_info; pass
4277 argument serial number to report_script.
4278 * script.h (class Script_info): Move to incremental.h.
4279 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4280 * symtab.h (Symbol_table::add_from_incrobj): New function.
4281 (Symbol_table::set_file_offset): New function.
4282
4283 2011-04-05 Cary Coutant <ccoutant@google.com>
4284
4285 * incremental-dump.cc (dump_incremental_inputs): Change signature
4286 to take a Sized_incremental_binary; change caller. Use readers
4287 in Sized_incremental_binary.
4288 * incremental.cc
4289 (Sized_incremental_binary::find_incremental_inputs_sections):
4290 Rename do_find_incremental_inputs_sections to this.
4291 (Sized_incremental_binary::setup_readers): New function.
4292 (Sized_incremental_binary::do_check_inputs): Check
4293 has_incremental_info_ flag; move setup code to setup_readers;
4294 use input readers.
4295 (Sized_incremental_binary::do_file_is_unchanged): New function.
4296 (Sized_incremental_binary::do_get_input_reader): New function.
4297 * incremental.h (class Incremental_binary): Move to end of file.
4298 (Incremental_binary::file_is_unchanged): New function.
4299 (Incremental_binary::do_file_is_unchanged): New function.
4300 (Incremental_binary::Input_reader): New class.
4301 (Incremental_binary::get_input_reader): New function.
4302 (class Sized_incremental_binary): Move to end of file.
4303 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4304 input section reader classes.
4305 (Sized_incremental_binary::has_incremental_info): New function.
4306 (Sized_incremental_binary::inputs_reader): New function.
4307 (Sized_incremental_binary::symtab_reader): New function.
4308 (Sized_incremental_binary::relocs_reader): New function.
4309 (Sized_incremental_binary::got_plt_reader): New function.
4310 (Sized_incremental_binary::do_file_is_unchanged): New function.
4311 (Sized_incremental_binary::Sized_input_reader): New class.
4312 (Sized_incremental_binary::get_input_reader): New function.
4313 (Sized_incremental_binary::find_incremental_inputs_sections):
4314 Rename do_find_incremental_inputs_sections to this.
4315 (Sized_incremental_binary::setup_readers): New function.
4316 (Sized_incremental_binary::has_incremental_info_): New data member.
4317 (Sized_incremental_binary::inputs_reader_): New data member.
4318 (Sized_incremental_binary::symtab_reader_): New data member.
4319 (Sized_incremental_binary::relocs_reader_): New data member.
4320 (Sized_incremental_binary::got_plt_reader_): New data member.
4321 (Sized_incremental_binary::current_input_file_): New data member.
4322
4323 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4324
4325 PR gold/12640
4326 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4327 violation.
4328
4329 2011-03-30 Cary Coutant <ccoutant@google.com>
4330
4331 * archive.cc (Archive::include_member): Adjust call to report_object.
4332 (Add_archive_symbols::run): Add script_info to call to
4333 report_archive_begin.
4334 (Lib_group::include_member): Adjust call to report_object.
4335 (Add_lib_group_symbols::run): Adjust call to report_object.
4336 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4337 blocks. Add object count for script input files.
4338 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4339 script_info parameter; change all callers.
4340 (Incremental_inputs::report_object): Add script_info parameter;
4341 change all callers.
4342 (Incremental_inputs::report_script): Store backpointer to
4343 incremental info entry.
4344 (Output_section_incremental_inputs::set_final_data_size): Record
4345 additional information for scripts.
4346 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4347 * incremental.h (Incremental_script_entry::add_object): New function.
4348 (Incremental_script_entry::get_object_count): New function.
4349 (Incremental_script_entry::get_object): New function.
4350 (Incremental_script_entry::objects_): New data member; adjust
4351 constructor.
4352 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4353 (Incremental_inputs::report_object): Add script_info parameter.
4354 (Incremental_inputs_reader::get_object_count): New function.
4355 (Incremental_inputs_reader::get_object_offset): New function.
4356 * options.cc (Input_arguments::add_file): Return reference to
4357 new input argument.
4358 * options.h (Input_argument::set_script_info): New function.
4359 (Input_argument::script_info): New function.
4360 (Input_argument::script_info_): New data member; adjust all
4361 constructors.
4362 (Input_file_group::add_file): Return reference to new input argument.
4363 (Input_file_lib::add_file): Likewise.
4364 (Input_arguments::add_file): Likewise.
4365 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4366 * script.cc (Parser_closure::Parser_closure): Add script_info
4367 parameter; adjust all callers.
4368 (Parser_closure::script_info): New function.
4369 (Parser_closure::script_info_): New data member.
4370 (read_input_script): Report scripts earlier to incremental info.
4371 (script_add_file): Set script_info in Input_argument.
4372 (script_add_library): Likewise.
4373 * script.h (Script_options::Script_info): Rewrite class.
4374
4375 2011-03-29 Cary Coutant <ccoutant@google.com>
4376
4377 * archive.cc (Library_base::should_include_member): Move
4378 method here from class Archive.
4379 (Archive::Archive): Initialize base class.
4380 (Archive::should_include_member): Move to base class.
4381 (Archive::do_for_all_unused_symbols): New function.
4382 (Add_archive_symbols::run): Remove redundant access to
4383 incremental_inputs.
4384 (Lib_group::Lib_group): Initialize base class.
4385 (Lib_group::do_filename): New function.
4386 (Lib_group::include_member): Pass pointer to Lib_group to
4387 report_object.
4388 (Lib_group::do_for_all_unused_symbols): New function.
4389 (Add_lib_group_symbols::run): Report archive information for
4390 incremental links.
4391 * archive.h (class Library_base): New base class.
4392 (class Archive): Derive from Library_base.
4393 (Archive::filename): Move to base class.
4394 (Archive::set_incremental_info): Likewise.
4395 (Archive::incremental_info): Likewise.
4396 (Archive::Should_include): Likewise.
4397 (Archive::should_include_member): Likewise.
4398 (Archive::Armap_entry): Remove.
4399 (Archive::Unused_symbol_iterator): Remove.
4400 (Archive::unused_symbols_begin): Remove.
4401 (Archive::unused_symbols_end): Remove.
4402 (Archive::do_filename): New function.
4403 (Archive::do_get_mtime): New function.
4404 (Archive::do_for_all_unused_symbols): New function.
4405 (Archive::task_): Move to base class.
4406 (Archive::incremental_info_): Likewise.
4407 (class Lib_group): Derive from Library_base.
4408 (Lib_group::do_filename): New function.
4409 (Lib_group::do_get_mtime): New function.
4410 (Lib_group::do_for_all_unused_symbols): New function.
4411 (Lib_group::task_): Move to base class.
4412 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4413 function.
4414 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4415 function.
4416 * incremental.cc (Incremental_inputs::report_archive_begin):
4417 Use Library_base; call library's get_mtime; add incremental inputs
4418 entry before members.
4419 (class Unused_symbol_visitor): New class.
4420 (Incremental_inputs::report_archive_end): Use Library_base; use
4421 visitor class to record unused symbols; don't add incremental inputs
4422 entry after members.
4423 (Incremental_inputs::report_object): Use Library_base.
4424 * incremental.h
4425 (Incremental_archive_entry::Incremental_archive_entry): Remove
4426 unused Archive parameter.
4427 (Incremental_inputs::report_archive_begin): Use Library_base.
4428 (Incremental_inputs::report_archive_end): Likewise.
4429 (Incremental_inputs::report_object): Likewise.
4430 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4431 function.
4432 * object.h (Object::for_all_global_symbols): New function.
4433 (Object::do_for_all_global_symbols): New function.
4434 (Sized_relobj::do_for_all_global_symbols): New function.
4435 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4436 function.
4437 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4438 function.
4439
4440 2011-03-27 Ian Lance Taylor <iant@google.com>
4441
4442 * archive.cc (Archive::interpret_header): Return -1 if something
4443 goes wrong. Change callers accordingly.
4444
4445 2011-03-25 Cary Coutant <ccoutant@google.com>
4446
4447 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4448 * testsuite/Makefile.in: Regenerate.
4449
4450 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4451
4452 * plugin.cc (get_view): New.
4453 (Plugin::load): Pass get_view to the plugin.
4454 (Plugin_manager::get_view): New.
4455
4456 2011-03-21 Ian Lance Taylor <iant@google.com>
4457
4458 * testsuite/final_layout.sh: Rewrite to not use dc.
4459 * testsuite/relro_test.sh: Fail if dc is not present.
4460
4461 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4462
4463 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4464 Change == to -eq.
4465 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4466 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4467 Change == to -eq.
4468 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4469 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4470
4471 2011-03-14 Ian Lance Taylor <iant@google.com>
4472
4473 * script-sections.cc (Sort_output_sections::script_compare):
4474 Rename from is_before, change return type.
4475 (Sort_output_sections::operator()): Adjust accordingly.
4476
4477 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4478
4479 PR gold/12572
4480 * testsuite/odr_violation2.cc: Add comment to make all error line
4481 numbers double digits.
4482 * testsuite/debug_msg.sh: Adjust expected errors.
4483
4484 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4485
4486 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4487 but mark earlier ones as non-canonical
4488 (offset_to_iterator): Update search target and example
4489 (do_addr2line): Return extra lines in a vector*
4490 (format_file_lineno): Extract from do_addr2line
4491 (one_addr2line): Add vector* out-param
4492 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4493 when a lineno entry appeared last for its instruction
4494 (Dwarf_line_info): Add vector* out-param
4495 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4496 * symtab.cc (Odr_violation_compare): Include the lineno in the
4497 comparison again.
4498 (linenos_from_loc): New. Combine the canonical line for an
4499 address with its other lines.
4500 (True_if_intersect): New. Helper functor to make
4501 std::set_intersection a query.
4502 (detect_odr_violations): Compare sets of lines instead of just
4503 one line for each function. This became less deterministic, but
4504 has fewer false positives.
4505 * symtab.h: Declarations.
4506 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4507 mix an optimized and non-optimized object in the same binary
4508 (odr_violation2.so): Same.
4509 * testsuite/Makefile.in: Regenerate from Makefile.am.
4510 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4511 * testsuite/debug_msg.sh: Update line numbers and add
4512 assertions.
4513 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4514 non-optimized context.
4515 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4516 isn't inlined, and use OdrDerived in an optimized context.
4517 * testsuite/odr_header1.h: Defines OdrDerived, where
4518 optimization will change the
4519 first-instruction-in-the-destructor's file and line number.
4520 * testsuite/odr_header2.h: Defines OdrBase.
4521
4522 2011-03-09 Ian Lance Taylor <iant@google.com>
4523
4524 * fileread.cc (File_read::clear_views): Don't delete the whole
4525 file view.
4526
4527 2011-03-08 Ian Lance Taylor <iant@google.com>
4528
4529 PR gold/12525
4530 * fileread.cc: #include <climits>.
4531 (GOLD_IOV_MAX): Define.
4532 (File_read::read_multiple): Limit number of entries by iov_max.
4533 * fileread.h (class File_read): Always set max_readv_entries to
4534 128.
4535
4536 2011-03-07 Ian Lance Taylor <iant@google.com>
4537
4538 PR gold/12525
4539 * options.h (class General_options): Add -dy and -dn.
4540
4541 2011-03-02 Cary Coutant <ccoutant@google.com>
4542
4543 * testsuite/script_test_9.t: Add TLS segment.
4544
4545 2011-03-02 Simon Baldwin <simonb@google.com>
4546
4547 * configure.ac: Add check for gnu_indirect_function support in
4548 the toolchain building binutils.
4549 * configure: Rebuild.
4550
4551 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4552
4553 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4554 plugin only symbols.
4555 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4556 in plugin files as not needed in the symbol table.
4557
4558 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4559
4560 * output.cc (Output_section::add_input_section): Delay fill
4561 generation for section ordering.
4562
4563 2011-02-09 Ian Lance Taylor <iant@google.com>
4564
4565 PR gold/12316
4566 * object.h (class Sized_relobj): Remove clear_local_symbols.
4567 * reloc.cc (Sized_relobj::do_relocate): Don't call
4568 clear_local_symbols.
4569
4570 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4571
4572 * plugin.cc (is_visible_from_outside): Return true for symbols
4573 in the -u option.
4574
4575 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4576
4577 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4578 filename.
4579
4580 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4581
4582 * icf.h (is_section_foldable_candidate): Change type of parameter
4583 to std::string.
4584 * icf.cc (Icf::find_identical_sections): Change type of local variable
4585 section_name to be std::string.
4586 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4587
4588 2011-01-25 Ian Lance Taylor <iant@google.com>
4589
4590 * script.cc (script_add_extern): Rewrite to use
4591 add_symbol_reference.
4592
4593 2011-01-25 Doug Kwan <dougkwan@google.com>
4594
4595 * icf.cc (get_section_contents): Always lock section's object.
4596
4597 2011-01-24 Ian Lance Taylor <iant@google.com>
4598
4599 * options.h (class General_options): Accept
4600 --no-detect-odr-violations.
4601
4602 2011-01-24 Ian Lance Taylor <iant@google.com>
4603
4604 * version.cc (version_string): Bump to 1.11.
4605
4606 2011-01-24 Ian Lance Taylor <iant@google.com>
4607
4608 * plugin.cc (class Plugin_rescan): Define new class.
4609 (Plugin_manager::claim_file): Set any_claimed_.
4610 (Plugin_manager::save_archive): New function.
4611 (Plugin_manager::save_input_group): New function.
4612 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4613 necessary.
4614 (Plugin_manager::new_undefined_symbol): New function.
4615 (Plugin_manager::rescan): New function.
4616 (Plugin_manager::rescannable_defines): New function.
4617 (Plugin_manager::add_input_file): Set any_added_.
4618 * plugin.h (class Plugin_manager): define new fields rescannable_,
4619 undefined_symbols_, any_claimed_, and any_added_. Declare
4620 Plugin_rescan as friend. Declare new functions.
4621 (Plugin_manager::Rescannable): Define type.
4622 (Plugin_manager::Rescannable_list): Define type.
4623 (Plugin_manager::Undefined_symbol_list): Define type.
4624 (Plugin_manager::Plugin_manager): Initialize new fields.
4625 * archive.cc (Archive::defines_symbol): New function.
4626 (Add_archive_symbols::run): Pass archive to plugins if any.
4627 * archive.h (class Archive): Declare defines_symbol.
4628 * readsyms.cc (Input_group::~Input_group): New function.
4629 (Finish_group::run): Pass input_group to plugins if any.
4630 * readsyms.h (class Input_group): Declare destructor.
4631 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4632 any.
4633
4634 2011-01-10 Ian Lance Taylor <iant@google.com>
4635
4636 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4637 section as relro.
4638 (Layout::set_segment_offsets): Reset increase_relro before calling
4639 set_section_addresses a second time.
4640
4641 2011-01-04 Cary Coutant <ccoutant@google.com>
4642
4643 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4644 sections before NOBITS sections.
4645
4646 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4647
4648 * version.cc (print_version): Update copyright to 2011.
4649
4650 2010-12-23 Cary Coutant <ccoutant@google.com>
4651
4652 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4653 of OS to this->add. Add OD parameter to second form of the function.
4654
4655 2010-12-20 Ian Lance Taylor <iant@google.com>
4656
4657 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4658 second of two consecutive entries with same offset.
4659
4660 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4661
4662 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4663 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4664 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4665 to avoid unneeded links against $(LDADD).
4666 * testsuite/Makefile.in: Regenerate.
4667
4668 2010-12-15 Ian Lance Taylor <iant@google.com>
4669
4670 PR gold/12324
4671 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4672 for R_X86_64_32 and R_X86_64_PC32.
4673 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4674 ver_matching_def_pic.o.
4675 (ver_matching_def_pic.o): New target.
4676
4677 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4678
4679 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4680 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4681 Move definition before File_read::View member definitions.
4682 (File_read::View::~View): Initialize and hold lock before
4683 updating current_mapped_bytes.
4684
4685 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4686
4687 * dwarf_reader.cc: Remove outdated comment.
4688 * gold-threads.cc: Fix typo in error message.
4689 * archive.cc: Fix typos in comments.
4690 * archive.h: Likewise.
4691 * arm-reloc-property.cc: Likewise.
4692 * arm-reloc-property.h: Likewise.
4693 * arm-reloc.def: Likewise.
4694 * arm.cc: Likewise.
4695 * attributes.h: Likewise.
4696 * cref.cc: Likewise.
4697 * ehframe.cc: Likewise.
4698 * fileread.h: Likewise.
4699 * gold.h: Likewise.
4700 * i386.cc: Likewise.
4701 * icf.cc: Likewise.
4702 * incremental.h: Likewise.
4703 * int_encoding.cc: Likewise.
4704 * layout.h: Likewise.
4705 * main.cc: Likewise.
4706 * merge.h: Likewise.
4707 * object.cc: Likewise.
4708 * object.h: Likewise.
4709 * options.cc: Likewise.
4710 * readsyms.cc: Likewise.
4711 * reduced_debug_output.cc: Likewise.
4712 * reloc.cc: Likewise.
4713 * script-sections.cc: Likewise.
4714 * sparc.cc: Likewise.
4715 * symtab.h: Likewise.
4716 * target-reloc.h: Likewise.
4717 * target.cc: Likewise.
4718 * target.h: Likewise.
4719 * timer.cc: Likewise.
4720 * timer.h: Likewise.
4721 * x86_64.cc: Likewise.
4722
4723 2010-12-09 Cary Coutant <ccoutant@google.com>
4724
4725 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4726 stack.
4727 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4728 parameter; change all callers.
4729 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4730 * options.h (warn_execstack): New option.
4731
4732 2010-12-07 Doug Kwan <dougkwan@google.com>
4733
4734 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4735 like function call relocations.
4736
4737 2010-12-07 Ian Lance Taylor <iant@google.com>
4738
4739 * archive.cc (Archive::get_elf_object_for_member): Permit
4740 punconfigured to be NULL.
4741 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4742 (Archive::include_member): Pass NULL to get_elf_object_for_member
4743 if we searched for the archive and this is the first included
4744 object.
4745
4746 2010-12-01 Ian Lance Taylor <iant@google.com>
4747
4748 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4749 track_relocs_type_ field.
4750 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4751 Set track_relocs_type_.
4752 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4753 contents when using RELA relocs.
4754 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4755 reloc_map_.
4756 * reloc.cc (Track_relocs::next_addend): New function.
4757 * reloc.h (class Track_relocs): Declare next_addend.
4758
4759 2010-12-01 Ian Lance Taylor <iant@google.com>
4760
4761 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4762 virtual destructor.
4763
4764 2010-12-01 Ian Lance Taylor <iant@google.com>
4765
4766 * README: Update compilers known to work and fail.
4767
4768 2010-11-23 Matthias Klose <doko@ubuntu.com>
4769
4770 * configure.in: For --enable-gold, handle value `default' instead of
4771 `both*'. Always install ld as ld.bfd, install as ld if gold is
4772 not the default.
4773 * configure: Regenerate.
4774
4775 2010-11-18 Doug Kwan <dougkwan@google.com>
4776
4777 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4778 and right_alignment to be zero. Store result alignment only if it is
4779 greater than existing alignment.
4780
4781 2010-11-16 Cary Coutant <ccoutant@google.com>
4782
4783 PR gold/12220
4784 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4785 Check for ".zdebug_line".
4786
4787 2010-11-16 Doug Kwan <dougkwan@google.com>
4788 Cary Coutant <ccoutant@google.com>
4789
4790 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4791 by reference; adjust all callers.
4792 * output.cc (Output_segment::set_section_addresses): Adjust references
4793 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4794 list is empty.
4795 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4796 end at page boundary.
4797
4798 2010-11-16 Cary Coutant <ccoutant@google.com>
4799
4800 PR gold/12220
4801 * layout.cc (Layout::choose_output_section): Transform names of
4802 compressed sections even when using a script with a SECTIONS clause.
4803 (Layout::output_section_name): Remove code to transform
4804 compressed debug section names.
4805 * output.cc (Output_section::add_input_section): Use uncompressed
4806 section size when tracking input sections.
4807
4808 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4809
4810 * symtab.h (Symbol::NON_PIC_REF): Remove.
4811 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4812 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4813 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4814 (Symbol::use_plt_offset): Take a flags argument and pass it
4815 directly to needs_dynamic_reloc. Restrict check for undefined
4816 weak symbols to function calls.
4817 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4818 (Target_arm::Scan::global): Use it.
4819 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4820 (Target_arm::Relocate::relocate): Likewise.
4821 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4822 parameter with an r_type parameter. Use get_reference_flags
4823 to get the flags.
4824 (Target_arm::Relocate::relocate): Update accordingly.
4825 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4826 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4827 (Target_i386::Scan::global): Likewise.
4828 (Target_i386::Relocate::relocate): Likewise.
4829 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4830 parameter with an r_type parameter. Use get_reference_flags
4831 to get the flags.
4832 (Target_i386::Relocate::relocate): Update accordingly.
4833 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4834 (Target_powerpc::Scan::global): Use it.
4835 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4836 (Target_powerpc::Relocate::relocate): Likewise.
4837 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4838 (Target_sparc::Scan::global): Use it.
4839 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4840 (Target_sparc::Relocate::relocate): Likewise.
4841 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4842 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4843 (Target_x86_64::Scan::global): Likewise.
4844 (Target_x86_64::Relocate::relocate): Likewise.
4845
4846 2010-11-08 Doug Kwan <dougkwan@google.com>
4847 Cary Coutant <ccoutant@google.com>
4848
4849 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4850 (Arm_exidx_merge_section::section_contents_): New data member.
4851 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4852 (Arm_input_section::~Arm_input_section): De-allocate memory.
4853 (Arm_input_section::original_contents_): New data member.
4854 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4855 in parameters instead of calling Object::section_contents without
4856 locking.
4857 (Arm_output_section::group_section): New parameter TASK. Pass it
4858 to callees that need locking objects.
4859 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4860 to lock EXIDX input sections. Fix a formatting issue. Call
4861 Arm_exidx_merged_section::build_contents to create merged section
4862 contents.
4863 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4864 to lock object of stub table owner.
4865 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4866 TEXT_SIZE to initialize data member TEXT_SIZE_.
4867 (Arm_exidx_input_section::addralign): Fix typo in comment.
4868 (Arm_exidx_input_section::text_size): New method.
4869 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4870 that require locking objects. Lock objects before scanning for stubs
4871 and updating local symbols.
4872 (Arm_input_section<big_endian>::init): Copy contents of original
4873 input section.
4874 (Arm_input_section<big_endian>::do_write): Use saved contents of
4875 original input section instead of calling Object::section_contents
4876 without locking.
4877 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4878 size without calling Object::section_size().
4879 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4880 for size. Allocate a buffer for merged EXIDX entries.
4881 (Arm_exidx_merged_section::build_contents): New method.
4882 (Arm_exidx_merged_section::do_write): Move merge section contents
4883 building code to Arm_exidx_merged_section::build_contetns. Write
4884 out contetns in buffer instead of building it on the fly.
4885 (Arm_relobj::make_exidx_input_section): Also pass text section size
4886 to Arm_exidx_input_section constructor.
4887 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4888 (Arm_dynobj::do_read_symbols): Fix memory leak.
4889 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4890 * target.h: (class Task): Add forward declaration.
4891 (Target::relax): Add new parameter TASK and pass it to
4892 Target::do_relax().
4893 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4894
4895 2010-11-05 Cary Coutant <ccoutant@google.com>
4896
4897 PR gold/10708
4898 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4899 object when reading from the file.
4900 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4901 second layout pass.
4902 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4903 when reading section contents.
4904 (get_section_contents): Likewise.
4905 (icf::find_identical_sections): Likewise.
4906 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4907 object when reading from the file.
4908 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4909 the object when doing deferred section layout.
4910
4911 2010-11-03 Nick Clifton <nickc@redhat.com>
4912
4913 PR gold/12001
4914 * script.h (class Symbol_assignment: name): New member. Returns
4915 the name of the symbol.
4916 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4917 Returns true if the given symbol name is on the list of
4918 assignments wating to be processed.
4919 * archive.cc (should_incldue_member): If the symbol is undefined,
4920 check to see if it is on the list of symbols pending assignment.
4921
4922 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4923
4924 * script-sections.cc (Script_sections::find_memory_region): Check
4925 for a NULL output section pointer.
4926
4927 2010-10-29 Doug Kwan <dougkwan@google.com>
4928
4929 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4930 Output_section::add_relaxed_input_section.
4931 * output.cc (Output_section::add_relaxed_input_section): Add new
4932 arguments LAYOUT and NAME. Set section order index.
4933 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4934 Copy section order index.
4935 * output.h (Output_section::add_relaxed_input_section): Add new
4936 arguments LAYOUT and NAME.
4937
4938 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4939
4940 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4941 NATIVE_OR_CROSS_LINKER.
4942 * testsuite/Makefile.in: Regenerate.
4943
4944 2010-10-20 Doug Kwan <dougkwan@google.com>
4945
4946 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4947 without SHF_LINK_ORDER flags.
4948 * layout.cc (Layout::choose_output_section): Do not filter
4949 SHF_LINK_ORDER flag in a relocatable link.
4950
4951 2010-10-17 Cary Coutant <ccoutant@google.com>
4952
4953 * output.h (Output_segment::set_section_addresses): Change function
4954 signature. Update all callers.
4955 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4956 sections.
4957 (Output_segment::set_section_addresses): Align after last TLS
4958 section. Add padding before last relro section instead of after.
4959
4960 2010-10-17 Doug Kwan <dougkwan@google.com>
4961
4962 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4963 GOT output section to be writable.
4964
4965 2010-10-14 Cary Coutant <ccoutant@google.com>
4966
4967 * debug.h (DEBUG_INCREMENTAL): New flag.
4968 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4969 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4970 mode.
4971 * incremental.cc (report_command_line): Ignore all forms of
4972 --incremental.
4973 * layout.cc (Layout::Layout): Check parameters for incremental link
4974 mode.
4975 * options.cc (General_options::parse_incremental): New function.
4976 (General_options::parse_no_incremental): New function.
4977 (General_options::parse_incremental_full): New function.
4978 (General_options::parse_incremental_update): New function.
4979 (General_options::incremental_mode_): New data member.
4980 (General_options::finalize): Check incremental_mode_.
4981 * options.h (General_options): Update help text for --incremental.
4982 Add --no-incremental, --incremental-full, --incremental-update.
4983 (General_options::Incremental_mode): New enum type.
4984 (General_options::incremental_mode): New function.
4985 (General_options::incremental_mode_): New data member.
4986 * parameters.cc (Parameters::incremental_mode_): New data member.
4987 (Parameters::set_options): Set incremental_mode_.
4988 (Parameters::set_incremental_full): New function.
4989 (Parameters::incremental): New function.
4990 (Parameters::incremental_update): New function.
4991 (set_parameters_incremental_full): New function.
4992 * parameters.h (Parameters::set_incremental_full): New function.
4993 (Parameters::incremental): New function.
4994 (Parameters::incremental_update): New function.
4995 (Parameters::incremental_mode_): New data member.
4996 (set_parameters_incremental_full): New function.
4997 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4998 incremental link mode.
4999 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5000 (Sized_relobj::do_relocate_sections): Likewise.
5001 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5002 option.
5003 * testsuite/Makefile.in: Regenerate.
5004 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5005
5006 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5007
5008 * script-sections.h (class Script_sections): Make
5009 Sections_elements typedef public.
5010 * script-sections.cc (class Sort_output_sections): Add elements_
5011 field. Add constructor which sets it; change all callers.
5012 (Sort_output_sections::is_before): New function.
5013 (Sort_output_sections::operator()): Call is_before.
5014 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5015 conditional.
5016 * testsuite/script_test_10.sh: New test. Test script section
5017 order.
5018 * testsuite/script_test_10.t: Likewise.
5019 * testsuite/script_test_10.s: Likewise.
5020 * testsuite/Makefile.am: Wrap the cross linker tests and the
5021 common tests into NATIVE_OR_CROSS_LINKER.
5022 (check_SCRIPTS): Add script_test_10.sh.
5023 (check_DATA): Add script_test_10.stdout.
5024 (script_test_10.o, script_test_10): New targets.
5025 (script_test_10.stdout): New target.
5026 * configure, testsuite/Makefile.in: Regenerate.
5027
5028 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5029
5030 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5031 error for the deprecated relocations.
5032 (Target_arm::Scan::global): Likewise.
5033 (Target_arm::Relocate::relocate): Likewise.
5034
5035 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5036
5037 * fileread.cc (Input_file::find_file): Initialize *found_name
5038 and *namep when using the fallback search for case 4.
5039
5040 2010-10-11 Cary Coutant <ccoutant@google.com>
5041
5042 * options.h (class General_options): Redefine -z lazy as an alias for
5043 the negation of -z now.
5044
5045 2010-10-11 Ian Lance Taylor <iant@google.com>
5046
5047 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5048 binding.
5049
5050 2010-10-06 Nick Clifton <nickc@redhat.com>
5051
5052 * script-sections.cc(class Memory_region): Remove
5053 current_lma_offset_ field. Rename current_vma_offset_ to
5054 current_offset_. Add last_section_ field.
5055 (Memory_region::get_current_vma_address): Rename to
5056 get_current_address.
5057 (Memory_region::get_current_lma_address): Delete.
5058 (Memory_region::increment_vma_offset): Rename to
5059 increment_offset.
5060 (Memory_region::increment_lma_offset): Delete.
5061 (Memory_region::attributes_compatible): New method. Returns
5062 true if the provided section is compatible with the region.
5063 (Memory_region::get_last_section): New method. Returns the last
5064 section to use the region.
5065 (Memory_region::set_last_section): New method. Stores the last
5066 section to use the region.
5067 (Script_sections::block_in_region): New method. Returns true if
5068 a block of memory is contained within a region.
5069 (Script_sections::find_memory_region): New method. Locates a
5070 memory region to be used to set a VMA or LMA address.
5071 (Output_section_definition::set_section_addresses): Add code to
5072 check for addresses set by memory regions.
5073 (Output_segment::set_section_addresses): Remove memory region
5074 walking code.
5075 (Script_sections::create_segment): Add a warning if a header
5076 segment is created outside of any region.
5077 * script-sections.h (class Script_sections): Add prototypes for
5078 find_memory_region and block_in_region methods.
5079 * testsuite/memory_test.s: Use .long instead of .word.
5080 * testsuite/memory_test.t: Add some more output sections.
5081 * testsuite/memory_test.sh: Update expected output.
5082
5083 2010-10-02 Doug Kwan <dougkwan@google.com>
5084
5085 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5086 defintion to symtab.h
5087 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5088 declaration to defintion.
5089
5090 2010-10-01 Nick Clifton <nickc@redhat.com>
5091
5092 * expression.cc (eval): Replace dummy argument with NULL.
5093 (eval_maybe_dot): Check for a NULL result section pointer.
5094 (Symbol_expression::value): Likewise.
5095 (Dot_expression::value): Likewise.
5096 (BINARY_EXPRESSION): Likewise.
5097 (Max_expression::value): Likewise.
5098 (Min_expression::value): Likewise.
5099 (Absolute_expression::value): Likewise.
5100 (Addr_expression::value_from_output_section): Likewise.
5101 (Loaddddr_expression::value_from_output_section): Likewise.
5102 (Segment_start_expression::value): Likewise.
5103 * script-sections.cc
5104 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5105 argument with NULL.
5106 (Sections_elememt_dot_assignment::set_section_addresses):
5107 Likewise.
5108 (Output_data_expression::do_write_to_buffer): Likewise.
5109 (Output_section_definition::finalize_symbols): Likewise.
5110 (Output_section_definition::set_section_addresses): Likewise.
5111
5112 2010-09-30 Doug Kwan <dougkwan@google.com>
5113
5114 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5115
5116 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5117
5118 * target.h (Target::can_icf_inline_merge_sections): New virtual
5119 function.
5120 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5121 virtual function.
5122 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5123 virtual function.
5124 * icf.cc (get_section_contents): Inline merge sections only when
5125 target allows it.
5126
5127 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5128
5129 * configure: Regenerate.
5130
5131 2010-09-17 Ian Lance Taylor <iant@google.com>
5132
5133 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5134 * testsuite/Makefile.am (memory_test.o): New target.
5135 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5136 memory_test.t.
5137 * testsuite/Makefile.in: Rebuild.
5138
5139 2010-09-17 Doug Kwan <dougkwan@google.com>
5140
5141 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5142 defintion if relocation uses GOT entries of the symbol.
5143 * testsuite/icf_safe_test.sh: Fix test.
5144 * testsuite/icf_safe_so_test.sh: Fix test.
5145
5146 2010-09-16 Cary Coutant <ccoutant@google.com>
5147
5148 * script_sections.cc (class Memory_region): Remove "NULL" from
5149 vector initializations.
5150
5151 2010-09-15 Cary Coutant <ccoutant@google.com>
5152
5153 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5154 Resolve forwarding symbols.
5155
5156 2010-09-15 Doug Kwan <dougkwan@google.com>
5157
5158 * gold/testsuite/script_test_3.t: Add ARM special sections.
5159 * gold/testsuite/script_test_4.t: Same.
5160 * gold/testsuite/script_test_5.t: Same.
5161 * gold/testsuite/script_test_6.t: Same.
5162 * gold/testsuite/script_test_7.t: Same.
5163 * gold/testsuite/script_test_7.t: Same.
5164 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5165
5166 2010-09-14 Cary Coutant <ccoutant@google.com>
5167
5168 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5169 (Target_x86_64::Relocate::relocate_tls): Replace check for
5170 saw_tls_block_reloc_ with test for executable section.
5171
5172 2010-09-12 Cary Coutant <ccoutant@google.com>
5173
5174 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5175 position-independent executables to shared libraries need dynamic
5176 relocations.
5177 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5178 position-independent executables.
5179 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5180 * testsuite/Makefile.in: Regenerate.
5181
5182 2010-09-10 Nick Clifton <nickc@redhat.com>
5183
5184 PR gold/11997
5185 * testsuite/memory_test.t: Discard any sections that are not
5186 needed.
5187
5188 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5189
5190 PR gold/11996
5191 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5192 "This::" to work around a bug in gcc 4.2.
5193
5194 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5195
5196 2010-09-09 Rafael Espindola <espindola@google.com>
5197
5198 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5199 sections with different PF_X flags in the same segment.
5200 (Layout::find_first_load_seg): Search all segments to find the first
5201 one.
5202 * options.h (rosegment): New.
5203
5204 2010-09-08 Rafael Espindola <espindola@google.com>
5205
5206 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5207
5208 2010-09-08 Doug Kwan <dougkwan@google.com>
5209
5210 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5211 (Arm_relobj::do_relocate_sections): Add new parameter for output
5212 file to match the parent.
5213 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5214 of local symbols instead of input values. Update code to track
5215 changes in gold::relocate_section.
5216 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5217 (Sized_relobj::compute_final_local_value_internal): New methods.
5218 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5219 body into private version of Sized_relobj::compute_final_local_value.
5220 Call the inline method.
5221 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5222 merged symbol value if there is one.
5223 (Symbol_value::has_output_value): New method defintiion.
5224 (Sized_relobj::Compute_final_local_value_status): New enum type.
5225 (Sized_relobj::compute_final_local_value): New methods.
5226 (Sized_relobj::compute_final_local_value_internal): New methods.
5227 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5228 and arm_cortex_a8.sh.
5229 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5230 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5231 New tests.
5232 * Makefile.in: Regenerate.
5233 * testsuite/arm_bl_out_of_range.s: Update test.
5234 * testsuite/thumb_bl_out_of_range.s: Ditto.
5235 * testsuite/thumb_blx_out_of_range.s: Ditto.
5236 * testsuite/arm_branch_out_of_range.sh: New file.
5237 * testsuite/arm_cortex_a8.sh: Ditto.
5238 * testsuite/arm_cortex_a8_b.s: Ditto.
5239 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5240 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5241 * testsuite/arm_cortex_a8_bl.s: Ditto.
5242 * testsuite/arm_cortex_a8_blx.s: Ditto.
5243 * testsuite/arm_cortex_a8_local.s: Ditto.
5244 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5245 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5246
5247 2010-09-08 Rafael Espindola <espindola@google.com>
5248
5249 * Makefile.am (memory_test.stdout): Run readelf with -W.
5250 * Makefile.in: Regenerate.
5251 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5252 64 bit output.
5253
5254 2010-09-08 Rafael Espindola <espindola@google.com>
5255
5256 * script-sections.cc (Script_sections::add_memory_region): Convert
5257 field precision to int.
5258 * script.cc (script_set_section_region, script_set_section_region):
5259 Convert field precision to int.
5260
5261 2010-09-08 Rafael Espindola <espindola@google.com>
5262
5263 * arm.cc (do_finalize_sections): Create the __exidx_start and
5264 __exdix_end symbols even when the section is missing.
5265
5266 2010-09-08 Nick Clifton <nickc@redhat.com>
5267
5268 * README: Remove claim that MEMORY is not supported.
5269 * expression.cc (script_exp_function_origin)
5270 (script_exp_function_length): Move from here to ...
5271 * script.cc: ... here.
5272 (script_set_section_region, script_add_memory)
5273 (script_parse_memory_attr, script_include_directive): New
5274 functions.
5275 * script-sections.cc
5276 (class Memory_region): New class.
5277 (class Output_section_definition): Add set_memory_region,
5278 set_section_vma, set_section_lma and get_section_name methods.
5279 (class Script_Sections): Add add_memory_region,
5280 find_memory_region, find_memory_region_origin,
5281 find_memory_region_length and set_memory_region methods.
5282 Have set_section_addresses method walk the list of set memory
5283 regions.
5284 Extend the print methos to display memory regions.
5285 * script-sections.h: Add prototypes for new methods.
5286 Add enum for MEMORY region attributes.
5287 * yyscript.y: Add support for parsing MEMORY regions.
5288 * script-c.h: Add prototypes for new functions.
5289 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5290 * testsuite/Makefile.in: Regenerate.
5291 * testsuite/memory_test.sh: New script.
5292 * testsuite/memory_test.s: New assembler source file.
5293 * testsuite/memory_test.t: New linker script.
5294
5295 2010-08-27 Doug Kwan <dougkwan@google.com>
5296
5297 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5298 reference override an existing dynamic weak reference.
5299 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5300 * testsuite/Makefile.in: Regenerate.
5301 * testsuite/dyn_weak_ref.sh: New file.
5302 * testsuite/dyn_weak_ref_1.c: Ditto.
5303 * testsuite/dyn_weak_ref_2.c: Ditto.
5304
5305 2010-08-27 Ian Lance Taylor <iant@google.com>
5306
5307 * incremental.h (class Incremental_input_entry): Add virtual
5308 destructor.
5309
5310 2010-08-27 Ian Lance Taylor <iant@google.com>
5311
5312 * testsuite/start_lib_test_3.c: Mark t3 as used.
5313
5314 2010-08-27 Nick Clifton <nickc@redhat.com>
5315
5316 * options.cc (version_script): Fix small typo in previous
5317 whitespace tidyup.
5318
5319 2010-08-25 Nick Clifton <nickc@redhat.com>
5320
5321 * archive.cc: Formatting fixes: Remove whitespace between
5322 typename and following asterisk. Remove whitespace between
5323 function name and opening parenthesis.
5324 * archive.h: Likewise.
5325 * arm.cc: Likewise.
5326 * attributes.cc: Likewise.
5327 * attributes.h: Likewise.
5328 * common.cc: Likewise.
5329 * copy-relocs.cc: Likewise.
5330 * dirsearch.h: Likewise.
5331 * dynobj.cc: Likewise.
5332 * ehframe.cc: Likewise.
5333 * ehframe.h: Likewise.
5334 * expression.cc: Likewise.
5335 * fileread.cc: Likewise.
5336 * fileread.h: Likewise.
5337 * gc.h: Likewise.
5338 * gold-threads.cc: Likewise.
5339 * gold.cc: Likewise.
5340 * i386.cc: Likewise.
5341 * icf.h: Likewise.
5342 * incremental-dump.cc: Likewise.
5343 * incremental.cc: Likewise.
5344 * layout.cc: Likewise.
5345 * layout.h: Likewise.
5346 * main.cc: Likewise.
5347 * merge.cc: Likewise.
5348 * merge.h: Likewise.
5349 * object.cc: Likewise.
5350 * object.h: Likewise.
5351 * options.cc: Likewise.
5352 * options.h: Likewise.
5353 * output.cc: Likewise.
5354 * output.h: Likewise.
5355 * plugin.cc: Likewise.
5356 * plugin.h: Likewise.
5357 * powerpc.cc: Likewise.
5358 * reloc.cc: Likewise.
5359 * script-c.h: Likewise.
5360 * script-sections.cc: Likewise.
5361 * script.cc: Likewise.
5362 * stringpool.cc: Likewise.
5363 * symtab.cc: Likewise.
5364 * symtab.h: Likewise.
5365 * target.cc: Likewise.
5366 * timer.cc: Likewise.
5367 * timer.h: Likewise.
5368 * version.cc: Likewise.
5369 * x86_64.cc: Likewise.
5370
5371 2010-08-24 Nick Clifton <nickc@redhat.com>
5372
5373 PR 11899
5374 * layout.cc (segment_precedes): Sort segments by their physical
5375 addresses, if they have been set.
5376
5377 2010-08-23 Cary Coutant <ccoutant@google.com>
5378
5379 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5380 symbols data.
5381 (Lib_group::include_member): Unlock object after deleting its
5382 symbols data.
5383 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5384 the bug fixed here.
5385
5386 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5387 Cary Coutant <ccoutant@google.com>
5388
5389 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5390 constructor, and set_blocker.
5391 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5392 readsyms_blocker_.
5393 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5394 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5395 * testsuite/Makefile.am (start_lib_test): New test case.
5396 * testsuite/Makefile.in: Regenerate.
5397 * testsuite/start_lib_test_main.c: New file.
5398 * testsuite/start_lib_test_1.c: New file.
5399 * testsuite/start_lib_test_2.c: New file.
5400 * testsuite/start_lib_test_3.c: New file.
5401
5402 2010-08-19 Ian Lance Taylor <iant@google.com>
5403
5404 * Makefile.in: Rebuild with automake 1.11.1.
5405 * aclocal.m4: Likewise.
5406 * testsuite/Makefile.in: Likewise.
5407
5408 2010-08-19 Ian Lance Taylor <iant@google.com>
5409
5410 PR 10893
5411 * i386.cc (class Output_data_plt_i386): Update declarations.
5412 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5413 local_ifuncs_ fields.
5414 (Target_i386::do_plt_section_for_global): New function.
5415 (Target_i386::do_plt_section_for_local): New function.
5416 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5417 parameter; change all callers. Initialize global_ifuncs_ and
5418 local_ifuncs_. If doing a static link define __rel_iplt_start and
5419 __rel_iplt_end.
5420 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5421 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5422 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5423 symbols.
5424 (Target_i386::make_plt_section): New function, broken out of
5425 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5426 (Target_i386::make_plt_entry): Call make_plt_section.
5427 (Target_i386::make_local_ifunc_plt_entry): New function.
5428 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5429 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5430 R_386_IRELATIVE to switch.
5431 (Target_i386::Scan::global): Likewise.
5432 (Target_i386::Relocate::relocate): Likewise.
5433 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5434 switch.
5435 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5436 (Target_x86_64::do_plt_section_for_global): New function.
5437 (Target_x86_64::do_plt_section_for_local): New function.
5438 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5439 parameter; change all callers. If doing a static link define
5440 __rela_iplt_start and __rela_iplt_end.
5441 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5442 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5443 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5444 to point to .plt.
5445 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5446 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5447 switch.
5448 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5449 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5450 R_X86_64_IRELATIVE to switch.
5451 (Target_x86_64::Scan::global): Likewise.
5452 (Target_x86_64::Relocate::relocate): Likewise.
5453 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5454 switch.
5455 * target.h (class Target): Add plt_section_for_global and
5456 plt_section_for_local functions. Add do_plt_section_for_global
5457 and do_plt_section_for_local virtual functions.
5458 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5459 clarifying comments.
5460 (Symbol::use_plt_offset): Handle IFUNC symbol.
5461 * object.cc (Sized_relobj::Sized_relobj): Initialize
5462 local_plt_offsets_.
5463 (Sized_relobj::local_has_plt_offset): New function.
5464 (Sized_relobj::local_plt_offset): New function.
5465 (Sized_relobj::set_local_plt_offset): New function.
5466 (Sized_relobj::do_count): Handle IFUNC symbol.
5467 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5468 a bit away from input_shndx_ field. Add set_is_func_symbol and
5469 is_ifunc_symbol functions.
5470 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5471 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5472 local_plt_offsets_ field.
5473 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5474 * output.h (class Output_section_data): Add non-const
5475 output_section function.
5476 (class Output_data_got): Update declarations.
5477 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5478 Add use_plt_offset parameter to global and local constructors.
5479 Change all callers. Change local_sym_index_ field to 31 bits.
5480 Change GSYM_CODE and CONSTANT_CODE accordingly.
5481 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5482 doing a static link don't set sh_link field.
5483 (Output_data_got::Got_entry::write): Use PLT offset if
5484 appropriate.
5485 (Output_data_got::add_global_plt): New function.
5486 (Output_data_got::add_local_plt): New function.
5487 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5488 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5489 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5490 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5491 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5492 IFUNC conditional.
5493 * testsuite/ifunc-sel.h: New file.
5494 * testsuite/ifuncmain1.c: New file.
5495 * testsuite/ifuncmain1vis.c: New file.
5496 * testsuite/ifuncmod1.c: New file.
5497 * testsuite/ifuncdep2.c: New file.
5498 * testsuite/ifuncmain2.c: New file.
5499 * testsuite/ifuncmain3.c: New file.
5500 * testsuite/ifuncmod3.c: New file.
5501 * testsuite/ifuncmain4.c: New file.
5502 * testsuite/ifuncmain5.c: New file.
5503 * testsuite/ifuncmod5.c: New file.
5504 * testsuite/ifuncmain6pie.c: New file.
5505 * testsuite/ifuncmod6.c: New file.
5506 * testsuite/ifuncmain7.c: New file.
5507 * configure, testsuite/Makefile.in: Rebuild.
5508
5509 2010-08-18 Ian Lance Taylor <iant@google.com>
5510
5511 * incremental.cc
5512 (Output_section_incremental_inputs::write_input_files): Add cast
5513 to avoid signed/unsigned comparison warning.
5514 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5515
5516 2010-08-12 Cary Coutant <ccoutant@google.com>
5517
5518 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5519
5520 2010-08-13 Ian Lance Taylor <iant@google.com>
5521
5522 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5523
5524 2010-08-12 Cary Coutant <ccoutant@google.com>
5525 Doug Kwan <dougkwan@google.com>
5526
5527 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5528 defintion overrides non-weak undef, remember that the original undef
5529 is not weak.
5530 * symtab.cc (Symbol_table::sized_write_global): For undef without
5531 an original weak binding, set binding to global in output.
5532 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5533 * testsuite/Makefile.in: Regenerate.
5534 * testsuite/strong_ref_weak_def.sh: New file.
5535 * testsuite/strong_ref_weak_def_1.c: Ditto.
5536 * testsuite/strong_ref_weak_def_2.c: Ditto.
5537
5538 2010-08-12 Cary Coutant <ccoutant@google.com>
5539
5540 * testsuite/incremental_test.sh: Rewrite.
5541 * testsuite/incremental_test_1.c: Rewrite.
5542 * testsuite/incremental_test_2.c: Rewrite.
5543
5544 2010-08-12 Cary Coutant <ccoutant@google.com>
5545
5546 * arm.cc (Target_arm::got_size): Add const.
5547 (Target_arm::got_entry_count): New function.
5548 (Target_arm::plt_entry_count): New function.
5549 (Target_arm::first_plt_entry_offset): New function.
5550 (Target_arm::plt_entry_size): New function.
5551 (Output_data_plt_arm::entry_count): New function.
5552 (Output_data_plt_arm::first_plt_entry_offset): New function.
5553 (Output_data_plt_arm::get_plt_entry_size): New function.
5554 * i386.cc (Target_i386::got_size): Add const.
5555 (Target_i386::got_entry_count): New function.
5556 (Target_i386::plt_entry_count): New function.
5557 (Target_i386::first_plt_entry_offset): New function.
5558 (Target_i386::plt_entry_size): New function.
5559 (Output_data_plt_i386::entry_count): New function.
5560 (Output_data_plt_i386::first_plt_entry_offset): New function.
5561 (Output_data_plt_i386::get_plt_entry_size): New function.
5562 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5563 find_incremental_inputs_sections. Dump incremental_got_plt section.
5564 * incremental.cc: Include target.h.
5565 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5566 parameter. Adjust all callers. Find incremental_got_plt section.
5567 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5568 section.
5569 (Output_section_incremental_inputs::set_final_data_size): Calculate
5570 size of incremental_got_plt section.
5571 (Output_section_incremental_inputs::do_write): Write the
5572 incremental_got_plt section.
5573 (Got_plt_view_info): New struct.
5574 (Local_got_offset_visitor): New class.
5575 (Global_got_offset_visitor): New class.
5576 (Global_symbol_visitor_got_plt): New class.
5577 (Output_section_incremental_inputs::write_got_plt): New function.
5578 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5579 Add parameter. Adjust all callers.
5580 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5581 (Incremental_inputs::got_plt_section): New function.
5582 (Incremental_inputs::got_plt_section_): New data member.
5583 (Incremental_got_plt_reader): New class.
5584 * layout.cc (Layout::create_incremental_info_sections): Add the
5585 incremental_got_plt section.
5586 * object.h (Got_offset_list::get_list): New function.
5587 (Got offset_list::for_all_got_offsets): New function.
5588 (Sized_relobj::local_got_offset_list): New function.
5589 * powerpc.cc (Target_powerpc::got_size): Add const.
5590 (Target_powerpc::got_entry_count): New function.
5591 (Target_powerpc::plt_entry_count): New function.
5592 (Target_powerpc::first_plt_entry_offset): New function.
5593 (Target_powerpc::plt_entry_size): New function.
5594 (Output_data_plt_powerpc::entry_count): New function.
5595 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5596 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5597 * sparc.cc (Target_sparc::got_size): Add const.
5598 (Target_sparc::got_entry_count): New function.
5599 (Target_sparc::plt_entry_count): New function.
5600 (Target_sparc::first_plt_entry_offset): New function.
5601 (Target_sparc::plt_entry_size): New function.
5602 (Output_data_plt_sparc::entry_count): New function.
5603 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5604 (Output_data_plt_sparc::get_plt_entry_size): New function.
5605 * symtab.h (Symbol::got_offset_list): New function.
5606 (Symbol_table::for_all_symbols): New function.
5607 * target.h (Sized_target::got_entry_count): New function.
5608 (Sized_target::plt_entry_count): New function.
5609 (Sized_target::plt_entry_size): New function.
5610 * x86_64.cc (Target_x86_64::got_size): Add const.
5611 (Target_x86_64::got_entry_count): New function.
5612 (Target_x86_64::plt_entry_count): New function.
5613 (Target_x86_64::first_plt_entry_offset): New function.
5614 (Target_x86_64::plt_entry_size): New function.
5615 (Output_data_plt_x86_64::entry_count): New function.
5616 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5617 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5618
5619 2010-08-12 Cary Coutant <ccoutant@google.com>
5620
5621 * archive.cc: Include incremental.h.
5622 (Archive::Archive): Initialize incremental_info_.
5623 (Archive::include_member): Record archive members in incremental info.
5624 (Add_archive_symbols::run): Record begin and end of an archive in
5625 incremental info.
5626 (Lib_group::include_member): Record objects in incremental info.
5627 * archive.h (Incremental_archive_entry): Forward declaration.
5628 (Archive::set_incremental_info): New member function.
5629 (Archive::incremental_info): New member function.
5630 (Archive::Unused_symbol_iterator): New class.
5631 (Archive::unused_symbols_begin): New member function.
5632 (Archive::unused_symbols_end): New member function.
5633 (Archive::incremental_info_): New data member.
5634 * incremental-dump.cc (find_input_containing_global): New function.
5635 (dump_incremental_inputs): Dump new incremental info sections.
5636 * incremental.cc: Include symtab.h.
5637 (Output_section_incremental_inputs): New class.
5638 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5639 new incremental info sections.
5640 (Sized_incremental_binary::do_check_inputs): Likewise.
5641 (Incremental_inputs::report_archive): Remove.
5642 (Incremental_inputs::report_archive_begin): New function.
5643 (Incremental_inputs::report_archive_end): New function.
5644 (Incremental_inputs::report_object): New function.
5645 (Incremental_inputs::finalize_inputs): Remove.
5646 (Incremental_inputs::report_input_section): New function.
5647 (Incremental_inputs::report_script): Rewrite.
5648 (Incremental_inputs::finalize): Do nothing but finalize string table.
5649 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5650 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5651 (Incremental_inputs::create_data_sections): New function.
5652 (Incremental_inputs::relocs_entsize): New function.
5653 (Output_section_incremental_inputs::set_final_data_size): New function.
5654 (Output_section_incremental_inputs::do_write): New function.
5655 (Output_section_incremental_inputs::write_header): New function.
5656 (Output_section_incremental_inputs::write_input_files): New function.
5657 (Output_section_incremental_inputs::write_info_blocks): New function.
5658 (Output_section_incremental_inputs::write_symtab): New function.
5659 * incremental.h (Incremental_script_entry): Forward declaration.
5660 (Incremental_object_entry): Forward declaration.
5661 (Incremental_archive_entry): Forward declaration.
5662 (Incremental_inputs): Forward declaration.
5663 (Incremental_inputs_header_data): Remove.
5664 (Incremental_inputs_header): Remove.
5665 (Incremental_inputs_header_write): Remove.
5666 (Incremental_inputs_entry_data): Remove.
5667 (Incremental_inputs_entry): Remove.
5668 (Incremental_inputs_entry_write): Remove.
5669 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5670 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5671 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5672 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5673 Likewise.
5674 (Incremental_input_entry): New class.
5675 (Incremental_script_entry): New class.
5676 (Incremental_object_entry): New class.
5677 (Incremental_archive_entry): New class.
5678 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5679 (Incremental_inputs::report_inputs): Remove.
5680 (Incremental_inputs::report_archive): Remove.
5681 (Incremental_inputs::report_archive_begin): New function.
5682 (Incremental_inputs::report_archive_end): New function.
5683 (Incremental_inputs::report_object): Change prototype.
5684 (Incremental_inputs::report_input_section): New function.
5685 (Incremental_inputs::report_script): Change prototype.
5686 (Incremental_inputs::get_reloc_count): New function.
5687 (Incremental_inputs::set_reloc_count): New function.
5688 (Incremental_inputs::create_data_sections): New function.
5689 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5690 (Incremental_inputs::inputs_section): New function.
5691 (Incremental_inputs::symtab_section): New function.
5692 (Incremental_inputs::relocs_section): New function.
5693 (Incremental_inputs::get_stringpool): Add const.
5694 (Incremental_inputs::command_line): Add const.
5695 (Incremental_inputs::inputs): Remove.
5696 (Incremental_inputs::command_line_key): New function.
5697 (Incremental_inputs::input_file_count): New function.
5698 (Incremental_inputs::input_files): New function.
5699 (Incremental_inputs::relocs_entsize): New function.
5700 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5701 (Incremental_inputs::finalize_inputs): Remove.
5702 (Incremental_inputs::Input_info): Remove.
5703 (Incremental_inputs::lock_): Remove.
5704 (Incremental_inputs::inputs_): Change type.
5705 (Incremental_inputs::inputs_map_): Remove.
5706 (Incremental_inputs::current_object_entry_): New data member.
5707 (Incremental_inputs::inputs_section_): New data member.
5708 (Incremental_inputs::symtab_section_): New data member.
5709 (Incremental_inputs::relocs_section_): New data member.
5710 (Incremental_inputs::reloc_count_): New data member.
5711 (Incremental_inputs_reader): New class.
5712 (Incremental_symtab_reader): New class.
5713 (Incremental_relocs_reader): New class.
5714 * layout.cc (Layout::finalize): Move finalization of incremental info
5715 and creation of incremental info sections to follow finalization of
5716 symbol table. Set offsets for postprocessing sections.
5717 (Layout::create_incremental_info_sections): Call
5718 Incremental_inputs::create_data_sections. Add incremental symtab
5719 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5720 sections to layout after input sections.
5721 * layout.h (struct Timespec): Forward declaration.
5722 (Layout::incremental_inputs): Add const.
5723 (Layout::create_incremental_info_sections): Add parameter.
5724 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5725 * object.cc: Include incremental.h.
5726 (Relobj::finalize_incremental_relocs): New function.
5727 (Sized_relobj::do_layout): Record input sections in incremental info.
5728 * object.h (Object::output_section): New function.
5729 (Object::output_section_offset): Moved from Relobj.
5730 (Object::get_incremental_reloc_base): New function.
5731 (Object::get_incremental_reloc_count): New function.
5732 (Object::do_output_section): New function.
5733 (Object::do_output_section_offset): Moved from Relobj.
5734 (Object::do_get_incremental_reloc_base): New function.
5735 (Object::do_get_incremental_reloc_count): New function.
5736 (Object::Object): Initialize new data members.
5737 (Relobj::output_section): Renamed do_output_section and moved to
5738 protected.
5739 (Relobj::output_section_offset): Moved to Object.
5740 (Relobj::do_get_incremental_reloc_base): New function.
5741 (Relobj::do_get_incremental_reloc_count): New function.
5742 (Relobj::allocate_incremental_reloc_counts): New function.
5743 (Relobj::count_incremental_reloc): New function.
5744 (Relobj::finalize_incremental_relocs): New function.
5745 (Relobj::next_incremental_reloc_index): New function.
5746 (Relobj::reloc_counts_): New data member.
5747 (Relobj::reloc_bases_): New data member.
5748 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5749 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5750 (Sized_relobj::incremental_relocs_scan): New function.
5751 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5752 (Sized_relobj::incremental_relocs_write): New function.
5753 (Sized_relobj::incremental_relocs_write_reltype): New function.
5754 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5755 incremental link.
5756 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5757 archives and object files elsewhere.
5758 (Add_symbols::run): Report object files here.
5759 (Finish_group::run): Report end of archive at end of group.
5760 * reloc.cc: Include layout.h, incremental.h.
5761 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5762 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5763 (Sized_relobj::incremental_relocs_scan): New function.
5764 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5765 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5766 (Sized_relobj::incremental_relocs_write): New function.
5767 (Sized_relobj::incremental_relocs_write_reltype): New function.
5768 * script.cc (read_input_script): Rewrite test for incremental link.
5769 Change call to Incremental_inputs::report_script.
5770 * symtab.h (Symbol_table::first_global_index): New function.
5771 (Symbol_table::output_count): New function.
5772
5773 2010-08-12 Doug Kwan <dougkwan@google.com>
5774
5775 * arm.cc (Target_arm::merge_object_attributes): Check command line
5776 options --no-wchar-size-warning and --no-enum-size-warning.
5777 * options.h (General_options): Add ld-compatible options
5778 --no-enum-size-warning and --no-wchar-size-warning.
5779
5780 2010-08-04 Ian Lance Taylor <iant@google.com>
5781
5782 * x86_64.cc (Target_x86_64::Scan::local): Use
5783 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5784 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5785 (Target_x86_64::Scan::global): Likewise.
5786 (Target_x86_64::Relocate::relocate): Likewise.
5787 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5788 Likewise.
5789
5790 2010-08-03 Cary Coutant <ccoutant@google.com>
5791
5792 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5793 to reserve space in merged_strings vector. Keep total input size
5794 for stats.
5795 (Output_merge_string::do_print_merge_stats): Print total input size.
5796 * merge.h (Output_merge_string): Add input_size_ field.
5797 * stringpool.cc (Stringpool_template::string_length): Move
5798 implementations out of Stringpool_template class and place in
5799 stringpool.h.
5800 * stringpool.h (string_length): Move out of Stringpool_template.
5801
5802 2010-08-03 Ian Lance Taylor <iant@google.com>
5803
5804 PR 11712
5805 * layout.cc (relaxation_loop_body): If address of load segment is
5806 set, adjust address to include headers if possible.
5807
5808 2010-08-03 Ian Lance Taylor <iant@google.com>
5809
5810 * version.cc (version_string): Bump to 1.10.
5811
5812 2010-08-03 Ian Lance Taylor <iant@google.com>
5813
5814 PR 11805
5815 * layout.h (enum Output_section_order): Define.
5816 (class Layout): Update declarations.
5817 * layout.cc (Layout::get_output_section): Add order parameter.
5818 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5819 is_first_non_relro parameters. Change all callers.
5820 (Layout::choose_output_section): Likewise.
5821 (Layout::add_output_section_data): Likewise.
5822 (Layout::make_output_section): Likewise. Set order.
5823 (Layout::default_section_order): New function.
5824 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5825 * output.cc (Output_section::Output_section): Initialize order_.
5826 Don't initialize deleted fields.
5827 (Output_segment::Output_segment): Don't initialize deleted
5828 fields.
5829 (Output_segment::add_output_section_to_load): New function
5830 replacing add_output_section. Change all callers to call this or
5831 add_output_section_to_nonload.
5832 (Output_segment::add_output_section_to_nonload): New function.
5833 (Output_segment::remove_output_section): Rewrite.
5834 (Output_segment::add_initial_output_data): Likewise.
5835 (Output_segment::has_any_data_sections): Likewise.
5836 (Output_segment::is_first_section_relro): Likewise.
5837 (Output_segment::maximum_alignment): Likewise.
5838 (Output_segment::has_dynamic_reloc): New function replacing
5839 dynamic_reloc_count. Change all callers.
5840 (Output_segment::has_dynamic_reloc_list): New function replacing
5841 dynamic_reloc_count_list. Change all callers.
5842 (Output_segment::set_section_addresses): Rewrite.
5843 (Output_segment::set_offset): Rewrite.
5844 (Output_segment::find_first_and_last_list): Remove.
5845 (Output_segment::set_tls_offsets): Rewrite.
5846 (Output_segment::first_section_load_address): Likewise.
5847 (Output_segment::output_section_count): Likewise.
5848 (Output_segment::section_with_lowest_load_address): Likewise.
5849 (Output_segment::write_section_headers): Likewise.
5850 (Output_segment::print_sections_to_map): Likewise.
5851 * output.h (class Output_data): Remove dynamic_reloc_count_
5852 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5853 (Output_data::add_dynamic_reloc): Rewrite.
5854 (Output_data::has_dynamic_reloc): New function.
5855 (Output_data::dynamic_reloc_count): Remove.
5856 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5857 is_last_relro_, is_first_non_relro_, is_interp_,
5858 is_dynamic_linker_section_ fields. Add order and set_order
5859 functions. Remove is_relro_local, set_is_relro_local,
5860 is_last_relro, set_is_last_relro, is_first_non_relro,
5861 set_is_first_non_relro functions, is_interp, set_is_interp,
5862 is_dynamic_linker_section, and set_is_dynamic_linker_section
5863 functions.
5864 (class Output_segment): Change Output_data_list from std::list to
5865 std:;vector. Add output_lists_ field. Remove output_data_ and
5866 output_bss_ fields. Update declarations.
5867
5868 2010-08-02 Ian Lance Taylor <iant@google.com>
5869
5870 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5871 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5872 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5873
5874 2010-08-02 Ian Lance Taylor <iant@google.com>
5875
5876 PR 11855
5877 * script.cc (Script_options::Script_options): Initialize
5878 symbol_definitions_ and symbol_references_.
5879 (Script_options::add_symbol_assignment): Update
5880 symbol_definitions_ and symbol_references_.
5881 (Script_options::add_symbol_reference): New function.
5882 (script_symbol): New function.
5883 * script.h (class Script_options): Add symbol_definitions_ and
5884 symbol_references_ fields.
5885 (Script_options::referenced_const_iterator): New type.
5886 (Script_options::referenced_begin): New function.
5887 (Script_options::referenced_end): New function.
5888 (Script_options::is_referenced): New function.
5889 (Script_options::any_unreferenced): New function.
5890 * script-c.h (script_symbol): Declare.
5891 * yyscript.y (exp): Call script_symbol.
5892 * symtab.cc: Include "script.h".
5893 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5894 Change all callers. Check symbols referenced by scripts.
5895 (Symbol_table::add_undefined_symbols_from_command_line): Add
5896 layout parameter. Change all callers.
5897 (Symbol_table::do_add_undefined_symbols_from_command_line):
5898 Likewise. Break out loop body. Check symbols referenced by
5899 scripts.
5900 (Symbol_table::add_undefined_symbol_from_command_line): New
5901 function broken out of
5902 do_add_undefined_symbols_from_command_line.
5903 * symtab.h (class Symbol_table): Update declarations.
5904 * archive.cc: Include "layout.h".
5905 (Archive::should_include_member): Add layout parameter. Change
5906 all callers. Check for symbol mentioned in expression.
5907 * archive.h (class Archive): Update declaration.
5908 * object.cc (Sized_relobj::do_should_include_member): Add layout
5909 parameter.
5910 * object.h (Object::should_include_member): Add layout parameter.
5911 Change all callers.
5912 (Object::do_should_include_member): Add layout parameter.
5913 (class Sized_relobj): Update declaration.
5914 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5915 parameter.
5916 * dynobj.h (class Sized_dynobj): Update declaration.
5917 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5918 layout parameter.
5919 * plugin.h (class Sized_pluginobj): Update declaration.
5920
5921 2010-08-02 Ian Lance Taylor <iant@google.com>
5922
5923 PR 11866
5924 * output.cc (Output_segment::set_offset): Search for the first and
5925 last sections rather than assuming that the list is in order.
5926 (Output_segment::find_first_and_last_list): New function.
5927 * output.h (class Output_segment): Update declarations.
5928 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5929 (relro_strip_test_SOURCES): New variable.
5930 (relro_strip_test_DEPENDENCIES): New variable.
5931 (relro_strip_test_LDFLAGS): New variable.
5932 (relro_strip_test_LDADD): New variable.
5933 (relro_strip_test.so): New target.
5934
5935 2010-08-02 Ian Lance Taylor <iant@google.com>
5936
5937 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5938 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5939 (Target_i386::got_tlsdesc_section): New function.
5940 (Target_i386::got_section): Create space for GOT entries for
5941 TLSDESC relocations.
5942 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5943 R_386_TLS_GOTDESC.
5944 (Target_i386::Scan::global): Likewise.
5945 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5946 using TLSDESC GOT.
5947 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5948 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5949 (Target_x86_64::got_tlsdesc_section): New function.
5950 (Target_x86_64::got_section): Create space for GOT entries for
5951 TLSDESC relocations.
5952 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5953 R_386_TLS_GOTDESC.
5954 (Target_x86_64::Scan::global): Likewise.
5955 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5956 using TLSDESC GOT.
5957
5958 2010-08-02 Ian Lance Taylor <iant@google.com>
5959
5960 * testsuite/final_layout.sh: Use dc to convert from hex to
5961 decimal.
5962
5963 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5964
5965 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5966 paramter to the call to gold::gc_process_relocs.
5967 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5968 paramter to the call to gold::gc_process_relocs.
5969 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5970 parameter to the call to gold::gc_process_relocs.
5971 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5972 template parameter to the call to gold::gc_process_relocs.
5973 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5974 paramter to the call to gold::gc_process_relocs.
5975 * gc.h (get_embedded_addend_size): New function.
5976 (gc_process_relocs): Save the size of the reloc for use by ICF.
5977 * icf.cc (get_section_contents): Get the addend from the text section
5978 for SHT_REL relocation sections.
5979 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5980 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5981 * int_encoding.h (read_from_pointer): New overloaded function.
5982 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5983 * testsuite/icf_sht_rel_addend_test.sh: New file.
5984 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5985 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5986
5987 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5988
5989 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5990 * Makefile.in: Regenerate.
5991 * testsuite/Makefile.in: Regenerate.
5992
5993 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5994
5995 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5996 * gold/testsuite/debug_msg.cc: Likewise.
5997 * gold/testsuite/odr_violation1.cc
5998 * gold/testsuite/odr_violation2.cc
5999
6000 2010-07-21 Cary Coutant <ccoutant@google.com>
6001
6002 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6003 string, and length fields.
6004 (Output_merge_string::Merged_strings_list): New type.
6005 (Output_merge_string::Merged_strings_lists): New typedef.
6006 (Output_merge_string): Replace merged_strings_ with
6007 merged_strings_lists_.
6008 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6009 Merged_strings_list per input object and section. Don't store pointer
6010 to the string. Don't store length with each merged string entry.
6011 (Output_merge_string::finalize_merged_data): Loop over list of merged
6012 strings lists. Recompute length of each merged string.
6013
6014 2010-07-15 Cary Coutant <ccoutant@google.com>
6015
6016 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6017 here.
6018
6019 2010-07-14 Ian Lance Taylor <iant@google.com>
6020
6021 * descriptors.cc (Descriptors::open): Report correct name in error
6022 message.
6023
6024 2010-07-13 Doug Kwan <dougkwan@google.com>
6025
6026 * arm.cc (Arm_input_section::Arm_input_section): For a
6027 SHT_ARM_EXIDX section, always keeps the input sections.
6028 (Arm_input_section::set_exidx_section_link): New method.
6029 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6030 has_errors_ to false.
6031 (Arm_exidx_input_section::has_errors,
6032 Arm_exidx_input_section::set_has_errors): New methods.
6033 (Arm_exidx_input_section::has_errors_): New data member.
6034 (Arm_relobj::get_exidx_shndx_list): New method.
6035 (Arm_output_section::append_text_sections_to_list): Do not skip
6036 section without SHF_EXECINSTR.
6037 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6038 errors.
6039 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6040 section header. Make error messages more verbose. Check for
6041 a non-executable section linked to an EXIDX section.
6042 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6043 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6044 check that there is no deferred EXIDX section if we exit early.
6045 Instead of not making an EXIDX section in case of an error, make one
6046 and set the has_errors flag of it.
6047 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6048 in a relocatable link.
6049 (Target_arm::do_relax): Look for the EXIDX output section instead of
6050 assuming that it is called .ARM.exidx.
6051 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6052 section list. Do not check for SHF_EXECINSTR section flags but
6053 skip any input section with errors.
6054 * output.cc (Output_section::Output_section): Initialize
6055 always_keeps_input_sections_ to false.
6056 (Output_section::add_input_section): Check for
6057 always_keeps_input_sections_.
6058 * output.h (Output_section::always_keeps_input_sections,
6059 Output_section::set_always_keeps_input_sections): New methods.
6060 (Output_section::always_keeps_input_sections): New data member.
6061
6062 2010-07-13 Rafael Espindola <espindola@google.com>
6063
6064 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6065 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6066
6067 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6068 Ian Lance Taylor <iant@google.com>
6069
6070 * output.h (Output_section_lookup_maps::add_merge_section):
6071 Correct check of whether value was inserted.
6072 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6073 (Output_section_lookup_maps::add_relaxed_input_section):
6074 Likewise.
6075 * arm.cc (Target_arm::got_section): Remove used local os.
6076 * i386.cc (Target_i386::got_section): Likewise.
6077 * x86_64.cc (Target_x86_64::got_section): Likewise.
6078 * sparc.cc (Target_sparc::got_section): Likewise.
6079 (Target_sparc::relocate): Remove unused local have_got_offset.
6080 * powerpc.cc (Target_powerpc::relocate): Likewise.
6081
6082 2010-07-13 Ian Lance Taylor <iant@google.com>
6083
6084 * compressed_output.cc (zlib_decompress): Fix signature in
6085 !HAVE_ZLIB_H case.
6086
6087 * archive.cc (Archive::include_member): Unlock an external member
6088 of a thin archive. Don't bother to delete an object we know is
6089 NULL.
6090
6091 2010-07-12 Cary Coutant <ccoutant@google.com>
6092
6093 * compressed_output.cc (zlib_decompress): New function.
6094 (get_uncompressed_size): New function.
6095 (decompress_input_section): New function.
6096 * compressed_output.h (get_uncompressed_size): New function.
6097 (decompress_input_section): New function.
6098 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6099 Handle compressed debug sections.
6100 * layout.cc (is_compressed_debug_section): New function.
6101 (Layout::output_section_name): Map compressed section names to
6102 canonical names.
6103 * layout.h (is_compressed_debug_section): New function.
6104 (is_debug_info_section): Recognize compressed debug sections.
6105 * merge.cc: Include compressed_output.h.
6106 (Output_merge_data::do_add_input_section): Handle compressed
6107 debug sections.
6108 (Output_merge_string::do_add_input_section): Handle compressed
6109 debug sections.
6110 * object.cc: Include compressed_output.h.
6111 (Sized_relobj::Sized_relobj): Initialize new data members.
6112 (build_compressed_section_map): New function.
6113 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6114 * object.h (Object::section_is_compressed): New method.
6115 (Object::do_section_is_compressed): New method.
6116 (Sized_relobj::Compressed_section_map): New type.
6117 (Sized_relobj::do_section_is_compressed): New method.
6118 (Sized_relobj::compressed_sections_): New data member.
6119 * output.cc (Output_section::add_input_section): Handle compressed
6120 debug sections.
6121 * reloc.cc: Include compressed_output.h.
6122 (Sized_relobj::write_sections): Handle compressed debug sections.
6123
6124 2010-07-08 Cary Coutant <ccoutant@google.com>
6125
6126 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6127 weak when resolving to a dynamic def.
6128 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6129 for weak undef/dynamic def cases. Adjust callers.
6130 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6131 undef_binding_weak_.
6132 (Symbol_table::sized_write_globals): Adjust symbol binding.
6133 (Symbol_table::sized_write_symbol): Add binding parameter.
6134 * symtab.h (Symbol::set_undef_binding): New method.
6135 (Symbol::is_undef_binding_weak): New method.
6136 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6137 (Symbol_table::should_override): Add new parameter.
6138 (Symbol_table::sized_write_symbol): Add new parameter.
6139
6140 * testsuite/weak_undef_file1.cc: Add new test case.
6141 * testsuite/weak_undef_file2.cc: Fix header comment.
6142 * testsuite/weak_undef_test.cc: Add new test case.
6143
6144 2010-06-29 Doug Kwan <dougkwan@google.com>
6145
6146 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6147 Initialize USE_SYMBOL_.
6148 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6149 definition.
6150 (Arm_reloc_property::uses_symbol_): New data member declaration.
6151 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6152 uses symbol value and symbol is undefined but not weakly undefined.
6153
6154 2010-06-28 Rafael Espindola <espindola@google.com>
6155
6156 * plugin.cc (Plugin::load): Use dlerror.
6157
6158 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6159
6160 * symtab.cc (detect_odr_violations): When reporting an ODR
6161 violation, report an object where the symbol is defined.
6162
6163 2010-06-25 Doug Kwan <dougkwan@google.com>
6164
6165 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6166 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6167 definition.
6168 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6169 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6170 target hook to detect function points.
6171 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6172 * icf.h (Icf::check_section_for_function_pointers): Change type of
6173 parameter SECTION_NAME to const reference to std::string. Use
6174 target hook to determine if section may have unsafe pointers.
6175 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6176 method definition.
6177
6178 2010-06-21 Rafael Espindola <espindola@google.com>
6179
6180 * fileread.cc (Input_file::find_fie): New
6181 (Input_file::open): Use Input_file::find_fie.
6182 * fileread.h (Input_file::find_fie): New
6183 * plugin.cc (set_extra_library_path): New.
6184 (Plugin::load): Add set_extra_library_path to the transfer vector.
6185 (Plugin_manager::set_extra_library_path): New.
6186 (Plugin_manager::add_input_file): Use the extra search path if set.
6187 (set_extra_library_path(): New.
6188 * plugin.h (Plugin_manager): Add set_extra_library_path and
6189 extra_search_path_.
6190
6191 2010-06-19 Cary Coutant <ccoutant@google.com>
6192
6193 * layout.cc (gdb_sections): Add .debug_types.
6194 (lines_only_debug_sections): Likewise.
6195
6196 2010-06-18 Rafael Espindola <espindola@google.com>
6197
6198 * plugin.cc (add_input_file,add_input_library)
6199 (Plugin_manager::add_input_file): Make filename arguments const.
6200 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6201 const.
6202
6203 2010-06-16 Doug Kwan <dougkwan@google.com>
6204
6205 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6206 .ARM.attributes section if we have not merged any input
6207 attributes sections.
6208
6209 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6210
6211 * arm.cc: Allow combining objects with no EABI version
6212 information.
6213
6214 2010-06-15 Rafael Espindola <espindola@google.com>
6215
6216 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6217
6218 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6219
6220 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6221 (struct iovec): Correct !HAVE_READV definition.
6222
6223 2010-06-10 Cary Coutant <ccoutant@google.com>
6224
6225 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6226 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6227 reloc sections.
6228 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6229
6230 PR 11683
6231 * symtab.h (Symbol::is_placeholder): New member function.
6232 * target-reloc.h (relocate_section): Check for placeholder symbols.
6233
6234 * testsuite/Makefile.am (plugin_test_8): New test.
6235 (plugin_test_9): New test.
6236 * testsuite/Makefile.in: Regenerate.
6237
6238 2010-06-09 Nick Clifton <nickc@redhat.com>
6239
6240 * yyscript.y (input_list_element): Allow strings prefixed with
6241 the '-' character. Treat these as libraries.
6242 * script.cc (script_add_library): New function. Adds a library
6243 specified by "-l<name>" found in an input script.
6244 * script-c.h: Add prototype for script_add_library.
6245
6246 2010-06-07 Doug Kwan <dougkwan@google.com>
6247
6248 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6249 Restrict stub-group size to be within long conditional branch
6250 range when working around cortex-A8 erratum.
6251
6252 2010-06-07 Damien Diederen <dd@crosstwine.com>
6253
6254 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6255 #ifdef typo.
6256
6257 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6258
6259 PR gold/11658
6260 * output.cc
6261 (Output_section::Input_section_sort_entry::compare_section_ordering):
6262 Change to return non-zero correctly.
6263 (Output_section::Input_section_sort_section_order_index_compare
6264 ::operator()): Change to fix ambiguity in comparisons.
6265
6266 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6267
6268 * gold.h (is_wildcard_string): New function.
6269 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6270 (Layout::layout_eh_frame): Ditto.
6271 (Layout::find_section_order_index): New method.
6272 (Layout::read_layout_from_file): New method.
6273 * layout.h (Layout::find_section_order_index): New method.
6274 (Layout::read_layout_from_file): New method.
6275 (Layout::input_section_position_): New private member.
6276 (Layout::input_section_glob_): New private member.
6277 * main.cc (main): Call read_layout_from_file here.
6278 * options.h (--section-ordering-file): New option.
6279 * output.cc (Output_section::input_section_order_specified_): New
6280 member.
6281 (Output_section::Output_section): Initialize new member.
6282 (Output_section::add_input_section): Add new parameter.
6283 Keep input sections when --section-ordering-file is used.
6284 (Output_section::set_final_data_size): Sort input sections when
6285 section ordering file is specified.
6286 (Output_section::Input_section_sort_entry): Add new parameter.
6287 Check sorting type.
6288 (Output_section::Input_section_sort_entry::compare_section_ordering):
6289 New method.
6290 (Output_section::Input_section_sort_compare::operator()): Change to
6291 consider section_order_index.
6292 (Output_section::Input_section_sort_init_fini_compare::operator()):
6293 Change to consider section_order_index.
6294 (Output_section::Input_section_sort_section_order_index_compare
6295 ::operator()): New method.
6296 (Output_section::sort_attached_input_sections): Change to sort
6297 according to section order when specified.
6298 (Output_section::add_input_section<32, true>): Add new parameter.
6299 (Output_section::add_input_section<64, true>): Add new parameter.
6300 (Output_section::add_input_section<32, false>): Add new parameter.
6301 (Output_section::add_input_section<64, false>): Add new parameter.
6302 * output.h (Output_section::add_input_section): Add new parameter.
6303 (Output_section::input_section_order_specified): New
6304 method.
6305 (Output_section::set_input_section_order_specified): New method.
6306 (Input_section::Input_section): Initialize section_order_index_.
6307 (Input_section::section_order_index): New method.
6308 (Input_section::set_section_order_index): New method.
6309 (Input_section::section_order_index_): New member.
6310 (Input_section::Input_section_sort_section_order_index_compare): New
6311 struct.
6312 (Output_section::input_section_order_specified_): New member.
6313 * script-sections.cc (is_wildcard_string): Delete and move modified
6314 method to gold.h.
6315 (Output_section_element_input::Output_section_element_input): Modify
6316 call to is_wildcard_string.
6317 (Output_section_element_input::Input_section_pattern
6318 ::Input_section_pattern): Ditto.
6319 (Output_section_element_input::Output_section_element_input): Ditto.
6320 * testsuite/Makefile.am (final_layout): New test case.
6321 * testsuite/Makefile.in: Regenerate.
6322 * testsuite/final_layout.cc: New file.
6323 * testsuite/final_layout.sh: New file.
6324
6325 2010-06-01 Rafael Espindola <espindola@google.com>
6326
6327 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6328
6329 2010-06-01 Rafael Espindola <espindola@google.com>
6330
6331 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6332 visibility of symbols.
6333
6334 2010-05-27 Doug Kwan <dougkwan@google.com>
6335
6336 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6337 from start of output section instead of address for a local symbol
6338 in a merged or relaxed section when doing a relocatable link.
6339
6340 2010-05-26 Rafael Espindola <espindola@google.com>
6341
6342 PR 11604
6343 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6344 adding sections the garbage collector removed.
6345 * gold/testsuite/Makefile.am: Add test.
6346 * gold/testsuite/Makefile.in: Regenerate.
6347 * gold/testsuite/plugin_test_7.sh: New.
6348 * gold/testsuite/plugin_test_7_1.c: New.
6349 * gold/testsuite/plugin_test_7_2.c: New.
6350
6351 2010-05-26 Rafael Espindola <espindola@google.com>
6352
6353 * script-sections.cc (Output_section_definition::set_section_addresses):
6354 Check for --section-start.
6355
6356 2010-05-26 Doug Kwan <dougkwan@google.com>
6357
6358 * arm.cc (Arm_scan_relocatable_relocs): New class.
6359 (Target_arm::relocate_special_relocatable): New method.
6360 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6361 (Arm_relocate_functions::thumb_branch_common): Same.
6362 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6363 instead of Default_scan_relocatable_relocs.
6364 * target-reloc.h (relocate_for_relocatable): Let target handle
6365 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6366 * target.h (Sized_target::relocate_special_relocatable): New method.
6367
6368 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6369
6370 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6371
6372 2010-05-23 Doug Kwan <dougkwan@google.com>
6373
6374 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6375 instead of a cast.
6376 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6377 with a direct branch, not a conditional branch, to a stub.
6378 * merge.cc (Output_merge_base::record_input_section): New method
6379 defintion.
6380 (Output_merge_data::do_add_input_section): Record input section if
6381 keeps-input-sections flag is set.
6382 (Output_merge_string::do_add_input_section): Ditto.
6383 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6384 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6385 INPUT_SECTIONS_.
6386 (Output_merge_base::keeps_input_sections,
6387 Output_merge_base::set_keeps_input_sections,
6388 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6389 method definitions.
6390 (Output_merge_base::Input_sections): New type declaration.
6391 (Output_merge_base::input_sections_begin,
6392 Output_merge_base::input_sections_end,
6393 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6394 (Output_merge_base::bool keeps_input_sections_,
6395 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6396 Output_merge_base::input_sections_): New data members.
6397 (Output_merge_data::do_set_keeps_input_sections): New method
6398 defintion.
6399 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6400 * output.cc (Output_section::Input_section::relobj): Move method
6401 defintion from class declaration to here and handle merge sections.
6402 (Output_section::Input_section::shndx): Ditto.
6403 (Output_section::Output_section): Remove initializations of removed
6404 data members and initialize new data member LOOKUP_MAPS_.
6405 (Output_section::add_input_section): Set keeps-input-sections flag
6406 for a newly created merge output section as appropriate. Adjust code
6407 to use Output_section_lookup_maps class.
6408 (Output_section::add_relaxed_input_section): Adjst code for lookup
6409 maps code refactoring.
6410 (Output_section::add_merge_input_section): Add a new parameter
6411 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6412 class. If adding input section to a newly created merge output
6413 section fails, remove the new merge section.
6414 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6415 Adjust code for use of the Output_section_lookup_maps class.
6416 (Output_section::find_merge_section): Ditto.
6417 (Output_section::build_lookup_maps): New method defintion.
6418 (Output_section::find_relaxed_input_section): Adjust code to use
6419 Output_section_lookup_maps class.
6420 (Output_section::get_input_sections): Export merge sections. Adjust
6421 code to use Output_section_lookup_maps class.
6422 (Output_section:::add_script_input_section): Adjust code to use
6423 Output_section_lookup_maps class. Update lookup maps for merge
6424 sections also.
6425 (Output_section::discard_states): Use Output_section_lookup_maps.
6426 (Output_section::restore_states): Same.
6427 * output.h (Merge_section_properties): Move class defintion out of
6428 Output_section.
6429 (Output_section_lookup_maps): New class.
6430 (Output_section::Input_section::is_merge_section): New method
6431 defintion.
6432 (Output_section::Input_section::relobj): Move defintion out of class
6433 defintion. Declare method only.
6434 (Output_section::Input_section::shndx): Ditto.
6435 (Output_section::Input_section::output_merge_base): New method defintion.
6436 (Output_section::Input_section::u2_.pomb): New union field.
6437 (Output_section::Merge_section_by_properties_map,
6438 Output_section::Output_section_data_by_input_section_map,
6439 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6440 Remove types.
6441 (Output_section::add_merge_input_section): Add new parameter
6442 KEEPS_INPUT_SECTIONS.
6443 (Output_section::build_lookup_maps): New method declaration.
6444 (Output_section::merge_section_map_,
6445 Output_section::merge_section_by_properties_map_,
6446 Output_section::relaxed_input_section_map_,
6447 Output_section::is_relaxed_input_section_map_valid_): Remove data
6448 members.
6449 (Output_section::lookup_maps_): New data member.
6450
6451 2010-05-21 Doug Kwan <dougkwan@google.com>
6452
6453 PR gold/11619
6454 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6455 avoid a compilation error.
6456
6457 2010-05-19 Rafael Espindola <espindola@google.com>
6458
6459 * script-sections.cc (Output_section_definition::allocate_to_segment):
6460 Update the phdrs_list even when the output section is NULL.
6461 * testsuite/Makefile.am: Add test.
6462 * testsuite/Makefile.in: Regenerate.
6463 * testsuite/script_test_9.cc: New.
6464 * testsuite/script_test_9.sh: New.
6465 * testsuite/script_test_9.t: New.
6466
6467 2010-05-19 Doug Kwan <dougkwan@google.com>
6468
6469 * arm.cc (Arm_input_section::original_size): New method.
6470 (Arm_input_section::do_addralign): Add a cast.
6471 (Arm_input_section::do_output_offset): Remove static cast.
6472 (Arm_input_section::original_addralign,
6473 Arm_input_section::original_size_): Change type to uint32_t.
6474 (Arm_input_section::init): Add safe casts for section alignment
6475 and size.
6476 (Arm_input_section::set_final_data_size): Do not set address and
6477 offset of stub table.
6478 (Arm_output_section::fix_exidx_coverage): Change use of of
6479 Output_section::Simple_input_section to that of
6480 Output_section::Input_section.
6481 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6482 except for the first pass.
6483 * output.cc (Output_section::get_input_sections): Change type of
6484 input_sections to std::list<Input_section>.
6485 (Output_section::add_script_input_section): Rename from
6486 Output_section::add_simple_input_section. Change type of SIS
6487 parameter from Simple_input_section to Input_section.
6488 * output.h (Output_section::Simple_input_section): Remove class.
6489 (Output_section::Input_section): Change class visibility to public.
6490 (Output_section::Input_section::addralign): Use stored alignments
6491 for special input sections if set.
6492 (Output_section::Input_section::set_addralign): New method.
6493 (Output_section::get_input_sections): Change parameter type from
6494 list of Simple_input_section to list of Input_section.
6495 (Output_section::add_script_input_section): Rename from
6496 Output_section::add_simple_input_section. Change first parameter's
6497 type from Simple_input_section to Input_section and remove the
6498 second and third parameters.
6499 * script-sections.cc (Input_section::Input_section_list): Change
6500 type to list of Output_section::Input_section/
6501 (Input_section_info::Input_section_info): Change parameter type of
6502 INPUT_SECTION to Output_section::Input_section.
6503 (Input_section_info::input_section): Change return type.
6504 (Input_section_info::input_section_): Change type to
6505 Output_section::Input_section.
6506 (Output_section_element_input::set_section_addresses): Adjust code
6507 to use Output_section::Input_section instead of
6508 Output_section::Simple_input_section. Adjust code for renaming
6509 of Output_section::add_simple_input_section.
6510 (Orphan_output_section::set_section_addresses): Ditto.
6511
6512 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6513
6514 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6515 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6516
6517 2010-05-18 Rafael Espindola <espindola@google.com>
6518
6519 * options.cc (General_options::finalize): Handle -nostdlib.
6520 * options.h (nostdlib): New option.
6521 * script.cc (script_add_search_dir): Handle -nostdlib.
6522
6523 2010-05-12 Doug Kwan <dougkwan@google.com>
6524
6525 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6526 attributes section only if there no attributes section after merging.
6527 (Target_arm::merge_object_attributes): Move value of
6528 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6529 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6530 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6531 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6532 and arm_attr_merge_7.stdout.
6533 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6534 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6535 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6536 arm_attr_merge_7b.o): New rules.
6537 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6538 arm_attr_merge_7
6539 * testsuite/Makefile.in: Regenerate.
6540 * testsuite/arm_attr_merge.sh: New file.
6541 * testsuite/arm_attr_merge_[67][ab].s: Same.
6542
6543 2010-05-05 Nick Clifton <nickc@redhat.com>
6544
6545 * po/es.po: Updated Spanish translation.
6546
6547 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6548
6549 * Makefile.am (install-exec-local): Properly install gold as
6550 default cross linker.
6551 * Makefile.in: Regenerated.
6552
6553 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6554 Nick Clifton <nickc@redhat.com>
6555
6556 * configure.ac (install_as_default): Define and set to false
6557 unless --enable-gold or --enable-gold=both/gold has been
6558 specified.
6559 * configure: Regenerate.
6560
6561 * Makefile.am (install-exec-local): Install the executable as
6562 'ld.gold'. If install_as_default is true then also install it as
6563 'ld'.
6564 * Makefile.in: Regenerated.
6565
6566 2010-04-24 Ian Lance Taylor <iant@google.com>
6567
6568 * layout.cc (Layout::layout_reloc): In relocatable link don't
6569 combine reloc sections for grouped sections.
6570
6571 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6572
6573 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6574 sections that are not ordinary to icf.
6575 * icf.cc (get_section_contents): Handle relocation pointing to section
6576 with no object or shndx information.
6577 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6578 * testsuite/Makefile.in: Regenerate.
6579 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6580 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6581
6582 2010-04-22 Ian Lance Taylor <iant@google.com>
6583
6584 * expression.cc (Expression::Expression_eval_info): Add
6585 result_alignment_pointer field.
6586 (Expression::eval_with_dot): Add result_alignment_pointer
6587 parameter. Change all callers.
6588 (Expression::eval_maybe_dot): Likewise.
6589 (class Binary_expression): Add alignment_pointer parameter to
6590 left_value and right_value. Change all callers.
6591 (BINARY_EXPRESSION): Set result alignment.
6592 (class Trinary_expression): Add alignment_pointer parameter to
6593 arg2_value and arg3_value. Change all callers.
6594 (Trinary_cond::value): Set result alignment.
6595 (Max_expression::value, Min_expression::value): Likewise.
6596 (Align_expression::value): Likewise.
6597 * script-sections.cc (class Sections_element): Add dot_alignment
6598 parameter to set_section_addresses virtual function. Update
6599 instantiations.
6600 (class Output_section_element): Likewise.
6601 (Script_sections::create_segments): Add dot_alignment parameter.
6602 Change all callers.
6603 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6604 (Script_sections::set_phdrs_clause_addresses): Likewise.
6605 * script-sections.h: Update declarations.
6606 * script.h: Update declarations.
6607 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6608 min_p_align.
6609 * testsuite/script_test_3.t: Set large alignment.
6610 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6611 segment has expected alignment.
6612
6613 2010-04-22 Nick Clifton <nickc@redhat.com>
6614
6615 * po/gold.pot: Updated by the Translation project.
6616 * po/vi.po: Updated Vietnamese translation.
6617
6618 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6619
6620 * testsuite/Makefile.am (check_PROGRAMS): Add
6621 icf_virtual_function_folding_test.
6622 * testsuite/Makefile.in: Regenerated.
6623
6624 2010-04-15 Andrew Haley <aph@redhat.com>
6625
6626 * options.h (merge_exidx_entries): New option.
6627 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6628 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6629 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6630 (Target_arm::merge_exidx_entries): New function.
6631 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6632 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6633 to Arm_exidx_fixup constructor.
6634 Add new arg, merge_exidx_entries.
6635 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6636 Arm_output_section::fix_exidx_coverage.
6637
6638 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6639
6640 * icf.cc (get_section_contents): Check for preemptible functions.
6641 Ignore addend when appropriate.
6642 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6643 section folded.
6644 (add_from_relobj): Check for section folded.
6645 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6646 * symtab.h (should_add_dynsym_entry): Add new parameter.
6647 * target-reloc.h (scan_relocs): Check for section folded.
6648 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6649 Check reloc types for function pointers in shared objects.
6650 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6651 case.
6652 (icf_preemptible_functions_test): New test case.
6653 (icf_string_merge_test): New test case.
6654 * testsuite.Makefile.in: Regenerate.
6655 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6656 bar_glob. Refactor code.
6657 * testsuite/icf_preemptible_functions_test.cc: New file.
6658 * testsuite/icf_preemptible_functions_test.sh: New file.
6659 * testsuite/icf_string_merge_test.cc: New file.
6660 * testsuite/icf_string_merge_test.sh: New file.
6661 * testsuite/icf_virtual_function_folding_test.cc: New file.
6662 * testsuite/icf_virtual_function_folding_test.sh: New file.
6663
6664 2010-04-14 Doug Kwan <dougkwan@google.com>
6665
6666 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6667 for local symbol recounting if we remove a section due to ICF.
6668 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6669 there are no regular objects in input.
6670
6671 2010-04-13 Doug Kwan <dougkwan@google.com>
6672
6673 * arm.cc (Arm_input_section::set_final_data_size): Compute
6674 accurate final data size instead of using current data size.
6675
6676 2010-04-09 Doug Kwan <dougkwan@google.com>
6677
6678 * layout.cc (Layout::choose_output_section): Handle script section
6679 types.
6680 (Layout::make_output_section_for_script): Add section type parameter.
6681 Handle script section types.
6682 * layout.h (Layout::make_output_section_for_script): Add section
6683 type parameter.
6684 * output.cc (Output_section::Output_section): Initialize data member
6685 is_noload_.
6686 (Output_section::do_reset_address_and_file_offset): Do not set address
6687 to 0 if section is a NOLOAD section.
6688 * output.h (Output_section::is_noload): New method.
6689 (Output_section::set_is_noload): Ditto.
6690 (Output_section::is_noload_): New data member.
6691 * script-c.h (Script_section_type): New enum type.
6692 (struct Parser_output_section_header): Add new file section_type.
6693 * script-sections.cc (Sections_element::output_section_name): Add
6694 parameter for returning script section type.
6695 (Output_section_definition::output_section_name): Ditto.
6696 (Output_section_definition::section_type)P; New method.
6697 (Output_section_definiton::script_section_type_name): Ditto.
6698 (Output_section_definition::script_section_type_): New data member.
6699 (Output_section_definition::Output_section_definition): Initialize
6700 data member Output_section_definition::script_section_type_.
6701 (Output_section_definition::create_sections): Pass script section type
6702 to Layout::make_output_section_for_script.
6703 (Output_section_definition::output_section_name): Return script
6704 section type to caller.
6705 (Output_section_definition::set_section_address): Do not advance
6706 dot value and load address if section type is NOLOAD. Set address
6707 of NOLOAD sections regardless of section flags.
6708 (Output_section_definition::print): Print section type if it is
6709 not SCRIPT_SECTION_TYPE_NONE.
6710 (Output_section_definition::section_type): New method.
6711 (Output_section_definition::script_section_type_name): Ditto.
6712 (Script_sections::output_section_name): Add new parameter
6713 PSECTION_TYPE for returning script section type. Pass it to
6714 section elements. Handle discard sections.
6715 (Sort_output_sections::operator()): Handle NOLOAD sections.
6716 * script-sections.h (Script_sections::Section_type): New enum type.
6717 (Script_sections::output_section_name): Add a new parameter for
6718 returning script section type.
6719 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6720 INFO and NOLOAD.
6721 * yyscript.y (union): Add new field SECTION_TYPE.
6722 (COPY, DSECT, INFO, NOLOAD): New tokens.
6723 (opt_address_and_section_type): Change type to output_section_header.
6724 (section_type): New non-terminal
6725 (section_header): Handle section type.
6726 (opt_address_and_section_type): Return section type value.
6727
6728 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6729
6730 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6731 * testsuite/plugin_common_test_2.c (foo): Likewise.
6732
6733 2010-04-08 Doug Kwan <dougkwan@google.com>
6734
6735 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6736 Output_merge_data.
6737 * output.cc (Output_section::add_merge_input_section): Simplify
6738 code and return status of Output_merge_base::add_input_section.
6739 Update merge section map only if Output_merge_base::add_input_section
6740 returns true.
6741
6742 2010-04-07 Doug Kwan <dougkwan@google.com>
6743
6744 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6745 if section is marked as containing instructions but has no mapping
6746 symbols.
6747 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6748 correct section index.
6749 (Arm_relobj::find_linked_text_section): Ditto.
6750
6751 2010-04-07 Cary Coutant <ccoutant@google.com>
6752
6753 * archive.cc (include_member): Destroy Read_symbols_data object before
6754 releasing file.
6755 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6756 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6757 (Read_symbols_data::~Read_symbols_data) New destructor.
6758 (Section_relocs::Section_relocs) New constructor.
6759 (Section_relocs::~Section_relocs) New destructor.
6760 (Read_relocs_data::Read_relocs_data) New constructor.
6761 (Read_relocs_data::~Read_relocs_data) New destructor.
6762 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6763 pointers to NULL after deleting.
6764
6765 2010-04-07 Doug Kwan <dougkwan@google.com>
6766
6767 * arm.cc: Replace "endianity" with "endianness" in comments.
6768 (Arm_exidx_cantunwind): Ditto.
6769 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6770 (Arm_relobj::merge_flags_and_attributes): New method.
6771 (Arm_relobj::merge_flags_and_attributes_): New data member.
6772 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6773 (Arm_relobj::scan_sections_for_stubs): Ditto.
6774 (Arm_relobj::do_read_symbols): Check to see if we really want to
6775 merge processor-specific flags and attributes. Exit early if
6776 an object is empty except for section names and the undefined symbol.
6777 (Target_arm::do_finalize_sections): Move check for ELF format to
6778 Arm_relobj::do_read_symbols. Merge processor specific flags and
6779 attributes from a regular object only when we have determined that
6780 it is aapropriate. Do not create an .ARM.attributes section in
6781 output if there is no regular input object.
6782 (Target_arm::merge_processor_specific_flags): Check
6783 --warn-mismatch before printing any error.
6784 (Target_arm::merge_object_attributes): Ditto.
6785 * gold.cc (queue_middle_tasks): Handle the case in which there is
6786 no regular object in input.
6787 * options.cc (General_options::parse_EB): New method.
6788 (General_options::parse_EL): Same.
6789 (General_options::General_options): Initialize endianness_.
6790 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6791 New options.
6792 (General_options::Endianness): New enum.
6793 (General_options::endianness): New method.
6794 (General_options::endianness_): New data member.
6795 * parameters.cc (Parameters::set_options): Check target endianness.
6796 (Parameters::set_target_once): Ditto.
6797 (Parameters::check_target_endianness): New method.
6798 (parameters_force_valid_target): If either -EL or -EB is specified,
6799 use it to define endianness of default target.
6800 * parameters.h (Parameters::check_target_endianness): New method
6801 declaration.
6802 * target.h (class Target): Change "endianity" to "endianness"
6803 in comments.
6804
6805 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6806
6807 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6808 * configure: Regenerate.
6809 * Makefile.in: Regenerate.
6810 * testsuite/Makefile.in: Regenerate.
6811
6812 2010-04-06 Cary Coutant <ccoutant@google.com>
6813
6814 gcc PR lto/42757
6815 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6816 prevailing definitions of common symbols.
6817 * testsuite/plugin_test_6.sh: New test case.
6818 * testsuite/plugin_common_test_1.c: New test case.
6819 * testsuite/plugin_common_test_2.c: New test case.
6820 * testsuite/Makefile.am (plugin_test_6): New test case.
6821 * testsuite/Makefile.in: Regenerate.
6822
6823 2010-04-06 Nick Clifton <nickc@redhat.com>
6824
6825 * po/vi.po: New Vietnamese translation.
6826
6827 2010-03-30 Doug Kwan <dougkwan@google.com>
6828
6829 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6830
6831 2010-03-25 Doug Kwan <dougkwan@google.com>
6832
6833 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6834 to avoid a conversion warning on a 32-bit host.
6835
6836 2010-03-24 Ian Lance Taylor <iant@google.com>
6837
6838 * testsuite/script_test_3.t: Add a TLS segment.
6839 * testsuite/Makefile.am (check_PROGRAMS): Add
6840 tls_phdrs_script_test.
6841 (tls_phdrs_script_test_SOURCES): Define.
6842 (tls_phdrs_script_test_DEPENDENCIES): Define.
6843 (tls_phdrs_script_test_LDFLAGS): Define.
6844 (tls_phdrs_script_test_LDADD): Define.
6845 * testsuite/Makefile.in: Rebuild.
6846
6847 2010-03-23 Cary Coutant <ccoutant@google.com>
6848
6849 * fileread.cc (find_or_make_view): Fix comment.
6850
6851 2010-03-23 Ian Lance Taylor <iant@google.com>
6852
6853 * script-sections.cc (class Orphan_section_placement): Define
6854 PLACE_TLS and PLACE_TLS_BSS.
6855 (Orphan_section_placement::Orphan_section_placement): Initialize
6856 new places.
6857 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6858 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6859 (tls_script_test_SOURCES): Define.
6860 (tls_script_test_DEPENDENCIES): Define.
6861 (tls_script_test_LDFLAGS): Define.
6862 (tls_script_test_LDADD): Define.
6863 * testsuite/Makefile.in: Rebuild.
6864
6865 2010-03-22 Doug Kwan <dougkwan@google.com>
6866
6867 * arm.cc (Arm_relocate_functions::abs8,
6868 Arm_relocate_functions::abs16): Use correct check for overflow
6869 specified in the ARM ELF specs.
6870 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6871 target of a BLX instruction specially.
6872 (Reloc_stub::stub_type_for_reloc): Ditto.
6873 (Relocate::relocate): Use symbolic names instead of numeric relocation
6874 codes to report error.
6875 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6876 workaround.
6877 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6878 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6879 thumb2_blx_out_of_range.stdout
6880 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6881 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6882 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6883 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6884 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6885 thumb2_blx_in_range, thumb2_blx_in_range.o,
6886 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6887 thumb2_blx_out_of_range.o): New rules.
6888 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6889 thumb2_blx_in_range and thumb2_blx_out_of_range.
6890 * testsuite/Makefile.in: Regenerate.
6891 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6892 * testsuite/thumb_blx_in_range.s: New file.
6893 * testsuite/thumb_blx_out_of_range.s: New file.
6894
6895 2010-03-22 Rafael Espindola <espindola@google.com>
6896
6897 * archive.cc (Should_include): Move to archive.h.
6898 (should_include_member): Make it a member of Archive.
6899 (Lib_group): New.
6900 (Add_lib_group_symbols): New.
6901 * archive.h: Include options.h.
6902 (Archive_member): Moved from Archive.
6903 (Should_include): Moved from archive.cc.
6904 (Lib_group): New.
6905 (Add_lib_group_symbols): New.
6906 * dynobj.cc (do_should_include_member): New.
6907 * dynobj.h (do_should_include_member): New.
6908 * gold.cc (queue_initial_tasks): Update call to queue.
6909 * main.cc (main): Print lib group stats.
6910 * object.cc (do_should_include_member): New.
6911 * object.h: Include archive.h.
6912 (Object::should_include_member): New.
6913 (Object::do_should_include_member): New.
6914 (Sized_relobj::do_should_include_member): New.
6915 * options.cc (General_options::parse_start_lib): New.
6916 (General_options::parse_end_lib): New.
6917 (Input_arguments::add_file): Handle lib groups.
6918 (Input_arguments::start_group): Check we are not in a lib.
6919 (Input_arguments::start_lib): New.
6920 (Input_arguments::end_lib): New.
6921 * options.h (General_options): Add start_lib and end_lib.
6922 (Input_argument::lib_): New.
6923 (Input_argument::lib): New.
6924 (Input_argument::is_lib): New.
6925 (Input_file_lib): New.
6926 (Input_arguments::in_lib_): New.
6927 (Input_arguments::in_lib): New.
6928 (Input_arguments::start_lib): New.
6929 (Input_arguments::end_lib_): New.
6930 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6931 in unused members as preempted.
6932 (Sized_pluginobj::do_should_include_member): New.
6933 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6934 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6935 return the blocker.
6936 (Read_symbols::do_whole_lib_group): New.
6937 (Read_symbols::do_lib_group): New.
6938 (Read_symbols::do_read_symbols): Handle lib groups.
6939 (Read_symbols::get_name): Handle lib groups.
6940 * readsyms.h (Read_symbols): Add an archive member pointer.
6941 (Read_symbols::do_whole_lib_group): New.
6942 (Read_symbols::do_lib_group): New.
6943 (Read_symbols::member_): New.
6944 * script.cc (read_input_script): Update call to queue_soon.
6945
6946 2010-03-19 Doug Kwan <dougkwan@google.com>
6947
6948 * arm.cc (Stub_table::Stub_table): Initialize new data members
6949 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6950 (Stub_table::add_reloc_stub): Assign stub offset and update
6951 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6952 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6953 New data members.
6954 (Stub_table::update_data_size_and_addralign): Use
6955 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6956 instead of going over all reloc stubs.
6957 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6958 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6959 Stringpool_template::offset_ to size of Stringpool_char.
6960 (Stringpool_template::new_key_offset): Remove code to initialize
6961 Stringpool_template::offset_.
6962 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6963 Stringpool_template::offset_ to zero.
6964
6965 2010-03-15 Doug Kwan <dougkwan@google.com>
6966
6967 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6968 offset_.
6969 (Stringpool_template::new_key_offset): New method.
6970 (Stringpool_template::add_string): Assign offsets when adding new
6971 strings.
6972 (Stringpool_template::set_string_offsets): Do not set string offsets
6973 when not optimizing.
6974 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6975 member size_.
6976 (Chunked_vector::clear): Clear size_.
6977 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6978 (Chunked_vector::size): Return size_.
6979 (Chunked_vector::push_back): Use size_ to find insert position.
6980 (Chunked_vector::size_): New data member.
6981 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6982 (Stringpool_template::new_key_offset): New method declaration.
6983 (Stringpool_template::offset_): New data member.
6984
6985 2010-03-15 Rafael Espindola <espindola@google.com>
6986
6987 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6988 Add_symbols' constructor.
6989 * readsyms.h (Add_symbols): Remove the input_group member.
6990
6991 2010-03-10 Ian Lance Taylor <iant@google.com>
6992
6993 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6994 target to ask whether a reference to a symbol requires a stack
6995 split.
6996 * target.h (Target::is_call_to_non_split): New function.
6997 (Target::do_is_call_to_non_split): Declare virtual function.
6998 * target.cc: Include "symtab.h".
6999 (Target::do_is_call_to_non_split): New function.
7000 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7001
7002 2010-03-10 Cary Coutant <ccoutant@google.com>
7003
7004 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7005 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7006 (File_read::open[2]): Add whole_file_view_ to list of views.
7007 (File_read::make_view): Remove test of whole_file_view_.
7008 (File_read::find_or_make_view): Create whole_file_view_ if
7009 necessary.
7010 (File_read::clear_views): Replace bool parameter with enum;
7011 adjust all callers. Don't delete views with permanent data;
7012 do delete cached views and views from archives if
7013 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7014 if clearing the corresponding view.
7015 * fileread.h (File_read::Clear_views_mode): New enum.
7016 (File_read::View::is_permanent_view): New method.
7017 (File_read::clear_views): Replace bool parameter
7018 with enum; adjust all callers.
7019 * options.h (General_options): Change keep_files_mapped option;
7020 add map_whole_files.
7021 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7022 releasing the file.
7023 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7024 the file.
7025
7026 2010-03-10 David S. Miller <davem@davemloft.net>
7027
7028 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7029
7030 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7031
7032 * icf.cc (get_section_contents): Add '@' marker after processing the
7033 merge reloc.
7034
7035 2010-03-08 Doug Kwan <dougkwan@google.com>
7036
7037 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7038 due to a conversion warning.
7039 (Arm_relobj::update_output_local_symbol_count): Check for local
7040 symbol with unset output index.
7041
7042 2010-03-05 Ian Lance Taylor <iant@google.com>
7043
7044 * options.h (class General_options): Add --spare-dynamic-tags.
7045 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7046 --spare-dynamic-tags.
7047
7048 2010-03-05 Ian Lance Taylor <iant@google.com>
7049
7050 * incremental.cc: Include "libiberty.h".
7051
7052 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7053
7054 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7055 function, is_info_ member.
7056 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7057 (Versions::Versions): Update caller.
7058 (Versions::define_base_version): Likewise.
7059 (Versions::add_def): Likewise.
7060
7061 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7062
7063 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7064 (Scan::possible_function_pointer_reloc): New function.
7065 (Scan::local_reloc_may_be_function_pointer): Change to call
7066 possible_function_pointer_reloc.
7067 (Scan::global_reloc_may_be_function_pointer): Ditto.
7068 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7069 relocations in ".data.rel.ro._ZTV" section.
7070 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7071 * testsuite/icf_safe_so_test.cc: Ditto.
7072 * testsuite/icf_safe_test.cc: Ditto.
7073 * testsuite/icf_safe_test.sh: Ditto.
7074
7075 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7076 Ian Lance Taylor <iant@google.com>
7077
7078 * target-reloc.h (relocate_section): Check the symbol table index
7079 for -1U before setting the local symbol index.
7080 (scan_relocatable_relocs): If copying the relocation, record that
7081 the local symbol is required.
7082 * object.h (Symbol_value::is_output_symtab_index_set): New
7083 function.
7084 (Symbol_value::may_be_discarded_from_output_symtab): New
7085 function.
7086 (Symbol_value::has_output_symtab_entry): New function.
7087 (Symbol_value::needs_output_symtab_entry): Remove.
7088 (Symbol_value::output_symtab_index): Make sure the symbol index is
7089 set.
7090 (Symbol_value::set_output_symtab_index): Make sure the symbol
7091 index is not set. Make sure the new index is valid.
7092 (Symbol_value::set_must_have_output_symtab_entry): New function.
7093 (Symbol_value::has_output_dynsym_entry): New function.
7094 (Symbol_value::set_output_dynsym_index): Make sure the new index
7095 is valid.
7096 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7097 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7098 local symbol if permitted.
7099 (Sized_relobj::do_finalize_local_symbols): Call
7100 is_output_symtab_index_set rather than needs_output_symtab_entry.
7101 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7102 rather than needs_output_symtab_entry. Call
7103 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7104 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7105 is_output_symtab_index_set rather than needs_output_symtab_entry.
7106 * testsuite/discard_locals_relocatable_test.c: New file.
7107 * testsuite/discard_locals_test.sh: Test -r.
7108 * testsuite/Makefile.am (check_DATA): Add
7109 discard_locals_relocatable_test1.syms,
7110 discard_local_relocatable_test2.syms.
7111 (MOSTLYCLEANFILES): Likewise. Also add
7112 discard_locals_relocatable_test1.lout and
7113 discard_locals_relocatable_test2.out.
7114 (discard_locals_relocatable_test1.syms): New target.
7115 (discard_locals_relocatable_test.o): New target.
7116 (discard_locals_relocatable_test1.out): New target.
7117 (discard_locals_relocatable_test2.syms): New target.
7118 (discard_locals_relocatable_test2.out): New target.
7119 (various): Add missing ../ld-new dependencies.
7120 * testsuite/Makefile.in: Rebuild.
7121
7122 2010-03-03 Nick Clifton <nickc@redhat.com>
7123
7124 * po/fi.po: New Finnish translation.
7125
7126 2010-03-01 Doug Kwan <dougkwan@google.com>
7127
7128 * layout.cc (Layout::Layout): Force section types of .init_array*,
7129 .preinit_array* and .fini_array* sections.
7130 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7131 Fix check of return value of std::string::find.().
7132 (Output_section::Input_section_sort_compare::operator()): Remove
7133 comment about .init_array.
7134 (Output_section::Input_section_sort_init_fini_compare::operator()):
7135 New method.
7136 (Output_section::sort_attached_input_sections): Handle .init_array
7137 and .fini_array specially.
7138 * output.h (Output_section::Inut_section_sort_compare): Update
7139 comment.
7140 (Output_section::Input_section_sort_init_fini_compare): New struct.
7141
7142 2010-02-26 Doug Kwan <dougkwan@google.com>
7143
7144 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7145 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7146 * testsuite/debug_msg.sh: Avoid matching source line number for
7147 use of global variable undef_int.
7148
7149 2010-02-26 Doug Kwan <dougkwan@google.com>
7150
7151 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7152 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7153 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7154 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7155 * options.cc (General_options::General_options): Initialize member
7156 fix_v4bx_.
7157 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7158 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7159 and rm_no_fix_v4bx.stdout
7160 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7161 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7162 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7163 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7164 and arm_no_fix_v4bx.
7165 * Makefile.in: Regenerate.
7166 * testsuite/arm_fix_v4bx.s: New file.
7167 * testsuite/arm_fix_v4bx.sh: Ditto.
7168
7169 2010-02-24 Doug Kwan <dougkwan@google.com>
7170
7171 * arm.cc (Target_arm::got_section): Make the .got section the first
7172 non RELRO section in the data segment.
7173 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7174 suffixes of section names.
7175
7176 2010-02-24 Doug Kwan <dougkwan@google.com>
7177
7178 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7179 flags and attributes merging if an input file is a binary file.
7180 * fileread.cc (Input_file::open): Record format of original file.
7181 * fileread.h (Input_file::Format): New enum type.
7182 (Input_file::Input_file): Initialize data member format_.
7183 (Input_file::format): New method definition.
7184 (Input_file::format_):: New data member.
7185
7186 2010-02-24 Doug Kwan <dougkwan@google.com>
7187
7188 * arm.cc (Arm_output_data_got): New class.
7189 (ARM_TCB_SIZE): New constant
7190 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7191 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7192 If user uses a script with a SECTIONS clause, issue only a warning
7193 for a misplaced EXIDX input section. Otherwise, issue an error.
7194 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7195 garbage collection.
7196 (Target_arm::got_mode_index_entry): Handle static linking.
7197 (Target_arm::Scan::local): Ditto.
7198 (Target_arm::Scan::global): Ditto.
7199 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7200 all incorrectly implemented relocations.
7201 (Target_arm::fix_exidx_coverage): Pass layout to
7202 Arm_output_section::fix_exidx_coverage.
7203 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7204 from ".ARM.exidx." and ".ARM.extab.".
7205
7206 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7207
7208 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7209 section if it does not already exist.
7210 * attributes.cc (Attributes_section_data::Attributes_section_data):
7211 Don't crash if size is zero.
7212
7213 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7214 Ian Lance Taylor <iant@google.com>
7215
7216 * gold.cc (queue_middle_tasks): If no input files were opened,
7217 exit.
7218 * workqueue.h (Task_function::Task_function): Assert that there is
7219 a blocker.
7220
7221 2010-02-22 Doug Kwan <dougkwan@google.com>
7222
7223 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7224 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7225 types to avoid warnings due to different uint64_t implementations
7226 on different hosts.
7227
7228 2010-02-21 Doug Kwan <dougkwan@google.com>
7229
7230 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7231 handling of the maximum backward branch offset.
7232 (Arm_relocate_functions::thumb_branch_common): Ditto.
7233 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7234 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7235 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7236 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7237 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7238 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7239 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7240 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7241 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7242 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7243 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7244 thumb2_bl_out_of_range.o): New rules.
7245 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7246 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7247 thumb2_bl_out_of_range
7248 * testsuite/Makefile.in: Regenerate.
7249 * testsuite/arm_bl_in_range.s: New file.
7250 * testsuite/arm_bl_out_of_range.s: Ditto.
7251 * testsuite/arm_branch_in_range.sh: Ditto.
7252 * testsuite/arm_branch_range.t: Ditto.
7253 * testsuite/thumb2_branch_range.t: Ditto.
7254 * testsuite/thumb_bl_in_range.s: Ditto.
7255 * testsuite/thumb_bl_out_of_range.s: Ditto.
7256 * testsuite/thumb_branch_range.t: Ditto.
7257
7258 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7259
7260 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7261 Add reloc offset information.
7262 * icf.cc (get_section_contents): Change iterators to point to the new
7263 vectors. Add reloc offset information to the contents.
7264 * icf.h (Icf::Sections_reachable_info): New typedef.
7265 (Icf::Sections_reachable_list): New typedef.
7266 (Icf::Offset_info): New typedef.
7267 (Icf::Reloc_info): New struct typedef.
7268 (Icf::Reloc_info_list): New typedef.
7269 (Icf::symbol_reloc_list): Delete method.
7270 (Icf::addend_reloc_list): Delete method.
7271 (Icf::section_reloc_list): Delete method.
7272 (Icf::reloc_info_list): New method.
7273 (Icf::reloc_info_list_): New member.
7274
7275 2010-02-19 Doug Kwan <dougkwan@google.com>
7276
7277 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7278 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7279 * arm.cc (Arm_relocation_functions): New forward declaration.
7280 (Target_arm::Target_arm): Initialize new data members
7281 got_mod_index_offset_ and tls_base_symbol_defined_.
7282 (Target_arm::Relocate::relocate_tls): New method.
7283 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7284 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7285 New methods.
7286 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7287 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7288 (Target_arm::got_mod_index_offset_,
7289 Target_arm::tls_base_symbol_defined_): New data members.
7290 (Target_arm::Scan::local, Target::Scan::global,
7291 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7292 relocations.
7293
7294 2010-02-18 Doug Kwan <dougkwan@google.com>
7295
7296 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7297 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7298 text section as a parameter becuase some broken tools may not set
7299 the link in section header.
7300 (Target_arm::has_got_section): New method.
7301 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7302 without any mapping symbol as data only. Remove warning.
7303 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7304 link in its section header, try to discover the link by inspecting the
7305 REL31 relocation at the beginning of the section.
7306 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7307 in error message.
7308 (Target_arm::Scan::global): Treat any reference to the symbol
7309 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7310
7311 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7312
7313 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7314 (Scan::global_reloc_may_be_function_pointer): New function.
7315 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7316 (Scan::global_reloc_may_be_function_pointer): New function.
7317 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7318 (Scan::global_reloc_may_be_function_pointer): New function.
7319 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7320 (Scan::global_reloc_may_be_function_pointer): New function.
7321 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7322 (Scan::global_reloc_may_be_function_pointer): New function.
7323 (Scan::possible_function_pointer_reloc): New function.
7324 (Target_x86_64::can_check_for_function_pointers): New function.
7325 * gc.h (gc_process_relocs): Scan relocation types to determine if
7326 function pointers were taken for targets that support it.
7327 * icf.cc (Icf::find_identical_sections): Include functions for
7328 folding in safe ICF whose pointer is not taken.
7329 * icf.h (Secn_fptr_taken_set): New typedef.
7330 (fptr_section_id_): New member.
7331 (section_has_function_pointers): New function.
7332 (set_section_has_function_pointers): New function.
7333 (check_section_for_function_pointers): New function.
7334 * options.h: Fix comment for safe ICF option.
7335 * target.h (can_check_for_function_pointers): New function.
7336 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7337 Modify icf_safe_test for X86-64.
7338 * testsuite/Makefile.in: Regenerate.
7339 * testsuite/icf_safe_so_test.cc: New file.
7340 * testsuite/icf_safe_so_test.sh: New file.
7341 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7342 (main): Change to take pointer to function kept_func_3.
7343 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7344 folding is done correctly for X86-64.
7345
7346 2010-02-12 David S. Miller <davem@davemloft.net>
7347
7348 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7349 is_symbolless parameter.
7350 (Output_reloc<SHT_REL>::is_symbolless): New.
7351 (Output_reloc<SHT_REL>::is_symbolless_): New.
7352 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7353 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7354 (Output_reloc<SHT_RELA>::is_symbolless): New.
7355 (Output_data_reloc::add_global): Handle is_symbolless.
7356 (Output_data_reloc::add_global_relative): Likewise.
7357 (Output_data_reloc::add_local): Likewise.
7358 (Output_data_reloc::add_local_relative): Likewise.
7359 (Output_data_reloc::add_symbolless_global_addend): New.
7360 (Output_data_reloc::add_symbolless_local_addend): New.
7361 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7362 is_symbolless.
7363 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7364 instead of ->is_relative_
7365 (Output_reloc::write): Likewise.
7366 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7367 (Output_reloc::write_rel): Simplify.
7368
7369 * sparc.cc (Target_sparc::Scan::local): Use
7370 ->add_symbolless_local_addend as needed.
7371 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7372 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7373 based upon relocation offset.
7374
7375 2010-02-11 Doug Kwan <dougkwan@google.com>
7376
7377 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7378 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7379 beginning of function.
7380 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7381 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7382 parameter is_32bit in calls to should_apply_static_reloc.
7383 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7384 (check_DATA): Add arm_abs_global.stdout.
7385 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7386 arm_abs_global.stdout): New rules.
7387 (MOSTLLYCLEANFILES): Add arm_abs_global
7388 * Makefile.in: Regenerate.
7389 * testsuite/arm_abs_global.s: New file.
7390 * testsuite/arm_abs_global.sh: Ditto.
7391 * testsuite/arm_abs_lib.s: Ditto.
7392
7393 2010-02-11 Ian Lance Taylor <iant@google.com>
7394
7395 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7396 Read_relocs task.
7397 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7398 Allocate_commons_task first.
7399 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7400 task, rather than symtab_lock_.
7401 (Gc_process_relocs::~Gc_process_relocs): New function.
7402 (Gc_process_relocs::is_runnable): Check this_blocker_.
7403 (Gc_process_relocs::locks): Use next_blocker_ rather than
7404 blocker_.
7405 (Scan_relocs::~Scan_relocs): New function.
7406 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7407 symtab_lock_.
7408 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7409 next_blocker_.
7410 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7411 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7412 constructor accordingly.
7413 (class Gc_process_relocs): Likewise.
7414 (class Scan_relocs): Likewise.
7415 * common.h (class Allocate_commons_task): Remove symtab_lock_
7416 field, and corresponding constructor parameter.
7417 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7418 symtab_lock_.
7419 (Allocate_commons_task::locks): Likewise.
7420
7421 2010-02-11 Ian Lance Taylor <iant@google.com>
7422
7423 * gold-threads.h (class Once): Define.
7424 (class Initialize_lock): Rewrite as child of Once.
7425 * gold-threads.cc (class Once_initialize): Define.
7426 (once_pointer_control): New static variable.
7427 (once_pointer, once_arg): New static variables.
7428 (c_run_once): New static function.
7429 (Once::Once, Once::run_once, Once::internal_run): New functions.
7430 (class Initialize_lock_once): Remove.
7431 (initialize_lock_control): Remove.
7432 (initialize_lock_pointer): Remove.
7433 (initialize_lock_once): Remove.
7434 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7435 (Initialize_lock::initialize): Rewrite.
7436 (Initialize_lock::do_run_once): New function.
7437 * archive.cc (Archive::interpret_header): Only clear name if it is
7438 not already empty.
7439 * fileread.cc: Include "gold-threads.h"
7440 (file_counts_lock): New static variable.
7441 (file_counts_initialize_lock): Likewise.
7442 (File_read::release): Only increment counts when using --stats.
7443 Use a lock around the increment.
7444 * parameters.cc (class Set_parameters_target_once): Define.
7445 (set_parameters_target_once): New static variable.
7446 (Parameters::Parameters): Move here from parameters.h.
7447 (Parameters::set_target): Rewrite.
7448 (Parameters::set_target_once): New function.
7449 (Parameters::clear_target): Move here and rewrite.
7450 * parameters.h (class Parameters): Update declarations. Add
7451 set_parameters_target_once_ field.
7452 (Parameters::Parameters): Move to parameters.cc.
7453 (Parameters::clear_target): Likewise.
7454 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7455 task.
7456 (Start_group::~Start_group): New function.
7457 (Start_group::is_runnable): New function.
7458 (Start_group::locks, Start_group::run): New functions.
7459 (Finish_group::run): Change saw_undefined to size_t.
7460 * readsyms.h (class Start_group): Define.
7461 (class Finish_group): Change saw_undefined_ field to size_t.
7462 (Finish_group::Finish_group): Remove saw_undefined and
7463 this_blocker parameters. Change all callers.
7464 (Finish_group::set_saw_undefined): New function.
7465 (Finish_group::set_blocker): New function.
7466 * symtab.h (class Symbol_table): Change saw_undefined to return
7467 size_t. Change saw_undefined_ field to size_t.
7468 * target-select.cc (Set_target_once::do_run_once): New function.
7469 (Target_selector::Target_selector): Initialize set_target_once_
7470 field. Don't initialize lock_ and initialize_lock_ fields.
7471 (Target_selector::instantiate_target): Rewrite.
7472 (Target_selector::set_target): New function.
7473 * target-select.h (class Set_target_once): Define.
7474 (class Target_selector): Update declarations. Make
7475 Set_target_once a friend. Remove lock_ and initialize_lock_
7476 fields. Add set_target_once_ field.
7477
7478 2010-02-10 Ian Lance Taylor <iant@google.com>
7479
7480 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7481 queueing any tasks.
7482 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7483 (queue_middle_tasks): Add all blockers before queueing any tasks.
7484 (queue_final_tasks): Likewise.
7485 * token.h (Task_token::add_blockers): New function.
7486 * object.h (Input_objects::number_of_relobjs): New function.
7487
7488 2010-02-10 Ian Lance Taylor <iant@google.com>
7489
7490 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7491 shared, not if not position independent.
7492 * x86_64.cc (Relocate::relocate_tls): Likewise.
7493 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7494 (tls_pie_pic_test): New target.
7495 * testsuite/Makefile.in: Rebuild.
7496
7497 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7498 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7499 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7500 * testsuite/Makefile.in: Rebuild.
7501
7502 2010-02-09 David S. Miller <davem@davemloft.net>
7503
7504 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7505 R_SPARC_RELATIVE using ->add_local_relative().
7506 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7507
7508 * output.h (Output_data_dynamic::add_section_size): New method
7509 that takes two Output_data objects.
7510 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7511 entry param. Handle it in initializers.
7512 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7513 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7514 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7515 arg.
7516 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7517 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7518 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7519 for dynrel_includes_plt.
7520 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7521 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7522 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7523 before .rela.plt
7524 (Target_sparc::do_finalize_sections): Update to pass true for
7525 dynrel_includes_plt.
7526 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7527 output before .rela.plt
7528 (Target_powerpc::do_finalize_sections): Update to pass true for
7529 dynrel_includes_plt when 32-bit.
7530
7531 2010-02-08 Doug Kwan <dougkwan@google.com>
7532
7533 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7534 method.
7535 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7536 Arm_relobj::scan_section_for_cortex_a8_stubs,
7537 Arm_relobj::do_relocation_section): Instead of calling
7538 Output_section::output_address, use faster
7539 Arm_relobj::simple_input_section_output_address.
7540
7541 2010-02-08 David S. Miller <davem@davemloft.net>
7542
7543 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7544 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7545 relocation helper function.
7546
7547 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7548 just like R_SPARC_GOT{10,13,22}.
7549 (Target_sparc::Scan::local): Likewise.
7550 (Target_sparc::Relocate:relocate): Likewise.
7551
7552 2010-02-06 Ian Lance Taylor <iant@google.com>
7553
7554 * configure.ac: Rewrite targetobjs duplicate removal code to use
7555 only shell constructs.
7556 * configure: Rebuild.
7557
7558 2010-02-05 Doug Kwan <dougkwan@google.com>
7559
7560 PR 11247
7561 * arm.cc (Arm_relobj::section_is_scannable): New method.
7562 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7563 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7564
7565 2010-02-04 Doug Kwan <dougkwan@google.com>
7566
7567 PR 11247
7568 * arm-reloc-property.cc (cstdio): Include.
7569 * configure.ac (targetobjs): Remove duplicates.
7570 * configure: Regenerate.
7571 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7572 big and little endian version for a given address size.
7573
7574 2010-02-03 Doug Kwan <dougkwan@google.com>
7575
7576 * arm-reloc-property.cc
7577 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7578 definition.
7579 * arm-reloc-property.h
7580 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7581 New method definition.
7582 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7583 declaration.
7584 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7585 overflow to N.
7586 (GOT_PREL): Change implemented to Y.
7587 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7588 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7589 (Arm_relocate_functions::movw_abs_nc): Remove method.
7590 (Arm_relocate_functions::movt_abs): Ditto.
7591 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7592 (Arm_relocate_functions::thm_movt_abs): Ditto.
7593 (Arm_relocate_functions::movw_rel_nc): Ditto.
7594 (Arm_relocate_functions::movw_rel): Ditto.
7595 (Arm_relocate_functions::movt_rel): Ditto.
7596 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7597 (Arm_relocate_functions:thm_movw_rel): Ditto.
7598 (Arm_relocate_functions:thm_movt_rel): Ditto.
7599 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7600 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7601 New method definitions.
7602 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7603 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7604 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7605 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7606 (Target_arm::Relocate::relocate): Check for non-static or
7607 unimplemented relocation code and exit early. Change calls to
7608 Target_arm::reloc_uses_thumb_bit and
7609 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7610 instead. Refactor code to handle similar relocations to increase
7611 code sharing. Remove check for unsupported relocation code in switch
7612 statement.
7613 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7614 relocation property table to find out size. Change error message to
7615 print out the name of a relocation code instead of the numeric value.
7616 (Target_arm::scan_reloc_for_stub): Use relocation property table
7617 instead of calling Target_arm::reloc_uses_thumb_bit().
7618
7619 2010-02-02 Doug Kwan <dougkwan@google.com>
7620
7621 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7622 types of relaxed input section.
7623
7624 2010-02-02 Doug Kwan <dougkwan@google.com>
7625
7626 * Makefile.am (HFILES): Add arm-reloc-property.h.
7627 (DEFFILES): New.
7628 (TARGETSOURCES): Add arm-reloc-property.cc
7629 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7630 (libgold_a_SOURCES): $(DEFFILES)
7631 * Makefile.in: Regenerate.
7632 * arm-reloc-property.cc: New file.
7633 * arm-reloc-property.h: New file.
7634 * arm-reloc.def: New file.
7635 * arm.cc: Update comments.
7636 (arm-reloc-property.h): New included header.
7637 (arm_reloc_property_table): New global variable.
7638 (Target_arm::do_select_as_default_target): New method definition.
7639 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7640 arm-reloc-property to targ_extra_obj.
7641 * parameters.cc (set_parameters_target): Call
7642 Target::select_as_default_target().
7643 * target.h (Target::select_as_default_target): New method definition.
7644 (Target::do_select_as_default_target): Same.
7645
7646 2010-02-01 Doug Kwan <dougkwan@google.com>
7647
7648 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7649 first_output_text_section_.
7650 (Arm_exidx_fixup::first_output_text_section): New method definition.
7651 (Arm_exidx_fixup::first_output_text_section_): New data member.
7652 (Arm_exidx_fixup::process_exidx_section): Record the first text
7653 output section seen.
7654 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7655 and entsize in output section header.
7656
7657 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7658
7659 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7660 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7661 (Arm_relocate_functions::thm_alu11): New Method.
7662 (Arm_relocate_functions::thm_pc8): New Method.
7663 (Arm_relocate_functions::thm_pc12): New Method.
7664 (Target_arm::Scan::local): Handle the relocations.
7665 (Target_arm::Scan::global): Likewise.
7666 (Target_arm::Relocate::relocate): Likewise.
7667 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7668
7669 2010-01-29 Doug Kwan <dougkwan@google.com>
7670
7671 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7672 of relocation types as ld.
7673
7674 2010-01-29 Doug Kwan <dougkwan@google.com>
7675
7676 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7677 to public.
7678 (Arm_relocate_functions::thumb_branch_common): Ditto.
7679 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7680 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7681 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7682 Arm_relocate_functions::jump24): Remove.
7683 (Target_arm::Relocate::relocate): Adjust code to call
7684 Arm_relocation_functions::arm_branch_common and
7685 Arm_relocation_functions::thumb_branch_common instead of their removed
7686 wrappers. Merge switch-cases together to reduce source code size.
7687
7688 2010-01-29 Doug Kwan <dougkwan@google.com>
7689
7690 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7691 output_local_symbol_count_needs_update_.
7692 (Arm_relobj::output_local_symbol_count_needs_update,
7693 Arm_relobj::set_output_local_symbol_count_needs_update,
7694 Arm_relobj::update_output_local_symbol_count): New methods.
7695 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7696 member.
7697 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7698 of pointed function as in a R_ARM_PREL31 relocation.
7699 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7700 for output local symbol count updating.
7701 (Target_arm::do_relax): Update output local symbol counts in objects
7702 if necessary.
7703 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7704
7705 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7706
7707 * arm.cc: Added support for the ARM relocations:
7708 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7709 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7710 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7711 movw_prel_nc).
7712 (Arm_relocate_functions::movw_rel): New method.
7713 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7714 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7715 thm_movw_prel_nc).
7716 (Arm_relocate_functions::thm_movw_rel): New method.
7717 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7718 thm_movt_prel).
7719 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7720 relocations.
7721 (Target_arm::Scan::global): Likewise.
7722 (Target_arm::Relocate::relocate): Likewise.
7723 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7724 Likewise.
7725
7726 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7727
7728 * arm.cc: Added support for ARM group relocations.
7729 (Target_arm::reloc_needs_sym_origin): New method.
7730 (Arm_relocate_functions::calc_grp_kn): New method.
7731 (Arm_relocate_functions::calc_grp_residual): New method.
7732 (Arm_relocate_functions::calc_grp_gn): New method.
7733 (Arm_relocate_functions::arm_grp_alu): New Method.
7734 (Arm_relocate_functions::arm_grp_ldr): New Method.
7735 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7736 (Arm_relocate_functions::arm_grp_ldc): New Method.
7737 (Target_arm::Scan::local): Handle the ARM group relocations.
7738 (Target_arm::Scan::global): Likewise.
7739 (Target_arm::Relocate::relocate): Likewise.
7740 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7741 Likewise.
7742
7743 2010-01-26 Doug Kwan <dougkwan@google.com>
7744
7745 * arm.cc (set): Include.
7746 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7747 pointer type.
7748 (Arm_output_section::Text_section_list): New type.
7749 (Arm_output_section::append_text_sections_to_list): New method.
7750 (Arm_output_section::fix_exidx_coverage): Ditto.
7751 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7752 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7753 Relobj::set_section_offset() instead of
7754 Sized_relobj::invalidate_section_offset().
7755 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7756 parameter for section headers. Ignore relocation sections for
7757 unallocated sections and EXIDX sections.
7758 (Target_arm::fix_exidx_coverage): New method.
7759 (Target_arm::output_section_address_less_than): New type.
7760 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7761 linked text section instead of the EXIDX section.
7762 (Arm_output_section::create_stub_group): Add an assertion to check
7763 that this is not an EXIDX output section.
7764 (Arm_output_section::append_text_sections_to_list): New method.
7765 (Arm_output_section::fix_exidx_coverage): Ditto.
7766 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7767 Arm_relobj::section_needs_reloc_stub_scanning.
7768 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7769 first pass.
7770 (Target_arm::fix_exidx_coverage): New method.
7771 * object.h (Relobj::set_output_section): New method.
7772 (Sized_relobj::invalidate_section_offset): Remove method.
7773 (Sized_relobj::do_invalidate_section_offset): Remove method.
7774 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7775
7776 2010-01-25 Doug Kwan <dougkwan@google.com>
7777
7778 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7779 Fix warning due to signed and unsigned comparison on a 32-bit host.
7780
7781 2010-01-22 Doug Kwan <dougkwan@google.com>
7782
7783 * arm.cc (Target_arm::do_relax): Record an output section for section
7784 offset adjustment it contains any stub table that has changed.
7785 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7786 offsets in an output section if necessary.
7787 * output.cc (Output_section::Output_section): Initialize
7788 section_offsets_need_adjustments_.
7789 (Output_section::add_input_section_for_script): Renamed to
7790 Output_section::add_simple_input_section.
7791 (Output_section::save_states): Add a comment.
7792 (Output_section::discard_states): New method defintion.
7793 (Output_section::adjust_section_offsets): Same.
7794 * output.h (Output_section::add_input_section_for_script): Renamed to
7795 Output_section::add_simple_input_section.
7796 (Output_section::discard_states): New method declaration.
7797 (Output_section::adjust_section_offsets): Same.
7798 (Output_section::section_offsets_need_adjustment,
7799 Output_section::set_section_offsets_need_adjustment): New method
7800 definitions.
7801 (Output_section::section_offsets_need_adjustment_): New data member.
7802 * script-sections.cc
7803 (Output_section_element_input::set_section_address): Adjust code for
7804 renaming of Output_section::add_input_section_for_script.
7805 (Orphan_output_section::set_section_address): Same.
7806
7807 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7808
7809 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7810 Fix_v4bx enum values .
7811 * gold/options.h (General_options): New option definitions.
7812 (General_options::fix_v4bx): New method.
7813 (General_options::Fix_v4bx): New enum.
7814 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7815 (General_options::parse_fix_v4bx_interworking): New method.
7816
7817 2010-01-22 Doug Kwan <dougkwan@google.com>
7818
7819 * arm.cc (Arm_exidx_fixup): New class.
7820
7821 2010-01-21 Doug Kwan <dougkwan@google.com>
7822
7823 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7824 classes.
7825 (Arm_exidx_section_offset_map): New type.
7826
7827 2010-01-21 Doug Kwan <dougkwan@google.com>
7828
7829 * arm.cc (Arm_exidx_input_section): New class.
7830 (Arm_relobj::exidx_input_section_by_link,
7831 Arm_relobj::exidx_input_section_by_shndx,
7832 Arm_relobj::make_exidx_input_section): New methods.
7833 (read_arm_attributes_section): Remove.
7834 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7835 information about them.
7836 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7837 to here.
7838
7839 2010-01-20 Doug Kwan <dougkwan@google.com>
7840
7841 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7842 Input_section_specifier to Section_id.
7843 (Target_arm::new_arm_input_section: Adjust code for change of key
7844 type.
7845 (Target_arm::find_arm_input_section): Ditto.
7846 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7847 (Section_id): Remove.
7848 (Garbage_collection::Section_id_hash): Remove.
7849 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7850 (Section_id): Remove.
7851 (Icf::Section_id_hash): Remove.
7852 * object.h (Section_id, Const_section_id, Section_id_hash,
7853 Const_section_id_hash): New type definitions.
7854 * output.cc (Output_section::add_relaxed_input_section): Change to
7855 use Const_section_id instead of Input_section_specifier as key type.
7856 (Output_section::add_merge_input_section): Ditto.
7857 (Output_section::build_relaxation_map): Change to use Section_id
7858 instead of Input_section_specifier as key type.
7859 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7860 Ditto.
7861 (Output_section::convert_input_sections_to_relaxed_sections): Change
7862 to use Const_section_id instead of Input_section_specifier as key type.
7863 (Output_section::find_merge_section): Ditto.
7864 (Output_section::find_relaxed_input_section): Ditto.
7865 * output.h (Input_section_specifier): Remove class.
7866 (Output_section::Output_section_data_by_input_section_map): Change
7867 key type to Const_section_id.
7868 (Output_section::Output_relaxed_input_section_by_input_section_map):
7869 Ditto.
7870 (Output_section::Relaxation_map): Change key type to Section_id.
7871
7872 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7873
7874 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7875 (class Arm_v4bx_stub): New class.
7876 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7877 (Stub_factory::make_arm_v4bx_stub): New method.
7878 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7879 (Stub_table::empty): Handle v4bx stubs.
7880 (Stub_table::add_arm_v4bx_stub): New method.
7881 (Stub_table::find_arm_v4bx_stub): New method.
7882 (Arm_relocate_functions::v4bx): New method.
7883 (Target_arm::fix_v4bx): New method.
7884 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7885 (Stub_table::relocate_stubs): Likewise.
7886 (Stub_table::do_write): Likewise.
7887 (Stub_table::update_data_size_and_addralign): Likewise.
7888 (Stub_table::finalize_stubs): Likewise.
7889 (Target_arm::Scan::local): Likewise.
7890 (Target_arm::Scan::global): Likewise.
7891 (Target_arm::do_finalize_sections): Likewise.
7892 (Target_arm::Relocate::relocate): Likewise.
7893 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7894 Likewise.
7895 (Target_arm::scan_reloc_for_stub): Likewise.
7896 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7897
7898 2010-01-19 Ian Lance Taylor <iant@google.com>
7899
7900 * output.cc (Output_section_headers::do_sized_write): Write large
7901 segment count to sh_info field.
7902 (Output_file_header::do_sized_write): For large segment count,
7903 write PN_XNUM to e_phnum field.
7904
7905 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7906
7907 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7908 (Arm_relocate_functions::thm_jump8): New function.
7909 (Arm_relocate_functions::thm_jump11): New function.
7910 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7911 R_ARM_THM_JUMP11.
7912 (Target_arm::Scan::global): Likewise.
7913 (Target_arm::Relocate::relocate): Likewise.
7914 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7915 Likewise.
7916
7917 2010-01-14 Doug Kwan <dougkwan@google.com>
7918
7919 * arm.cc (map, utility): Include headers.
7920 (Target_arm::apply_cortex_a8_workaround): New method.
7921 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7922 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7923 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7924 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7925 the --[no-]fix-cortex-a8 command line options.
7926 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7927 (Target_arm::relocate_stub): Use addend in instruction template.
7928 * options.h (DEFINE_bool): Set the user-set flag.
7929 (General_options): Add --[no-]-fix-cortex options.
7930 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7931 : Update fast look-up map after conversion.
7932
7933 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7934
7935 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7936 in the first pass of do_layout.
7937
7938 2010-01-13 Doug Kwan <dougkwan@google.com>
7939
7940 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7941 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7942 apparent compiler problem of not folding static constant integral
7943 data members of elfcpp::Elf_sizes<32>.
7944
7945 2010-01-13 Doug Kwan <dougkwan@google.com>
7946
7947 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7948 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7949 Arm_relobj::scan_section_for_cortex_a8_erratum,
7950 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7951 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7952 sections to scan for relocation stubs into a new method
7953 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7954 relocation and Cortex-A8 stub scanning.
7955 (Target_arm::do_relax): Force stubs to be after stubbed sections
7956 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7957 the beginning of a new relaxation pass. Update a comment.
7958 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7959
7960 2010-01-12 Ian Lance Taylor <iant@google.com>
7961
7962 * target-reloc.h (visibility_error): New inline function.
7963 (relocate_section): Call visibility_error.
7964 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7965 (MOSTLYCLEANFILES): Likewise.
7966 (protected_4_pic.o, protected_3.err): New targets.
7967 * testsuite/protected_4.cc: New file.
7968
7969 2010-01-12 Doug Kwan <dougkwan@google.com>
7970
7971 * arm.cc (Cortex_a8_reloc): New class.
7972 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7973 and cortex_a8_relocs_info_.
7974 (Target_arm::fix_cortex_a8): New method definition.
7975 (Target_arm::Cortex_a8_relocs_info): New type.
7976 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7977 New data member declarations.
7978 (Target_arm::scan_reloc_for_stub): Record information about
7979 relocations for THUMB branches that might be exempted from the
7980 Cortex-A8 workaround.
7981 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7982 at the beginning of a relaxation pass.
7983
7984 2010-01-12 Doug Kwan <dougkwan@google.com>
7985
7986 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7987 (Arm_relobj::Mapping_symbol_position,
7988 Arm_reloj::Mapping_symbol_position_less,
7989 Arm_relobj::Mapping_symbols_info): New types.
7990 (Target_arm::is_mapping_symbol_name): New method definition.
7991 (Arm_relobj::do_count_local_symbols): Save information about mapping
7992 symbols.
7993
7994 2010-01-11 Doug Kwan <dougkwan@google.com>
7995
7996 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7997 Arm_relocate_functions::thumb32_branch_upper,
7998 Arm_relocate_functions::thumb32_branch_lower,
7999 Arm_relocate_functions::thumb32_cond_branch_offset,
8000 Arm_relocate_functions::thumb32_cond_branch_upper,
8001 Arm_relocate_functions::thumb32_cond_branch_lower,
8002 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8003 branch offset encoding.
8004 (Arm_relocate_functions::thumb_branch_common): Use new branch
8005 offset encoding methods to avoid code duplication.
8006 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8007 (Stub_addend_reader::operator()): Use new branch encoding method
8008 to avoid code duplication.
8009
8010 2010-01-11 Doug Kwan <dougkwan@google.com>
8011
8012 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8013 (Target_arm::do_finalize_sections): Define special EXIDX section
8014 symbols only if referenced.
8015 * gc.h (Garbage_collection::add_reference): New method.
8016 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8017 code duplication.
8018
8019 2010-01-11 Ian Lance Taylor <iant@google.com>
8020
8021 * script.cc (Version_script_info::build_expression_list_lookup):
8022 Change complaing about duplicate wildcard match from error to
8023 warning.
8024
8025 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8026 of 2009-12-30.
8027 (Version_script_info::Version_script_info): Initialize globs_,
8028 default_version_, default_is_global_, and exact_. Don't
8029 initialize globals_ or locals_.
8030 (Version_script_info::build_lookup_tables): Build local symbols
8031 first.
8032 (Version_script_info::unquote): New function.
8033 (Version_script_info::add_exact_match): New function.
8034 (Version_script_info::build_expression_list_lookup): Remove lookup
8035 parameter. Add is_global parameter. Change all callers. Handle
8036 wildcard pattern specially. Unquote pattern. Call
8037 add_exact_match.
8038 (Version_script_info::get_name_to_match): New function.
8039 (Version_script_info::get_symbol_version): New function.
8040 (Version_script_info::get_symbol_version_helper): Remove.
8041 (Version_script_info::check_unmatched_names): Call unquote.
8042 * script.h (class Version_script_info): Change get_symbol_version
8043 to be non-inline and add is_global parameter; change all callers.
8044 Rewrite symbol_is_local. Update declarations. Define struct
8045 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8046 Remove globals_ and locals_ members. Add exact_, globs_,
8047 default_version_, is_global_.
8048 (Version_script_info::Glob): Remove pattern, add expression and
8049 is_global. Update constructor. Change all callers.
8050 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8051 default version.
8052 (Versions::symbol_section_contents): If a symbol is undefined, or
8053 defined in a dynamic object, set the version index to
8054 VER_NDX_LOCAL.
8055 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8056 symbol_is_local.
8057 (Symbol_table::add_from_pluginobj): Likewise.
8058 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8059
8060 2010-01-11 Doug Kwan <dougkwan@google.com>
8061
8062 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8063 (incremental_dump_LDADD): Add linking option for libintl.
8064 * Makefile.in: Regenerate.
8065
8066 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8067
8068 PR gold/11144
8069 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8070 instead of -Ds.
8071 * testsuite/Makefile.in: Regenerated.
8072
8073 2010-01-10 Doug Kwan <dougkwan@google.com>
8074
8075 * options.h (DEFINE_var): Use parentheses around argument varname__
8076 in macro body to avoid any unintended subsequent substitutions.
8077
8078 2010-01-10 Ian Lance Taylor <iant@google.com>
8079
8080 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8081 candidates before doing symbol resolution.
8082
8083 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8084 ODR candidates if only one is weak.
8085
8086 2010-01-08 Ian Lance Taylor <iant@google.com>
8087
8088 * script.cc (Version_script_info::build_expression_list_lookup):
8089 Don't warn about ambiguous version, just record the ambiguity.
8090 (Version_script_info::get_symbol_version_helper): Give error if
8091 version is ambiguous.
8092
8093 2010-01-08 Doug Kwan <dougkwan@google.com>
8094
8095 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8096 prev_data_size_ and prev_addralign_. Remove initializer for
8097 deleted data member has_been_changed_.
8098 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8099 to determine if the table is empty.
8100 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8101 Remove.
8102 (Stub_table::add_reloc_stub): Define method in class definition
8103 instead of just declaring it there.
8104 (Stub_table::add_cortex_a8_stub): New method definition.
8105 (Stub_table::update_data_size_and_addralign): Ditto.
8106 (Stub_table::finalize_stubs): Ditto.
8107 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8108 (Stub_table::do_addralign_): Return address alignment in the
8109 (Stub_table::do_reset_address_and_file_offset): Define method in
8110 class definition instead of declaring it there. Set current data
8111 size to be the data size of the previous pass.
8112 (Stub_table::set_final_data_size): Use current data size as the
8113 final data size.
8114 (Stub_table::relocate_stub): Change parameter type of stub from
8115 Reloc_stub pointer to Stub pointer.
8116 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8117 (Stub_table::Cortex_a8_stub_list): New typedef.
8118 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8119 Stub_table::prev_addralign_): New data member.
8120 (Arm_relobj::Arm_relobj): Initialize data member
8121 section_has_cortex_a8_workaround_.
8122 (Arm_relobj::section_has_cortex_a8_workaround,
8123 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8124 definitions.
8125 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8126 declarations.
8127 (Target_arm::relocate_stub): Change parameter type of stub from
8128 Reloc_stub pointer to Stub pointer.
8129 (Insn_template::size, Insn_template::alignment): Handle
8130 THUMB16_SPECIAL_TYPE.
8131 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8132 Stub_table::update_data_size_and_addralign,
8133 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8134 definitions.
8135 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8136 (Stub_table::do_write): Ditto.
8137 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8138
8139 2010-01-08 Ian Lance Taylor <iant@google.com>
8140
8141 PR 11108
8142 * symtab.h (class Symbol): Remove fields is_target_special_ and
8143 has_plt_offset_. Add field is_defined_in_discarded_section_.
8144 (Symbol::is_defined_in_discarded_section): New function.
8145 (Symbol::set_is_defined_in_discarded_section): New function.
8146 (Symbol::has_plt_offset): Rewrite.
8147 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8148 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8149 Don't initialize is_target_special_ or has_plt_offset_.
8150 Initialize is_defined_in_discarded_section_.
8151 (Symbol_table::add_from_relobj): If appropriate, set
8152 is_defined_in_discarded_section.
8153 * resolve.cc (Symbol::override_base_with_special): Don't test
8154 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8155 * target-reloc.h (relocate_section): Do special handling for
8156 symbols defined in discarded sections for global symbols as well
8157 as local symbols.
8158
8159 2010-01-08 Ian Lance Taylor <iant@google.com>
8160
8161 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8162 the SHT_SYMTAB case.
8163
8164 2010-01-08 Ian Lance Taylor <iant@google.com>
8165
8166 * object.cc (Sized_relobj::do_layout): Don't get confused if
8167 layout_eh_frame returns NULL.
8168
8169 2010-01-08 Ian Lance Taylor <iant@google.com>
8170
8171 PR 11084
8172 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8173 dynamic symbol table, use the normal symbol table.
8174 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8175 symbol table.
8176
8177 2010-01-08 Ian Lance Taylor <iant@google.com>
8178
8179 PR 11072
8180 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8181 sections.
8182
8183 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8184
8185 * version.cc (print_version): Change to "Copyright 2010".
8186
8187 2010-01-08 Ian Lance Taylor <iant@google.com>
8188
8189 PR 10287
8190 PR 11063
8191 * i386.cc (class Target_i386): Change return type of plt_section
8192 to be non-const.
8193 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8194 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8195 tls_desc_rel_ field.
8196 (Output_data_plt_i386::rel_tls_desc): New function.
8197 (Target_i386::rel_tls_desc_section): New function.
8198 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8199 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8200 R_386_TLS_DESC reloc in rel_tls_desc_section.
8201 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8202 Define struct Tlsdesc_info.
8203 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8204 (Target_x86_64::do_reloc_symbol_index): New function.
8205 (Target_x86_64::add_tlsdesc_info): New function.
8206 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8207 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8208 tlsdesc_rel_ field.
8209 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8210 all callers.
8211 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8212 (Target_x86_64::rela_tlsdesc_section): New function.
8213 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8214 handling.
8215 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8216 (Target_x86_64::do_reloc_addend): New function.
8217 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8218 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8219 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8220 (Output_reloc::type): New function.
8221 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8222 (Output_reloc::is_target_specific): New function.
8223 (Output_reloc::target_arg): New function.
8224 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8225 absolute relocs and target specific relocs.
8226 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8227 add_target_specific.
8228 (class Output_data_reloc) [SHT_RELA]: Likewise.
8229 * output.cc (Output_reloc::Output_reloc): Add four new versions
8230 for absolute relocs and target specific relocs.
8231 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8232 (Output_reloc::get_symbol_index): Likewise.
8233 (Output_reloc::local_section_offset): Check that local_sym_index_
8234 is not TARGET_CODE or 0.
8235 (Output_reloc::symbol_value): Likewise.
8236 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8237 reloc.
8238 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8239 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8240 functions.
8241 * layout.cc (add_target_dynamic_tags): Use output section for
8242 DT_PLTRELSZ and DT_JMPREL.
8243
8244 2010-01-07 Ian Lance Taylor <iant@google.com>
8245
8246 PR 11061
8247 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8248 function.
8249 (class Output_data_reloc_generic): Define.
8250 (class Output_data_reloc_base): Change base class to
8251 Output_data_reloc_generic. Change add() method to call
8252 bump_relative_reloc_count for a relative reloc. Remove
8253 sort_relocs_ field.
8254 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8255 to sort_relocs().
8256 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8257 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8258 appropriate.
8259 * layout.h (class Layout): Update declaration.
8260
8261 2010-01-07 Ian Lance Taylor <iant@google.com>
8262
8263 * output.h (class Output_data): Add const version of
8264 output_section and do_output_section.
8265 (class Output_section_data): Add const version of
8266 do_output_section.
8267 (class Output_section): Likewise.
8268 * layout.cc (Layout::add_target_dynamic_tags): New function.
8269 * layout.h (class Layout): Update declarations.
8270 * arm.cc (Target_arm::do_finalize_sections): Use
8271 add_target_dynamic_tags.
8272 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8273 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8274 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8275 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8276
8277 2010-01-07 Ian Lance Taylor <iant@google.com>
8278
8279 PR 11042
8280 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8281 object as needed.
8282
8283 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8284 Ian Lance Taylor <iant@google.com>
8285
8286 PR 11019
8287 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8288 Xindex::read_symtab_xindex.
8289
8290 2010-01-07 Doug Kwan <dougkwan@google.com>
8291
8292 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8293 (Insn_template::thumb16_bcond_insn): New method declaration.
8294 (Insn_template): Fix spelling.
8295 (Stub::thumb16_special): New method declaration.
8296 (Stub::do_write): Define virtual method which was previously pure
8297 virtual.
8298 (Stub::do_thumb16_special): New method declaration.
8299 (Stub::do_fixed_endian_write): New template member.
8300 (Reloc_stub::do_write): Remove.
8301 (Reloc_stub::do_fixed_endian_write): Remove.
8302 (Cortex_a8_stub): New class definition.
8303 (Stub_factory::make_cortex_a8_stub): New method definition.
8304 (Stub_factory::Stub_factory): Add missing static storage class
8305 qualifier for elf32_arm_stub_a8_veneer_blx.
8306
8307 2010-01-07 Ian Lance Taylor <iant@google.com>
8308
8309 PR 10980
8310 * options.h (class General_options): Add --warn-unresolved-symbols
8311 and --error-unresolved-symbols.
8312 * errors.cc (Errors::undefined_symbol): Implement
8313 --warn-unresolved-symbols.
8314
8315 * options.h (class General_options): Add -z text and -z textoff.
8316 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8317
8318 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8319
8320 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8321 (Garbage_collection::cident_sections): New function.
8322 (Garbage_collection::add_cident_section): New function.
8323 (Garbage_collection::cident_sections_): New member.
8324 (gc_process_relocs): Add references to sections whose names are C
8325 identifiers.
8326 * gold.h (cident_section_start_prefix): New constant.
8327 (cident_section_stop_prefix): New constant.
8328 (is_cident): New function.
8329 * layout.cc (Layout::define_section_symbols): Replace string constants
8330 with the newly defined constants.
8331 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8332 C identifiers.
8333 * testsuite/Makefile.am: Add gc_orphan_section_test.
8334 * testsuite/Makefile.in: Regenerate.
8335 * testsuite/gc_orphan_section_test.cc: New file.
8336 * testsuite/gc_orphan_section_test.sh: New file.
8337
8338 2010-01-06 Ian Lance Taylor <iant@google.com>
8339
8340 PR 10980
8341 * options.h (class General_options): Add --warn-shared-textrel.
8342 * layout.cc (Layout::finish_dynamic_section): Implement
8343 --warn-shared-textrel.
8344
8345 PR 10980
8346 * options.h (class General_options): Add --warn-multiple-gp.
8347
8348 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8349
8350 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8351 $(THREADSLIB) and $(LIBDL).
8352 * Makefile.in: Rebuild.
8353
8354 2010-01-06 Ian Lance Taylor <iant@google.com>
8355
8356 PR 10980
8357 * options.cc (General_options::parse_section_start): New function.
8358 (General_options::section_start): New function.
8359 (General_options::General_options): Initialize all members.
8360 * options.h: Include <map>
8361 (class General_options): Add --section-start. Add section_starts_
8362 member.
8363 * layout.cc (Layout::attach_allocated_section_to_segment): If
8364 --section-start was used, set the address of the segment. Remove
8365 local sort_sections.
8366 (Layout::relaxation_loop_body): If the address of the load segment
8367 has been set by --section-start, don't use it.
8368 * output.h (Output_segment::update_flags_for_output_section): New
8369 function.
8370 * output.cc (Output_segment::add_output_section): Call
8371 update_flags_for_output_section.
8372
8373 2010-01-05 Ian Lance Taylor <iant@google.com>
8374
8375 PR 10980
8376 * options.h (class General_options): Add --undefined-version.
8377 * script.cc (struct Version_expression): Add was_matched_by_symbol
8378 field.
8379 (Version_script_info::matched_symbol): New function.
8380 (Version_script_info::get_symbol_version_helper): Call
8381 matched_symbol.
8382 (Version_script_info::check_unmatched_names): New function.
8383 * script.h (class Version_script_info): Update declarations.
8384 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8385
8386 * options.h (class General_options): Use DEFINE_bool_alias for
8387 allow_multiple_definition.
8388 * resolve.cc (Symbol_table::should_override): Don't test
8389 allow_multiple_definition.
8390
8391 PR 10980
8392 * options.h (class General_options): Add --cref.
8393 * main.cc (main): Print cref table if --cref. Don't close mapfile
8394 until after printing cref table.
8395 * cref.cc: Include "symtab.h".
8396 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8397 (Cref_table_compare::operator()): New function.
8398 (Cref_inputs::gather_cref): New function.
8399 (filecol): New static const.
8400 (Cref_inputs::print_cref): New function.
8401 (Cref::print_cref): New function.
8402 * cref.h: Include <cstdio>.
8403 (class Cref): Update declarations.
8404 * mapfile.h (Mapfile::file): New function.
8405 * object.h (class Object): Define Symbols. Declare virtual
8406 do_get_global_symbols.
8407 (Object::get_global_symbols): New function.
8408 * object.cc (Input_objects::add_object): Pass object to cref_ if
8409 --cref.
8410 (Input_objects::archive_start): Likewise.
8411 (Input_objects::archive_stop): Likewise.
8412 (Input_objects::print_cref): New function.
8413 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8414 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8415 --cref.
8416 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8417 function.
8418 * plugin.h (class Sized_pluginobj): Update declarations.
8419
8420 2010-01-05 Ian Lance Taylor <iant@google.com>
8421
8422 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8423 to is_default_version. Rename insdef to insdefault.
8424 (Symbol_table::add_from_relobj): Rename def to is_default_version
8425 and local to is_forced_local.
8426 (Symbol_table::add_from_pluginobj): Likewise.
8427 (Symbol_table::add_from_dynobj): Likewise.
8428 (Symbol_table::define_special_symbol): Rename insdef to
8429 insdefault.
8430
8431 2010-01-04 Ian Lance Taylor <iant@google.com>
8432
8433 PR 10980
8434 * options.h (class General_options): Add
8435 --allow-multiple-definition and -z muldefs.
8436 * resolve.cc (Symbol_table::should_override): Don't warn about a
8437 multiple symbol definition if --allow-multiple-definition or -z
8438 muldefs.
8439
8440 PR 10980
8441 * options.h (class General_options): Add --add-needed and
8442 --copy-dt-needed-entries. Tweak --as-needed help entry.
8443 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8444 error if --copy-dt-needed-entries aka --add-needed is used and
8445 would cause a change in behaviour.
8446
8447 PR 10980
8448 * options.h (class General_options): Add -G as a short version of
8449 --shared. Add no-op options -assert, -g, and -i.
8450
8451 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8452
8453 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8454 check for .text or .gnu.linkonce.t sections.
8455 * icf.cc (Icf::find_identical_sections): Ditto.
8456 Change the detection for mangled function name within the section
8457 name.
8458 * icf.h (is_section_foldable_candidate): New function.
8459
8460 2009-12-30 Ian Lance Taylor <iant@google.com>
8461
8462 PR 10980
8463 * options.h (class General_options): Permit two dashes with
8464 --retain-symbols-file.
8465
8466 2009-12-30 Ian Lance Taylor <iant@google.com>
8467
8468 PR 10979
8469 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8470 don't put the file header and segment headers in the text
8471 segment.
8472
8473 PR 10979
8474 * common.cc (Sort_commons::operator()): Stabilize sort when both
8475 entries are NULL.
8476 (Symbol_table::do_allocate_commons_list): When allocating common
8477 symbols, skip a symbol which is no longer common.
8478 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8479 an object before checking its type.
8480 * testsuite/common_test_2.c: New file.
8481 * testsuite/common_test_3.c: New file.
8482 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8483 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8484 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8485 (common_test_2_pic.o, common_test_2.so): New targets.
8486 (common_test_3_pic.o, common_test_3.so): New targets.
8487 * testsuite/Makefile.in: Rebuild.
8488
8489 PR 10979
8490 * script.cc (read_input_script): If we see a new SECTIONS clause,
8491 and we have added an input section, give an error.
8492 * layout.h (class Layout): Add have_added_input_section function.
8493 Add have_added_input_section_ field.
8494 * layout.cc (Layout::Layout): Initialize
8495 have_added_input_section_.
8496 (Layout::layout): Set have_added_input_section_.
8497 (Layout::layout_eh_frame): Likewise.
8498
8499 2009-12-30 Ian Lance Taylor <iant@google.com>
8500
8501 PR 10931
8502 * options.h (class General_options): Add --sort-common option.
8503 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8504 * common.cc (Sort_common): Add sort_order parameter to
8505 constructor. Add sort_order_ field.
8506 (Sort_commons::operator): Check sort_order_.
8507 (Symbol_table::allocate_commons): Determine the sort order.
8508 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8509 Change all callers.
8510 (Symbol_table::do_allocate_commons_list): Likewise.
8511
8512 2009-12-30 Ian Lance Taylor <iant@google.com>
8513
8514 PR 10916
8515 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8516 symbols from this object, don't change the visibility of an
8517 undefined symbol.
8518 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8519
8520 2009-12-30 Ian Lance Taylor <iant@google.com>
8521
8522 PR 10861
8523 * script.h (class Version_script_info): Define Language enum.
8524 Update declarations. Define Glob, Exact, and Lookup types. Add
8525 new fields globals_, locals_, and is_finalized_.
8526 * script.cc: Various formatting fixes.
8527 (class Parser_closure): Change language_stack_ from a vector of
8528 std::string to one of Version_script_info::Language. Adjust all
8529 uses accordingly.
8530 (class Lazy_demangler): Remove.
8531 (struct Version_expression): Change language from std::string to
8532 Version_script_info::Language.
8533 (Version_script_info::Version_script_info): New function.
8534 (Version_script_info::~Version_script_info): Don't call clear.
8535 (Version_script_info::finalize): New function.
8536 (Version_script_info::build_lookup_tables): New function.
8537 (Version_script_info::build_expression_list_lookup): New
8538 function.
8539 (Version_script_info::get_symbol_version_helper): Rewrite to use
8540 lookup tables.
8541 (Version_script_info::print_expression_list): Adjust to use
8542 Version_script_info::Language.
8543 (script_push_lex_into_version_mode): Check that the version script
8544 has not been finalized.
8545 (version_script_push_lang): Change language string to
8546 Version_script_info::Language.
8547 * options.cc (Command_line::version_script): New function.
8548 * options.h (class General_options): Add finalize_dynamic_list
8549 function. Change version_script from declaration to definition.
8550 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8551 * testsuite/version_script.map: Remove duplicate def of foo.
8552 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8553 version_script.map.
8554 * testsuite/Makefile.in: Rebuild.
8555
8556 2009-12-30 Ian Lance Taylor <iant@google.com>
8557
8558 PR 10843
8559 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8560 if the input symbol index is 0, make the output symbol index 0.
8561
8562 2009-12-30 Ian Lance Taylor <iant@google.com>
8563
8564 PR 10670
8565 * options.h (class General_options): Add -x/--discard-all.
8566 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8567 --discard-all. If the local symbol needs a dynamic entry, check
8568 that before handling --discard-locals.
8569
8570 2009-12-30 Ian Lance Taylor <iant@google.com>
8571
8572 PR 10450
8573 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8574 flags to PF_R.
8575 (Output_segment::add_output_section): Don't change the flags if
8576 the type is PT_TLS.
8577
8578 PR 10450
8579 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8580 GNU hash table if they need a dynamic value. Otherwise, don't add
8581 them if they are defined in a dynamic object or are forced local.
8582
8583 2009-12-29 Ian Lance Taylor <iant@google.com>
8584
8585 PR 10450
8586 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8587 .gnu.hash table for a 32-bit target.
8588
8589 PR 10450
8590 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8591 regular and a dynamic object only needs a dynamic symbol table
8592 entry if it is externally visible.
8593
8594 PR 10450
8595 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8596 constructor. Add global_offset_table_ field.
8597 (Target_i386::got_section): Set global_offset_table_.
8598 (Target_i386::do_finalize_sections): Set global_offset_table_
8599 size.
8600 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8601 in constructor. Add global_offset_table_ field.
8602 (Target_x86_64::got_section): Set global_offset_table_.
8603 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8604 size.
8605
8606 * layout.cc (Layout::Layout): Initialize increase_relro_.
8607 (Layout::get_output_section): Add is_relro, is_last_relro, and
8608 is_first_non_relro parameters. Change all callers.
8609 (Layout::choose_output_section): Likewise.
8610 (Layout::add_output_section_data): Likewise.
8611 (Layout::make_output_section): Likewise.
8612 (Layout::set_segment_offsets): Clear increase_relro when using a
8613 linker script.
8614 * layout.h (class Layout): Add increase_relro method. Add
8615 increase_relro_ field. Update declarations.
8616 * output.cc (Output_section::Output_section): Initialize
8617 is_last_relro_ and is_first_non_relro_.
8618 (Output_segment::add_output_section): Group relro sections is
8619 do_sort is true. Handle is_last_relro and is_first_non_relro.
8620 (Output_segment::maximum_alignment): Remove relro handling.
8621 (Output_segment::set_section_addresses): Add increase_relro
8622 parameter. Change all callers. Add initial alignment to align
8623 relro sections on separate page. Remove old relro handling.
8624 (Output_segment::set_section_list_addresses): Remove in_relro
8625 parameter. Change all callers.
8626 (Output_segment::set_offset): Add increase parameter. Change all
8627 callers. Remove old relro handling.
8628 * output.h (class Output_section): Add new methods: is_last_relro,
8629 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8630 Add is_last_relro_ and is_first_non_relro_ fields.
8631 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8632 Create separate .got.plt section. Call increase_relro.
8633 * x86_64.cc (Target_x86_64::got_section): Likewise.
8634 * testsuite/relro_script_test.t: Add .got.plt.
8635
8636 PR 10450
8637 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8638 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8639 (Layout::finalize): Call set_dynamic_symbol_size.
8640 (Layout::set_dynamic_symbol_size): New function.
8641 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8642 set_dynamic_symbol_size.
8643
8644 PR 10450
8645 * output.h (class Output_section): Add is_entsize_zero_ field.
8646 * output.cc (Output_section::Output_section): Initialize
8647 is_entsize_zero_.
8648 (Output_section::set_entsize): If two different entsizes are
8649 requested, force it to zero.
8650 (Output_section::add_input_section): Set flags for .debug_str
8651 before updating section flags. Set entsize.
8652 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8653 and SHF_STRING if all input sections have those flags.
8654
8655 2009-12-29 Rafael Espindola <espindola@google.com>
8656
8657 * main.cc (main): Fix the sys time reporting.
8658 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8659 reporting.
8660
8661 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8662
8663 * options.cc (General_options::parse_version): Allow -v to exit
8664 without an error if there is nothing to link.
8665
8666 2009-12-29 Ian Lance Taylor <iant@google.com>
8667
8668 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8669 using a version of gcc before 4.1.
8670 * configure: Rebuild.
8671
8672 2009-12-28 Chris Demetriou <cgd@google.com>
8673
8674 * attributes.cc (Output_attributes_section_data::do_write): Use
8675 std::vector::front rather than std::vector::data.
8676
8677 2009-12-28 Ian Lance Taylor <iant@google.com>
8678
8679 * symtab.h (class Symbol_table): Add enum Defined.
8680 * resolve.cc (Symbol_table::should_override): Add defined
8681 parameter. Change all callers. Test whether object is NULL
8682 before calling a method on it.
8683 (Symbol_table::report_resolve_problem): Add defined parameter.
8684 Change all callers.
8685 (Symbol_table::should_override_with_special): Likewise.
8686 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8687 parameter. Change all callers.
8688 (Symbol_table::do_define_in_output_data): Likewise.
8689 (Symbol_table::define_in_output_segment): Likewise.
8690 (Symbol_table::do_define_in_output_segment): Likewise.
8691 (Symbol_table::define_as_constant): Likewise.
8692 (Symbol_table::do_define_as_constant): Likewise.
8693 * script.h (class Symbol_assignment): Add is_defsym parameter to
8694 constructor; change all callers.
8695 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8696 parameter. Change all callers. Add is_defsym_ field.
8697 (class Parser_closure): Add parsing_defsym parameter to
8698 constructor; change all callers. Add parsing_defsym accessor
8699 function. Add parsing_defsym_ field.
8700
8701 2009-12-28 Ian Lance Taylor <iant@google.com>
8702
8703 * gold.cc (queue_middle_tasks): Fix formatting.
8704 * object.cc (Relobj::is_section_name_included): Likewise.
8705
8706 2009-12-23 Ian Lance Taylor <iant@google.com>
8707
8708 * i386.cc (Target_i386::do_calls_non_split): Recognize
8709 -fsplit-stack prologue for a function with a static chain.
8710 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8711 -fsplit-stack prologue when using %r11.
8712
8713 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8714
8715 * options.cc (General_options::parse_version): Make -v continue and do
8716 the link like GNU ld does.
8717
8718 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8719
8720 * Makefile.am (CCFILES): Add timer.cc.
8721 (HFILES): Add timer.h.
8722 * configure.ac: Check for sysconf and times.
8723 * main.cc: include timer.h.
8724 (main): Use Timer instead of get_run_time.
8725 * timer.cc: New.
8726 * timer.h: New.
8727 * workqueue.cc: include timer.h.
8728 (Workqueue::find_and_run_task):
8729 Report user, sys and wall time.
8730 * Makefile.in: Regenerate.
8731 * config.in: Regenerate.
8732 * configure: Regenerate.
8733
8734 2009-12-16 Doug Kwan <dougkwan@google.com>
8735
8736 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8737 sections.
8738 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8739 relaxed input sections.
8740 * output.cc (Output_section::find_relaxed_input_section): Change
8741 return type to Output_relaxed_input_section pointer. Adjust code
8742 for new type of relaxed_input_section_map_.
8743 * output.h (Output_section::find_relaxed_input_section): Change
8744 return type to Output_relaxed_input_section pointer.
8745 (Output_section::Output_relaxed_input_section_by_input_section_map):
8746 New type.
8747 (Output_section::relaxed_input_section_map_): Change type to
8748 Output_section::Output_relaxed_input_section_by_input_section_map.
8749 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8750 input section.
8751
8752 2009-12-15 Ian Lance Taylor <iant@google.com>
8753
8754 * layout.cc (Layout::create_shstrtab): Only write out after input
8755 sections if we are compressing debug sections.
8756
8757 2009-12-15 Ian Lance Taylor <iant@google.com>
8758
8759 * archive.cc (Archive::add_symbols): Only look up a symbol without
8760 a version if there is, in fact, a version.
8761
8762 2009-12-14 Ian Lance Taylor <iant@google.com>
8763
8764 Revert -Wshadow changes, all changes from:
8765 2009-12-11 Doug Kwan <dougkwan@google.com>
8766 2009-12-11 Nick Clifton <nickc@redhat.com>
8767 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8768
8769 2009-12-11 Doug Kwan <dougkwan@google.com>
8770
8771 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8772 due to -Wshadow.
8773 * attributes.cc (Object_attribute::size): Ditto.
8774 (Attributes_section_data::size): Ditto.
8775 (Attributes_section_data::Attributes_section_data): Ditto.
8776 (Output_attributes_section_data::do_write): Ditto.
8777 * attributes.h (Object_attribute::set_type): Ditto.
8778 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8779
8780 2009-12-11 Nick Clifton <nickc@redhat.com>
8781
8782 * archive.cc: Fix shadowed variable warnings.
8783 * arm.cc: Likewise.
8784 * compressed_output.cc: Likewise.
8785 * compressed_output.h: Likewise.
8786 * configure: Likewise.
8787 * dwarf_reader.cc: Likewise.
8788 * dynobj.cc: Likewise.
8789 * dynobj.h: Likewise.
8790 * ehframe.cc: Likewise.
8791 * ehframe.h: Likewise.
8792 * errors.cc: Likewise.
8793 * expression.cc: Likewise.
8794 * fileread.cc: Likewise.
8795 * fileread.h: Likewise.
8796 * freebsd.h: Likewise.
8797 * i386.cc: Likewise.
8798 * icf.cc: Likewise.
8799 * incremental.h: Likewise.
8800 * layout.cc: Likewise.
8801 * layout.h: Likewise.
8802 * mapfile.cc: Likewise.
8803 * merge.cc: Likewise.
8804 * merge.h: Likewise.
8805 * object.cc: Likewise.
8806 * object.h: Likewise.
8807 * options.h: Likewise.
8808 * output.cc: Likewise.
8809 * output.h: Likewise.
8810 * parameters.cc: Likewise.
8811 * plugin.cc: Likewise.
8812 * powerpc.cc: Likewise.
8813 * reduced_debug_output.cc: Likewise.
8814 * reduced_debug_output.h: Likewise.
8815 * reloc.cc: Likewise.
8816 * reloc.h: Likewise.
8817 * resolve.cc: Likewise.
8818 * script-sections.cc: Likewise.
8819 * script.cc: Likewise.
8820 * script.h: Likewise.
8821 * sparc.cc: Likewise.
8822 * symtab.cc: Likewise.
8823 * symtab.h: Likewise.
8824 * target-select.cc: Likewise.
8825 * target-select.h: Likewise.
8826 * token.h: Likewise.
8827 * workqueue.cc: Likewise.
8828 * workqueue.h: Likewise.
8829 * x86_64.cc: Likewise.
8830
8831 2009-12-10 Doug Kwan <dougkwan@google.com>
8832
8833 * arm.cc (attributes.h): New include.
8834 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8835 (Arm_relobj::~Arm_relobj): Delete object pointed by
8836 attributes_section_data_.
8837 (Arm_relobj::attributes_section_data): New method definition.
8838 (Arm_relobj::attributes_section_data_): New data member declaration.
8839 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8840 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8841 attributes_section_data_.
8842 (Arm_dynobj::attributes_section_data): New method definition.
8843 (Arm_dynobj::attributes_section_data_): New data member declaration.
8844 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8845 initialization value of may_use_blx_ to false.
8846 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8847 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8848 object attributes to compute results instead of hard-coding.
8849 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8850 Target_arm::get_secondary_compatible_arch,
8851 Target_arm::set_secondary_compatible_arch
8852 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8853 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8854 New method declarations.
8855 (Target_arm::get_aeabi_object_attribute): New method definition.
8856 (Target_arm::attributes_section_data_): New data member declaration.
8857 (read_arm_attributes_section): New template definition.
8858 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8859 (Arm_dynobj::do_read_symbols): Ditto.
8860 (Target_arm::do_finalize_sections): Merge attributes sections from
8861 input. Check for BLX use after attributes section merging.
8862 Fix __exidx_start and __exidx_end visibility. Create an
8863 .ARM.attributes section if necessary.
8864 (Target_arm::get_secondary_compatible_arch,
8865 Target_arm::set_secondary_compatible_arch,
8866 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8867 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8868 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8869 New method definitions.
8870
8871 2009-12-09 Ian Lance Taylor <iant@google.com>
8872
8873 * plugin.cc (Plugin::load): Don't cast from void* to a function
8874 pointer.
8875
8876 2009-12-09 Ian Lance Taylor <iant@google.com>
8877
8878 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8879 information fields.
8880
8881 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8882
8883 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8884 Replace two_file_shared_1.so with two_file_shared_2.so.
8885 * testsuite/Makefile.in: Regenerated.
8886
8887 2009-12-08 Doug Kwan <dougkwan@google.com>
8888
8889 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8890 (HFILES): Add attributes.h and int_encoding.h.
8891 * Makefile.in: Regenerate.
8892 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8893 function definitions to int_encoding.cc
8894 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8895 prototypes to int_encoding.h
8896 * reduced_debug_output.cc (int_encoding.h): New include.
8897 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8898 function definitions to int_encoding.cc
8899 (insert_into_vector, read_from_pointer): Move template definitions to
8900 int_encoding.h
8901 * attributes.cc: New file.
8902 * attributes.h: New file.
8903 * int_encoding.cc: New file.
8904 * int_encoding.h: New file.
8905
8906 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8907
8908 PR gold/11055
8909 * incremental-dump.cc (dump_incremental_inputs): New.
8910 (main): Use dump_incremental_inputs.
8911
8912 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8913
8914 PR gold/10893
8915 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8916 checking elfcpp::STT_FUNC.
8917 (Target_i386::Relocate::relocate): Likewise.
8918 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8919
8920 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8921 symbols from shared libraries into normal FUNC symbols.
8922
8923 * symtab.h (Symbol): Add is_func and use it.
8924
8925 2009-12-05 Doug Kwan <dougkwan@google.com>
8926
8927 * arm.cc (Target_arm::arm_info): Initialize new fields
8928 attributes_section and attributes_vendor.
8929 * i386.cc (Target_i386::i386_info): Same.
8930 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8931 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8932 fields attributes_section and attributes_vendor.
8933 * sparc.cc (Target_sparc::sparc_info): Same.
8934 * target.h (Target::attributes_section, Target::attributes_vendor,
8935 Target::is_attributes_section, Target::attribute_arg_type,
8936 Target::attributes_order): New method definitions.
8937 (Target::Target_info::attributes_section,
8938 Target::Target_info::attributes_vendor): New fields.
8939 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8940 virtual method definitions.
8941 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8942 attributes_section and attributes_vendor.
8943 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8944
8945 2009-12-05 Doug Kwan <dougkwan@google.com>
8946
8947 * arm.cc: Update comments about interworking and stub generation.
8948 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8949 considered as non-PIC.
8950 (Arm_relocate_functions::base_abs): Fix formatting.
8951 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8952 of function to use GOT entry address instead of offset.
8953 (Target_arm::Scan::global): Issue an error if a symbol would need a
8954 PLT does not get one because it is untyped. Remove code to create
8955 dynamic symbols for relative branches.
8956 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8957 takes unsigned integer instead of boolean.
8958
8959 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8960
8961 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8962 (two_file_test_LDADD): Likewise.
8963 (common_test_1_LDADD): Likewise.
8964 (exception_test_LDADD) Likewise.
8965 (weak_test_LDADD): Likewise.
8966 (many_sections_test_LDADD): Likewise.
8967 (initpri1_LDADD): Likewise.
8968 (script_test_1_LDADD): Likewise.
8969 (script_test_2_LDADD): Likewise.
8970 (justsyms_LDADD): Likewise.
8971 (binary_test_LDADD): Likewise.
8972 (large_LDADD): Likewise.
8973 * testsuite/Makefile.in: Regenerated.
8974
8975 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8976
8977 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8978 (Symbol_table::override_with_special): Likewise.
8979 (Symbol_table::add_from_object): Likewise.
8980
8981 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8982
8983 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8984 Don't set the data_offset twice.
8985
8986 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8987
8988 * testsuite/Makefile.in: Regenerate.
8989
8990 2009-12-03 Doug Kwan <dougkwan@google.com>
8991
8992 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8993 (Target_arm::do_finalize_sections): Add parameter for symbol table
8994 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8995 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8996 parameter for symbol table pointer.
8997 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8998 an additional parameter for a pointer to symbol table.
8999 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9000 parameter for a symbol table pointer.
9001 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9002 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9003 Ditto.
9004 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9005 parameter for a symbol table pointer.
9006
9007 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9008
9009 * incremental.cc (Incremental_inputs_header)
9010 (Incremental_inputs_header_write, Incremental_inputs_entry)
9011 (Incremental_inputs_entry_write): Move ...
9012 * incremental.h (Incremental_inputs_header)
9013 (Incremental_inputs_header_write, Incremental_inputs_entry)
9014 (Incremental_inputs_entry_write): here.
9015
9016 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9017
9018 * incremental.cc (make_sized_incremental_binary): Set the target.
9019 Error if it is incompatible.
9020 * output.h (Output_file): Add filename method.
9021
9022 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9023
9024 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9025 from the get_* methods.
9026
9027 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9028
9029 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9030 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9031 Write 0 for the data_offset of scripts.
9032
9033 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9034
9035 * testsuite/Makefile.am: Add the incremental_test.sh test.
9036 * testsuite/incremental_test.sh: New.
9037 * testsuite/incremental_test_1.c: New.
9038 * testsuite/incremental_test_2.c: New.
9039
9040 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9041
9042 * incremental-dump.cc (main): Fix typos.
9043
9044 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9045
9046 PR gold/11025
9047 * incremental-dump.cc (main): Use llu to print 64 bit values.
9048
9049 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9050 H.J. Lu <hongjiu.lu@intel.com>
9051
9052 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9053 $(LIBDL).
9054 (incremental_dump_LDADD): Likewise.
9055 * Makefile.in: Regenerated.
9056
9057 2009-11-25 Doug Kwan <dougkwan@google.com>
9058
9059 Revert:
9060
9061 2009-11-25 Doug Kwan <dougkwan@google.com>
9062
9063 * arm.cc (Target_arm::Target_arm): Move method definition
9064 outside of class definition. Add code to handle
9065 --target1-rel, --target1-abs and --target2= options.
9066 (Target_arm::get_reloc_reloc_type): Change method to be
9067 non-static and const.
9068 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9069 New data member declaration.
9070 (Target_arm::Scan::local, Target_arm::Scan::global,
9071 Target_arm::Relocate::relocate,
9072 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9073 Adjust call to Target_arm::get_real_reloc_type.
9074 (Target_arm::get_real_reloc_type): Use command line options
9075 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9076 * options.h (--target1-rel, --target1-abs, --target2): New
9077 ARM-only options.
9078
9079 2009-11-25 Doug Kwan <dougkwan@google.com>
9080
9081 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9082 class definition. Add code to handle --target1-rel, --target1-abs
9083 and --target2= options.
9084 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9085 and const.
9086 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9087 member declaration.
9088 (Target_arm::Scan::local, Target_arm::Scan::global,
9089 Target_arm::Relocate::relocate,
9090 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9091 call to Target_arm::get_real_reloc_type.
9092 (Target_arm::get_real_reloc_type): Use command line options to
9093 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9094 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9095 options.
9096
9097 2009-11-25 Doug Kwan <dougkwan@google.com>
9098
9099 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9100 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9101 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9102 formatting.
9103 (Arm_relocate_functions::thm_call): Replace body with a call to
9104 Arm_relocate_functions::thumb_branch_common.
9105 (Arm_relocate_functions::thm_jump24,
9106 Arm_relocate_functions::thm_xpc22): New method definitions.
9107 (Arm_relocate_functions::thumb_branch_common): New method definition.
9108 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9109 operator.
9110 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9111 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9112
9113 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9114
9115 * Makefile.am: Build incremental-dump
9116 * Makefile.in: Regenerate.
9117 * incremental-dump.cc: New.
9118 * incremental.cc (Incremental_inputs_header_data,
9119 Incremental_inputs_entry_data): Move to incremental.h
9120 * incremental.h: (Incremental_inputs_header_data,
9121 Incremental_inputs_entry_data): Move from incremental.cc
9122
9123 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9124
9125 * incremental.cc (Incremental_inputs_header,
9126 Incremental_inputs_header_write, Incremental_inputs_entry,
9127 Incremental_inputs_entry_write): Add a typedef with the data type.
9128
9129 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9130
9131 * incremental.cc (Incremental_inputs_header,
9132 Incremental_inputs_header_write, Incremental_inputs_entry,
9133 Incremental_inputs_entry_write): Update comment about which
9134 type has the filed descriptions.
9135
9136 2009-11-15 Doug Kwan <dougkwan@google.com>
9137
9138 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9139 (Arm_relocate_functions::arm_branch_common): Change method defintion
9140 in class definition to a method declaration and update list of formal
9141 parameters.
9142 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9143 Arm_relocation_functions::jump24): Adjust call to
9144 Arm_relocate_functions::arm_branch_common. Update list of formal
9145 parameters.
9146 (Arm_relocate_functions::xpc25): New method definition.
9147 (Arm_relocate_functions::arm_branch_common): Move method defintion
9148 out from class definition. Use stubs for mode-switching and extending
9149 branch ranges.
9150 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9151 specially. Change code to enable use of stubs in ARM branches.
9152
9153 2009-11-10 Doug Kwan <dougkwan@google.com>
9154
9155 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9156 in method declaration.
9157 (Target_arm::relocate_stub): New method declaration.
9158 (Target_arm::default_target): Change to return a pointer instead of
9159 a const reference.
9160 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9161 Target_arm::default_target.
9162 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9163 method definition.
9164 (Target_arm::relocate_section): Adjust view.
9165 (Target_arm::relocate_stub): New method definition.
9166
9167 2009-11-10 Doug Kwan <dougkwan@google.com>
9168
9169 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9170 a format warning.
9171 * incremental.cc (open_incremental_binary): Initialized local
9172 variables to avoid warnings.
9173 * object.cc (make_elf_object): Ditto.
9174 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9175 a format warning.
9176
9177 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9178
9179 PR gold/10930
9180 * testsuite/plugin_test.c: Include "config.h".
9181
9182 2009-11-09 Doug Kwan <dougkwan@google.com>
9183
9184 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9185 (arm_symbol_value): Remove.
9186 (Arm_relocate_functions::arm_branch_common,
9187 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9188 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9189 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9190 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9191 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9192 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9193 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9194 Arm_relocate_functions::thm_mobw_abs_nc,
9195 Arm_relocate_functions::thm_mov_abs,
9196 Arm_relocate_functions::movw_prel_nc,
9197 Arm_relocate_functions::thm_movt_abs,
9198 Arm_relocate_functions::movt_prel,
9199 Arm_relocate_functions::thm_movw_prel_nc,
9200 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9201 (Target_arm::Relocate::relocate): Only decompose address into two
9202 parts if relocation type uses the thumb-bit and pass the actual
9203 bit instead of a flag indicating that the thumb-bit is used. Adjust
9204 calls to methods in Arm_relocate_functions for this change.
9205
9206 2009-11-08 Ian Lance Taylor <iant@google.com>
9207
9208 PR 10925
9209 * reloc.cc: Instantiate
9210 Sized_relobj::initialize_input_to_output_maps and
9211 Sized_relobj:free_input_to_output_maps.
9212
9213 2009-11-06 Ian Lance Taylor <iant@google.com>
9214
9215 PR 10876
9216 * defstd.cc (in_segment): Set only_if_ref true for "end".
9217
9218 2009-11-06 Doug Kwan <dougkwan@google.com>
9219
9220 * arm.cc (class Reloc_stub): Correct a comment.
9221 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9222 (Target_arm::scan_section_for_stubs): New method declaration.
9223 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9224 Change methods from private to protected.
9225 (Target_arm::do_may_relax): New method definition.
9226 (Target_arm::do_relax, Target_arm::group_sections,
9227 Target_arm::scan_reloc_for_stub,
9228 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9229 (Target_arm::arm_input_section_map_): New data member declaration.
9230 (Target_arm::scan_reloc_for_stub,
9231 Target_arm::scan_reloc_section_for_stubs,
9232 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9233 Target_arm::do_relax): New method definitions.
9234
9235 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9236
9237 * configure.ac: Check for (struct stat)::st_mtim
9238 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9239 * config.in: Regenerate.
9240 * configure: Regenerate.
9241
9242 2009-11-05 Ian Lance Taylor <iant@google.com>
9243
9244 PR 10910
9245 * output.cc (Output_segment::add_output_section): Add missing
9246 return statement.
9247
9248 2009-11-04 Ian Lance Taylor <iant@google.com>
9249
9250 PR 10880
9251 * object.h (class Object): Add is_needed and set_is_needed
9252 methods. Add is_needed_ field. Make bool fields into bitfields.
9253 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9254 defined in a dynamic object and referenced by a regular object,
9255 set is_needed for the dynamic object.
9256 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9257 if the file is marked with as_needed and it is not needed.
9258
9259 2009-11-04 Ian Lance Taylor <iant@google.com>
9260
9261 PR 10887
9262 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9263 tags if data is discarded by linker script.
9264 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9265 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9266 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9267 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9268
9269 2009-11-04 Ian Lance Taylor <iant@google.com>
9270
9271 * layout.cc (Layout::get_output_section): Add is_interp and
9272 is_dynamic_linker_section parameters. Change all callers.
9273 (Layout::choose_output_section): Likewise.
9274 (Layout::make_output_section): Likewise.
9275 (Layout::add_output_section_data): Add is_dynamic_linker_section
9276 parameter. Change all callers.
9277 * layout.h (class Layout): Update declarations.
9278 * output.h (class Output_section): Add is_interp, set_is_interp,
9279 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9280 Add is_interp_, is_dynamic_linker_section_ fields. Change
9281 generate_code_fills_at_write_ to a bitfield.
9282 * output.cc (Output_section::Output_sections): Initialize new
9283 fields.
9284 (Output_segment::add_output_section): Add do_sort parameter.
9285 Change all callers.
9286
9287 2009-11-03 Ian Lance Taylor <iant@google.com>
9288
9289 PR 10860
9290 * options.h (class General_options): Add --warn-common.
9291 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9292 merging two common symbols.
9293 (Symbol_table::should_override): Handle --warn-common when merging
9294 a common symbol with a defined symbol. Use report_resolve_problem
9295 for multiple definitions.
9296 (Symbol_table::report_resolve_problem): New function.
9297 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9298
9299 2009-11-03 Doug Kwan <dougkwan@google.com>
9300
9301 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9302 stub_factory_.
9303 (Target_arm::stub_factory): New method definition.
9304 (Target_arm::new_arm_input_section,
9305 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9306 Target_arm::reloc_uses_thumb_bit): New method declarations.
9307 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9308 New type definitions.
9309 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9310 member declarations.
9311 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9312 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9313 New method definitions.
9314
9315 2009-11-03 Ian Lance Taylor <iant@google.com>
9316
9317 * options.h (class General_options): Add --warn_constructors.
9318
9319 2009-11-03 Ian Lance Taylor <iant@google.com>
9320
9321 PR 10893
9322 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9323 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9324
9325 2009-11-03 Ian Lance Taylor <iant@google.com>
9326
9327 PR 10895
9328 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9329 --msgid-bugs-address.
9330 (install-pdf): New target.
9331 (install-data_yes): Look up one directory to find mkinstalldirs.
9332
9333 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9334
9335 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9336 tree.
9337
9338 2009-10-30 Doug Kwan <dougkwan@google.com>
9339
9340 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9341
9342 2009-10-30 Doug Kwan <dougkwan@google.com>
9343
9344 * arm.cc (Stub_addend_reader): New struct template definition
9345 and partial specializations.
9346 (Stub_addend_reader::operator()): New method definition for a
9347 partially specialized template.
9348
9349 2009-10-30 Doug Kwan <dougkwan@google.com>
9350
9351 * arm.cc (Arm_relobj::processor_specific_flags): New method
9352 definition.
9353 (Arm_relobj::do_read_symbols): New method declaration.
9354 (Arm_relobj::processor_specific_flags_): New data member declaration.
9355 (Arm_dynobj): New class definition.
9356 (Target_arm::do_finalize_sections): Add input_objects parameter.
9357 (Target_arm::do_adjust_elf_header): New method declaration.
9358 (Target_arm::are_eabi_versions_compatible,
9359 (Target_arm::merge_processor_specific_flags): New method declaration.
9360 (Target_arm::do_make_elf_object): New overloaded method definitions
9361 and declaration.
9362 (Arm_relobj::do_read_symbols): New method definition.
9363 (Arm_dynobj::do_read_symbols): Ditto.
9364 (Target_arm::do_finalize_sections): Add input_objects parameters.
9365 Merge processor-specific flags from all input objects.
9366 (Target_arm::are_eabi_versions_compatible,
9367 Target_arm::merge_processor_specific_flags,
9368 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9369 New method definitions.
9370 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9371 Input_objects pointer type parameter.
9372 * layout.cc (Layout::finalize): Pass input objects to target's.
9373 finalize_sections function.
9374 * output.cc (Output_file_header::do_sized_write): Set ELF file
9375 header's processor-specific flags.
9376 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9377 Input_objects pointer type parameter.
9378 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9379 * target.h (Input_objects): New forward class declaration.
9380 (Target::processor_specific_flags,
9381 Target::are_processor_specific_flags_sect): New method definitions.
9382 (Target::finalize_sections): Add input_objects parameter.
9383 (Target::Target): Initialize processor_specific_flags_ and
9384 are_processor_specific_flags_set_.
9385 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9386 parameter.
9387 (Target::set_processor_specific_flags): New method definition.
9388 (Target::processor_specific_flags_,
9389 Target::are_processor_specific_flags_set_): New data member
9390 declarations.
9391 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9392 Input_objects pointer type parameter.
9393
9394 2009-10-30 Doug Kwan <dougkwan@google.com>
9395
9396 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9397
9398 2009-10-28 Ian Lance Taylor <iant@google.com>
9399
9400 * object.h (class Relobj): Drop options parameter from
9401 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9402 do_scan_relocs, do_relocate. Change all callers.
9403 (class Sized_relobj): Drop options parameters from
9404 do_gc_process_relocs, do_scan_relocs, do_relocate,
9405 do_relocate_sections, relocate_sections, emit_relocs_scan,
9406 emit_relocs_scan_reltype. Change all callers.
9407 (struct Relocate_info): Remove options field and all references to
9408 it.
9409 * reloc.h (class Read_relocs): Remove options constructor
9410 parameter and options_ field. Change all callers.
9411 (class Gc_process_relocs, class Scan_relocs): Likewise.
9412 (class Relocate_task): Likewise.
9413 * target-reloc.h (scan_relocs): Remove options parameter. Change
9414 all callers.
9415 (scan_relocatable_relocs): Likewise.
9416 * target.h (class Sized_target): Remove options parameter from
9417 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9418 all callers.
9419 * gc.h (gc_process_relocs): Remove options parameter. Change all
9420 callers.
9421 * arm.cc: Update functions to remove options parameters.
9422 * i386.cc: Likewise.
9423 * powerpc.cc: Likewise.
9424 * sparc.cc: Likewise.
9425 * x86_64.cc: Likewise.
9426 * testsuite/testfile.cc: Likewise.
9427
9428 2009-10-28 Doug Kwan <dougkwan@google.com>
9429
9430 * arm.cc (Arm_relobj): New class definition.
9431 (Arm_relobj::scan_sections_for_stubs,
9432 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9433 New method definitions.
9434
9435 2009-10-28 Cary Coutant <ccoutant@google.com>
9436
9437 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9438 (Plugin::cleanup_done_): New member.
9439 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9440 (Plugin_manager::cleanup_done_): Remove.
9441 (Plugin_manager::add_input_file): Edit error message.
9442 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9443 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9444
9445 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9446
9447 * fileread.cc: (File_read::View::~View): Use the new
9448 data_ownership_ filed.
9449 (File_read::~File_read): Dispose the new whole_file_view_.
9450 (File_read::open): Mmap the whole file if needed.
9451 (File_read::open): Use whole_file_view_ instead of contents_.
9452 (File_read::find_view): Use whole_file_view_ if applicable.
9453 (File_read::do_read): Use whole_file_view_ instead of contents_.
9454 (File_read::make_view): Use whole_file_view_ instead of contents_,
9455 update File_read::View::View call.
9456 (File_read::find_or_make_view): Update File_read::View::View
9457 call.
9458 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9459 remove contents_
9460 (File_read::View::Data_ownership): New enum.
9461 (File_read::View::View): Replace bool mapped_ with Data_ownership
9462 argument.
9463 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9464 (File_read::View::data_ownership_): New field.
9465 (File_read::contents_): Remove (replaced by whole_file_view_).
9466 (File_read::whole_file_view_): New field.
9467 * options.h (class General_options): Add --keep-files-mapped.
9468
9469 2009-10-27 Cary Coutant <ccoutant@google.com>
9470
9471 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9472 * testsuite/Makefile.am (plugin_test_5): New test case.
9473 * testsuite/Makefile.in: Regenerate.
9474
9475 2009-10-25 Doug Kwan <dougkwan@google.com>
9476
9477 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9478 from private to protected to allow access by child class.
9479 (Sized_relobj::do_relocate_sections): New method declaration.
9480 (Sized_relobj::relocate_sections): Virtualize.
9481 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9482 Sized_relobj::relocate_sections. Instantiate template explicitly
9483 for different target sizes and endianity.
9484
9485 2009-10-24 Doug Kwan <dougkwan@google.com>
9486
9487 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9488 (Arm_input_section::as_arm_input_section): New method.
9489 (Arm_output_section): New class definition.
9490 (Arm_output_section::create_stub_group,
9491 Arm_output_section::group_sections): New method definitions.
9492
9493 2009-10-22 Doug Kwan <dougkwan@google.com>
9494
9495 * arm.cc (Arm_input_section): New class definition.
9496 (Arm_input_section::init, Arm_input_section:do_write,
9497 Arm_input_section::set_final_data_size,
9498 Arm_input_section::do_reset_address_and_file_offset): New method
9499 definitions.
9500
9501 2009-10-21 Doug Kwan <dougkwan@google.com>
9502
9503 * arm.cc (Stub_table, Arm_input_section): New forward class
9504 declarations.
9505 (Stub_table): New class defintion.
9506 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9507 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9508 New method definition.
9509
9510 2009-10-21 Doug Kwan <dougkwan@google.com>
9511
9512 * arm.cc: Update copyright comments.
9513 (Target_arm): New forward class template declaration.
9514 (Arm_address): New type.
9515 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9516 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9517 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9518 constants.
9519 (Insn_template): Same.
9520 (DEF_STUBS): New macro.
9521 (Stub_type): New enum type.
9522 (Stub_template): New class definition.
9523 (Stub): Same.
9524 (Reloc_stub): Same.
9525 (Stub_factory): Same.
9526 (Target_arm::Target_arm): Initialize may_use_blx_ and
9527 should_force_pic_veneer_.
9528 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9529 Target_arm::should_force_pic_veneer,
9530 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9531 Target_arm::using_thumb_only, Target_arm:;default_target): New
9532 method defintions.
9533 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9534 New data member declarations.
9535 (Insn_template::size, Insn_template::alignment): New method defintions.
9536 (Stub_template::Stub_template): New method definition.
9537 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9538 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9539 (Stub_factory::Stub_factory): New method definition.
9540 * gold.h (string_hash): New template.
9541 * output.h (Input_section_specifier::hash_value): Use
9542 gold::string_hash.
9543 (Input_section_specifier::string_hash): Remove.
9544 * stringpool.cc (Stringpool_template::string_hash): Use
9545 gold::string_hash.
9546
9547 2009-10-20 Doug Kwan <dougkwan@google.com>
9548
9549 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9550 symbols of relaxed input sections.
9551 * output.h (Output_section::find_relaxed_input_section): Make
9552 method public.
9553
9554 2009-10-16 Doug Kwan <dougkwan@google.com>
9555
9556 * dynobj.cc (Versions::Versions): Initialize version_script_.
9557 Only insert base version symbol definition for a shared object
9558 if version script defines any version versions.
9559 (Versions::define_base_version): New method definition.
9560 (Versions::add_def): Check that base version is not needed.
9561 (Versions::add_need): Define base version lazily.
9562 * dynobj.h (Versions::define_base_version): New method declaration.
9563 (Versions::needs_base_version_): New data member declaration.
9564 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9565 (check_DATA): Add no_version_test.stdout.
9566 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9567 New make rules.
9568 * testsuite/Makefile.in: Regenerate.
9569 * testsuite/no_version_test.c: New file.
9570 * testsuite/no_version_test.sh: Ditto.
9571
9572 2009-10-16 Doug Kwan <dougkwan@google.com>
9573
9574 * expression.cc (class Segment_start_expression): New class definition.
9575 (Segment_start_expression::value): New method definition.
9576 (script_exp_function_segment_start): Return a new
9577 Segment_start_expression.
9578 * gold/script-c.h (script_saw_segment_start_expression): New function
9579 prototype.
9580 * script-sections.cc (Script_sections::Script_sections): Initialize
9581 SAW_SEGMENT_START_EXPRESSION_ to false.
9582 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9583 and -Tbbs options to specify section addresses if given in
9584 command line and no SEGMENT_START expression is seen in a script.
9585 * script-sections.h (Script_sections::saw_segment_start_expression,
9586 Script_sections::set_saw_segment_start_expression): New method
9587 definition.
9588 (Script_sections::saw_segment_start_expression_): New data member
9589 declaration.
9590 * script.cc (script_saw_segment_start_expression): New function.
9591 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9592 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9593 script_test_7.sh and script_test_8.sh.
9594 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9595 script_test_8.stdout.
9596 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9597 (script_test_6, script_test_6.stdout, script_test_7,
9598 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9599 * Makefile.in: Regenerate.
9600 * testsuite/script_test_6.sh: New file.
9601 * testsuite/script_test_6.t: Same.
9602 * testsuite/script_test_7.sh: Same.
9603 * testsuite/script_test_7.t: Same.
9604 * testsuite/script_test_8.sh: Same.
9605
9606 2009-10-16 Doug Kwan <dougkwan@google.com>
9607
9608 * output.cc (Output_segment::set_section_list_address): Cast
9609 expressions to unsigned long long type to avoid format warnings.
9610
9611 2009-10-15 Ian Lance Taylor <iant@google.com>
9612
9613 * script.cc (Script_options::add_symbol_assignment): Always add a
9614 dot assignment to script_sections_.
9615 * script-sections.cc (Script_sections::add_dot_assignment):
9616 Initialize if necessary.
9617
9618 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9619 program headers with no load segment if there is a linker script.
9620
9621 * layout.cc (Layout::set_segment_offsets): Align the file offset
9622 to the segment aligment for -N or -n with no load segment.
9623 * output.cc (Output_segment::add_output_section): Don't crash if
9624 the first section is a TLS section.
9625 (Output_segment::set_section_list_addresses): Print an error
9626 message if the address moves backward in a linker script.
9627 * script-sections.cc
9628 (Output_section_element_input::set_section_addresses): Don't
9629 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9630 (Orphan_output_section::set_section_addresses): Likewise.
9631
9632 2009-10-15 Doug Kwan <dougkwan@google.com>
9633
9634 * layout.cc (Layout::finish_dynamic_section): Generate tags
9635 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9636 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9637 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9638
9639 2009-10-14 Ian Lance Taylor <iant@google.com>
9640
9641 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9642 fields.
9643 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9644 data_shdr fields of relinfo.
9645 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9646 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9647 R_386_TLS_LDO_32, adjust based on section flags.
9648 (Target_i386::Relocate::fix_up_ldo): Remove.
9649
9650 2009-10-13 Ian Lance Taylor <iant@google.com>
9651
9652 Add support for -pie.
9653 * options.h (class General_options): Add -pie and
9654 --pic-executable.
9655 (General_options::output_is_position_independent): Test -pie.
9656 (General_options::output_is_executable): Return true if not shared
9657 and not relocatable.
9658 (General_options::output_is_pie): Remove.
9659 * options.cc (General_options::finalize): Reject incompatible uses
9660 of -pie.
9661 * gold.cc (queue_middle_tasks): A -pie link is not static.
9662 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9663 * symtab.cc (Symbol::final_value_is_known): Return false if
9664 output_is_position_independent.
9665 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9666 output_is_position_independent.
9667 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9668 output_is_position_independent.
9669 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9670 output_is_position_independent.
9671 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9672 two_file_pie_test.
9673 (basic_pie_test.o, basic_pie_test): New targets.
9674 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9675 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9676 (two_file_pie_test): New target.
9677 * testsuite/Makefile.in: Rebuild.
9678 * README: Remove note saying that -pie is not supported.
9679
9680 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9681
9682 * options.h (class General_options): Add -init and -fini.
9683 * layout.cc (Layout::finish_dynamic_section): Emit
9684 given init and fini functions.
9685
9686 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9687
9688 * gc.h (gc_process_relocs): Check if icf is enabled using new
9689 function.
9690 * gold.cc (queue_initial_tasks): Likewise.
9691 (queue_middle_tasks): Likewise.
9692 * object.cc (do_layout): Likewise.
9693 * symtab.cc (is_section_folded): Likewise.
9694 * main.cc (main): Likewise.
9695 * reloc.cc (Read_relocs::run): Likewise.
9696 (Sized_relobj::do_scan_relocs): Likewise.
9697 * icf.cc (is_function_ctor_or_dtor): New function.
9698 (Icf::find_identical_sections): Check if function is ctor or dtor when
9699 safe icf is chosen.
9700 * options.h (General_options::icf): Change option to be an enum.
9701 (Icf_status): New enum.
9702 (icf_enabled): New method.
9703 (icf_safe_folding): New method.
9704 (set_icf_status): New method.
9705 (icf_status_): New variable.
9706 * (options.cc) (General_options::finalize): Set icf_status_.
9707 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9708 icf_test and icf_keep_unique_test to use the --icf enum flag.
9709 * testsuite/icf_safe_test.sh: New file.
9710 * testsuite/icf_safe_test.cc: New file.
9711
9712 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9713
9714 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9715 includes to gc.h and icf.h.
9716 * arm.cc: Include gc.h.
9717 * gold.cc: Likewise.
9718 * i386.cc: Likewise.
9719 * powerpc.cc: Likewise.
9720 * sparc.cc: Likewise.
9721 * x86_64.cc: Likewise.
9722 * gc.h: Include icf.h.
9723
9724 2009-10-11 Ian Lance Taylor <iant@google.com>
9725
9726 * plugin.cc: Include "gold.h" before other header files.
9727
9728 2009-10-10 Chris Demetriou <cgd@google.com>
9729
9730 * options.h (Input_file_argument::Input_file_type): New enum.
9731 (Input_file_argument::is_lib_): Replace with...
9732 (Input_file_argument::type_): New member.
9733 (Input_file_argument::Input_file_argument): Take Input_file_type
9734 'type' rather than boolean 'is_lib' as second argument.
9735 (Input_file_argument::is_lib): Use type_.
9736 (Input_file_argument::is_searched_file): New function.
9737 (Input_file_argument::may_need_search): Handle is_searched_file.
9738 * options.cc (General_options::parse_library): Support -l:filename.
9739 (General_options::parse_just_symbols): Update for Input_file_argument
9740 changes.
9741 (Command_line::process): Likewise.
9742 * archive.cc (Archive::get_file_and_offset): Likewise.
9743 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9744 * script.cc (read_script_file, script_add_file): Likewise.
9745 * fileread.cc (Input_file::Input_file): Likewise.
9746 (Input_file::will_search_for): Handle is_searched_file.
9747 (Input_file::open): Likewise.
9748 * readsyms.cc (Read_symbols::get_name): Likewise.
9749 * testsuite/Makefile.am (searched_file_test): New test.
9750 * testsuite/Makefile.in: Regenerate.
9751 * testsuite/searched_file_test.cc: New file.
9752 * testsuite/searched_file_test_lib.cc: New file.
9753
9754 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9755 Ian Lance Taylor <iant@google.com>
9756
9757 * descriptor.cc: Include <cstdio> and "binary-io.h".
9758 (Descriptors::open): Open the files in binary mode always.
9759 * script.cc (Lex::get_token): Treat \r as whitespace.
9760
9761 2009-10-09 Ian Lance Taylor <iant@google.com>
9762
9763 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9764
9765 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9766 Ian Lance Taylor <iant@google.com>
9767
9768 * configure.ac: Check for readv function also.
9769 * fileread.cc (readv): Define if not HAVE_READV.
9770 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9771 does not exist.
9772 * config.in: Regenerate.
9773 * configure: Regenerate.
9774
9775 2009-10-09 Doug Kwan <dougkwan@google.com>
9776
9777 * layout.cc (Layout::make_output_section): Call target hook to make
9778 ordinary output section.
9779 (Layout::finalize): Adjust parameter list of call the
9780 Target::may_relax().
9781 * layout.h (class Layout::section_list): New method.
9782 * merge.h (Output_merge_base::entsize): Change visibility to public.
9783 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9784 New methods.
9785 (Output_merge_string::do_is_string): New method.
9786 * object.cc (Sized_relobj::do_setup): renamed from
9787 Sized_relobj::set_up.
9788 * object.h (Sized_relobj::adjust_shndx,
9789 Sized_relobj::initializ_input_to_output_maps,
9790 Sized_relobj::free_input_to_output_maps): Change visibilities to
9791 protected.
9792 (Sized_relobj::setup): Virtualize.
9793 (Sized_relobj::do_setup): New method declaration.
9794 (Sized_relobj::invalidate_section_offset,
9795 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9796 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9797 * options.cc (parse_int): New function.
9798 * options.h (parse_int): New declaration.
9799 (DEFINE_int): New macro.
9800 (stub_group_size): New option.
9801 * output.cc (Output_section::Output_section): Initialize memebers
9802 merge_section_map_, merge_section_by_properties_map_,
9803 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9804 (Output_section::add_input_section): Handled deferred code-fill
9805 generation and remove an old comment.
9806 (Output_section::add_relaxed_input_section): New method definition.
9807 (Output_section::add_merge_input_section): Use merge section by
9808 properties map to speed to search. Update merge section maps
9809 as appropriate.
9810 (Output_section::build_relaxation_map): New method definition.
9811 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9812 Same.
9813 (Output_section::relax_input_section): Renamed to
9814 Output_section::convert_input_sections_to_relaxed_sections and change
9815 interface to take a vector of pointers to relaxed sections.
9816 (Output_section::find_merge_section,
9817 Output_section::find_relaxed_input_section): New method definitions.
9818 (Output_section::is_input_address_mapped,
9819 Output_section::output_offset, Output_section::output_address):
9820 Use output section data maps to speed up searching.
9821 (Output_section::find_starting_output_address): Add comments.
9822 (Output_section::do_write,
9823 Output_section::write_to_postprocessing_buffer): Do code-fill
9824 generation as appropriate.
9825 (Output_section::get_input_sections): Invalidate relaxed input section
9826 map.
9827 (Output_section::restore_states): Adjust type of checkpoint .
9828 Invalidate relaxed input section map.
9829 * output.h (Output_merge_base): New class declaration.
9830 (Input_section_specifier): New class defintion.
9831 (class Output_relaxed_input_section) Change base class to
9832 Output_section_data_build.
9833 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9834 base class initializer.
9835 (Output_section::add_relaxed_input_section): New method declaration.
9836 (Output_section::Input_section): Change visibility to protected.
9837 (Output_section::Input_section::relobj,
9838 Output_section::Input_section::shndx): Handle relaxed input sections.
9839 Output_section::input_sections) Change visibility to protected. Also
9840 define overload to return a non-const pointer.
9841 (Output_section::Merge_section_properties): New class defintion.
9842 (Output_section::Merge_section_by_properties_map,
9843 Output_section::Output_section_data_by_input_section_map,
9844 Output_section::Relaxation_map): New types.
9845 (Output_section::relax_input_section): Rename method to
9846 Output_section::convert_input_sections_to_relaxed_sections and change
9847 interface to take a vector of relaxed section pointers.
9848 (Output_section::find_merge_section,
9849 Output_section::find_relaxed_input_section,
9850 Output_section::build_relaxation_map,
9851 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9852 New method declarations.
9853 (Output_section::merge_section_map_
9854 Output_section::merge_section_by_properties_map_,
9855 Output_section::relaxed_input_section_map_,
9856 Output_section::is_relaxed_input_section_map_valid_,
9857 Output_section::generate_code_fills_at_write_): New data members.
9858 * script-sections.cc
9859 (Output_section_element_input::set_section_addresses): Call
9860 current_data_size and addralign methods of relaxed input sections.
9861 (Orphan_output_section::set_section_addresses): Call current_data_size
9862 and addralign methods of relaxed input sections.
9863 * symtab.cc (Symbol_table::compute_final_value): Extract template
9864 from the body of Symbol_table::sized_finalize_symbol.
9865 (Symbol_table::sized_finalized_symbol): Call
9866 Symbol_table::compute_final_value.
9867 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9868 (Symbol_table::compute_final_value): New templated method declaration.
9869 * target.cc (Target::do_make_output_section): New method defintion.
9870 * target.h (Target::make_output_section): New method declaration.
9871 (Target::relax): Add more parameters for input objects, symbol table
9872 and layout. Adjust call to do_relax.
9873 (Target::do_make_output_section): New method declaration.
9874 (Target::do_relax): Add parameters for input objects, symbol table
9875 and layout.
9876
9877 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9878
9879 * pread.c: Include stdio.h.
9880
9881 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9882
9883 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9884 defined.
9885
9886 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9887
9888 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9889 Change read_shndx type to unsigned int.
9890 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9891 int.
9892 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9893 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9894 Change read_shndx type to unsigned int.
9895 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9896 int.
9897 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9898 * layout.cc (Layout::create_symtab_sections): Cast the result of
9899 local_symcount * symsize to off_t in the gold_assert.
9900
9901 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9902
9903 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9904 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9905 R_ARM_BASE_ABS.
9906 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9907 (Arm_relocate_functions::thm_abs5): New function.
9908 (Arm_relocate_functions::abs12): New function.
9909 (Arm_relocate_functions::abs16): New function.
9910 (Arm_relocate_functions::base_abs): New function.
9911 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9912 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9913 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9914 R_ARM_BASE_ABS.
9915 (Scan::global): Likewise.
9916 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9917 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9918 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9919 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9920 R_ARM_BASE_ABS.
9921
9922 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9923
9924 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9925 (Arm_relocate_functions::movt_prel): New function.
9926 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9927 (Arm_relocate_functions::thm_movt_prel): New function.
9928 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9929 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9930 (Scan::global, Relocate::relocate): Likewise.
9931 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9932
9933 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9934
9935 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9936 Incremental_checker.
9937 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9938 unsigned int.
9939 (class Incremental_inputs_header): New class.
9940 (Incremental_inputs_header_writer): Edit comment.
9941 (Incremental_inputs_entry): New class.
9942 (Incremental_inputs_entry_writer): Edit comment.
9943 (Sized_incremental_binary::do_find_incremental_inputs_section):
9944 Add *strtab_shndx parameter, fill it.
9945 (Sized_incremental_binary::do_check_inputs): New method.
9946 (Incremental_checker::can_incrementally_link_output_file): Use
9947 Sized_incremental_binary::check_inputs.
9948 (Incremental_inputs::report_command_line): Save command line in
9949 command_line_.
9950 * incremental.h:
9951 (Incremental_binary::find_incremental_inputs_section): New
9952 method.
9953 (Incremental_binary::do_find_incremental_inputs_section): Add
9954 strtab_shndx parameter.
9955 (Incremental_binary::do_check_inputs): New pure virtual method.
9956 (Sized_incremental_binary::do_check_inputs): Declare.
9957 (Incremental_checker::Incremental_checker): Add incremental_inputs
9958 parameter, use it to initialize incremental_inputs_.
9959 (Incremental_checker::incremental_inputs_): New field.
9960 (Incremental_checker::command_line): New method.
9961 (Incremental_checker::inputs): New method.
9962 (Incremental_checker::command_line_): New field.
9963
9964 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9965
9966 * incremental.cc: Include <cstdarg> and "target-select.h".
9967 (vexplain_no_incremental): New function.
9968 (explain_no_incremental): New function.
9969 (Incremental_binary::error): New method.
9970 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9971 method.
9972 (make_sized_incremental_binary): New function.
9973 (open_incremental_binary): New function.
9974 (can_incrementally_link_file): Add checks if output is ELF and has
9975 inputs section.
9976 * incremental.h: Include "elfcpp_file.h" and "output.h".
9977 (Incremental_binary): New class.
9978 (Sized_incremental_binary): New class.
9979 (open_incremental_binary): Declare.
9980 * object.cc (is_elf_object): Use
9981 elfcpp::Elf_recognizer::is_elf_file.
9982 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9983 * output.h (Output_file::filesize): New method.
9984
9985 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9986
9987 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9988 New function.
9989 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9990 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9991 function.
9992 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9993 function.
9994 (Arm_relocate_functions::movw_abs_nc): New function.
9995 (Arm_relocate_functions::movt_abs): New function.
9996 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9997 (Arm_relocate_functions::thm_movt_abs): New function.
9998 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9999 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10000 (Scan::global): Likewise.
10001 (Relocate::relocate): Likewise.
10002 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10003
10004 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10005
10006 * arm.cc (Arm_relocate_functions::got_prel) New function.
10007 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10008 (Relocate::relocate): Likewise.
10009 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10010
10011 2009-10-06 Ian Lance Taylor <iant@google.com>
10012
10013 * options.h (class General_options): Define
10014 split_stack_adjust_size parameter.
10015 * object.h (class Object): Add uses_split_stack_ and
10016 has_no_split_stack_ fields. Add uses_split_stack and
10017 has_no_split_stack accessor functions. Declare
10018 handle_split_stack_section.
10019 (class Reloc_symbol_changes): Define.
10020 (class Sized_relobj): Define Function_offsets. Declare
10021 split_stack_adjust, split_stack_adjust_reltype, and
10022 find_functions.
10023 * object.cc (Object::handle_split_stack_section): New function.
10024 (Sized_relobj::do_layout): Call handle_split_stack_section.
10025 * dynobj.cc (Sized_dynobj::do_layout): Call
10026 handle_split_stack_section.
10027 * reloc.cc (Sized_relobj::relocate_sections): Call
10028 split_stack_adjust for executable sections in split_stack
10029 objects. Pass reloc_map to relocate_section.
10030 (Sized_relobj::split_stack_adjust): New function.
10031 (Sized_relobj::split_stack_adjust_reltype): New function.
10032 (Sized_relobj::find_functions): New function.
10033 * target-reloc.h: Include "object.h".
10034 (relocate_section): Add reloc_symbol_changes parameter. Change
10035 all callers.
10036 * target.h (class Target): Add calls_non_split method. Declare
10037 do_calls_non_split virtual method. Declare match_view and
10038 set_view_to_nop.
10039 * target.cc: Include "elfcpp.h".
10040 (Target::do_calls_non_split): New function.
10041 (Target::match_view): New function.
10042 (Target::set_view_to_nop): New function.
10043 * gold.cc (queue_middle_tasks): Give an error if mixing
10044 split-stack and non-split-stack objects with -r.
10045 * i386.cc (Target_i386::relocate_section): Add
10046 reloc_symbol_changes parameter.
10047 (Target_i386::do_calls_non_split): New function.
10048 * x86_64.cc (Target_x86_64::relocate_section): Add
10049 reloc_symbol_changes parameter.
10050 (Target_x86_64::do_calls_non_split): New function.
10051 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10052 parameter.
10053 * powerpc.cc (Target_powerpc::relocate_section): Add
10054 reloc_symbol_changes parameter.
10055 * sparc.cc (Target_sparc::relocate_section): Add
10056 reloc_symbol_changes parameter.
10057 * configure.ac: Call AM_CONDITIONAL for the default target.
10058 * configure: Rebuild.
10059 * testsuite/Makefile.am (TEST_AS): New variable.
10060 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10061 (check_DATA): Add split_i386 and split_x86_64 files.
10062 (SPLIT_DEFSYMS): Define.
10063 (split_i386_[1234n].o): New targets.
10064 (split_i386_[124]): New targets.
10065 (split_i386_[1234r].stdout): New targets.
10066 (split_x86_64_[1234n].o): New targets.
10067 (split_x86_64_[124]): New targets.
10068 (split_x86_64_[1234r].stdout): New targets.
10069 (MOSTLYCLEANFILES): Add new executables.
10070 * testsuite/split_i386.sh: New file.
10071 * testsuite/split_x86_64.sh: New file.
10072 * testsuite/split_i386_1.s: New file.
10073 * testsuite/split_i386_2.s: New file.
10074 * testsuite/split_i386_3.s: New file.
10075 * testsuite/split_i386_4.s: New file.
10076 * testsuite/split_i386_n.s: New file.
10077 * testsuite/split_x86_64_1.s: New file.
10078 * testsuite/split_x86_64_2.s: New file.
10079 * testsuite/split_x86_64_3.s: New file.
10080 * testsuite/split_x86_64_4.s: New file.
10081 * testsuite/split_x86_64_n.s: New file.
10082 * testsuite/testfile.cc (Target_test): Update relocation_section
10083 function.
10084 * testsuite/Makefile.in: Rebuild.
10085
10086 2009-10-06 Ian Lance Taylor <iant@google.com>
10087
10088 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10089 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10090 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10091 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10092 the address on ldo_addrs_.
10093 (Target_i386::Relocate::fix_up_ldo): New function.
10094
10095 2009-10-06 Rafael Espindola <espindola@google.com>
10096
10097 * plugin.cc (add_input_library): New.
10098 (Plugin::load): Add add_input_library to tv.
10099 (Plugin_manager::add_input_file): Add the is_lib argument.
10100 (add_input_file): Update call to Plugin_manager::add_input_file.
10101 (add_input_library): New.
10102 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10103
10104 2009-09-30 Doug Kwan <dougkwan@google.com>
10105
10106 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10107 symbol and call Symbol::may_need_copy_reloc to determine if
10108 a copy reloc is needed.
10109 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10110 nocopyreloc is given in command line.
10111 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10112 given in command line.
10113 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10114 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10115 of the removed Target_i386::may_need_copy_reloc.
10116 * options.h (copyreloc): New option with default value false.
10117 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10118 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10119 instead of the removed Target_powerpc::may_need_copy_reloc.
10120 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10121 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10122 instead of the removed Target_sparc::may_need_copy_reloc.
10123 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10124 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10125 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10126 instead of the removed Target_x86_64::may_need_copy_reloc.
10127
10128 2009-09-30 Ian Lance Taylor <iant@google.com>
10129
10130 * object.h (class Object): Remove target_ field, and target,
10131 sized_target, and set_target methods.
10132 (Object::sized_target): Remove.
10133 (class Sized_relobj): Update declarations. Remove sized_target.
10134 * object.cc (Sized_relobj::setup): Remove target parameter.
10135 Change all callers.
10136 (Input_objects::add_object): Don't do anything with the target.
10137 (make_elf_sized_object): Add punconfigured parameter. Change all
10138 callers. Set or test parameter target.
10139 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10140 Change all callers.
10141 * parameters.cc (Parameters::set_target): Change parameter type to
10142 be non-const.
10143 (Parameters::default_target): Remove.
10144 (set_parameters_target): Change parameter type to be non-const.
10145 (parameters_force_valid_target): New function.
10146 (parameters_clear_target): New function.
10147 * parameters.h (class Parameters): Update declarations. Remove
10148 default_target method. Add sized_target and clear_target
10149 methods. Change target_ to be non-const.
10150 (set_parameters_target): Update declaration.
10151 (parameters_force_valid_target): Declare.
10152 (parameters_clear_target): Declare.
10153 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10154 as NULL if we aren't searching.
10155 (Add_symbols::run): Don't check for compatible target.
10156 * fileread.cc (Input_file::open_binary): Call
10157 parameters_force_valid_target.
10158 * gold.cc (queue_middle_tasks): Likewise.
10159 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10160 set_target on object.
10161 * dynobj.h (class Sized_dynobj): Update declarations.
10162 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10163 make_elf_object returns NULL.
10164 (Archive::include_member): Don't check whether object target is
10165 compatible.
10166 * output.cc (Output_section::add_input_section): Get target from
10167 parameters.
10168 (Output_section::relax_input_section): Likewise.
10169 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10170 parameters.
10171 (Sized_relobj::do_scan_relocs): Likewise.
10172 (Sized_relobj::relocate_sections): Likewise.
10173 * resolve.cc (Symbol_table::resolve): Likewise.
10174 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10175 parameter. Change all callers.
10176 (Symbol_table::add_from_object): Get target from parameters.
10177 (Symbol_table::add_from_relobj): Don't check object target.
10178 (Symbol_table::add_from_dynobj): Likewise.
10179 (Symbol_table::define_special_symbol): Get target from
10180 parameters.
10181 * symtab.h (class Symbol_table): Update declaration.
10182 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10183 parameter. Change all callers. Clear parameter target.
10184 (Binary_test): Test target here.
10185 * testsuite/object_unittest.cc (gold_testsuite): Remove
10186 target_test_pointer parameter. Change all callers.
10187 (Object_test): Test target here.
10188
10189 2009-09-26 Ian Lance Taylor <iant@google.com>
10190
10191 * testsuite/initpri1.c: Don't try to use constructor priorities if
10192 compiling with gcc before 4.3.
10193
10194 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10195
10196 * testsuite/retain_symbols_file_test.sh (check_present): Change
10197 output file name to retain_symbols_file_test.stdout.
10198 (check_absent): Likewise.
10199
10200 2009-09-18 Craig Silverstein <csilvers@google.com>
10201
10202 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10203 * options.cc: Include <cerrno> and <fstream>.
10204 (General_options::finalize): Parse -retain-symbols-file tag.
10205 * options.h: New flag.
10206 (General_options): New method should_retain_symbol, new
10207 variable symbols_to_retain.
10208 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10209 should_retain_symbol map.
10210 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10211 * testsuite/Makefile.in: Regenerate.
10212 * testsuite/retain_symbols_file_test.sh: New file.
10213
10214 2009-09-18 Nick Clifton <nickc@redhat.com>
10215
10216 * po/es.po: Updated Spanish translation.
10217
10218 2009-09-17 Doug Kwan <dougkwan@google.com>
10219
10220 * debug.h (DEBUG_RELAXATION): New constant.
10221 (DEBUG_ALL): Add DEBUG_RELAXATION.
10222 (debug_string_to_enum): Add relaxation debug option.
10223 * layout.cc
10224 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10225 Layout::Relaxation_debug_check::read_sections,
10226 Layout::Relaxation_debug_check::read_sections): New method definitions.
10227 (Layout::Layout): Initialize data members
10228 record_output_section_data_from_scrips_,
10229 script_output_section_data_list_ and relaxation_debug_check_.
10230 (Layout::save_segments, Layout::restore_segments,
10231 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10232 Layout::relaxation_loop_body): New method definitions.
10233 (Layout::finalize): Support relaxation. Move section layout code to
10234 Layout::relaxation_loop_body.
10235 (Layout::set_asection_address_from_script): Move code for orphan
10236 section placement out.
10237 (Layout::place_orphan_sections_in_script): New method definition.
10238 * layout.h (Output_segment_headers, Output_file_header):
10239 New forward class declarations.
10240 (Layout::~Layout): Define.
10241 (Layout::new_output_section_data_from_script): New method definition.
10242 (Layout::place_orphan_sections_in_script): New method declaration.
10243 (Layout::Segment_states): New type declaration.
10244 (Layout::save_segments, Layout::restore_segments,
10245 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10246 Layout::relaxation_loop_body): New method declarations.
10247 (Layout::Output_section_data_list): New type declaration.
10248 (Layout::Relaxation_debug_check): New class definition.
10249 (Layout::record_output_section_data_from_script_,
10250 Layout::script_output_section_data_list_, Layout::segment_states_,
10251 Layout::relaxation_debug_check_): New data members.
10252 * output.cc: (Output_section_headers::do_size): New method definition.
10253 (Output_section_headers::Output_section_headers): Move size
10254 computation to Output_section_headers::do_size.
10255 (Output_segment_headers::do_size): New method definition.
10256 (Output_file_header::Output_file_header): Move size computation to
10257 Output_file_header::do_size and call it.
10258 (Output_file_header::do_size): New method definition.
10259 (Output_data_group::Output_data_group): Adjust call to
10260 Output_section_data.
10261 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10262 (Output_symtab_xindex::do_write): Add array bound check.
10263 (Output_section::Input_section::print_to_mapfile): Handle
10264 RELAXED_INPUT_SECTION_CODE.
10265 (Output_section::Output_section): Initialize data member checkpoint_.
10266 (Output_section::~Output_section): Delete checkpoint object pointed
10267 by checkpoint_.
10268 (Output_section::add_input_section): Always add an Input_section if
10269 relaxing.
10270 (Output_section::add_merge_input_section): Add assert.
10271 (Output_section::relax_input_section): New method definition.
10272 (Output_section::set_final_data_size): Set load address to zero for
10273 an unallocated section.
10274 (Output_section::do_address_and_file_offset_have_reset_values):
10275 New method definition.
10276 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10277 Handle relaxed input section.
10278 (Output_section::sort_attached_input_sections): Checkpoint input
10279 section list lazily.
10280 (Output_section::get_input_sections): Change type of input_sections to
10281 list of Simple_input_section pointers. Checkpoint input section list
10282 lazily. Also handle relaxed input sections.
10283 (Output_section::add_input_section_for_script): Take a reference to
10284 a Simple_input_section object instead of Relobj pointer and section
10285 index as parameter. Handle relaxed input sections.
10286 (Output_section::save_states, Output_section::restore_states): New
10287 method definitions.
10288 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10289 (Output_data::is_data_size_fixed): New method definition.
10290 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10291 if it is fixed.
10292 (Output_data::address_and_file_offset_have_reset_values): New method
10293 definition.
10294 (Output_data::do_address_and_file_offset_have_reset_values): New method
10295 definition.
10296 (Output_data::set_data_size): Check that data size is not fixed.
10297 (Output_data::fix_data_size): New method definition.
10298 (Output_data::is_data_size_fixed_): New data member.
10299 (Output_section_headers::set_final_data_size): New method definition.
10300 (Output_section_headers::do_size): New method declaration.
10301 (Output_segment_headers::set_final_data_size): New method definition.
10302 (Output_segment_headers::do_size): New method declaration.
10303 (Output_file_header::set_final_data_size)::New method definition.
10304 (Output_file_header::do_size)::New method declaration.
10305 (Output_section_data::Output_section_data): Add new parameter
10306 is_data_size_fixed and use it to fix data size.
10307 (Output_data_const::Output_data_const): Adjust call to base class
10308 constructor and fix data size.
10309 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10310 base class constructor and fix data size.
10311 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10312 base class constructor and fix data size.
10313 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10314 class constructor and fix data size.
10315 (Output_data_group::set_final_data_size): New method definition.
10316 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10317 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10318 class constructor and fix data size.
10319 (Output_relaxed_input_section): New class definition.
10320 (Output_section::Simple_input_section): New class definition.
10321 (Output_section::get_input_sections): Adjust parameter list.
10322 (Output_section::add_input_section_for_script): Same.
10323 (Output_section::save_states, Output_section::restore_states,
10324 Output_section::do_address_and_file_offset_have_reset_values,
10325 (Output_section::Input_section::Input_section): Handle
10326 RELAXED_INPUT_SECTION_CODE. Add new overload for
10327 Output_relaxed_input_section.
10328 (Output_section::Input_section::is_input_section,
10329 Output_section::Input_section::set_output_section): Handle relaxed
10330 input section.
10331 (Output_section::Input_section::is_relaxed_input_section,
10332 Output_section::Input_section::output_section_data,
10333 Output_section::Input_section::relaxed_input_section): New method
10334 definitions.
10335 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10336 value.
10337 (Output_section::Input_section::u1_): Update comments.
10338 (Output_section::Input_section::u2_): Add new union member poris.
10339 (Output_section::Checkpoint_output_section): New classs definition.
10340 (Output_section::relax_input_section): New method declaration.
10341 (Output_section::checkpoint_): New data member.
10342 (Output_segment): Update comments.
10343 (Output_segment::Output_segment): Un-privatize copy constructor.
10344 (Output_segment::operator=): Un-privatize.
10345 * script-sections.cc (Output_section_element::Input_section_list):
10346 Change element type to Output_section::Simple_input_section.
10347 (Output_section_element_dot_assignment::set_section_addresses):
10348 Register output section data for relaxation clean up.
10349 (Output_data_exression::Output_data_expression): Adjust call to base
10350 constructor to fix data size.
10351 (Output_section_element_data::set_section_addresses): Register
10352 Output_data_expression object for relaxation clean up.
10353 (struct Input_section_info): Replace Relobj pointer and section index
10354 pair with Output_section::Simple_input_section and Convert struct to a
10355 class.
10356 (Input_section_sorter::operator()): Adjust access to
10357 Input_section_info data member to use accessors.
10358 (Output_section_element_input::set_section_addresses): Use layout
10359 parameter. Adjust code to use Output_section::Simple_input_section
10360 and Input_secction_info classes. Register filler for relaxation
10361 clean up.
10362 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10363 and section index pair with Output_section::Simple_input_section
10364 class. Adjust code accordingly.
10365 (Phdrs_element::release_segment): New method definition.
10366 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10367 segment list.
10368 (Script_sections::release_segments): New method definition.
10369 * gold/script-sections.h (Script_sections::release_segments): New
10370 method declaration.
10371 * gold/target.h (Target::may_relax, Target::relax,
10372 Target::do_may_relax, Target::do_relax): New method definitions.
10373
10374 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10375
10376 * arm.cc (has_signed_unsigned_overflow): New function.
10377 (Arm_relocate_functions::abs8): New function.
10378 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10379 (Target_arm::Scan::global): Likewise.
10380 (Target_arm::relocate::relocate): Likewise.
10381 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10382 Likewise.
10383
10384 2009-09-16 Cary Coutant <ccoutant@google.com>
10385
10386 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10387 * testsuite/Makefile.in: Regenerate.
10388
10389 2009-09-11 Nick Clifton <nickc@redhat.com>
10390
10391 * po/gold.pot: Updated by the Translation project.
10392
10393 2009-09-08 Cary Coutant <ccoutant@google.com>
10394
10395 * output.cc (Output_file::open): Add execute permission to empty file.
10396 * testsuite/Makefile.am (permission_test): New test.
10397 * testsuite/Makefile.in: Regenerate.
10398
10399 2009-09-02 Ian Lance Taylor <iant@google.com>
10400
10401 * output.cc (Output_file::resize): Call map_no_anonymous rather
10402 than map.
10403
10404 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10405
10406 * gold.cc: Include "incremental.h".
10407 (queue_initial_tasks): Call Incremental_checker methods.
10408 * incremental.cc: Include "output.h".
10409 (Incremental_checker::can_incrementally_link_output_file): New
10410 method.
10411 * incremental.h (Incremental_checker): New class.
10412
10413 * output.cc (Output_file::open_for_modification): New method.
10414 (Output_file::map_anonymous): Changed return type to bool. Record
10415 map in base_ field.
10416 (Output_file::map_no_anonymous): New method, broken out of map.
10417 (Output_file::map): Use map_no_anonymous and map_anonymous.
10418 * output.h (class Output_file): Update declarations.
10419
10420 2009-08-24 Cary Coutant <ccoutant@google.com>
10421
10422 * options.h (Command_line::Pre_options): New class.
10423 (Command_line::pre_options): New member.
10424 * options.cc (gold::options::ready_to_register): New variable.
10425 (One_option::register_option): Do nothing if not registering options.
10426 Assert if same short option registered twice.
10427 (General_options::General_options): Turn off option registration when
10428 done constructing.
10429 (Command_line::Pre_options::Pre_options): New constructor.
10430
10431 2009-08-24 Cary Coutant <ccoutant@google.com>
10432
10433 * options.h (General_options::no_keep_memory): Remove incorrect
10434 short option.
10435
10436 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10437
10438 * Makefile.am (am__skiplex, am__skipyacc): New.
10439 * Makefile.in: Regenerate.
10440
10441 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10442
10443 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10444 (INCLUDES): ... this.
10445 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10446 (AM_CPPFLAGS): Renamed from ...
10447 (INCLUDE): ... this.
10448 * Makefile.in, testsuite/Makefile.in: Regenerate.
10449
10450 * Makefile.in: Regenerate.
10451 * aclocal.m4: Likewise.
10452 * config.in: Likewise.
10453 * configure: Likewise.
10454 * testsuite/Makefile.in: Likewise.
10455
10456 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10457 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10458 * Makefile.in: Regenerate.
10459 * testsuite/Makefile.in: Regenerate.
10460
10461 2009-08-19 Cary Coutant <ccoutant@google.com>
10462
10463 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10464 symbols in shared libraries overridden by hidden or internal symbols
10465 in the main program.
10466
10467 2009-08-19 Chris Demetriou <cgd@google.com>
10468
10469 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10470 checking source file names in error messages.
10471
10472 2009-08-18 Doug Kwan <dougkwan@google.com>
10473
10474 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10475 an elcpp::Ehdr as parameter. Adjust call to set_target.
10476 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10477 an elfcpp::Ehdr as parameter.
10478 * object.cc (Object::set_target): Remove the version that looks up
10479 a target and sets it.
10480 (Sized_relobj::setup): Take a Target object instead of
10481 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10482 (make_elf_sized_object): Find target and ask target to
10483 make an ELF object.
10484 * object.h: (Object::set_target): Remove the version that looks up
10485 a target and sets it.
10486 (Sized_relobj::setup): Take a Target object instead of
10487 an elfcpp:Ehdr as parameter.
10488 * target.cc: Include dynobj.h.
10489 (Target::do_make_elf_object_implementation): New.
10490 (Target::do_make_elf_object): New.
10491 * target.h (Target::make_elf_object): New template declaration.
10492 (Target::do_make_elf_object): New method declarations.
10493 (Target::do_make_elf_object_implementation): New template declaration.
10494
10495 2009-08-14 Ian Lance Taylor <iant@google.com>
10496
10497 * gold.h (FUNCTION_NAME): Define.
10498 (gold_unreachable): Use FUNCTION_NAME.
10499
10500 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10501
10502 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10503 symbol in the --keep-unique list is not found.
10504
10505 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10506
10507 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10508 been maked as --keep-unique.
10509 (Icf::unfold_section): New function.
10510 * icf.h (Icf::unfold_section): New function.
10511 * options.h (General_options::keep_unique): New option.
10512 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10513 * testsuite/Makefile.in: Regenerate.
10514 * testsuite/icf_keep_unique_test.sh: New file.
10515 * testsuite/icf_keep_unique_test.cc: New file.
10516
10517 2009-08-12 Cary Coutant <ccoutant@google.com>
10518
10519 PR 10471
10520 * resolve.cc (Symbol_table::resolve): Check for references from
10521 dynamic objects to hidden and internal symbols.
10522 * testsuite/Makefile.am (hidden_test.sh): New test.
10523 * testsuite/Makefile.in: Regenerate.
10524 * testsuite/hidden_test.sh: New script.
10525 * testsuite/hidden_test_1.c: New test source.
10526 * testsuite/hidden_test_main.c: New test source.
10527
10528 2009-08-11 Doug Kwan <dougkwan@google.com>
10529
10530 * arm.cc: Update comments.
10531 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10532 segment to locate the .ARM.exidx section if present.
10533
10534 2009-08-09 Doug Kwan <dougkwan@google.com>
10535
10536 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10537 patch.
10538
10539 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10540 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10541 compiler warnings.
10542
10543 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10544
10545 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10546 valid tls_segment only for non-debug-section relocations.
10547 * testsuite/Makefile.am: Add gc_tls_test.
10548 * testsuite/Makefile.in: Regenerate.
10549 * testsuite/gc_tls_test.cc: New file.
10550 * testsuite/gc_tls_test.sh: New file.
10551
10552 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10553
10554 * icf.cc: New file.
10555 * icf.h: New file.
10556 * Makefile.am (CCFILES): Add icf.cc.
10557 (HFILES): Add icf.h
10558 * Makefile.in: Regenerate.
10559 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10560 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10561 section, symbol and addend information for the relocs.
10562 * gold.cc (queue_middle_tasks): Call identical code folding.
10563 * gold.h: Add defines for multimap.
10564 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10565 to the call of finalize_local_symbols.
10566 * main.cc (main): Create object of class Icf.
10567 * object.cc (Sized_relobj::do_layout): Allow this function to be
10568 called twice during icf.
10569 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10570 to sections marked as identical by icf.
10571 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10572 when available.
10573 (Sized_relobj::do_section_entsize): New function.
10574 * object.h (Object::section_entsize): New function.
10575 (Object::do_section_entsize): New pure virtual function.
10576 (Relobj::finalize_local_symbols): Add new parameter.
10577 (Relobj::do_section_entsize): New function.
10578 * options.h (General_options::icf): New option.
10579 (General_options::icf_iterations): New option.
10580 (General_options::print_icf_sections): New option.
10581 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10582 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10583 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10584 icf.
10585 * symtab.cc (Symbol_table::is_section_folded): New function.
10586 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10587 to sections marked as identical by icf.
10588 * symtab.h (Symbol_table::set_icf): New function.
10589 (Symbol_table::icf): New function.
10590 (Symbol_table::is_section_folded): New function.
10591 (Symbol_table::icf_): New data member.
10592 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10593 * testsuite/Makefile.am: Add commands to build icf_test.
10594 * testsuite/Makefile.in: Regenerate.
10595 * testsuite/icf_test.sh: New file.
10596 * testsuite/icf_test.cc: New file.
10597
10598 2009-07-24 Chris Demetriou <cgd@google.com>
10599
10600 * layout.cc (is_compressible_debug_section): Fix incorrect
10601 comment about compressed section names.
10602
10603 2009-07-20 Ian Lance Taylor <ian@airs.com>
10604
10605 PR 10419
10606 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10607
10608 2009-07-16 Ian Lance Taylor <iant@google.com>
10609
10610 PR 10400
10611 * layout.h: #include <map>.
10612 (class Kept_section): Change from struct to class. Add accessors
10613 and setters. Add section size to Comdat_group mapping. Change
10614 Comdat_group to std::map. Add is_comdat_ field. Add
10615 linkonce_size field in union.
10616 (class Layout): Update declaration of find_or_add_kept_section.
10617 Don't declare find_kept_object.
10618 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10619 parameter. Add object, shndx, is_comdat, and is_group_name
10620 parameters. Change all callers. Adjust for new Kept_section.
10621 (Layout::find_kept_object): Remove.
10622 * object.cc (Sized_relobj::include_section_group): Update use of
10623 Kept_section. Rename secnum to shndx. Only record
10624 Kept_comdat_section if sections are the same size.
10625 (Sized_relobj::include_linkonce_section): Update use of
10626 Kept_section. Only record Kept_comdat_section if sections are the
10627 same size. Set size of linkonce section.
10628 (Sized_relobj::map_to_kept_section): Update call to
10629 get_kept_comdat_section.
10630 * object.h (class Sized_relobj): Rename fields in
10631 Kept_comdat_section to drop trailing underscores; change object
10632 field to Relobj*. Change Kept_comdat_section_table to store
10633 struct rather than pointer.
10634 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10635 Add kept_object and kept_shndx parameters. Change all callers.
10636 (Sized_relobj::get_kept_comdat_section): Change return type to
10637 bool. Add kept_object and kept_shndx parameters. Change all
10638 callers.
10639 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10640 Layout::find_or_add_kept_section.
10641
10642 2009-07-09 Ian Lance Taylor <iant@google.com>
10643
10644 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10645 Reserve space in the hash table.
10646
10647 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10648
10649 * fileread.cc (File_read::get_mtime): New method.
10650 * fileread.h (Timespec): New structure.
10651 (File_read::get_mtime): New method.
10652 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10653 Renamed from timestamp_nsec.
10654 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10655 Elf_Xword.
10656 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10657 timestamp_nsec.
10658 (Incremental_inputs::report_archive): Save mtime; style fix.
10659 (Incremental_inputs::report_obejct): Save mtime; style fix.
10660 (Incremental_inputs::report_script): Save mtime; style fix.
10661 (Incremental_inputs::finalize_inputs): Style fix.
10662 (Incremental_inputs::finalize): Style fix.
10663 (Incremental_inputs::create_input_section_data): Store inputs
10664 mtime.
10665 * incremental.h (Incremental_inputs::report_script): Add mtime
10666 argument.
10667 (Incremental_inputs::Input_info::Input_info): Intialize only one
10668 union member.
10669 (Incremental_inputs::Input_info::archive): Move to nameless
10670 union.
10671 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10672 (Incremental_inputs::Input_info::script): Move to nameless union.
10673 (Incremental_inputs::mtime): New field.
10674 * script.cc (read_input_script): Pass file mtime to
10675 Incremental_input.
10676 * script.h (Script_info::inputs): Style fix.
10677
10678 2009-07-01 Ian Lance Taylor <ian@airs.com>
10679
10680 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10681 instead of 32.
10682
10683 2009-06-24 Ian Lance Taylor <iant@google.com>
10684
10685 PR 10156
10686 * layout.cc (Layout::choose_output_section): If we find an
10687 existing section, update the flags.
10688 (Layout::create_notes): New function, broken out of
10689 Layout::finalize.
10690 (Layout::finalize): Don't create note sections.
10691 (Layout::create_note): Don't crash if linker script discards
10692 section.
10693 (Layout::create_gold_note): Likewise.
10694 (Layout::create_build_id): Likewise. Don't set
10695 after_input_sections on the section.
10696 (Layout::create_executable_stack_info): Remove target parameter.
10697 Change caller.
10698 * layout.h (class Layout): Declare create_notes. Update
10699 declaration of create_executable_stack_info.
10700 * gold.cc (queue_middle_tasks): Call create_notes.
10701 * output.cc (Output_section::update_flags_for_input_section): Move
10702 here from output.h. If SHF_ALLOC flag is newly set, mark address
10703 invalid.
10704 * output.h (Output_data::mark_address_invalid): New function.
10705 (class Output_section): Only declare, not define,
10706 update_flags_for_input_section. Remove set_flags.
10707
10708 2009-06-24 Ian Lance Taylor <iant@google.com>
10709
10710 * script-sections.cc (Output_section_definition::
10711 set_section_addresses): Rename shadowing local load_address to
10712 laddr.
10713
10714 2009-06-24 Ian Lance Taylor <iant@google.com>
10715
10716 PR 10244
10717 * reloc.cc (relocate_sections): Skip empty relocation sections.
10718
10719 2009-06-23 Ian Lance Taylor <iant@google.com>
10720
10721 PR 10156
10722 * layout.cc (Layout::create_note): Use choose_output_section
10723 rather than make_output_section.
10724
10725 2009-06-23 Ian Lance Taylor <iant@google.com>
10726
10727 PR 10237
10728 * options.cc (General_options::parse_V): Set printed_version_.
10729 (General_options::General_options): Initialize printed_version_.
10730 * options.h (class General_options): Add printed_version_ field.
10731 * gold.cc (queue_initial_tasks): If there are no input files,
10732 don't give a fatal error if we printed the version information.
10733 (queue_middle_tasks): If using -r with a shared object, give a
10734 fatal error rather than an ordinary error.
10735
10736 2009-06-23 Ian Lance Taylor <iant@google.com>
10737
10738 PR 10219
10739 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10740 (Layout::make_output_section): Set have_stabstr_section_ if we see
10741 a .stab*str section.
10742 (Layout::finalize): Call link_stabs_sections.
10743 (Layout::link_stabs_sections): New file.
10744 * layout.h (class Layout): Add have_stabstr_section_ field.
10745 Declare link_stabs_sections.
10746
10747 2009-06-23 Doug Kwan <dougkwan@google.com>
10748
10749 * Makefile.am (libgold_a_LIBADD): New.
10750 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10751 * Makefile.in: Regenerate.
10752 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10753 * configure: Regenerate.
10754 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10755 * fileread.cc: Include sys/state.h
10756 * gold.h: Declare memmem and strndup if found missing.
10757 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10758
10759 2009-06-23 Ian Lance Taylor <iant@google.com>
10760
10761 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10762 * configure: Rebuild.
10763
10764 2009-06-23 Ian Lance Taylor <iant@google.com>
10765
10766 PR 10147
10767 * object.cc (Object::section_contents): Don't try to get a view if
10768 the section has length zero.
10769 (Object::handle_gnu_warning_section): If the section is empty, use
10770 the name of the section as the warning.
10771
10772 2009-06-23 Ian Lance Taylor <iant@google.com>
10773
10774 PR 10133
10775 * stringpool.h (class Stringpool_template): Add optimize_ field.
10776 (Stringpool_template::set_optimize): New function.
10777 * stringpool.cc (Stringpool_template::Stringpool_template):
10778 Initialize optimize_ field.
10779 (Stringpool_template::set_string_offsets): Test local optimize
10780 fild rather than parameter.
10781 * layout.cc (Layout::Layout): Call set_optimize on the section
10782 name stringpool.
10783
10784 2009-06-22 Ian Lance Taylor <iant@google.com>
10785
10786 PR 10030
10787 * yyscript.y: Parse TARGET.
10788 * script.cc (script_set_target): New function.
10789 * script-c.h (script_set_target): Declare.
10790 * options.cc (General_options::string_to_object_format): Rename
10791 from string_to_object_format in anonymous namespace. Change
10792 callers.
10793 * options.h (class General_options): Declare
10794 string_to_object_format.
10795
10796 2009-06-22 Ian Lance Taylor <iant@google.com>
10797
10798 * script-sections.cc (Script_sections::create_segments): Don't put
10799 program headers in a PT_LOAD segment if -n or -N.
10800
10801 2009-06-22 Ian Lance Taylor <iant@google.com>
10802
10803 PR 10141
10804 * options.h (class General_options): Add -z lazy and -z now. Sort
10805 -z options into alphabetical order.
10806 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10807
10808 2009-06-21 Ian Lance Taylor <iant@google.com>
10809
10810 * layout.cc (Layout::make_output_section): Call
10811 Target::new_output_section.
10812 (Layout::attach_allocated_section_to_segment): Put large section
10813 sections in a separate load segment with the large segment flag
10814 set.
10815 (Layout::segment_precedes): Sort large data segments after other
10816 load segments.
10817 (align_file_offset): New static function.
10818 (Layout::set_segment_offsets): Use align_file_offset.
10819 * output.h (class Output_section): Add is_small_section_ and
10820 is_large_section_ fields.
10821 (Output_section::is_small_section): New function.
10822 (Output_section::set_is_small_section): New function.
10823 (Output_section::is_large_section): New function.
10824 (Output_section::set_is_large_section): New function.
10825 (Output_section::is_large_data_section): New function.
10826 (class Output_segment): Add is_large_data_segment_ field.
10827 (Output_segment::is_large_data_segment): New function.
10828 (Output_segment::set_is_large_data_segment): New function.
10829 * output.cc (Output_section::Output_section): Initialize new
10830 fields.
10831 (Output_segment::Output_segment): Likewise.
10832 (Output_segment::add_output_section): Add assertion that large
10833 data sections always go in large data segments. Force small data
10834 sections to the end of the list of data sections. Force small BSS
10835 sections to the start of the list of BSS sections. For large BSS
10836 sections to the end of the list of BSS sections.
10837 * symtab.h (class Symbol): Declare is_common_shndx.
10838 (Symbol::is_defined): Check Symbol::is_common_shndx.
10839 (Symbol::is_common): Likewise.
10840 (class Symbol_table): Define enum Commons_section_type. Update
10841 declarations. Add small_commons_ and large_commons_ fields.
10842 * symtab.cc (Symbol::is_common_shndx): New function.
10843 (Symbol_table::Symbol_table): Initialize new fields.
10844 (Symbol_table::add_from_object): Put small and large common
10845 symbols in the right list.
10846 (Symbol_table::sized_finalized_symbol): Check
10847 Symbol::is_common_shndx.
10848 (Symbol_table::sized_write_globals): Likewise.
10849 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10850 common symbol lists. Don't call do_allocate_commons_list if the
10851 list is empty.
10852 (Symbol_table::do_allocate_commons_list): Remove is_tls
10853 parameter. Add comons_section_type parameter. Change all
10854 callers. Handle small and large common symbols.
10855 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10856 Symbol::is_common_shndx.
10857 * resolve.cc (symbol_to_bits): Likewise.
10858 * target.h (Target::small_common_shndx): New function.
10859 (Target::small_common_section_flags): New function.
10860 (Target::large_common_shndx): New function.
10861 (Target::large_common_section_flags): New function.
10862 (Target::new_output_section): New function.
10863 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10864 small_common_section_flags, and large_common_section_flags
10865 fields.
10866 (Target::do_new_output_section): New virtual function.
10867 * arm.cc (Target_arm::arm_info): Initialize new fields.
10868 * i386.cc (Target_i386::i386_info): Likewise.
10869 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10870 Likewise.
10871 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10872 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10873 (Target_x86_64::do_new_output_section): New function.
10874 * configure.ac: Define conditional MCMODEL_MEDIUM.
10875 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10876 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10877 (large_LDFLAGS): Define.
10878 * testsuite/large.c: New file.
10879 * testsuite/testfile.cc (Target_test::test_target_info):
10880 Initialize new fields.
10881 * configure, testsuite/Makefile.in: Rebuild.
10882
10883 2009-06-05 Doug Kwan <dougkwan@google.com>
10884
10885 * Makefile.am (CCFILES): Add target.cc.
10886 * Makefile.in: Regenerate.
10887 * i386.cc (class Target_i386): Define new virtual method to
10888 override do_is_local_label_name in parent.
10889 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10890 local symbols if --discard-locals or -X is given.
10891 * options.h (class General_options): Declare new options
10892 '--discard-locals' and '-X' for discarding locals.
10893 * target.h (class Target): Define new methods is_local_label_name.
10894 Declare new virtual method do_is_local_label_name.
10895 * target.cc: New file.
10896 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10897 (check_SCRIPTS): Add discard_locals_test.sh.
10898 (check_DATA): Add discard_local_tests.syms.
10899 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10900 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10901 * testsuite/Makefile.in: Regenerate.
10902 * testsuite/discard_locals_test.c: New file.
10903 * testsuite/discard_locals_test.sh: Same.
10904
10905 2009-06-05 Doug Kwan <dougkwan@google.com>
10906
10907 * object.cc (Sized_relobj::Sized_relobj): Initialize
10908 discarded_eh_frame_shndx_ to -1U.
10909 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10910 section.
10911 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10912 a discarded .eh_frame section.
10913 (Sized_relobj::do_finalize_local_symbols): Ditto.
10914 * object.h (class Sized_relobj): Declare new member
10915 discarded_eh_frame_shndx_.
10916 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10917 (local_labels_test.o, local_labels_test): New rules.
10918 * testsuite/Makefile.in: Regenerate.
10919
10920 2009-06-04 Doug Kwan <dougkwan@google.com>
10921
10922 * layout.cc (Layout::section_name_mapping): Add mapping for
10923 special ARM sections.
10924
10925 2009-06-03 Doug Kwan <dougkwan@google.com>
10926
10927 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10928 (utils::has_overflow): Same.
10929
10930 2009-06-03 Ian Lance Taylor <iant@google.com>
10931
10932 * layout.cc (Layout::section_name_mapping): New array, replacing
10933 Layout::linkonce_mapping.
10934 (Layout::section_name_mapping_count): New variable, replacing
10935 Layout::linkonce_mapping_count.
10936 (Layout::linkonce_output_name): Remove.
10937 (Layout::output_section_name): Rewrite.
10938 * layout.h (class Layout): Rename Linkonce_mapping to
10939 Section_name_mapping, linkonce_mapping to section_name_mapping,
10940 linkonce_mapping_count to section_name_mapping_count. Don't
10941 declare linkonce_output_name.
10942
10943 2009-06-03 Doug Kwan <dougkwan@google.com>
10944
10945 * gold/arm.cc (namespace utils): New.
10946 (Target_arm::reloc_is_non_pic): Define new method.
10947 (class Arm_relocate_functions): New.
10948 (Target_arm::Relocate::relocate): Handle relocation types used by
10949 Android.
10950
10951 2009-06-03 Ian Lance Taylor <iant@google.com>
10952
10953 * arm.cc (Target_arm::scan::global): Use || instead of |.
10954
10955 2009-06-02 Doug Kwan <dougkwan@google.com>
10956
10957 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10958 issued_non_pic_error_.
10959 (class Target_arm::Scan): Declare new method check_non_pic.
10960 Define new method symbol_needs_plt_entry.
10961 Declare new data member issued_non_pic_error_.
10962 (class Target_arm::Relocate): Declare new method
10963 should_apply_static_reloc.
10964 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10965 (Target_arm::Scan::check_non_pic): Define new method.
10966 (Target_arm::Scan::local): Handle a small subset of reloc types used
10967 by Android.
10968 (Target_arm::Scan::local): Same.
10969 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10970
10971 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10972
10973 * incremental.cc (Incremental_inputs::report_command_line): Filter
10974 out --incremental-* options.
10975
10976 2009-05-29 Doug Kwan <dougkwan@google.com>
10977
10978 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10979 template class.
10980 (class Target_arm): Update comment.
10981 (Target_arm::Target_arm): Initialize new data members GOT_,
10982 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10983 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10984 and Target_arm::rel_dyn_section.
10985 Declare new_enum Target_arm::Got_type.
10986 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10987 and DYNBSS_.
10988 Update commments for member do_dynsym_value.
10989 (Target_arm::got_size, Target_arm::plt_section,
10990 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10991 new methods inside class defintion.
10992 (Target_arm::got_section): Define new method.
10993 (Target_arm::rel_dyn_section): Same.
10994 (Output_data_plt_arm): New template class.
10995 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10996 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10997 (Output_data_plt_arm::add_entry): Same.
10998 (Output_data_plt_arm::first_plt_entry): Define new
10999 static data member for PLT instruction template.
11000 (Output_data_plt_arm::plt_entry): Same.
11001 (Output_data_plt_arm::do_write): Define new method.
11002 (Target_arm::make_plt_entry): Same.
11003 (Target_arm::do_finalize_sections): Same.
11004 (Target_arm::do_dynsym_value): Same.
11005
11006 2009-05-28 Doug Kwan <dougkwan@google.com>
11007
11008 * Makefile.am (TARGETSOURCES): Add arm.cc.
11009 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11010 * Makefile.in: Regenerate.
11011 * arm.cc: New file.
11012 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11013
11014 2009-05-26 Doug Kwan <dougkwan@google.com>
11015
11016 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11017 (General_options::check_excluded_libs): Strip off directories in
11018 archive name before matching like GNU ld does.
11019 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11020 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11021 (exclude_libs_test_LDFLAGS): Add linker option
11022 -Wl,--exclude-libs,libexclude_libs_test_3
11023 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11024 an explicit archive without using -l.
11025 (alt/libexclude_libs_test_3.a): New make rule.
11026 * testsuite/Makefile.in: Regenerate.
11027 * testsuite/exclude_libs_test.c : Declare lib3_default().
11028 (main): Call it.
11029 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11030 * exclude_libs_test_3.c: New file.
11031
11032 2009-05-26 Nick Clifton <nickc@redhat.com>
11033
11034 * po/id.po: New Indonesian translation.
11035 * po/gold.pot: Updated template file.
11036
11037 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11038
11039 * testsuite/Makefile.am: Add -ffunction-sections to compile
11040 gc_comdat_test files. Add -Wl,--gc-sections to build
11041 gc_comdat_test.
11042 * testsuite/Makefile.in: Regenerate.
11043 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11044
11045 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11046
11047 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11048 kept comdat section was garbage collected.
11049 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11050 * testsuite/Makefile.in: Regenerate.
11051 * testsuite/gc_comdat_test.sh: New file.
11052 * testsuite/gc_comdat_test_1.cc: New file.
11053 * testsuite/gc_comdat_test_2.cc: New file.
11054
11055 2009-05-19 Doug Kwan <dougkwan@google.com>
11056
11057 * archive.cc (Archive::Archive): Move constructor from archive.h
11058 to here. Initialize no_export_.
11059 (Archive::get_elf_object_for_member): Set no_export flag of object.
11060 * archive.h (Archive::Archive): Move constructor body to
11061 archive.cc.
11062 (Archive::no_export): New method.
11063 (Archive::no_export_): New field.
11064 * object.h (Object::Object): Initialize no_export_ to false.
11065 (Object::no_export, Object::set_no_export): New methods.
11066 (Object::no_export_): New field.
11067 * options.cc (General_options::parse_exclude_libs): New method.
11068 (General_options::check_excluded_libs) Same.
11069 * options.h (exclude_libs): New option.
11070 (General_options::check_excluded_libs): New method declaration.
11071 (General_options::excluded_libs_): New field.
11072 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11073 default or protected visibility if an object has no-export flag set.
11074 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11075 (check_SCRIPTS): Add exclude_libs_test.sh.
11076 (check_DATA): Add exclude_libs_test.syms.
11077 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11078 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11079 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11080 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11081 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11082 libexclude_libs_test_2.a): New rules.
11083 * testsuite/Makefile.in: Regenerate.
11084 * testsuite/exclude_libs_test.c: New file.
11085 * testsuite/exclude_libs_test.sh: Ditto.
11086 * testsuite/exclude_libs_test_1.c: Ditto.
11087 * testsuite/exclude_libs_test_2.c: Ditto.
11088
11089 2009-05-15 Ian Lance Taylor <iant@google.com>
11090
11091 * configure.ac: Check for declarations for cases where libiberty.h
11092 checks HAVE_DECL_xxx.
11093 * configure, config.in: Rebuild.
11094
11095 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11096
11097 * gold.h (Incremental_argument_list): Remove (invalid) forward
11098 declaration.
11099 * incremental.cc (Incremental_inputs::report_achive): New method.
11100 (Incremental_inputs::report_object): New method.
11101 (Incremental_inputs::report_script): New method.
11102 (Incremental_inputs::finalize_inputs): New method.
11103 (Incremental_inputs::finalize): Call finalize_inputs().
11104 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11105 Create inputs entries.
11106 * incremental.h (Incremental_input_type): New enum.
11107 (Incremental_inputs::Incremental_input): Initialize new fields.
11108 (Incremental_inputs::report_inputs): New method.
11109 (Incremental_inputs::report_achive): New method.
11110 (Incremental_inputs::report_object): New method.
11111 (Incremental_inputs::report_script): New method.
11112 (Incremental_inputs::finalize_inputs): New method.
11113 (Incremental_inputs::Input_info): New struct.
11114 (Incremental_inputs::Input_info_map): New typedef.
11115 (Incremental_inputs::lock_): New field.
11116 (Incremental_inputs::Inputs_): New field.
11117 (Incremental_inputs::Inputs_map): New field.
11118 * main.cc (main): Call Incremental_input::report_inputs.
11119 * options.h (Input_argument_list): Typedef moved from
11120 Input_arguments.
11121 (Input_file_group::Files): Remove, use ::Input_argument_list.
11122 (Input_file_group::Input_argument_list): Remove, use
11123 ::Input_argument_list.
11124 * plugin.cc (Plugin_manager::add_input_file): Add error in
11125 incremental build.
11126 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11127 functions.
11128 * script.cc (read_input_script): Call
11129 Incremental_input::report_script.
11130 * script.h (Script_info): New class.
11131
11132 2009-04-27 Ian Lance Taylor <iant@google.com>
11133
11134 * x86_64.cc (do_adjust_output_section): Set entsize to
11135 plt_entry_size.
11136
11137 2009-04-23 Elliott Hughes <enh@google.com>
11138
11139 * output.cc (Output_file::close): After short writes, continue
11140 writing from the correct offset in the buffer being written.
11141
11142 2009-04-23 Chris Demetriou <cgd@google.com>
11143
11144 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11145 * configure: Regenerate.
11146 * config.in: Regenerate.
11147 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11148 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11149
11150 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11151
11152 * incremental.cc (Incremental_inputs_header_data): Renamed from
11153 Incremental_input_header_data.
11154 (Incremental_inputs_header_data::data_size): New field.
11155 (Incremental_inputs_header_data::put_input_file_count): Renamed
11156 from input_file_count.
11157 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11158 from command_line_offset.
11159 (Incremental_inputs_header_data::put_reserved): Renamed from
11160 put_reserved.
11161 (Incremental_inputs_entry_data): Renamed from
11162 Incremental_input_entry_data.
11163 (Incremental_inputs_entry_data::data_size): New field.
11164 (Incremental_inputs::report_command_line): New method.
11165 (Incremental_inputs::finalize): New method.
11166 (Incremental_inputs::create_incremental_inputs_data): New method.
11167 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11168 * incremental.h: New file.
11169 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11170 (Layout::finalize): Create incremental inputs section in
11171 incremental builds.
11172 (Layout::create_incremental_info_sections): New method.
11173 * layout.h (Layout::incremental_inputs): New method.
11174 (Layout::create_incremental_info_sections): New method.
11175 (Layout::incremental_inputs_): New field.
11176 * main.cc (main): Notify Incremental_input of the command line.
11177
11178 2009-04-01 Ian Lance Taylor <iant@google.com>
11179 Mikolaj Zalewski <mikolajz@google.com>
11180
11181 * gold.h (reserve_unordered_map): Define, three versions, one for
11182 each version of Unordered_map.
11183 * layout.cc (Layout::Layout): Remove options parameter. Add
11184 number_of_input_files parameter. Don't initialize options_.
11185 Initialize number_of_input_files_ and resized_signatures_. Move
11186 sections_are_attached_.
11187 (Layout::layout_group): Reserve space for group_signatures_.
11188 (Layout::find_or_add_kept_section): Change name parameter to be a
11189 reference. Resize signatures_ map when it gets large enough.
11190 (Layout::layout_eh_frame): Use parameters->options() instead of
11191 this->options_.
11192 (Layout::make_output_section): Likewise.
11193 (Layout::attach_allocated_section_to_segment): Likewise.
11194 (Layout::finalize, Layout::create_executable_stack): Likewise.
11195 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11196 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11197 * layout.h (class Layout): Update declarations. Remove options_
11198 field. Add number_of_input_files_ and resized_signatures_
11199 fields. Move sections_are_attached_ field.
11200 * main.cc (main): Pass number of input files to Layout
11201 constructor. Don't pass options.
11202
11203 2009-03-30 Ian Lance Taylor <iant@google.com>
11204
11205 * ffsll.c (ffsll): Correct implementation.
11206
11207 2009-03-27 Ian Lance Taylor <iant@google.com>
11208
11209 * ffsll.c: New file.
11210 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11211 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11212 * ftruncate.c (ftruncate): Declare before definition.
11213 * mremap.c (mremap): Likewise.
11214 * pread.c (pread): Likewise.
11215 * configure, Makefile.in, config.in: Rebuild.
11216
11217 * mremap.c: New file.
11218 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11219 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11220 (mremap): Declare if HAVE_MREMAP is not defined.
11221 * configure, Makefile.in, config.in: Rebuild.
11222
11223 2009-03-27 Cary Coutant <ccoutant@google.com>
11224
11225 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11226 position independent.
11227 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11228 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11229
11230 2009-03-24 Cary Coutant <ccoutant@google.com>
11231
11232 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11233 an executable.
11234 (needs_dynamic_reloc): Likewise.
11235
11236 2009-03-24 Ian Lance Taylor <iant@google.com>
11237
11238 * yyscript.y (file_cmd): Recognize EXTERN.
11239 (extern_name_list, extern_name_list_body): New nonterminals.
11240 * script.cc (script_add_extern): Define.
11241 * script-c.h (script_add_extern): Declare.
11242
11243 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11244
11245 * object.cc (is_elf_object): Define.
11246 * object.h (is_elf_object): Declare.
11247 * archive.cc (Archive::get_elf_object_for_member): Call
11248 is_elf_object.
11249 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11250
11251 2009-03-24 Elliott Hughes <enh@google.com>
11252
11253 * output.cc (Output_file::map_anonymous): Define.
11254 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11255 try an anonymous one. Report the size if the mmap fails.
11256 * output.h (class Output_file): Declare map_anonymous.
11257
11258 2009-03-24 Ian Lance Taylor <iant@google.com>
11259
11260 * target-select.cc (instantiate_target): Don't acquire the lock if
11261 the instantiated_target_ field has already been set.
11262
11263 2009-03-23 Ian Lance Taylor <iant@google.com>
11264
11265 * gold-threads.h (class Initialize_lock): Define.
11266 * gold-threads.cc (class Initialize_lock_once): Define.
11267 (initialize_lock_control): New static variable.
11268 (initialize_lock_pointer): New static variable.
11269 (initialize_lock_once): New static function.
11270 (Initialize_lock::Initialize_lock): Define.
11271 (Initialize_lock::initialize): Define.
11272 * target-select.h: Include "gold-threads.h".
11273 (class Target_selector): Add lock_ and initialize_lock_ fields.
11274 Don't define instantiate_target, just declare it.
11275 * target-select.cc (Target_selector::Target_selector): Initialize
11276 new fields.
11277 (Target_selector::instantiate_target): Define.
11278 * descriptors.h: Include "gold-threads.h".
11279 (class Descriptors): Add initialize_lock_ field.
11280 * descriptors.cc (Descriptors::Descriptors): Initialize new
11281 field.
11282 (Descriptors::open): Use initialize_lock_ field
11283 * errors.h (class Errors): Add initialize_lock_ field.
11284 * errors.cc (Errors::Errors): Initialize new field.
11285 (Errors::initialize_lock): Use initialize_lock_ field.
11286 * powerpc.cc (class Target_selector_powerpc): Remove
11287 instantiated_target_ field. In do_recognize call
11288 instantiate_target rather than do_instantiate_target. In
11289 do_instantiate_target just allocate a new target.
11290 * sparc.cc (class Target_selector_sparc): Likewise.
11291
11292 * freebsd.h: New file.
11293 * i386.cc: Include "freebsd.h".
11294 (Target_i386): Derive from Target_freebsd rather than
11295 Sized_target.
11296 (Target_selector_i386): Derive from Target_selector_freebsd rather
11297 than Target_selector.
11298 * x86_64.cc: Include "freebsd.h".
11299 (Target_x86_64): Derive from Target_freebsd rather than
11300 Sized_target.
11301 (Target_selector_x86_64): Derive from Target_selector_freebsd
11302 rather than Target_selector.
11303 * target.h (class Target): Add adjust_elf_header and
11304 do_adjust_elf_header.
11305 * output.cc (Output_file_header:: do_sized_write): Call target
11306 adjust_elf_header routine.
11307 * configure.tgt: Set targ_osabi.
11308 * configure.ac: Define GOLD_DEFAULT_OSABI.
11309 * parameters.cc (Parameters::default_target): Pass
11310 GOLD_DEFAULT_OSABI to select_target.
11311 * target-select.h (class Target_selector): Make instantiate_target
11312 protected rather than private.
11313 * Makefile.am (HFILES): Add freebsd.h.
11314 * configure, Makefile.in, config.in: Rebuild.
11315
11316 * merge.cc (do_add_input_section): Correct pend value. Change
11317 message about last entry not being null terminated from error to
11318 warning.
11319
11320 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11321
11322 * incremental.cc: New file.
11323 * Makefile.am (CCFILES): Add incremental.cc.
11324 * Makefile.in: Rebuild.
11325
11326 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11327
11328 * layout.cc (Layout::output_section_name): Preserve names
11329 of '.note.' sections.
11330
11331 2009-03-19 Ian Lance Taylor <iant@google.com>
11332
11333 * descriptors.cc (Descriptors::open): Check that the options are
11334 valid before using them.
11335
11336 2009-03-18 Ian Lance Taylor <iant@google.com>
11337
11338 * script-sections.h: Include <list>.
11339 (class Script_sections): Change Sections_elements from std::vector
11340 to std::list. Typedef public Elements_iterator. Add
11341 orphan_section_placement_, data_segment_align_start_, and
11342 saw_data_segment_align_ fields. Remove data_segment_align_index_
11343 field.
11344 * script-sections.cc (class Orphan_section_placement): New class.
11345 (class Sections_element): Add virtual functions is_relro and
11346 orphan_section_init. Remove virtual function place_orphan_here.
11347 (class Output_section_definition): Add is_relro and
11348 orphan_section_init. Remove place_orphan_here.
11349 (class Orphan_output_section): Likewise.
11350 (Script_sections::Script_sections): Update for field changes.
11351 (Script_sections::data_segment_align): Set saw_data_segment_align_
11352 and data_segment_align_start_, not data_segment_align_index.
11353 (Script_sections::data_segment_relro_end): Check
11354 saw_data_segment_align_. Use data_segment_align_start_ rather
11355 than data_segment_align_index_.
11356 (Script_sections::place_orphan): Rewrite to use
11357 Orphan_section_placement.
11358
11359 2009-03-17 Ian Lance Taylor <iant@google.com>
11360
11361 * archive.cc (Archive::add_symbols): Check for a version attached
11362 to the symbol name in the archive map.
11363 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11364 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11365 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11366 (ver_test_11.a): New target.
11367 * testsuite/Makefile.in: Rebuild.
11368
11369 * configure.ac: Check for chsize and posix_fallocate. Replace
11370 ftruncate.
11371 * ftruncate.c: New file, from gnulib.
11372 * output.cc (posix_fallocate): Define dummy version if not
11373 HAVE_POSIX_FALLOCATE.
11374 (Output_file::map): Call posix_fallocate rather than lseek and
11375 write.
11376 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11377 * configure, Makefile.in, config.in: Rebuild.
11378
11379 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11380
11381 * layout.h (Layout::create_note): Add section_name parameter.
11382 * layout.cc (Layout::create_note): Likewise.
11383 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11384
11385 2009-03-17 Ian Lance Taylor <iant@google.com>
11386
11387 * descriptors.cc: Include "options.h".
11388 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11389 (Descriptors::open): Always use O_CLOEXEC when opening a new
11390 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11391 then set FD_CLOEXEC.
11392
11393 * sparc.cc (class Target_sparc): Add has_got_section.
11394 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11395 make sure we have a GOT section.
11396
11397 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11398 (Target_sparc::Scan::local): Likewise.
11399 (Target_sparc::Scan::global): Likewise.
11400 (Target_sparc::Relocate::relocate): Likewise.
11401 (Target_sparc::Relocate::relocate_tls): Likewise.
11402
11403 * symtab.cc (Symbol_table::define_default_version): New function,
11404 broken out of add_from_object.
11405 (Symbol_table::add_from_object): Call define_default_version.
11406 (Symbol_table::define_special_symbol): Add resolve_oldsym
11407 parameter. Change all callers. If the version for a symbol comes
11408 from a version script, resolve it with the symbol with the same
11409 name with no version. Also add the symbol without a version if
11410 appropriate.
11411 (do_define_in_output_data): If resolving with oldsym, don't delete
11412 sym.
11413 (do_define_in_output_segment): Likewise.
11414 (do_define_as_constant): Likewise.
11415 * symtab.h (class Symbol_table): Update declarations.
11416
11417 2009-03-13 Ian Lance Taylor <iant@google.com>
11418
11419 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11420 (Read_symbols::requeue): New function.
11421 (Read_symbols::do_read_symbols): If make_elf_object fails because
11422 the target type is not configured, and the file was searched for,
11423 issue a warning and retry with the next directory.
11424 (Add_symbols::run): If the file has an incompatible format, and
11425 it was searched for, requeue the Read_symbols task. On error,
11426 release the object.
11427 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11428 dirindex parameter to constructor. Change all callers. Declare
11429 incompatible_warning and requeue.
11430 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11431 input_argument_ and input_group_ fields. Add them to
11432 constructor. Change all callers.
11433 (class Read_script): Add dirindex_ field. Add it to constructor.
11434 Change all callers.
11435 * archive.cc (Archive::setup): Remove input_objects parameter.
11436 Change all callers.
11437 (Archive::get_file_and_offset): Likewise.
11438 (Archive::read_all_symbols): Likewise.
11439 (Archive::read_symbols): Likewise.
11440 (Archive::get_elf_object_for_member): Remove input_objects
11441 parameter. Add punconfigured parameter. Change all callers.
11442 (Archive::add_symbols): Change return type to bool. Check return
11443 value of include_member.
11444 (Archive::include_all_members): Likewise.
11445 (Archive::include_member): Change return type to bool. Return
11446 false if first included object has incompatible target. Set
11447 included_member_ field.
11448 (Add_archive_symbols::run): If add_symbols returns false, requeue
11449 Read_symbols task.
11450 * archive.h (class Archive): Add included_member_ field.
11451 Initialize it in constructor. Add input_file and searched_for
11452 methods. Update declarations.
11453 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11454 input_argument_ fields. Add them to constructor. Change all
11455 callers.
11456 * script.cc: Include "target-select.h".
11457 (class Parser_closure): Add skip_on_incompatible_target_ and
11458 found_incompatible_target_ fields. Add
11459 skip_on_incompatible_target parameter to constructor. Change all
11460 callers. Add methods skip_on_incompatible_target,
11461 clear_skip_on_incompatible_target, found_incompatible_target, and
11462 set_found_incompatible_target.
11463 (read_input_script): Add dirindex parameter. Change all callers.
11464 If parser finds an incompatible target, requeue Read_symbols
11465 task.
11466 (script_set_symbol): Clear skip_on_incompatible_target in
11467 closure.
11468 (script_add_assertion, script_parse_option): Likewise.
11469 (script_start_sections, script_add_phdr): Likewise.
11470 (script_check_output_format): New function.
11471 * script.h (read_input_script): Update declaration.
11472 * script-c.h (script_check_output_format): Declare.
11473 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11474 (ignore_cmd): Remove OUTPUT_FORMAT.
11475 * fileread.cc (Input_file::Input_file): Add explicit this.
11476 (Input_file::will_search_for): New function.
11477 (Input_file::open): Add pindex parameter. Change all callers.
11478 * fileread.h (class Input_file): Add input_file_argument method.
11479 Declare will_search_for. Update declarations.
11480 * object.cc (make_elf_object): Add punconfigured parameter.
11481 Change all callers.
11482 * object.h (class Object): Make input_file public. Add
11483 searched_for method.
11484 (make_elf_object): Update declaration.
11485 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11486 restart search.
11487 * dirsearch.h (class Dirsearch): Update declaration.
11488 * options.h (class General_options): Add --warn-search-mismatch.
11489 * parameters.cc (Parameters::is_compatible_target): New function.
11490 * parameters.h (class Parameters): Declare is_compatible_target.
11491 * workqueue.cc (Workqueue::add_blocker): New function.
11492 * workqueue.h (class Workqueue): Declare add_blocker.
11493
11494 * fileread.cc (Input_file::open): Remove options parameter.
11495 Change all callers.
11496 (Input_file::open_binary): Likewise.
11497 * script.cc (read_input_script): Likewise.
11498 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11499 options parameter from constructor. Change all callers.
11500 (class Read_script): Likewise.
11501 * fileread.h (class Input_file): Update declarations.
11502 * script.h (read_input_script): Update declaration.
11503
11504 2009-03-10 Nick Clifton <nickc@redhat.com>
11505
11506 * po/es.po: New Spanish translation.
11507
11508 2009-03-06 Cary Coutant <ccoutant@google.com>
11509
11510 * options.cc (parse_short_option): Keep dash_z from registering itself.
11511
11512 2009-03-03 Ian Lance Taylor <iant@google.com>
11513
11514 PR 9918
11515 * target-reloc.h (relocate_section): Pass output_section to
11516 relocate.
11517 * i386.cc (Target_i386::should_apply_static_reloc): Add
11518 output_section parameter. Change all callers.
11519 (Target_i386::Relocate::relocate): Add output_section parameter.
11520 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11521 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11522 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11523 * testsuite/two_file_shared.sh: New script.
11524 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11525 (check_DATA): Add two_file_shared.dbg.
11526 (two_file_shared.dbg): New target.
11527 * testsuite/Makefile.in: Rebuild.
11528
11529 2009-03-01 Ian Lance Taylor <iant@google.com>
11530
11531 * configure.ac: Check for byteswap.h.
11532 * configure: Rebuild.
11533 * config.in: Rebuild.
11534
11535 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11536
11537 * layout.cc (Layout::find_or_add_kept_section): New function.
11538 (Layout::add_comdat): Removed.
11539 * layout.h (struct Kept_section): Move out of class Layout.
11540 Remove trailing underscores from field names. Add group_sections
11541 field. Rename group_ field to is_group. Change all uses.
11542 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11543 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11544 comdat_groups_ field.
11545 (Sized_relobj::include_section_group): Use
11546 find_or_add_kept_section and Kept_section::group_sections.
11547 (Sized_relobj::include_linkonce_section): Likewise.
11548 * object.cc (class Sized_relobj): Don't define Comdat_group or
11549 Comdat_group_table. Remove find_comdat_group and
11550 add_comdat_group. Remove comdat_groups_ field.
11551 * plugin.cc (include_comdat_group): Use
11552 Layout::find_or_add_kept_section.
11553
11554 2009-02-28 Ian Lance Taylor <iant@google.com>
11555
11556 * README: --gc-sections and map files are now supported. Document
11557 some build requirements.
11558
11559 PR 6992
11560 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11561 relocatable link set the value of the section symbol to zero.
11562 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11563 relocatable link don't include the section address in the local
11564 symbol value.
11565
11566 2009-02-27 Ian Lance Taylor <iant@google.com>
11567
11568 PR 6811
11569 * options.h (class Search_directory): Add is_system_directory.
11570 (class General_options): Declare is_in_system_directory.
11571 * options.cc (get_relative_sysroot): Make static.
11572 (get_default_sysroot): Make static.
11573 (General_optoins::is_in_system_directory): New function.
11574 * fileread.cc (Input_file::is_in_system_directory): New function.
11575 * fileread.h (class Input_file): Declare is_in_system_directory.
11576 * object.h (class Object): Add is_in_system_directory.
11577 (class Input_objects): Remove system_library_directory_ field.
11578 * object.cc (Input_objects::add_object): Don't set
11579 system_library_directory_.
11580 (input_objects::found_in_system_library_directory): Remove.
11581 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11582 parameter. Change all callers.
11583 (Symbol_table::sized_write_globals): Likewise.
11584 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11585 Call Object::is_in_system_directory.
11586 * symtab.h (class Symbol_table): Update declarations.
11587
11588 PR 5990
11589 * descriptors.h (Open_descriptor): Add is_on_stack field.
11590 * descriptors.cc (Descriptors::open): If the descriptor is on the
11591 top of the stack, remove it. Initialize is_on_stack field.
11592 (Descriptors::release): Only add pod to stack if it is not on the
11593 stack already.
11594 (Descriptors::close_some_descriptor): Clear stack_next and
11595 is_on_stack fields.
11596
11597 PR 7091
11598 * output.cc (Output_section::find_starting_output_address): Rename
11599 from starting_output_address; add PADDR parameter; change return
11600 type.
11601 * output.h (class Output_section): Declare
11602 find_starting_output_address instead of starting_output_address.
11603 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11604 section symbol for which we can't find a merge section.
11605
11606 PR 9836
11607 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11608 hidden or internal, force the symbol to be local.
11609 * resolve.cc (Symbol::override_visibility): Define.
11610 (Symbol::override_base): Use override_visibility.
11611 (Symbol_table::resolve): Likewise.
11612 (Symbol::override_base_with_special): Likewise.
11613 (Symbol_table::override_with_special): If the visibility is hidden
11614 or internal, force the symbol to be local.
11615 * symtab.h (class Symbol): Add set_visibility and
11616 override_visibility.
11617 * testsuite/ver_test_1.sh: New file.
11618 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11619 (check_DATA): Add ver_test_1.syms.
11620 (ver_test_1.syms): New target.
11621 * testsuite/Makefile.in: Rebuild.
11622
11623 2009-02-25 Cary Coutant <ccoutant@google.com>
11624
11625 * layout.cc (Layout::choose_output_section): Don't rename sections
11626 when using a linker script that has a SECTIONS clause.
11627 * Makefile.in: Regenerate.
11628
11629 * testsuite/Makefile.am (script_test_5.sh): New test case.
11630 * testsuite/Makefile.in: Regenerate.
11631 * testsuite/script_test_5.cc: New file.
11632 * testsuite/script_test_5.sh: New file.
11633 * testsuite/script_test_5.t: New file.
11634
11635 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11636
11637 * archive.cc (Archive::include_member): Update calls to add_symbols.
11638 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11639 the Layout argument.
11640 * dynobj.h (do_add_symbols): Add the Layout argument.
11641 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11642 Layout argument.
11643 * object.h (Object::add_symbols): Add the Layout argument.
11644 (Object::do_add_symbols): Add the Layout argument.
11645 (Sized_relobj::do_add_symbols): Add the Layout argument.
11646 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11647 Unify the two versions.
11648 (Add_plugin_symbols): Remove.
11649 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11650 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11651 (Add_plugin_symbols): Remove.
11652 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11653 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11654 (Add_symbols::run): Make it work with Pulginobj.
11655
11656 2009-02-06 Ian Lance Taylor <iant@google.com>
11657
11658 * object.cc (Sized_relobj::do_layout): Make info message start
11659 with lower case letter.
11660
11661 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11662
11663 * binary.cc: Fix file comment.
11664
11665 * options.h (enum Incremental_disposition): Define.
11666 (class General_options): Add new options: --incremental,
11667 --incremental_changed, --incremental_unchanged,
11668 --incremental_unknown. Add incremental_disposition_ and
11669 implicit_incremental_ fields.
11670 (General_options::incremental_disposition): New function.
11671 (class Position_dependent_options): Add incremental_disposition
11672 option.
11673 (Position_dependent_options::copy_from_options): Set incremental
11674 dispositions.
11675 * options.cc (General_options::parse_incremental_changed): New
11676 function.
11677 (General_options::parse_incremental_unchanged): New function.
11678 (General_options::parse_incremental_unknown): New function.
11679 (General_options::General_options): Initialize new fields
11680 incremental_disposition_ and implicit_incremental_.
11681 (General_options::finalize): Check for uasge of --incremental-*
11682 without --incremental.
11683
11684 2009-02-06 Chris Demetriou <cgd@google.com>
11685
11686 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11687 pointer and to report location as the file name associated with
11688 the symbol.
11689 (gold_undefined_symbol_at_location): New function to replace the
11690 old gold_undefined_symbol functionality.
11691 * target-reloc.h (relocate_section): Update to use
11692 gold_undefined_symbol_at_location.
11693 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11694 Call gold_undefined_symbol function rather than gold_error.
11695 * errors.h (Errors::undefined_symbol): Take location as a
11696 string, rather than calculating it from a relocation.
11697 * errors.cc (Errors::fatal): Print "fatal error:" before the
11698 formatted message.
11699 (Errors::error, Errors::error_at_location): Print "error: "
11700 before the formatted message.
11701 (Errors::undefined_symbol): Take location as a string, rather
11702 than calculating it from a relocation.
11703 (gold_undefined_symbol_at_location): New function akin to
11704 old gold_undefined_symbol, calculates location from relocation.
11705 (gold_undefined_symbol): Change to take only a Symbol pointer
11706 and to report location as the file name associated with the symbol.
11707 * testsuite/debug_msg.sh: Update for changed error messages.
11708 * testsuite/undef_symbol.sh: Likewise.
11709
11710 2009-02-04 Duncan Sands <baldrick@free.fr>
11711
11712 PR 9812
11713 * reduced_debug_output.h
11714 (Output_reduced_debug_abbrev_section::failed): Use format for
11715 gold_warning.
11716 (Output_reduced_debug_info_section::faild): Likewise.
11717
11718 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11719
11720 * script.cc (Lazy_demangler): New class.
11721 (Version_script_info::get_symbol_version_helper): Demangle a
11722 symbol only once.
11723
11724 2009-01-29 Cary Coutant <ccoutant@google.com>
11725
11726 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11727 to __tls_get_addr.
11728 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11729
11730 2009-01-28 Ian Lance Taylor <iant@google.com>
11731
11732 * version.cc (version_string): Bump to 1.9.
11733
11734 * gold.h: Include <cstring> and <stdint.h>.
11735 * version.cc: Include <cstdio>.
11736 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11737 warning.
11738 * reduced_debug_output.cc (insert_into_vector): Rename from
11739 Insert_into_vector; change all callers. Use Swap_unaligned to
11740 avoid aliasing issue; remove union since it is unnecessary.
11741
11742 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11743
11744 * Makefile.am (CCFILES): Add gc.cc.
11745 (HFILES): Add gc.h.
11746 * Makefile.in: Regenerate.
11747 * gold.cc (Gc_runner): New class.
11748 (queue_initial_tasks): Call garbage collection related tasks
11749 when corresponding options are invoked.
11750 (queue_middle_gc_tasks): New function.
11751 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11752 processed early before laying out sections during garbage collection.
11753 * gold.h (queue_middle_gc_tasks): New function.
11754 (is_prefix_of): Move from "layout.cc".
11755 * i386.cc (Target_i386::gc_process_relocs): New function.
11756 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11757 * main.cc (main): Create object of class "Garbage_collection".
11758 * object.cc (Relobj::copy_symbols_data): New function.
11759 (Relobj::is_section_name_included): New function.
11760 (Sized_relobj::do_layout): Allow this function to be called twice
11761 during garbage collection and defer layout of section during the
11762 first call.
11763 * object.h (Relobj::get_symbols_data): New function.
11764 (Relobj::is_section_name_included): New function.
11765 (Relobj::copy_symbols_data): New function.
11766 (Relobj::set_symbols_data): New function.
11767 (Relobj::get_relocs_data): New function.
11768 (Relobj::set_relocs_data): New function.
11769 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11770 (Relobj::gc_process_relocs): New function.
11771 (Relobj::do_gc_process_relocs): New pure virtual function.
11772 (Relobj::sd_): New data member.
11773 (Sized_relobj::is_output_section_offset_invalid): New function.
11774 (Sized_relobj::do_gc_process_relocs): New function.
11775 * options.h (General_options::gc_sections): Modify to not be a no-op.
11776 (General_options::print_gc_sections): New option.
11777 * plugin.cc (Plugin_finish::run): Remove function call to
11778 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11779 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11780 * reloc.cc (Read_relocs::run): Add task to process relocs and
11781 determine unreferenced sections when doing garbage collection.
11782 (Gc_process_relocs): New class.
11783 (Sized_relobj::do_gc_process_relocs): New function.
11784 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11785 sections that are garbage collected.
11786 * reloc.h (Gc_process_relocs): New class.
11787 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11788 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11789 symbols whose corresponding sections are garbage collected.
11790 (Symbol_table::Symbol_table): Add new parameter for the garbage
11791 collection object.
11792 (Symbol_table::gc_mark_undef_symbols): New function.
11793 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11794 (Symbol_table::gc_mark_dyn_syms): New function.
11795 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11796 as garbage.
11797 (Symbol_table::add_from_object): Likewise.
11798 (Symbol_table::add_from_relobj): When building shared objects, do not
11799 treat externally visible symbols as garbage.
11800 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11801 table information for static and relocatable links.
11802 * symtab.h (Symbol_table::set_gc): New function.
11803 (Symbol_table::gc): New function.
11804 (Symbol_table::gc_mark_undef_symbols): New function.
11805 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11806 (Symbol_table::gc_mark_dyn_syms): New function.
11807 (Symbol_table::gc_): New data member.
11808 * target.h (Sized_target::gc_process_relocs): New pure virtual
11809 function.
11810 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11811 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11812
11813 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11814
11815 * options.h (General_options::gc_sections): Define as a no-op for now.
11816 (General_options::no_keep_memory): Ditto.
11817 (General_options::Bshareable): Define.
11818 * options.cc (General_options::finalize): Honor -Bshareable.
11819
11820 2009-01-20 Andreas Schwab <schwab@suse.de>
11821
11822 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11823 read the value in the contents, since we don't use it. Use the
11824 template endianness when writing.
11825 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11826
11827 2009-01-19 Andreas Schwab <schwab@suse.de>
11828
11829 * configure.tgt (powerpc64-*): Fix targ_obj.
11830
11831 2009-01-15 Ian Lance Taylor <iant@google.com>
11832
11833 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11834 local symbols when stripping all symbols.
11835
11836 2009-01-14 Cary Coutant <ccoutant@google.com>
11837
11838 * output.cc (Output_reloc): Add explicit instantiations.
11839
11840 2009-01-14 Cary Coutant <ccoutant@google.com>
11841
11842 * archive.cc (Archive::get_elf_object_for_member): Remove call
11843 to File_read::claim_for_plugin.
11844 * descriptors.cc (Descriptors::open): Remove reference to
11845 is_claimed.
11846 (Descriptors::claim_for_plugin): Remove.
11847 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11848 (Descriptors::is_claimed): Remove.
11849 (claim_descriptor_for_plugin): Remove.
11850 * fileread.cc (File_read::claim_for_plugin): Remove.
11851 * fileread.h (File_read::claim_for_plugin): Remove.
11852 (File_read::descriptor): Reopen descriptor if necessary.
11853 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11854 (Plugin_manager::all_symbols_read): Add task parameter. Change
11855 all callers.
11856 (Plugin_manager::get_input_file): New function.
11857 (Plugin_manager::release_input_file): New function.
11858 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11859 corresponding data member.
11860 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11861 and pass to base constructor. Change all callers.
11862 (get_input_file, release_input_file): New functions.
11863 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11864 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11865 (Plugin_manager::all_symbols_read): Add task parameter.
11866 (Plugin_manager::get_input_file): New function.
11867 (Plugin_manager::release_input_file): New function.
11868 (Plugin_manager::task_): New data member.
11869 (Pluginobj::Pluginobj): Add filesize parameter.
11870 (Pluginobj::filename): New function.
11871 (Pluginobj::descriptor): New function.
11872 (Pluginobj::filesize): New function.
11873 (Pluginobj::filesize_): New data member.
11874 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11875 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11876 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11877
11878 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11879 with archive libraries.
11880 * testsuite/Makefile.in: Regenerate.
11881 * testsuite/plugin_test.c (struct sym_info): New type.
11882 (get_input_file, release_input_file): New static variables.
11883 (onload): Capture new transfer vector entries.
11884 (claim_file_hook): Stop reading at end of file according to filesize.
11885 Factor out parsing of readelf output into separate function.
11886 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11887 APIs and get the source file name from the symbol table. Convert
11888 source file name to corresponding object file name. Print info
11889 message when adding new input files.
11890 (parse_readelf_line): New function.
11891 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11892 * testsuite/plugin_test_2.sh: Likewise.
11893 * testsuite/plugin_test_3.sh: Likewise.
11894 * testsuite/plugin_test_4.sh: New test case.
11895
11896 2009-01-07 Ian Lance Taylor <iant@google.com>
11897
11898 * version.cc (version_string): Bump to 1.8.
11899
11900 2008-12-23 Cary Coutant <ccoutant@google.com>
11901
11902 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11903 * plugin.cc (Plugin_manager::finish): Rename as
11904 layout_deferred_objects. Move cleanup to separate function.
11905 (Plugin_manager::cleanup): New function.
11906 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11907 separately.
11908 * plugin.h (Plugin_manager::finish): Rename as
11909 layout_deferred_objects.
11910 (Plugin_manager::cleanup): New function.
11911 (Plugin_manager::cleanup_done): New field.
11912
11913 2008-12-23 Cary Coutant <ccoutant@google.com>
11914
11915 * plugin.cc (is_visible_from_outside): New function.
11916 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11917 so we don't return "IR only" status for exported symbols or -r links.
11918
11919 * testsuite/Makefile.am (plugin_test_3): New test case.
11920 * testsuite/Makefile.in: Regenerate.
11921 * testsuite/plugin_test_3.sh: New file.
11922
11923 2008-12-22 Cary Coutant <ccoutant@google.com>
11924
11925 * object.cc (Sized_relobj::layout_section): New function.
11926 (Sized_relobj::do_layout): Defer layout of input sections until after
11927 plugin has provided replacement files.
11928 (Sized_relobj::do_layout_deferred_sections): New function.
11929 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11930 (Relobj::layout_deferred_sections): New function.
11931 (Relobj::do_layout_deferred_sections): New function.
11932 (Sized_relobj::do_layout_deferred_sections): New function.
11933 (Sized_relobj::layout_section): New function.
11934 (Sized_relobj::Deferred_layout): New structure.
11935 (Sized_relobj::deferred_layout_): New field.
11936 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11937 Change all callers. Layout deferred sections.
11938 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11939 references.
11940 (Plugin_hook::run): Move code from do_plugin_hook inline.
11941 (Plugin_hook::do_plugin_hook): Remove.
11942 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11943 (Plugin_manager::finish): Renamed, was cleanup.
11944 (Plugin_manager::should_defer_layout): New function.
11945 (Plugin_manager::add_deferred_layout_object): New function.
11946 (Plugin_manager::Deferred_layout_list): New type.
11947 (Plugin_manager::deferred_layout_objects_): New field.
11948 (Plugin_hook::do_plugin_hook): Remove.
11949
11950 2008-12-17 Ian Lance Taylor <iant@google.com>
11951
11952 * options.h (class General_options): Add --no case for
11953 --export-dynamic.
11954
11955 2008-12-16 Cary Coutant <ccoutant@google.com>
11956
11957 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11958 vector.
11959 (Plugin_manager::claim_file): Create plugin object even if
11960 plugin did not call the add_symbols callback.
11961 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11962 asking for more symbols than were added.
11963 * testsuite/Makefile.am (plugin_test_1): Add test case with
11964 no global symbols.
11965 (empty.syms): New target.
11966 * testsuite/Makefile.in: Regenerate.
11967 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11968 message. Don't call add_symbols if no globals.
11969 (all_symbols_read_hook): Don't provide replacement for empty
11970 claimed file.
11971
11972 2008-12-12 Ian Lance Taylor <iant@google.com>
11973
11974 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11975 r_type == 0 for a local symbol with r_sym == 0.
11976 (scan_relocatable_relocs): Pass r_sym to
11977 local_non_section_strategy.
11978 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11979 r_sym parameter.
11980
11981 * configure.ac: Update test for TLS descriptors: they are
11982 supported as of glibc 2.9.
11983 * configure: Rebuild.
11984
11985 2008-12-11 Ian Lance Taylor <iant@google.com>
11986
11987 PR 7091
11988 * target-reloc.h (Default_scan_relocatable_relocs): For each
11989 function, map r_type == 0 to RELOC_DISCARD.
11990
11991 2008-12-10 Cary Coutant <ccoutant@google.com>
11992
11993 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11994 object to override a kept COMDAT group from a plugin object.
11995
11996 2008-12-09 Ian Lance Taylor <iant@google.com>
11997
11998 PR 7088
11999 * yyscript.y (file_cmd): Handle INPUT.
12000
12001 * testsuite/initpri1.c: Change all declarations to be full
12002 prototypes by adding void, to avoid compiler warnings.
12003
12004 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12005
12006 * options.cc (General_options::parse_plugin_opt): New.
12007 (General_options::add_plugin): The argument now is just the filename.
12008 (General_options::add_plugin_option): New.
12009 * options.h (plugin_opt): New.
12010 (add_plugin): Change argument name.
12011 (add_plugin_option): New.
12012 * plugin.cc (Plugin::load): Don't parse the plugin option.
12013 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12014 (Plugin::add_option): New.
12015 (Plugin::args_): Change type.
12016 (Plugin::filename_): New.
12017 (Plugin_manager::add_plugin_option): New.
12018 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12019 * testsuite/Makefile.in: Regenerate.
12020
12021 2008-12-05 Cary Coutant <ccoutant@google.com>
12022
12023 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12024 Handle --strip-lto-sections option.
12025 * options.h (strip_lto_sections): New option.
12026
12027 2008-12-01 Cary Coutant <ccoutant@google.com>
12028
12029 * plugin.cc (ld_plugin_message): Change format parameter to const.
12030 Fix mismatch between new[] and delete.
12031
12032 2008-11-14 Cary Coutant <ccoutant@google.com>
12033
12034 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12035 instead of -1U.
12036
12037 2008-11-05 Craig Silverstein <csilvers@google.com>
12038
12039 * options.cc (General_options::parse_dynamic_list): New function.
12040 * options.h (General_options): New flags dynamic_list,
12041 dynamic_list_data, dynamic_list_cpp_new, and
12042 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12043 (General_options::in_dynamic_list): New function.
12044 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12045 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12046 (Lex::can_continue_name): Likewise.
12047 (yylex): Likewise.
12048 (read_script_file): New parameter script_options.
12049 (read_dynamic_list): New function.
12050 (Script_options::define_dynamic_list): New function.
12051 (dynamic_list_keyword_parsecodes): New variable.
12052 (dynamic_list_keywords): New variable.
12053 * script.h (Script_options::define_dynamic_list): New function
12054 prototype.
12055 (read_dynamic_list): New function prototype.
12056 * symtab.cc (strprefix): New macro.
12057 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12058 dynamic_list_data, dynamic_list_cpp_new, and
12059 dynamic_list_cpp_typeinfo.
12060 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12061 (dynamic_list_expr): New rule.
12062 (dynamic_list_nodes): Likewise.
12063 (dynamic_list_node): Likewise.
12064 * testsuite/Makefile.am (dynamic_list): New test.
12065 * testsuite/Makefile.in: Regenerated.
12066 * testsuite/dynamic_list.t: New file.
12067 * testsuite/dynamic_list.sh: New file.
12068
12069 2008-11-05 Craig Silverstein <csilvers@google.com>
12070
12071 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12072 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12073 (t11_last): Likewise.
12074 * testsuite/ver_test_6.c (main): Likewise.
12075
12076 2008-10-07 Cary Coutant <ccoutant@google.com>
12077
12078 * options.c (General_options::finalize): Add check for -static and
12079 -shared.
12080 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12081 is not empty.
12082
12083 2008-10-02 Cary Coutant <ccoutant@google.com>
12084
12085 * plugin.cc (make_sized_plugin_object): Fix conditional
12086 compilation to work when not all targets are enabled.
12087
12088 2008-09-29 Cary Coutant <ccoutant@google.com>
12089
12090 * archive.cc (Archive::get_file_and_offset): Use filename instead
12091 of name to get library path.
12092 (Archive::include_member): Unlock external member of a thin archive.
12093
12094 * testsuite/Makefile.am (TEST_AR): New variable.
12095 (thin_archive_test_1): New test.
12096 (thin_archive_test_2): New test.
12097 * testsuite/Makefile.in: Regenerate.
12098 * testsuite/thin_archive_main.cc: New file.
12099 * testsuite/thin_archive_test_1.cc: New file.
12100 * testsuite/thin_archive_test_2.cc: New file.
12101 * testsuite/thin_archive_test_3.cc: New file.
12102 * testsuite/thin_archive_test_4.cc: New file.
12103
12104 2008-09-29 Cary Coutant <ccoutant@google.com>
12105
12106 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12107 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12108 instead of -1U.
12109 (Sized_relobj::do_finalize_local_symbols): Likewise.
12110 (Sized_relobj::map_to_kept_section): Likewise.
12111 * object.h (Sized_relobj::invalid_address): New constant.
12112 (Sized_relobj::do_output_section_offset): Check for invalid_address
12113 and return -1ULL.
12114 * output.cc (Output_reloc::local_section_offset): Use constant
12115 invalid_address instead of -1U.
12116 (Output_reloc::get_address): Likewise.
12117 (Output_section::output_address): Change -1U to -1ULL.
12118 * output.h (Output_reloc::invalid_address): New constant.
12119 * reloc.cc (Sized_relobj::write_sections): Use constant
12120 invalid_address instead of -1U.
12121 (Sized_relobj::relocate_sections): Likewise.
12122 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12123 values for merge sections.
12124 * target-reloc.h (relocate_for_relocatable): Use constant
12125 invalid_address instead of -1U.
12126
12127 2008-09-19 Cary Coutant <ccoutant@google.com>
12128
12129 Add plugin functionality for link-time optimization (LTO).
12130 * configure.ac (plugins): Add --enable-plugins option.
12131 * configure: Regenerate.
12132 * config.in: Regenerate.
12133 * Makefile.am (LIBDL): New variable.
12134 (CCFILES): Add plugin.cc.
12135 (HFILES): Add plugin.h.
12136 (ldadd_var): Add LIBDL.
12137 * Makefile.in: Regenerate.
12138
12139 * archive.cc: Include "plugin.h".
12140 (Archive::setup): Don't preread archive symbols when using a plugin.
12141 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12142 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12143 files.
12144 (Archive::include_member): Add symbols from plugin objects.
12145 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12146 * descriptors.cc (Descriptors::open): Check for file descriptors
12147 abandoned by plugins.
12148 (Descriptors::claim_for_plugin): New function.
12149 * descriptors.h (Descriptors::claim_for_plugin): New function.
12150 (Open_descriptor::is_claimed): New field.
12151 (claim_descriptor_for_plugin): New function.
12152 * fileread.cc (File_read::claim_for_plugin): New function.
12153 * fileread.h (File_read::claim_for_plugin): New function.
12154 (File_read::descriptor): New function.
12155 * gold.cc: Include "plugin.h".
12156 (queue_initial_tasks): Add task to call plugin hooks for generating
12157 new object files.
12158 * main.cc: Include "plugin.h".
12159 (main): Load plugin libraries.
12160 * object.h (Pluginobj): Declare.
12161 (Object::pluginobj): New function.
12162 (Object::do_pluginobj): New function.
12163 (Object::set_target): New function.
12164 * options.cc: Include "plugin.h".
12165 (General_options::parse_plugin): New function.
12166 (General_options::General_options): Initialize plugins_ field.
12167 (General_options::add_plugin): New function.
12168 * options.h (Plugin_manager): Declare.
12169 (General_options): Add --plugin option.
12170 (General_options::has_plugins): New function.
12171 (General_options::plugins): New function.
12172 (General_options::add_plugin): New function.
12173 (General_options::plugins_): New field.
12174 * plugin.cc: New file.
12175 * plugin.h: New file.
12176 * readsyms.cc: Include "plugin.h".
12177 (Read_symbols::do_read_symbols): Check for archive before checking
12178 for ELF file. Call plugin hooks to claim files.
12179 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12180 from a real object file; force override when processing replacement
12181 files.
12182 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12183 (Symbol::init_base_object): Likewise.
12184 (Symbol::init_base_output_data): Likewise.
12185 (Symbol::init_base_output_segment): Likewise.
12186 (Symbol::init_base_constant): Likewise.
12187 (Symbol::init_base_undefined): Likewise.
12188 (Symbol::output_section): Assert that object is not a plugin.
12189 (Symbol_table::add_from_pluginobj): New function.
12190 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12191 undefined.
12192 (Symbol_table::sized_write_globals): Likewise.
12193 (Symbol_table::add_from_pluginobj): Instantiate template.
12194 * symtab.h (Sized_pluginobj): Declare.
12195 (Symbol::in_real_elf): New function.
12196 (Symbol::set_in_real_elf): New function.
12197 (Symbol::in_real_elf_): New field.
12198 (Symbol_table::add_from_pluginobj): New function.
12199
12200 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12201 (LIBDL): New variable.
12202 (LDADD): Add LIBDL.
12203 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12204 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12205 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12206 (MOSTLYCLEANFILES): Likewise.
12207 * testsuite/Makefile.in: Regenerate.
12208 * testsuite/plugin_test.c: New file.
12209 * testsuite/plugin_test_1.sh: New file.
12210 * testsuite/plugin_test_2.sh: New file.
12211
12212 2008-09-16 Ian Lance Taylor <iant@google.com>
12213
12214 * target-reloc.h (relocate_section): Check whether a symbol is
12215 defined by the ABI before reporting an undefined symbol error.
12216 * target.h (Target::is_defined_by_abi): Make parameter const.
12217 (Target::do_is_defined_by_abi): Likewise.
12218 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12219 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12220 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12221 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12222 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12223 * testsuite/Makefile.in: Rebuild.
12224
12225 * fileread.cc (make_view): Add casts to avoid warning.
12226
12227 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12228
12229 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12230 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12231
12232 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12233
12234 * options.h (General_options::output_is_executable): New.
12235 (General_options::output_is_pie): New.
12236 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12237 for shared libraries.
12238 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12239
12240 2008-09-11 Chris Demetriou <cgd@google.com>
12241
12242 * options.h (origin): New -z option.
12243 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12244 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12245 in DT_FLAGS_1.
12246
12247 2008-09-05 Cary Coutant <ccoutant@google.com>
12248
12249 * fileread.cc (File_read::make_view): Add check for attempt to map
12250 beyond end of file.
12251
12252 2008-09-05 Cary Coutant <ccoutant@google.com>
12253
12254 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12255 explicit instantiations.
12256
12257 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12258
12259 PR gold/6858
12260 * options.cc (General_options::finalize): Allow undefined symbols
12261 in shlibs if linking -shared.
12262
12263 PR gold/6859
12264 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12265 symbols as not needing a dynsym entry.
12266
12267 2008-08-20 Craig Silverstein <csilvers@google.com>
12268
12269 * fileread.cc (File_read::open): Do not lock the file unless it
12270 was successfully opened.
12271
12272 2008-08-14 Cary Coutant <ccoutant@google.com>
12273
12274 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12275 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12276 * testsuite/tls_test.cc (struct int128): 128-bit struct
12277 for testing TLS relocs with non-zero addend.
12278 (v12): New TLS variable.
12279 (t12): New test.
12280 (t_last): Add check for v12.
12281 * testsuite/tls_test.h (t12): New function.
12282 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12283
12284 2008-08-13 Ian Lance Taylor <iant@google.com>
12285
12286 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12287 set tls_segment_ or relro_segment_.
12288 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12289 when appropriate.
12290 * output.h (Output_section::clear_is_relro): New function.
12291 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12292 sections specially even when output_data_ is empty.
12293 (Output_segment::maximum_alignment): When first section is relro,
12294 only force alignment for PT_LOAD segments.
12295 * script.cc (script_data_segment_align): New function.
12296 (script_data_segment_relro_end): New function.
12297 * script-c.h (script_data_segment_align): Declare.
12298 (script_data_segment_relro_end): Declare.
12299 * script-sections.h (class Script_sections): Declare
12300 data_segment_align and data_segment_relro_end. Add fields
12301 segment_align_index_ and saw_relro_end_.
12302 * script-sections.cc (class Sections_element): Add set_is_relro
12303 virtual function. Add new bool* parameter to place_orphan_here.
12304 Add get_output_section virtual function.
12305 (class Output_section_definition): Add set_is_relro. Add new
12306 bool* parameter to place_orphan_here. Add get_output_section.
12307 Add is_relro_ field.
12308 (Output_section_definition::Output_section_definition): Initialize
12309 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12310 and is_relro_ fields.
12311 (Output_section_definition::place_orphan_here): Add is_relro
12312 parameter.
12313 (Output_section_definition::set_section_addresses): Set relro for
12314 output section.
12315 (Output_section_definition::alternate_constraint): Likewise.
12316 (class Orphan_output_section): Add new bool* parameter to
12317 place_orphan_here. Add get_output_section.
12318 (Orphan_output_section::place_orphan_here): Add is_relro
12319 parameter.
12320 (Script_sections::Script_sections): Initialize
12321 data_segment_align_index_ and saw_relro_end_.
12322 (Script_sections::data_segment_align): New function.
12323 (Script_sections::data_segment_relro_end): New function.
12324 (Script_sections::place_orphan): Set or clear is_relro.
12325 (Script_sections::set_section_addresses): Force alignment of first
12326 TLS section.
12327 * yyscript.y (exp): Call script_data_segment_align and
12328 script_data_segment_relro_end.
12329 * testsuite/relro_script_test.t: New file.
12330 * testsuite/relro_test.cc (using_script): Declare.
12331 (t1, t2): Test using_script.
12332 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12333 (relro_script_test_SOURCES): Define.
12334 (relro_script_test_DEPENDENCIES): Define.
12335 (relro_script_test_LDFLAGS): Define.
12336 (relro_script_test_LDADD): Define.
12337 (relro_script_test.so): New target.
12338 * testsuite/Makefile.in: Rebuild.
12339
12340 2008-08-06 Cary Coutant <ccoutant@google.com>
12341
12342 * archive.cc (Archive::total_archives, Archive::total_members)
12343 (Archive::total_members_loaded): New variables.
12344 (Archive::setup): Add parameter. Add option to preread
12345 archive symbols.
12346 (Archive::read_armap): Add counter.
12347 (Archive::get_file_and_offset): New function.
12348 (Archive::get_elf_object_for_member): New function.
12349 (Archive::read_all_symbols): New function.
12350 (Archive::read_symbols): New function.
12351 (Archive::add_symbols): Add counters.
12352 (Archive::include_all_members): Use armap to find members if it's
12353 already built.
12354 (Archive::include_member): Skip reading symbols if already read.
12355 Factored code into Archive::get_file_and_offset and
12356 Archive::get_elf_object_for_member. Changed call to
12357 Mapfile::report_include_archive_member.
12358 (Archive::print_stats): New function.
12359 * archive.h: Declare Object and Read_symbols_data classes.
12360 (Archive::Archive): Add initializers for new members.
12361 (Archive::setup): Add parameter.
12362 (Archive::print_stats): New function.
12363 (Archive::total_archives, Archive::total_members)
12364 (Archive::total_members_loaded): New variables.
12365 (Archive::get_file_and_offset): New function.
12366 (Archive::get_elf_object_for_member): New function.
12367 (Archive::read_all_symbols): New function.
12368 (Archive::read_symbols): New function.
12369 (Archive::Archive_member): New class.
12370 (Archive::members_): New member.
12371 (Archive::num_members_): New member.
12372 * main.cc: Include archive.h.
12373 (main): Call Archive::print_stats.
12374 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12375 archive parameter; member_name is now the fully-decorated name.
12376 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12377 * options.h: (General_options): Add --preread-archive-symbols option.
12378 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12379 Archive::setup.
12380
12381 2008-08-04 Ian Lance Taylor <iant@google.com>
12382
12383 * symtab.h (Symbol::use_plt_offset): New function.
12384 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12385 * powerpc.cc (Relocate::relocate): Likewise.
12386 * sparc.cc (Relocate::relocate): Likewise.
12387 * x86_64.cc (Relocate::relocate): Likewise.
12388 * testsuite/weak_plt.sh: New test.
12389 * testsuite/weak_plt_main.cc: New test.
12390 * testsuite/weak_plt_shared.cc: New test.
12391 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12392 (check_PROGRAMS): Add weak_plt.
12393 (check_DATA): Add weak_plt_shared.so.
12394 (weak_plt_main_pic.o, weak_plt): New targets.
12395 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12396 * testsuite/Makefile.in: Rebuild.
12397
12398 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12399 gcctestdir/ld.
12400 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12401 * testsuite/Makefile.in: Rebuild.
12402
12403 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12404
12405 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12406 * Makefile.in: Regenerate.
12407 * po/POTFILES.in: Regenerate.
12408
12409 2008-07-29 Ian Lance Taylor <iant@google.com>
12410
12411 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12412 symbols before other symbols.
12413 * testsuite/script_test_2.cc (test_addr): Declare.
12414 (test_addr_alias): Declare.
12415 (main): Check that test_addr and test_addr_alias have the right
12416 values.
12417 * testsuite/script_test_2.t: Define test_addr_alias and
12418 test_addr.
12419
12420 2008-07-24 Ian Lance Taylor <iant@google.com>
12421
12422 PR 5990
12423 * descriptors.cc: New file.
12424 * descriptors.h: New file.
12425 * gold-threads.h (class Hold_optional_lock): New class.
12426 * fileread.cc: Include "descriptors.h".
12427 (File_read::~File_read): Release descriptor rather than closing
12428 it.
12429 (File_read::open) [file]: Call open_descriptor rather than open.
12430 Set is_descriptor_opened_.
12431 (File_read::open) [memory]: Assert that descriptor is not open.
12432 (File_read::reopen_descriptor): New function.
12433 (File_read::release): Release descriptor.
12434 (File_read::do_read): Make non-const. Reopen descriptor.
12435 (File_read::read): Make non-const.
12436 (File_read::make_view): Reopen descriptor.
12437 (File_read::do_readv): Likewise.
12438 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12439 Update declarations.
12440 * layout.cc: Include "descriptors.h".
12441 (Layout::create_build_id): Use open_descriptor rather than open.
12442 * output.cc: Include "descriptors.h".
12443 (Output_file::open): Use open_descriptor rather than open.
12444 * archive.cc (Archive::const_iterator): Change Archive to be
12445 non-const.
12446 (Archive::begin, Archive::end): Make non-const.
12447 (Archive::count_members): Likewise.
12448 * archive.h (class Archive): Update declarations.
12449 * object.h (Object::read): Make non-const.
12450 * Makefile.am (CCFILES): Add descriptors.cc.
12451 (HFILES): Add descriptors.h.
12452 * Makefile.in: Rebuild.
12453
12454 PR 6716
12455 * gold.h: Always include <clocale>. Add Solaris workarounds
12456 following code in binutils/sysdep.h.
12457
12458 PR 6048
12459 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12460 this->eh_frame_hdr_ is NULL before using it.
12461
12462 * dynobj.cc (Versions::Versions): Update comment.
12463
12464 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12465 the base version name.
12466
12467 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12468 array size plus one.
12469 (Stringpool_template::set_string_offsets): Subtract one from key
12470 before using it as an array index.
12471 (Stringpool_template::get_offset_with_length): Likewise.
12472 (Stringpool_template::write_to_buffer): Likewise.
12473 * stringpool.h (Stringpool_template::get_offset_from_key):
12474 Likewise.
12475
12476 2008-07-23 Ian Lance Taylor <iant@google.com>
12477
12478 PR 6658
12479 * object.h (Merged_symbol_value::value): Do our best to handle a
12480 negative addend.
12481
12482 PR 6647
12483 * script.cc (Version_script_info::get_versions): Don't add empty
12484 version tag to return value.
12485 (Version_script_info::get_symbol_version_helper): Change return
12486 type to bool. Add pversion parameter. Change all callers.
12487 (script_register_vers_node): Don't require a non-NULL tag.
12488 * script.h (class Version_script_info): Update declarations.
12489 (Version_script_info::get_symbol_version): Change return type to
12490 bool. Add version parameter. Change all callers.
12491 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12492 handling. Handle an empty version from a version script.
12493 (Symbol_table::define_special_symbol): Likewise.
12494 * testsuite/ver_test_10.script: New file.
12495 * testsuite/ver_test_10.sh: New file.
12496 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12497 (check_DATA): Add ver_test_10.syms.
12498 (ver_test_10.syms, ver_test_10.so): New target.
12499 * testsuite/Makefile.in: Rebuild.
12500
12501 2008-07-23 Simon Baldwin <simonb@google.com>
12502
12503 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12504 to zero for undefined symbols from dynamic libraries.
12505
12506 2008-07-23 Ian Lance Taylor <iant@google.com>
12507
12508 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12509 Change all callers.
12510 * symtab.h (class Symbol_table): Update declaration.
12511 * testsuite/ver_test_9.cc: New file.
12512 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12513 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12514 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12515 (ver_test_9.so, ver_test_9.o): New targets.
12516 * testsuite/Makefile.in: Rebuild.
12517
12518 2008-07-22 Ian Lance Taylor <iant@google.com>
12519
12520 * options.h (class General_options): Define --check-sections.
12521 * layout.cc (Layout::set_segment_offsets): Handle
12522 --check-sections.
12523
12524 * options.h (class General_options): Define -n/--nmagic and
12525 -N/--omagic.
12526 * options.cc (General_options::finalize): For -n/--nmagic or
12527 -N/--omagic, set -static.
12528 * layout.cc (Layout::attach_allocated_section_to_segment): If
12529 -N/--omagic, don't put read-only and read-write sections in
12530 different segments.
12531 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12532 finding a read-only segment.
12533 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12534 don't set the minimum segment alignment to the common page size,
12535 and don't set the file offset to the address modulo the page size.
12536 * script-sections.cc (Script_sections::create_segments): If
12537 -n/--omagic, don't put read-only and read-write sections in
12538 different segments.
12539
12540 * cref.cc: New file.
12541 * cref.h: New file.
12542 * options.h (class General_options): Add --print-symbol-counts.
12543 * main.cc (main): Issue defined symbol report if requested.
12544 * archive.cc (Archive::interpret_header): Make into a const member
12545 function.
12546 (Archive::add_symbols): Call Input_objects::archive_start and
12547 archive_stop.
12548 (Archive::const_iterator): Define new class.
12549 (Archive::begin, Archive::end): New functions.
12550 (Archive::include_all_members): Rewrite to use iterator.
12551 (Archive::count_members): New function.
12552 * archive.h (class Archive): Update declarations.
12553 (Archive::filename): New function.
12554 * object.cc: Include "cref.h".
12555 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12556 (Sized_relobj::do_get_global_symbol_counts): New function.
12557 (Input_objects::add_object): Add object to cross-referencer.
12558 (Input_objects::archive_start): New function.
12559 (Input_objects::archive_stop): New function.
12560 (Input_objects::print_symbol_counts): New function.
12561 * object.h: Declare Cref and Archive.
12562 (Object::get_global_symbol_counts): New function.
12563 (Object::do_get_global_symbol_counts): New pure virtual function.
12564 (class Sized_relobj): Add defined_count_ field. Update
12565 declarations.
12566 (class Input_objects): Add cref_ field. Update constructor.
12567 Update declarations.
12568 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12569 defined_count_.
12570 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12571 symbol counts.
12572 (Sized_dynobj::do_get_global_symbol_counts): New function.
12573 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12574 defined_count_. Update declarations. Define Symbols typedef.
12575 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12576 parameter. Change all callers.
12577 (Symbol_table::add_from_dynobj): Add sympointers and defined
12578 parameters. Change all callers.
12579 * symtab.h (class Symbol_table): Update declarations.
12580 * Makefile.am (CCFILES): Add cref.cc.
12581 (HFILES): Add cref.h.
12582 * Makefile.in: Rebuild.
12583
12584 2008-07-22 Simon Baldwin <simonb@google.com>
12585
12586 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12587 to zero when writing undefined symbols.
12588
12589 2008-07-22 Ian Lance Taylor <iant@google.com>
12590
12591 * output.cc (Output_section::add_input_section): Don't try to
12592 merge empty merge sections.
12593
12594 2008-07-21 Craig Silverstein <csilvers@google.com>
12595
12596 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12597 Include symbol version in error message.
12598
12599 2008-07-20 Chris Demetriou <cgd@google.com>
12600
12601 * configure.ac (gold_cv_c_random_seed): New configured variable.
12602 (RANDOM_SEED_CFLAGS): New substituted variable.
12603 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12604 * configure: Rebuild.
12605 * Makefile.in: Likewise.
12606 * testsuite/Makefile.in: Likewise.
12607
12608 2008-07-18 Ian Lance Taylor <iant@google.com>
12609
12610 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12611 where we see NAME/NULL and NAME/VERSION as separate symbols.
12612 * testsuite/ver_test_main.cc (main): Call t4.
12613 (t4, t4_2a): Define.
12614 * testsuite/ver_test_2.cc (t4_2): Define.
12615 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12616 * testsuite/ver_test_4.cc (t4_2a): Define.
12617 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12618 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12619
12620 2008-07-17 Ian Lance Taylor <iant@google.com>
12621
12622 * dynobj.cc (Versions::add_def): If we give an error about a
12623 missing version, go ahead and create the version anyhow.
12624
12625 2008-07-10 Ian Lance Taylor <iant@google.com>
12626
12627 Handle output sections with more than 0x7fffffff bytes.
12628 * object.h (class Relobj): Change map_to_output_ to
12629 output_sections_, and just keep a section pointer. Change all
12630 uses. Move comdat group support to Sized_relobj.
12631 (Relobj::is_section_specially_mapped): Remove.
12632 (Relobj::output_section): Remove poff parameter. Change all
12633 callers.
12634 (Relobj::output_section_offset): New function.
12635 (Relobj::set_section_offset): Rewrite.
12636 (Relobj::map_to_output): Remove.
12637 (Relobj::output_sections): New function.
12638 (Relobj::do_output_section_offset): New pure virtual function.
12639 (Relobj::do_set_section_offset): Likewise.
12640 (class Sized_relobj): Add section_offsets_ field. Add comdat
12641 group support from Relobj. Update declarations.
12642 (Sized_relobj::get_output_section_offset): New function.
12643 (Sized_relobj::do_output_section_offset): New function.
12644 (Sized_relobj::do_set_section_offset): New function.
12645 * object.cc (Relobj::output_section_address): Remove.
12646 (Sized_relobj::Sized_relobj): Initialize new fields.
12647 (Sized_relobj::include_section_group): Cast find_kept_object to
12648 Sized_relobj.
12649 (Sized_relobj::include_linkonce_section): Likewise.
12650 (Sized_relobj::do_layout): Use separate arrays for output section
12651 and output offset.
12652 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12653 output_sections.
12654 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12655 output_sections and section_offsets.
12656 (Sized_relobj::write_local_symbols): Likewise.
12657 (map_to_kept_section): Compute output address directly.
12658 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12659 output_sections and section_offsets.
12660 (Sized_relobj::write_sections): Likewise.
12661 (Sized_relobj::relocate_sections): Likewise.
12662 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12663 * output.h (class Output_reloc): Update declarations. Change
12664 u2_.relobj to Sized_relobj*.
12665 (class Output_data_reloc): Change add functions to use
12666 Sized_relobj*.
12667 * output.cc (Output_reloc::Output_reloc): Change relobj to
12668 Sized_relobj*.
12669 (Output_reloc::local_section_offset): Change return type to
12670 Elf_Addr. Use get_output_section_offset.
12671 (Output_reloc::get_address): Likewise.
12672 (Output_section::is_input_address_mapped): Don't call
12673 is_section_specially_mapped.
12674 (Output_section::output_offset): Likewise.
12675 (Output_section::output_address): Likewise.
12676 (Output_section::starting_output_address): Likewise.
12677 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12678 parameter to Sized_relobj*.
12679 (Copy_relocs::need_copy_reloc): Likewise.
12680 (Copy_relocs::save): Likewise.
12681 * copy-relocs.h (class Copy_relocs): Update declarations.
12682 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12683 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12684 * target-reloc.h (relocate_for_relocatable): Change
12685 offset_in_output_section type to Elf_Addr. Change code that uses
12686 it as well.
12687 * layout.cc (Layout::layout): Always set *off.
12688 * mapfile.cc (Mapfile::print_input_section): Use
12689 output_section_offset.
12690 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12691 Sized_relobj*.
12692 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12693 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12694 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12695
12696 2008-07-03 Ian Lance Taylor <iant@google.com>
12697
12698 * layout.cc (Layout::include_section): Do not discard unrecognized
12699 SHT_STRTAB sections.
12700
12701 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12702
12703 * script.cc (Lex::can_continue_name): Make '?' allowable in
12704 version-script names.
12705 * testsuite/version_script.map: Change glob pattern to use '?'
12706
12707 2008-06-30 Manish Singh <yosh@gimp.org>
12708
12709 PR 6585
12710 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12711 Correct typo.
12712
12713 2008-06-30 Ian Lance Taylor <iant@google.com>
12714
12715 PR 6660
12716 PR 6682
12717 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12718 versions]: Don't try to read the value in the contents, since we
12719 don't use it. Use the template endianness when writing.
12720
12721 2008-06-25 Cary Coutant <ccoutant@google.com>
12722
12723 * fileread.cc (File_read::make_view): Assert on zero-length view.
12724 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12725 symbol table when there are no symbols to read.
12726
12727 2008-06-23 Craig Silverstein <csilvers@google.com>
12728
12729 * version.cc (version_string): Bump to 1.7
12730
12731 2008-06-18 Craig Silverstein <csilvers@google.com>
12732
12733 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12734 constant 0xFFFF to type Valtype.
12735 (Powerpc_relocate_functions::rel16_ha): Likewise.
12736
12737 2008-06-17 Ian Lance Taylor <iant@google.com>
12738
12739 * output.h (Output_section::Input_section): Initialize p2align_ to
12740 zero for Output_section_data constructors.
12741 (Output_section::Input_section::addralign): If not an input
12742 section, return the alignment of the Output_section_data.
12743 * testsuite/copy_test.cc: New file.
12744 * testsuite/copy_test_1.cc: New file.
12745 * testsuite/copy_test_2.cc: New file.
12746 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12747 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12748 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12749 (copy_test_1_pic.o, copy_test_1.so): New targets.
12750 (copy_test_2_pic.o, copy_test_2.so): New targets.
12751 * testsuite/Makefile.in: Rebuild.
12752
12753 * script-sections.cc (Script_sections::place_orphan): Initialize
12754 local variable exact.
12755
12756 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12757
12758 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12759
12760 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12761 David S. Miller <davem@davemloft.net>
12762
12763 * powerpc.cc: New file.
12764 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12765 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12766 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12767 * Makefile.in: Rebuild.
12768
12769 2008-06-09 Ian Lance Taylor <iant@google.com>
12770
12771 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12772 <exception>.
12773 (throwing, orig_terminate): New static variables.
12774 (terminate_handler): New static function.
12775 (t2): Set terminate handler.
12776
12777 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12778
12779 PR 6584
12780 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12781 alignment.
12782
12783 2008-05-30 Cary Coutant <ccoutant@google.com>
12784
12785 * archive.cc (Archive::include_all_members) Correct to step
12786 over symbol table and extended name table in thin archives.
12787
12788 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12789
12790 PR 6407
12791 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12792 calculation.
12793
12794 2008-05-28 Caleb Howe <cshowe@google.com>
12795
12796 * reduced_debug_output.cc: New file.
12797 * reduced_debug_output.h: New file.
12798 * options.h (class General_options): Add --strip-debug-non-line.
12799 * options.cc (General_options::finalize): Add strip_debug_non_line
12800 to the strip heirarchy.
12801 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12802 fields.
12803 * layout.cc: Include "reduced_debug_output.h".
12804 (Layout::Layout): Initialize new fields.
12805 (line_only_debug_sections): New static array.
12806 (is_lines_only_debug_sections): New static inline function.
12807 (Layout::include_section): Handle --strip-debug-non-line.
12808 (Layout::make_output_section): If --strip-debug-non-line, build
12809 new output sections for .debug_abbrev and .debug_info.
12810 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12811 gold. Warn about possible overflow.
12812 (read_signed_LEB_128): Likewise.
12813 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12814 (read_signed_LEB_128): Declare.
12815 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12816 (HFILES): Add reduced_debug_output.h.
12817 * Makefile.in: Rebuild.
12818
12819 2008-05-21 Ian Lance Taylor <iant@google.com>
12820
12821 * mapfile.cc: New file.
12822 * mapfile.h: New file.
12823 * options.h (class General_options): Add -M/--print-map and -Map.
12824 * options.cc (General_options::finalize): Make -M equivalent to
12825 -Map -.
12826 * main.cc: Include <cstdio> and "mapfile.h".
12827 (main): Open mapfile if requested.
12828 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12829 constructor. Change caller.
12830 (queue_initial_tasks): Add mapfile parameter. Change caller.
12831 (queue_middle_tasks): Likewise.
12832 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12833 declarations.
12834 * archive.cc: Include "mapfile.h".
12835 (Archive::add_symbols): Add mapfile parameter. Change all
12836 callers. Pass mapfile, symbol, and reason to include_member.
12837 (Archive::include_all_members): Add mapfile parameter. Change all
12838 callers.
12839 (Archive::include_member): Add mapfile, sym, and why parameters.
12840 Change all callers. Report inclusion to map file.
12841 * archive.h: Include "fileread.h".
12842 (class Archive): Update declarations.
12843 (Archive::file): New const method.
12844 (class Add_archive_symbols): Add mapfile_ field. Update
12845 constructor. Change all callers.
12846 * readsyms.h (class Read_symbols): Likewise.
12847 (class Finish_group): Likewise.
12848 (class Read_script): Likewise.
12849 * common.cc: Include "mapfile.h".
12850 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12851 all callers.
12852 (Symbol_table::do_allocate_commons): Likewise.
12853 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12854 symbol allocation to mapfile.
12855 * common.h (class Allocate_commons_task): Add mapfile_ field.
12856 Update constructor. Change all callers.
12857 * symtab.h (class Symbol_table): Update declarations.
12858 * layout.cc: Include "mapfile.h".
12859 (Layout_task_runner::run): Print information to mapfile.
12860 (Layout::create_gold_note): Change Output_data_fixed_space to
12861 Output_data_zero_fill.
12862 (Layout::create_build_id): Likewise.
12863 (Layout::print_to_mapfile): New function.
12864 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12865 constructor. Change caller.
12866 (class Layout): Declare print_to_mapfile.
12867 * output.cc (Output_section::Input_section::print_to_mapfile): New
12868 function.
12869 (Output_section::add_input_section): If producing a map, always
12870 add to input_sections_ list.
12871 (Output_section::do_print_to_mapfile): New function.
12872 (Output_segment::print_sections_to_mapfile): New function.
12873 (Output_segment::print_section_list_to_mapfile): New function.
12874 * output.h: Include "mapfile.h".
12875 (Output_data::print_to_mapfile): New function.
12876 (Output_data::do_print_to_mapfile): New virtual function.
12877 (Output_segment_headers::do_print_to_mapfile): New function.
12878 (Output_file_header::do_print_to_mapfile): New function.
12879 (Output_data_const::do_print_to_mapfile): New function.
12880 (class Output_data_const_buffer): Add map_name_ field. Update
12881 constructor. Change all callers. Add do_print_to_mapfile
12882 function.
12883 (class Output_data_fixed_space): Likewise.
12884 (class Output_data_space): Likewise.
12885 (class Output_data_zero_fill): New class.
12886 (Output_data_strtab::do_print_to_mapfile): New function.
12887 (Output_data_reloc_base::do_print_to_mapfile): New function.
12888 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12889 (Output_data_group::do_print_to_mapfile): New function.
12890 (Output_data_got::do_print_to_mapfile): New function.
12891 (Output_data_dynamic::do_print_to_mapfile): New function.
12892 (Output_symtab_xindex::do_print_to_mapfile): New function.
12893 (class Output_section): Declare do_print_to_mapflie. Declare
12894 print_to_mapfile in Input_section.
12895 (class Output_segment): Declare new functions.
12896 * object.h (Sized_relobj::symbol_count): New function.
12897 * script-sections.cc
12898 (Output_section_element_dot_assignment::set_section_addresses):
12899 Change Output_data_fixed_space to Output_data_zero_fill.
12900 (Output_data_expression::do_print_to_mapfile): New function.
12901 * script.cc (read_input_script): Add mapfile parameter. Change
12902 all callers.
12903 * script.h (read_input_script): Update declaration.
12904 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12905 (Eh_frame::do_print_to_mapfile): New function.
12906 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12907 (Output_merge_string::do_print_to_mapfile): New function.
12908 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12909 function.
12910 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12911 function.
12912 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12913 function.
12914 * Makefile.am (CCFILES): Add mapfile.cc.
12915 (HFILES): Add mapfile.h.
12916 * Makefile.in: Rebuild.
12917
12918 2008-05-19 Ian Lance Taylor <iant@google.com>
12919
12920 * options.h (class General_options): Add -z relro.
12921 * layout.cc (Layout::Layout): Initialize relro_segment_.
12922 (Layout::add_output_section_data): Return the output section.
12923 (Layout::make_output_section): Rcognize relro sections and mark
12924 them appropriately.
12925 (Layout::attach_allocated_section_to_segment): Put relro sections
12926 in a PT_GNU_RELRO segment.
12927 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12928 section as relro.
12929 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12930 PT_TLS segments.
12931 (Layout::linkonce_mapping): Map d.rel.ro.local to
12932 .data.rel.ro.local.
12933 (Layout::output_section_name): Us .data.rel.ro.local for any
12934 section which begins with that.
12935 * layout.h (class Layout): Update add_output_section_data
12936 declaration. Add relro_segment_ field.
12937 * output.cc (Output_section::Output_section): Initialize is_relro_
12938 and is_relro_local_ fields.
12939 (Output_segment::add_output_section): Group relro sections.
12940 (Output_segment::is_first_section_relro): New function.
12941 (Output_segment::maximum_alignment): If there is a relro section,
12942 align the segment to the common page size.
12943 (Output_segment::set_section_addresses): Track whether we are
12944 looking at relro sections. If the last section is a relro
12945 section, align to the common page size.
12946 (Output_segment::set_section_list_addresses): Add in_relro
12947 parameter. Change all callers. Align to the page size when
12948 moving from relro to non-relro section.
12949 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12950 segment.
12951 * output.h (class Output_section): Add is_relro_ and
12952 is_relro_local_ fields.
12953 (Output_section::is_relro): New function.
12954 (Output_section::set_is_relro): New function.
12955 (Output_section::is_relro_local): New function.
12956 (Output_section::set_is_relro_local): New function.
12957 (class Output_segment): Update declarations.
12958 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12959 * sparc.cc (Target_sparc::got_section): Likewise.
12960 * x86_64.cc (Target_x86_64::got_section): Likewise.
12961 * testsuite/relro_test_main.cc: New file.
12962 * testsuite/relro_test.cc: New file.
12963 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12964 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12965 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12966 (relro_test.so, relro_test_pic.o): New targets.
12967 * testsuite/Makefile.in: Rebuild.
12968
12969 2008-05-16 Ian Lance Taylor <iant@google.com>
12970
12971 * output.cc (Output_segment::add_output_section): Remove front
12972 parameter.
12973 * output.h (class Output_segment): Remove
12974 add_initial_output_section and overloaded add_output_section.
12975 Update declaration of remaining add_output_section.
12976 * layout.cc (Layout::create_interp): Call add_output_section
12977 rather than add_initial_output_section.
12978 (Layout::finish_dynamic_section): Likewise.
12979
12980 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12981 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12982 know the dynamic type.
12983 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12984 field. Initialize it in constructor.
12985 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12986 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12987 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12988 reloc.
12989
12990 * output.cc (Output_reloc::get_address): Change return type to
12991 Elf_Addr.
12992 * output.h (class Output_reloc): Update get_address declaration.
12993 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12994 for section addresses.
12995
12996 2008-05-09 Ian Lance Taylor <iant@google.com>
12997
12998 PR 6493
12999 * gold.cc (gold_nomem): Use return value of write.
13000
13001 2008-05-08 Ian Lance Taylor <iant@google.com>
13002
13003 * symtab.c (Symbol::init_base_output_data): Add version
13004 parameter. Change all callers.
13005 (Symbol::init_base_output_segment): Likewise.
13006 (Symbol::init_base_constant): Likewise.
13007 (Symbol::init_base_undefined): Likewise.
13008 (Sized_symbol::init_output_data): Likewise.
13009 (Sized_symbol::init_output_segment): Likewise.
13010 (Sized_symbol::init_constant): Likewise.
13011 (Sized_symbol::init_undefined): Likewise.
13012 (Symbol_table::do_define_in_output_data): If the new symbol has a
13013 version, mark it as the default.
13014 (Symbol_table::do_define_in_output_segment): Likewise.
13015 (Symbol_table::do_define_as_constant): Likewise.
13016 * symtab.h (class Symbol): Update declarations.
13017 (class Sized_symbol): Likewise.
13018 * resolve.cc (Symbol::override_version): New function.
13019 (Symbol::override_base): Call override_version.
13020 (Symbol::override_base_with_special): Likewise.
13021 * testsuite/ver_script_8.script: New file.
13022 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13023 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13024 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13025 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13026
13027 2008-05-06 Ian Lance Taylor <iant@google.com>
13028
13029 PR 6049
13030 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13031 functions.
13032 (class General_options): Remove existing --undefined, and add
13033 --no-undefined instead. Add new --undefined as synonym for -u.
13034 * archive.cc (Archive::add_symbols): Check whether symbol was
13035 named with -u.
13036 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13037 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13038 all uses. Add IS_UNDEFINED. Update declarations to split
13039 different versions of init_base. Declare init_base_undefined.
13040 (Symbol::is_defined): Handle IS_UNDEFINED.
13041 (Symbol::is_undefined): Likewise.
13042 (Symbol::is_weak_undefined): Call is_undefined.
13043 (Symbol::is_absolute): Handle IS_CONSTANT.
13044 (class Sized_symbol): Update declarations to split different
13045 versions of init. Declare init_undefined.
13046 (class Symbol_table): Declare new functions.
13047 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13048 Change all callers.
13049 (Symbol::init_base_output_data): Likewise.
13050 (Symbol::init_base_output_segment): Likewise.
13051 (Symbol::init_base_constant): Likewise.
13052 (Symbol::init_base_undefined): New function.
13053 (Sized_symbol::init_object): Rename from init. Change all
13054 callers.
13055 (Sized_symbol::init_output_data): Likewise.
13056 (Sized_symbol::init_output_segment): Likewise.
13057 (Sized_symbol::init_constant): Likewise.
13058 (Sized_symbol::init_undefined): New function.
13059 (Symbol_table::add_undefined_symbols_from_command_line): New
13060 function.
13061 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13062 function.
13063 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13064 (Symbol::output_section): Likewise.
13065 (Symbol::set_output_section): Likewise.
13066 (Symbol_table::sized_finalize_symbol): Likewise.
13067 (Symbol_table::sized_write_globals): Likewise.
13068 * resolve.cc (Symbol_table::should_override): Likewise.
13069 (Symbol::override_base_with_special): Likewise.
13070
13071 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13072 symbol, change it to have default visibility.
13073 * testsuite/protected_1.cc: New file.
13074 * testsuite/protected_2.cc: New file.
13075 * testsuite/protected_3.cc: New file.
13076 * testsuite/protected_main_1.cc: New file.
13077 * testsuite/protected_main_2.cc: New file.
13078 * testsuite/protected_main_3.cc: New file.
13079 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13080 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13081 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13082 (protected_1.so): New target.
13083 (protected_1_pic.o, protected_2_pic.o): New targets.
13084 (protected_3_pic.o): New target.
13085 (check_PROGRAMS): Add protected_2.
13086 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13087 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13088 * testsuite/Makefile.in: Rebuild.
13089
13090 * options.h (DEFINE_var): Add set_user_set_##varname__.
13091 (DEFINE_bool_alias): New macro.
13092 (class General_options): Define -Bstatic using DEFINE_bool_alias
13093 rather than DEFINE_special. Add --undefined as an alias for -z
13094 defs.
13095 * options.cc (General_options::parse_Bstatic): Remove.
13096
13097 * options.h (class General_options): Add --fatal-warnings.
13098 * main.cc (main): Implement --fatal-warnings.
13099 * errors.h (Errors::warning_count): New function.
13100
13101 * options.h (class General_options): Add -Bsymbolic-functions.
13102 * symtab.h (Symbol::is_preemptible): Check for
13103 -Bsymbolic-functions.
13104
13105 2008-05-05 Ian Lance Taylor <iant@google.com>
13106
13107 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13108 as noVARNAME rather than no-VARNAME.
13109 (class General_options): Add option -z combreloc.
13110 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13111 get_address.
13112 (Output_reloc::sort_before) [SHT_REL]: New function.
13113 (Output_reloc::sort_before) [SHT_RELA]: New function.
13114 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13115 Sort_relocs_comparison.
13116 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13117 parameter. Change all callers.
13118 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13119 sort_relocs parameter. Change all callers.
13120 * output.cc (Output_reloc::get_address): New function, broken out
13121 of write_rel.
13122 (Output_reloc::write_rel): Call it.
13123 (Output_reloc::compare): New function.
13124 (Output_data_reloc_base::do_write): Optionally sort relocs.
13125
13126 * configure.ac: If targ_extra_obj is set, link it in.
13127 * configure.tgt: Initialize all variables.
13128 (x86_64*): Set targ_extra_obj and targ_extra_size.
13129 * configure: Rebuild.
13130
13131 * object.cc (Sized_relobj::include_section_group): Adjust section
13132 indexes read from group data. Build vector to pass to
13133 layout_group.
13134 * layout.cc (Layout::layout_group): Add flags and shndxes
13135 parameters. Remove contents parameter. Change caller. Update
13136 explicit instantiations.
13137 * layout.h (class Layout): Update layout_group declaration.
13138 * output.cc (Output_data_group::Output_data_group): Add flags and
13139 input_shndxes parameters. Remove contents parameter. Change
13140 caller.
13141 (Output_data_group::do_write): Change input_sections_ to
13142 input_shndxes_.
13143 * output.h (class Output_data_group): Update constructor
13144 declaration. Rename input_sections_ to input_shndxes_.
13145 * testsuite/many_sections_test.cc: Add template.
13146
13147 2008-04-30 Cary Coutant <ccoutant@google.com>
13148
13149 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13150
13151 * layout.cc (Layout::include_section): Refactored check for debug
13152 info section.
13153 (Layout::add_comdat): Add new parameters. Change type
13154 of signature parameter. Add object and shndx to signatures table.
13155 (Layout::find_kept_object): New function.
13156 * layout.h: Include <cstring>.
13157 (Layout::is_debug_info_section): New function.
13158 (Layout::add_comdat): Add new parameters.
13159 (Layout::find_kept_object): New function.
13160 (Layout::Kept_section): New struct.
13161 (Layout::Signatures): Change type of map range.
13162 * object.cc (Relobj::output_section_address): New function.
13163 (Sized_relobj::include_section_group): Add new parameters. Change
13164 calls to Layout::add_comdat. Change to build table of kept comdat
13165 groups and table mapping discarded sections to kept sections.
13166 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13167 (Sized_relobj::do_layout): Change calls to include_section_group and
13168 include_linkonce_section.
13169 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13170 value to zero when section is discarded.
13171 (Sized_relobj::map_to_kept_section): New function.
13172 * object.h (Relobj::output_section_address): New function.
13173 (Relobj::Comdat_group): New type.
13174 (Relobj::find_comdat_group): New function.
13175 (Relobj::Comdat_group_table): New type.
13176 (Relobj::Kept_comdat_section): New type.
13177 (Relobj::Kept_comdat_section_table): New type.
13178 (Relobj::add_comdat_group): New function.
13179 (Relobj::set_kept_comdat_section): New function.
13180 (Relobj::get_kept_comdat_section): New function.
13181 (Relobj::comdat_groups_): New field.
13182 (Relobj::kept_comdat_sections_): New field.
13183 (Symbol_value::input_value): Update comment.
13184 (Sized_relobj::map_to_kept_section) New function.
13185 (Sized_relobj::include_linkonce_section): Add new parameter.
13186 * target-reloc.h (Comdat_behavior): New type.
13187 (get_comdat_behavior): New function.
13188 (relocate_section): Add code to map a discarded section to the
13189 corresponding kept section when applying a relocation.
13190
13191 2008-04-30 Craig Silverstein <csilvers@google.com>
13192
13193 * dwarf_reader.cc (next_generation_count): New static var.
13194 (Addr2line_cache_entry): New struct.
13195 (addr2line_cache): New static var.
13196 (Dwarf_line_info::one_addr2line): Added caching.
13197 (Dwarf_line_info::clear_addr2line_cache): New function.
13198 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13199 cache-size parameter.
13200 (Dwarf_line_info::one_addr2line_cache): New function.
13201 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13202 new cache-size argument to one_addr2line(), and clear cache.
13203
13204 2008-04-28 Cary Coutant <ccoutant@google.com>
13205
13206 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13207 R_386_PC8 relocations.
13208
13209 2008-04-23 Ian Lance Taylor <iant@google.com>
13210
13211 * object.cc (Sized_relobj::include_section_group): Check for
13212 invalid section group.
13213
13214 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13215 header size.
13216
13217 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13218 than read for file header.
13219 * archive.cc (Archive::include_member): Likewise.
13220
13221 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13222
13223 * aclocal.m4: Regenerate.
13224 * configure: Regenerate.
13225
13226 2008-04-19 Ian Lance Taylor <iant@google.com>
13227
13228 * version.cc (version_string): Bump to 1.6.
13229
13230 * testsuite/Makefile.am (many_sections_r_test): New target.
13231 (many_sections_r_test_SOURCES): Remove.
13232 (many_sections_r_test_DEPENDENCIES): Remove.
13233 (many_sections_r_test_LDFLAGS): Remove.
13234 (many_sections_r_test_LDADD): Remove.
13235
13236 * object.cc (Sized_relobj::do_add_symbols): Always pass
13237 local_symbol_count_ to add_from_relobj.
13238
13239 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13240 every thousand variables.
13241 * testsuite/Makefile.in: Rebuild.
13242
13243 * object.cc (Xindex::initialize_symtab_xindex): New function.
13244 (Xindex::read_symtab_xindex): New function.
13245 (Xindex::sym_xindex_to_shndx): New function.
13246 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13247 available.
13248 (Sized_relobj::do_initialize_xindex): New function.
13249 (Sized_relobj::do_read_symbols): Adjust section links.
13250 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13251 parameter. Change all callers.
13252 (Sized_relobj::include_section_group): Adjust section links and
13253 symbol section indexes.
13254 (Sized_relobj::do_layout): Adjust section links.
13255 (Sized_relobj::do_count_local_symbols): Adjust section links and
13256 symbol section indexes.
13257 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13258 ordinary and special symbols.
13259 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13260 dynsym_xindex parameters. Change all callers. Adjust section
13261 links. Use SHN_XINDEX when needed.
13262 (Sized_relobj::get_symbol_location_info): Adjust section links.
13263 Don't get fooled by special symbols.
13264 * object.h (class Xindex): Define.
13265 (class Object): Add xindex_ parameter. Declare virtual functoin
13266 do_initialize_xindex.
13267 (Object::adjust_sym_shndx): New function.
13268 (Object::set_xindex): New protected function.
13269 (class Symbol_value): Add is_ordinary_shndx_ field.
13270 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13271 (Symbol_value::value): Assert ordinary section.
13272 (Symbol_value::initialize_input_to_output_map): Likewise.
13273 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13274 Change all callers.
13275 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13276 all callers.
13277 (class Sized_relobj): Update declarations.
13278 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13279 parameter. Change all callers.
13280 (Sized_relobj::adjust_shndx): New function.
13281 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13282 field.
13283 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13284 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13285 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13286 (Sized_dynobj::read_dynsym_section): Adjust section links.
13287 (Sized_dynobj::read_dynamic): Likewise.
13288 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13289 section links.
13290 (Sized_dynobj::do_initialize_xindex): New function.
13291 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13292 do_initialize_xindex.
13293 (Sized_dynobj::adjust_shndx): New function.
13294 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13295 dynsym_xindex_ fields.
13296 (Layout::finalize): Add a call to set_section_indexes before
13297 creating the symtab sections.
13298 (Layout::set_section_indexes): Don't do anything if the section
13299 already has a section index.
13300 (Layout::create_symtab_sections): Add shnum parameter. Change
13301 caller. Create .symtab_shndx section if needed.
13302 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13303 caller.
13304 (Layout::allocated_output_section_count): New function.
13305 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13306 needed.
13307 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13308 fields. Update declarations.
13309 (Layout::symtab_xindex): New function.
13310 (Layout::dynsym_xindex): New function.
13311 (class Write_symbols_task): Add layout_ field.
13312 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13313 Change caller.
13314 * output.cc (Output_section_headers::Output_section_headers): Add
13315 shstrtab_section parameter. Change all callers.
13316 (Output_section_headers::do_sized_write): Store overflow values
13317 for section count and section string table section index in
13318 section header zero.
13319 (Output_file_header::do_sized_write): Check for overflow of
13320 section count and section string table section index.
13321 (Output_symtab_xindex::do_write): New function.
13322 (Output_symtab_xindex::endian_do_write): New function.
13323 * output.h (class Output_section_headers): Add shstrtab_section_.
13324 Update declarations.
13325 (class Output_symtab_xindex): Define.
13326 (Output_section::has_out_shndx): New function.
13327 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13328 field.
13329 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13330 Change all callers.
13331 (Sized_symbol::init): Likewise.
13332 (Symbol::output_section): Check for ordinary symbol.
13333 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13334 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13335 callers.
13336 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13337 Change all callers. Simplify handling of symbols from sections
13338 not included in the link.
13339 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13340 distinction.
13341 (Weak_alias_sorter::operator()): Assert that symbols are
13342 ordinary.
13343 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13344 distinction.
13345 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13346 parameters. Change all callers.
13347 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13348 symbol distinction. Use SHN_XINDEX when needed.
13349 (Symbol_table::write_section_symbol): Add symtab_xindex
13350 parameter. Change all callers.
13351 (Symbol_table::sized_write_section_symbol): Likewise. Use
13352 SHN_XINDEX when needed.
13353 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13354 declarations.
13355 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13356 (Symbol::is_defined): Check is_ordinary.
13357 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13358 (Symbol::is_absolute, Symbol::is_common): Likewise.
13359 (class Sized_symbol): Update declarations.
13360 (class Symbol_table): Update declarations.
13361 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13362 parameters. Change all callers.
13363 (Sized_symbol::override): Likewise.
13364 (Symbol_table::override): Likewise.
13365 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13366 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13367 is_ordinary, and orig_st_shndx parameters. Change all callers.
13368 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13369 to be in an ordinary section.
13370 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13371 object and is_ordinary parameters. Change all callers.
13372 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13373 Change all callers. Don't add undefined or non-ordinary symbols
13374 to reloc_map_.
13375 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13376 Change all callers.
13377 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13378 declarations.
13379 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13380 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13381 (Sized_relobj::relocate_sections): Likewise.
13382 * target-reloc.h (scan_relocs): Adjust section symbol index.
13383 (scan_relocatable_relocs): Likewise.
13384 * i386.cc (Scan::local): Check for ordinary symbols.
13385 * sparc.cc (Scan::local): Likewise.
13386 * x86_64.cc (Scan::local): Likewise.
13387 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13388 to symbol_section_and_value.
13389 * testsuite/many_sections_test.cc: New file.
13390 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13391 (check_PROGRAMS): Add many_sections_test.
13392 (many_sections_test_SOURCES): Define.
13393 (many_sections_test_DEPENDENCIES): Define.
13394 (many_sections_test_LDFLAGS): Define.
13395 (BUILT_SOURCES): Add many_sections_define.h.
13396 (many_sections_define.h): New target.
13397 (BUILT_SOURCES): Add many_sections_check.h.
13398 (many_sections_check.h): New target.
13399 (check_PROGRAMS): Add many_sections_r_test.
13400 (many_sections_r_test_SOURCES): Define.
13401 (many_sections_r_test_DEPENDENCIES): Define.
13402 (many_sections_r_test_LDFLAGS): Define.
13403 (many_sections_r_test_LDADD): Define.
13404 (many_sections_r_test.o): New target.
13405 * testsuite/Makefile.in: Rebuild.
13406
13407 2008-04-17 Cary Coutant <ccoutant@google.com>
13408
13409 * errors.cc (Errors::info): New function.
13410 (gold_info): New function.
13411 * errors.h (Errors::info): New function.
13412 * gold.h (gold_info): New function.
13413 * object.cc (Input_objects::add_object): Print trace output.
13414 * options.cc (options::parse_set): New function.
13415 (General_options::parse_wrap): Deleted.
13416 (General_options::General_options): Deleted initializer.
13417 * options.h (options::String_set): New typedef.
13418 (options::parse_set): New function.
13419 (DEFINE_set): New macro.
13420 (General_options::wrap): Changed to use DEFINE_set. Changed
13421 callers of any_wrap_symbols and is_wrap_symbol.
13422 (General_options::trace, General_options::trace_symbol):
13423 New options.
13424 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13425 (General_options::wrap_symbols_): Deleted.
13426 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13427
13428 2008-04-17 David S. Miller <davem@davemloft.net>
13429
13430 * options.cc (General_options::parse_V): New function.
13431 * options.h: Add entries for -V and -Qy.
13432
13433 2008-04-17 Ian Lance Taylor <iant@google.com>
13434
13435 * common.cc (Symbol_table::allocate_commons): Remove options
13436 parameter. Change caller.
13437 (Symbol_table::do_allocate_commons): Remove options parameter.
13438 Change caller. Just call do_allocate_commons_list twice.
13439 (Symbol_table::do_allocate_commons_list): New function, broken out
13440 of do_allocate_commons.
13441 * common.h (class Allocate_commons_task): Remove options_ field.
13442 Update constructor.
13443 * symtab.cc (Symbol_table::Symbol_table): Initialize
13444 tls_commons_.
13445 (Symbol_table::add_from_object): Put TLS common symbols on
13446 tls_commons_ list.
13447 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13448 which are IN_OUTPUT_DATA.
13449 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13450 allocate_commons and do_allocate_commons declarations. Declare
13451 do_allocate_commons_list.
13452 * gold.cc (queue_middle_tasks): Update creation of
13453 Allocate_commons_task to not pass options.
13454 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13455 (TLS_TEST_C_FLAGS): New variable.
13456 (tls_test_c_pic.o): New target.
13457 (tls_test_shared.so): Link in tls_test_c_pic.o.
13458 (tls_test_c_pic_ie.o): New target.
13459 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13460 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13461 (tls_test_c.o): New target.
13462 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13463 (tls_pic_test_LDADD): Likewise.
13464 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13465 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13466 (tls_test_c_gnu2.o): New target.
13467 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13468 tls_test_c_gnu2.o.
13469 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13470 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13471 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13472 * testsuite/tls_test.cc: Include "config.h".
13473 (t_last): Call t11_last.
13474 * testsuite/tls_test.h (t11, t11_last): Declare.
13475 * testsuite/tls_test_c.c: New file.
13476 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13477 * configure.ac: Check for OpenMP support.
13478 * configure, config.in, Makefile.in: Rebuild.
13479 * testsuite/Makefile.in: Rebuild.
13480
13481 2008-04-16 Cary Coutant <ccoutant@google.com>
13482
13483 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13484 (Target_i386::tls_base_symbol_defined_): New field.
13485 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13486 (Target_i386::Scan::global): Likewise.
13487 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13488 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13489 (Target_x86_64::tls_base_symbol_defined_): New field.
13490 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13491 (Target_x86_64::Scan::global): Likewise.
13492
13493 2008-04-16 Cary Coutant <ccoutant@google.com>
13494
13495 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13496 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13497 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13498 building shared libraries.
13499 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13500 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13501 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13502 * testsuite/Makefile.in: Rebuild.
13503 * testsuite/weak_undef.h: New file.
13504 * testsuite/weak_undef_file1.cc: Add extra test cases.
13505 * testsuite/weak_undef_file2.cc: Likewise.
13506 * testsuite/weak_undef_test.cc: Likewise.
13507
13508 2008-04-16 David S. Miller <davem@davemloft.net>
13509
13510 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13511 Add issued_non_pic_error_ field. Declare check_non_pic.
13512 (Target_sparc::Scan::check_non_pic): New function.
13513 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13514 (Target_sparc::Scan::global): Likewise.
13515
13516 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13517 * configure: Rebuild.
13518
13519 * options.h (DEFINE_enable): New macro.
13520 (new_dtags): New enable option.
13521 (initfirst, interpose, loadfltr, nodefaultlib,
13522 nodelete, nodlopen, nodump): New -z options.
13523 * layout.cc (Layout:finish_dynamic_section): If new
13524 dtags enabled, emit DT_RUNPATH. Also, emit a
13525 DT_FLAGS_1 containing any specified -z flags.
13526
13527 2008-04-16 Ian Lance Taylor <iant@google.com>
13528
13529 * copy-relocs.cc: New file.
13530 * copy-relocs.h: New file.
13531 * reloc.cc: Remove Copy_relocs code.
13532 * reloc.h: Likewise.
13533 * reloc-types.h (struct Reloc_types) [both versions]: Add
13534 get_reloc_addend_noerror.
13535 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13536 variants of add_global which take an addend which must be zero.
13537 * i386.cc: Include "copy-relocs.h".
13538 (class Target_i386): Change type of copy_relocs_ to variable,
13539 update initializer.
13540 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13541 Change all callers.
13542 (Target_i386::do_finalize_sections): Change handling of
13543 copy_relocs_.
13544 * sparc.cc: Include "copy-relocs.h".
13545 (class Target_sparc): Change type of copy_relocs_ to variable,
13546 update initializer.
13547 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13548 Change all callers.
13549 (Target_sparc::do_finalize_sections): Change handling of
13550 copy_relocs_.
13551 * x86_64.cc: Include "copy-relocs.h".
13552 (class Target_x86_64): Change type of copy_relocs_ to variable,
13553 update initializer.
13554 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13555 class. Change all callers.
13556 (Target_x86_64::do_finalize_sections): Change handling of
13557 copy_relocs_.
13558 * Makefile.am (CCFILES): Add copy-relocs.cc.
13559 (HFILES): Add copy-relocs.h.
13560
13561 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13562
13563 * testsuite/script_test_4.sh: Permit leading zeroes.
13564
13565 2008-04-15 Ian Lance Taylor <iant@google.com>
13566
13567 * script-sections.cc (Script_sections::create_segments): Use
13568 header_size_adjustment even when there is enough room for the
13569 headers.
13570 * testsuite/script_test_4.sh: New file.
13571 * testsuite/script_test_4.t: New file.
13572 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13573 (check_DATA): Add script_test_4.stdout.
13574 (MOSTLYCLEANFILES): Likewise.
13575 (script_test_4): New target.
13576 (script_test_4.stdout): New target.
13577 * testsuite/Makefile.in: Rebuild.
13578
13579 * sparc.cc: Add definitions for Output_data_plt_sparc class
13580 constants.
13581
13582 2008-04-14 David S. Miller <davem@davemloft.net>
13583
13584 * sparc.cc: New file.
13585 * Makefile.am (TARGETSOURCES): Add sparc.cc
13586 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13587 * configure.tgt: Document targ_extra_size and
13588 targ_extra_big_endian. Add entries for sparc-* and
13589 sparc64-*.
13590 * configure.ac: Handle targ_extra_size and
13591 targ_extra_big_endian.
13592 * Makefile.in: Rebuild.
13593 * configure: Likewise.
13594 * po/POTFILES.in: Likewise.
13595 * po/gold.pot: Likewise.
13596
13597 2008-04-14 Ian Lance Taylor <iant@google.com>
13598
13599 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13600 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13601 in the name/type/flags to section mapping. Don't call
13602 allocate_output_section.
13603 (Layout::choose_output_section): Change parameter from adjust_name
13604 to is_input_section. Don't permit input sections after sections
13605 are attached to segments. Don't call allocate_output_section.
13606 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13607 not write_enable_output_section.
13608 (Layout::make_output_section): Don't push to
13609 unattached_section_list_ nor call attach_to_segment. Call
13610 attach_section_to_segment if sections are attached.
13611 (Layout::attach_sections_to_segments): New function.
13612 (Layout::attach_section_to_segment): New function.
13613 (Layout::attach_allocated_section_to_segment): Rename from
13614 attach_to_segment. Remove flags parameter.
13615 (Layout::allocate_output_section): Remove function.
13616 (Layout::write_enable_output_section): Remove function.
13617 * layout.h (class Layout): Update for above changes. Add new
13618 field sections_are_attached_.
13619 * output.h (Output_section::update_flags_for_input_section): New
13620 function.
13621 * output.cc (Output_section::add_input_section): Call
13622 update_flags_for_input_section.
13623 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13624
13625 2008-04-11 Cary Coutant <ccoutant@google.com>
13626
13627 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13628 thought unnecessary.
13629 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13630
13631 2008-04-11 Ian Lance Taylor <iant@google.com>
13632
13633 * output.h (class Output_section_data): Remove inline definition
13634 of set_addralign.
13635 * output.cc (Output_section_data::set_addralign): New function.
13636
13637 2008-04-11 Cary Coutant <ccoutant@google.com>
13638
13639 Add support for TLS descriptors for i386 and x86_64.
13640 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13641 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13642 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13643 GOT_TYPE_TLS_DESC.
13644 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13645 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13646 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13647 relocations.
13648 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13649 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13650 Fix problem with initial-exec relocations.
13651 (Target_i386::Relocate::relocate_tls): Likewise.
13652 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13653 relaxation.
13654 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13655 support for section-plus-offset dynamic table entries.
13656 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13657 (Output_data_dynamic::Dynamic_entry): Add support for
13658 section-plus-offset dynamic table entries.
13659 (Output_data_dynamic::Classification): Likewise.
13660 (Output_data_dynamic::classification_): Renamed offset_.
13661 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13662 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13663 (Target_x86_64::make_plt_section): New function.
13664 (Target_x86_64::reserve_tlsdesc_entries): New function.
13665 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13666 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13667 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13668 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13669 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13670 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13671 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13672 add extra PLT entry for TLS descriptors.
13673 (Output_data_plt_x86_64::got_): New field.
13674 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13675 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13676 fields.
13677 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13678 descriptors.
13679 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13680 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13681 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13682 R_386_TLS_DESC_CALL relocations.
13683 (Target_x86_64::Scan::global): Likewise.
13684 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13685 for TLS descriptors.
13686 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13687 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13688 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13689 GD-to-IE relaxation.
13690 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13691 and TLS_DESCRIPTORS.
13692 * Makefile.in: Rebuild.
13693 * configure: Rebuild.
13694 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13695 (tls_test_shared2.so): New target.
13696 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13697 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13698 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13699 (tls_shared_gd_to_ie_test_LDADD): New variable.
13700 (tls_shared_gnu2_gd_to_ie_test): New target.
13701 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13702 New targets.
13703 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13704 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13705 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13706 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13707 (tls_shared_gnu2_test): New target.
13708 (tls_test_gnu2_shared.so): New target.
13709 (tls_shared_gnu2_test_SOURCES): New variable.
13710 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13711 (tls_shared_gnu2_test_LDFLAGS): New variable.
13712 (tls_shared_gnu2_test_LDADD): New variable.
13713 * testsuite/Makefile.in: Rebuild.
13714 * testsuite/Makefile.
13715
13716 2008-04-11 Ian Lance Taylor <iant@google.com>
13717
13718 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13719 justsyms.t.
13720 * testsuite/Makefile.in: Rebuild.
13721
13722 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13723 long.
13724 * testsuite/script_test_2.cc (main): Adjust test.
13725
13726 2008-04-11 David S. Miller <davem@davemloft.net>
13727 Ian Lance Taylor <iant@google.com>
13728
13729 * options.h (General_options): Add entries for '-Y' and
13730 '-relax'.
13731 * options.cc (General_options:finalize): If -Y was used, add those
13732 entries to the library path instead of the default "/lib" and
13733 "/usr/lib".
13734
13735 2008-04-11 David S. Miller <davem@davemloft.net>
13736
13737 * testsuite/justsyms.t: Start at 0x100.
13738 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13739 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13740 long.
13741 * testsuite/script_test_2.cc: Adjust string and section length
13742 checks.
13743
13744 2008-04-09 Ian Lance Taylor <iant@google.com>
13745
13746 PR gold/5996
13747 * script-sections.cc (Sections_element::allocate_to_segment): Add
13748 orphan parameter.
13749 (Output_section_definition::allocate_to_segment): Likewise.
13750 (Orphan_output_section::allocate_to_segment): Likewise.
13751 (Script_sections::attach_sections_using_phdrs_clause): Don't
13752 propagate non-PT_LOAD segments to orphan sections.
13753 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13754 readelf rather than objdump.
13755 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13756 .interp section and PT_INTERP segment are the same size.
13757 * testsuite/Makefile.in: Rebuild.
13758
13759 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13760 aliases for symbols defined in the same object.
13761 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13762 (weak_alias_test_SOURCES): New variable.
13763 (weak_alias_test_DEPENDENCIES): New variable.
13764 (weak_alias_test_LDFLAGS): New variable.
13765 (weak_alias_test_LDADD): New variable.
13766 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13767 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13768 (weak_alias_test_3.o): New target.
13769 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13770 * testsuite/weak_alias_test_main.cc: New file.
13771 * testsuite/weak_alias_test_1.cc: New file.
13772 * testsuite/weak_alias_test_2.cc: New file.
13773 * testsuite/weak_alias_test_3.cc: New file.
13774
13775 2008-04-08 Ian Lance Taylor <iant@google.com>
13776
13777 * options.h (class General_options): Add --noinhibit-exec option.
13778 * main.cc (main): Check --noinhibit-exec.
13779
13780 * options.h (class General_options): Define --wrap as a special
13781 option. Add wrap_symbols_ field.
13782 (General_options::any_wrap_symbols): New function.
13783 (General_options::is_wrap_symbol): New function.
13784 * options.cc (General_options::parse_wrap): New function.
13785 (General_options::General_options): Initialize wrap_symbols_.
13786 * symtab.cc (Symbol_table::wrap_symbol): New function.
13787 (Symbol_table::add_from_object): Handle --wrap.
13788 * symtab.h (class Symbol_table): Declare wrap_symbol.
13789 * target.h (Target::wrap_char): New function.
13790 (Target::Target_info): Add wrap_char field.
13791 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13792 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13793 * testsuite/testfile.cc (Target_test::test_target_info):
13794 Likewise.
13795
13796 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13797 there is one.
13798
13799 * layout.h (class Layout): Add added_eh_frame_data_ field.
13800 * layout.cc (Layout::Layout): Initialize new field.
13801 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13802 output section until we find a section we merged successfully.
13803 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13804 that the size be non-zero.
13805
13806 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13807 qualifier.
13808
13809 2008-04-08 Craig Silverstein <csilvers@google.com>
13810
13811 * configure.ac: Export new conditional variable HAVE_ZLIB.
13812 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13813 on HAVE_ZLIB.
13814 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13815 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13816
13817 2008-04-07 Ian Lance Taylor <iant@google.com>
13818
13819 * version.cc (version_string): Set to "1.5".
13820
13821 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13822 Add issued_non_pic_error_ field. Declare check_non_pic.
13823 (Target_x86_64::Scan::check_non_pic): New function.
13824 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13825 (Target_x86_64::Scan::global): Likewise.
13826
13827 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13828 addend parameter. Change caller. Handle merge sections.
13829 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13830 Address to Addend. Don't add in the result of
13831 local_section_offset, pass down the addend and use the returned
13832 value.
13833 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13834 Update declarations of local_section_offset and symbol_value.
13835 * testsuite/two_file_test_1.cc (t18): New function.
13836 * testsuite/two_file_test_2.cc (f18): New function.
13837 * testsuite/two_file_test_main.cc (main): Call t18.
13838 * testsuite/two_file_test.h (t18, f18): Declare.
13839
13840 * configure.ac: Don't test for objdump, c++filt, or readelf.
13841 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13842 conditionals.
13843 (TEST_READELF): New variable.
13844 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13845 (check_PROGRAMS): Add two_file_strip_test.
13846 (two_file_strip_test): New target.
13847 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13848 (two_file_same_shared_strip_test_SOURCES): New variable.
13849 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13850 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13851 (two_file_same_shared_strip_test_LDADD): New variable.
13852 (two_file_shared_strip.so): New target.
13853 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13854 (ver_test_5.syms, ver_test_7.syms): Likewise.
13855 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13856 (strip_test_3.stdout): Use TEST_OBJDUMP.
13857 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13858
13859 2008-04-04 Cary Coutant <ccoutant@google.com>
13860
13861 * symtab.h (Symbol::is_weak_undefined): New function.
13862 (Symbol::is_strong_undefined): New function.
13863 (Symbol::is_absolute): New function.
13864 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13865 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13866 absolute symbols.
13867 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13868 (weak_undef_test): New target.
13869 * testsuite/Makefile.in: Rebuild.
13870 * testsuite/weak_undef_file1.cc: New file.
13871 * testsuite/weak_undef_file2.cc: New file.
13872 * testsuite/weak_undef_test.cc: New file.
13873
13874 2008-04-03 Craig Silverstein <csilvers@google.com>
13875
13876 * compressed_output.h (class Output_compressed_section): Use
13877 unsigned buffer.
13878 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13879 add zlib header.
13880 (zlib_compressed_suffix): Removed.
13881 (Output_compressed_section::set_final_data_size): Use unsigned
13882 buffers.
13883 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13884 Fix linker invocation.
13885 (flagstest_o_specialfile_and_compress_debug_sections):
13886 Likewise.
13887 * testsuite/Makefile.in: Regenerated.
13888
13889 2008-04-02 David S. Miller <davem@davemloft.net>
13890
13891 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13892 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13893
13894 2008-04-02 Craig Silverstein <csilvers@google.com>
13895
13896 * TODO: New file.
13897
13898 2008-04-02 Ian Lance Taylor <iant@google.com>
13899
13900 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13901 parameters. Update for new key type to views_. Change all
13902 callers.
13903 (File_read::read): Adjust for byteshift in returned view.
13904 (File_read::add_view): New function, broken out of
13905 find_and_make_view.
13906 (File_read::make_view): New function, broken out of
13907 find_and_make_view.
13908 (File_read::find_or_make_view): Add offset and aligned
13909 parameters. Rewrite accordingly. Change all callers.
13910 (File_read::get_view): Add offset and aligned parameters. Adjust
13911 for byteshift in return value.
13912 (File_read::get_lasting_view): Likewise.
13913 * fileread.h (class File_read): Update declarations.
13914 (class File_read::View): Add byteshift_ field. Add byteshift to
13915 constructor. Add byteshift method.
13916 * archive.h (Archive::clear_uncached_views): New function.
13917 (Archive::get_view): Add aligned parameter. Change all callers.
13918 * object.h (Object::get_view): Add aligned parameter. Change all
13919 callers.
13920 (Object::get_lasting_view): Likewise.
13921
13922 * fileread.cc (File_read::release): Don't call clear_views if
13923 there are multiple objects.
13924 * fileread.h (File_read::clear_uncached_views): New function.
13925 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13926 on the archive.
13927
13928 2008-03-31 Cary Coutant <ccoutant@google.com>
13929
13930 Add thin archive support.
13931 * archive.cc (Archive::armagt): New const.
13932 (Archive::setup): Remove task parameter and calls to unlock.
13933 (Archive::unlock_nested_archives): New function.
13934 (Archive::read_header): Add nested_off parameter. Change
13935 all callers.
13936 (Archive::interpret_header): Likewise.
13937 (Archive::include_all_members): Change to handle thin
13938 archives.
13939 (Archive::include_member): Likewise.
13940 * archive.h (Archive::Archive): Add new parameters and
13941 initializers.
13942 (Archive::armagt): New const.
13943 (Archive::setup): Remove task parameter.
13944 (Archive::unlock_nested_archives): New function.
13945 (Archive::read_header): Add nested_off parameter.
13946 (Archive::interpret_header): Likewise.
13947 (Archive::Nested_archive_table): New typedef.
13948 (Archive::is_thin_archive_): New field.
13949 (Archive::nested_archives_): New field.
13950 (Archive::options_): New field.
13951 (Archive::dirpath_): New field.
13952 (Archive::task_): New field.
13953 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13954 for thin archives. Pass additional parameters to
13955 Archive::Archive. Unlock the archive file after calling
13956 Archive::setup.
13957
13958 2008-03-29 Ian Lance Taylor <iant@google.com>
13959
13960 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13961 version symbol to be local.
13962 * testsuite/ver_test_4.sh: New file.
13963 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13964 (check_DATA): Add ver_test_4.syms.
13965 (ver_test_4.syms): New target.
13966 * testsuite/Makefile.in: Rebuild.
13967
13968 * output.cc
13969 (Output_section::Input_section_sort_entry::has_priority): New
13970 function.
13971 (Output_section::Input_section_sort_entry::match_file_name): New
13972 function.
13973 (Output_section::Input_section_sort_entry::match_section_name):
13974 Remove.
13975 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13976 Remove.
13977 (Output_section::Input_section_sort_entry::match_section_file):
13978 Remove.
13979 (Output_section::Input_section_sort_compare::operator()): Rewrite
13980 using new Input_section_sort_entry functions. Sort crtbegin and
13981 crtend first. Sort sections with no priority before sections with
13982 a priority.
13983 * testsuite/initpri1.c (d3): Check j != 4.
13984 (cd5): New constructor/destructor function.
13985 (main): Check j != 2.
13986
13987 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13988 new symbol when resolving, don't call set_is_default.
13989 * testsuite/ver_test_7.cc: New file.
13990 * testsuite/ver_test_7.sh: New file.
13991 * testsuite/Makefile.am (ver_test_7.so): New target.
13992 (ver_test_7.o): New target.
13993 (check_SCRIPTS): Add ver_test_7.sh.
13994 (check_DATA): Add ver_test_7.syms.
13995 (ver_test_7.syms): New target.
13996
13997 2008-03-28 Ian Lance Taylor <iant@google.com>
13998
13999 * layout.cc (Layout::layout): If we see an input section with a
14000 name that needs sorting, set the must_sort flag for the output
14001 section.
14002 (Layout::make_output_section): If the name of the output section
14003 indicates that it might require sorting, set the may_sort flag.
14004 * output.h (Output_section::may_sort_attached_input_sections): New
14005 function.
14006 (Output_section::set_may_sort_attached_input_sections): New
14007 function.
14008 (Output_section::must_sort_attached_input_sections): New
14009 function.
14010 (Output_section::set_must_sort_attached_input_sections): New
14011 function.
14012 (class Output_section): Declare Input_section_sort_entry. Define
14013 Input_section_sort_compare. Declare
14014 sort_attached_input_sections. Add new fields:
14015 may_sort_attached_input_sections_,
14016 must_sort_attached_input_sections_,
14017 attached_input_sections_are_sorted_.
14018 * output.cc (Output_section::Output_section): Initialize new
14019 fields.
14020 (Output_section::add_input_section): Add an entry to
14021 input_sections_ if may_sort or must_sort are true.
14022 (Output_section::set_final_data_size): Call
14023 sort_attached_input_sections if necessary.
14024 (Output_section::Input_section_sort_entry): Define new class.
14025 (Output_section::Input_section_sort_compare::operator()): New
14026 function.
14027 (Output_section::sort_attached_input_sections): New function.
14028 * configure.ac: Check whether the compiler supports constructor
14029 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14030 * testsuite/initpri1.c: New file.
14031 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14032 CONSTRUCTOR_PRIORITY.
14033 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14034 (initpri1_LDFLAGS): New variable.
14035 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14036
14037 2008-03-27 Ian Lance Taylor <iant@google.com>
14038
14039 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14040 * testsuite/common_test_1.c: New file.
14041 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14042 (common_test_1_SOURCES): New variable.
14043 (common_test_1_DEPENDENCIES): New variable.
14044 (common_test_1_LDFLAGS): New variable.
14045
14046 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14047 and commons_ correctly when NAME/VERSION does not override
14048 NAME/NULL.
14049 * testsuite/ver_test_6.c: New file.
14050 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14051 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14052 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14053
14054 2008-03-26 Ian Lance Taylor <iant@google.com>
14055
14056 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14057 of an undefined symbol from a version script.
14058 * testsuite/Makefile.am (ver_test_5.so): New target.
14059 (ver_test_5.o): New target.
14060 (check_SCRIPTS): Add ver_test_5.sh.
14061 (check_DATA): Add ver_test_5.syms.
14062 (ver_test_5.syms): New target.
14063 * testsuite/ver_test_5.cc: New file.
14064 * testsuite/ver_test_5.script: New file.
14065 * testsuite/ver_test_5.sh: New file.
14066 * Makefile.in, testsuite/Makefile.in: Rebuild.
14067
14068 PR gold/5986
14069 Fix problems building gold with gcc 4.3.0.
14070 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14071 (gold_error_at_location, gold_warning_at_location): Use it.
14072 * configure.ac: Check whether we can compile and use a template
14073 function with a printf attribute.
14074 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14075 when jumping over bytes.
14076 * object.cc: Instantiate Object::read_section_data.
14077 * debug.h: Include <cstring>
14078 * dwarf_reader.cc: Include <algorithm>
14079 * main.cc: Include <cstring>.
14080 * options.cc: Include <cstring>.
14081 * output.cc: Include <cstring>.
14082 * script.cc: Include <cstring>.
14083 * script.h: Include <string>.
14084 * symtab.cc: Include <cstring> and <algorithm>.
14085 * target-select.cc: Include <cstring>.
14086 * version.cc: Include <string>.
14087 * testsuite/testmain.cc: Include <cstdlib>.
14088 * configure, config.in: Rebuild.
14089
14090 2008-03-25 Ian Lance Taylor <iant@google.com>
14091
14092 * options.cc: Include "../bfd/bfdver.h".
14093 (options::help): Print bug reporting address.
14094
14095 * version.cc (print_version): Adjust output for current value of
14096 BFD_VERSION_STRING.
14097
14098 * NEWS: New file.
14099
14100 * options.cc (options::help): Print list of supported targets.
14101 * target-select.h: Include <vector>.
14102 (class Target_selector): Make machine_, size_, and is_big_endian_
14103 fields const. Add bfd_name_ and instantiated_target_ fields.
14104 (Target_selector::Target_selector): Add bfd_name parameter.
14105 (Target_selector::recognize): Make non-virtual, call
14106 do_recognize.
14107 (Target_selector::recognize_by_name): Make non-virtual, call
14108 do_recognize_by_name.
14109 (Target_selector::supported_names): New function.
14110 (Target_selector::bfd_name): New function.
14111 (Target_selector::do_instantiate_target): New pure virtual
14112 function.
14113 (Target_selector::do_recognize): New virtual function.
14114 (Target_selector::do_recognize_by_name): New virtual function.
14115 (Target_selector::instantiate_target): New private function.
14116 (supported_target_names): Declare.
14117 * target-select.cc (Target_selector::Target_selector): Update for
14118 new parameter and fields.
14119 (select_target_by_name): Check that the name matches before
14120 calling recognize_by_name.
14121 (supported_target_names): New function.
14122 * i386.cc (class Target_selector_i386): Update Target_selector
14123 constructor call. Remove recognize and recognize_by_name. Add
14124 do_instantiate_target.
14125 * x86_64.cc (class Target_selector_x86_64): Likewise.
14126 * testsuite/testfile.cc (class Target_selector_test): Update for
14127 changes to Target_selector.
14128
14129 * README: Rewrite, with some notes on unsupported features.
14130
14131 2008-03-24 Cary Coutant <ccoutant@google.com>
14132
14133 * i386.cc (Target_i386::Got_type): New enum declaration.
14134 (Target_i386::Scan::local): Updated callers of Output_data_got
14135 member functions.
14136 (Target_i386::Scan::global): Likewise.
14137 (Target_i386::Relocate::relocate): Likewise.
14138 (Target_i386::Relocate::relocate_tls): Likewise.
14139 * object.h (Got_offset_list): New class.
14140 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14141 (Sized_relobj::local_got_offset): Likewise.
14142 (Sized_relobj::set_local_got_offset): Likewise.
14143 (Sized_relobj::local_has_tls_got_offset): Removed.
14144 (Sized_relobj::local_tls_got_offset): Removed.
14145 (Sized_relobj::set_local_tls_got_offset): Removed.
14146 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14147 * output.cc (Output_data_got::add_global): Added got_type parameter.
14148 (Output_data_got::add_global_with_rel): Likewise.
14149 (Output_data_got::add_global_with_rela): Likewise.
14150 (Output_data_got::add_global_pair_with_rel): New function.
14151 (Output_data_got::add_global_pair_with_rela): New function.
14152 (Output_data_got::add_local): Added got_type parameter.
14153 (Output_data_got::add_local_with_rel): Likewise.
14154 (Output_data_got::add_local_with_rela): Likewise.
14155 (Output_data_got::add_local_pair_with_rel): New function.
14156 (Output_data_got::add_local_pair_with_rela): New function.
14157 (Output_data_got::add_global_tls): Removed.
14158 (Output_data_got::add_global_tls_with_rel): Removed.
14159 (Output_data_got::add_global_tls_with_rela): Removed.
14160 (Output_data_got::add_local_tls): Removed.
14161 (Output_data_got::add_local_tls_with_rel): Removed.
14162 (Output_data_got::add_local_tls_with_rela): Removed.
14163 * output.h (Output_data_got::add_global): Added got_type parameter.
14164 (Output_data_got::add_global_with_rel): Likewise.
14165 (Output_data_got::add_global_with_rela): Likewise.
14166 (Output_data_got::add_global_pair_with_rel): New function.
14167 (Output_data_got::add_global_pair_with_rela): New function.
14168 (Output_data_got::add_local): Added got_type parameter.
14169 (Output_data_got::add_local_with_rel): Likewise.
14170 (Output_data_got::add_local_with_rela): Likewise.
14171 (Output_data_got::add_local_pair_with_rel): New function.
14172 (Output_data_got::add_local_pair_with_rela): New function.
14173 (Output_data_got::add_global_tls): Removed.
14174 (Output_data_got::add_global_tls_with_rel): Removed.
14175 (Output_data_got::add_global_tls_with_rela): Removed.
14176 (Output_data_got::add_local_tls): Removed.
14177 (Output_data_got::add_local_tls_with_rel): Removed.
14178 (Output_data_got::add_local_tls_with_rela): Removed.
14179 * resolve.cc (Symbol::override_base_with_special): Removed
14180 reference to has_got_offset_ field.
14181 * symtab.cc (Symbol::init_fields): Replaced initialization
14182 of got_offset_ with got_offsets_. Removed initialization
14183 of has_got_offset_
14184 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14185 (Symbol::got_offset): Likewise.
14186 (Symbol::set_got_offset): Likewise.
14187 (Symbol::has_tls_got_offset): Removed.
14188 (Symbol::tls_got_offset): Removed.
14189 (Symbol::set_tls_got_offset): Removed.
14190 (Symbol::got_offset_): Removed.
14191 (Symbol::tls_mod_got_offset_): Removed.
14192 (Symbol::tls_pair_got_offset_): Removed.
14193 (Symbol::got_offsets_): New field.
14194 (Symbol::has_got_offset): Removed.
14195 (Symbol::has_tls_mod_got_offset): Removed.
14196 (Symbol::has_tls_pair_got_offset): Removed.
14197 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14198 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14199 member functions.
14200 (Target_x86_64::Scan::global): Likewise.
14201 (Target_x86_64::Relocate::relocate): Likewise.
14202 (Target_x86_64::Relocate::relocate_tls): Likewise.
14203
14204 2008-03-25 Ben Elliston <bje@au.ibm.com>
14205
14206 * yyscript.y: Fix spelling error in comment.
14207
14208 2008-03-24 Ian Lance Taylor <iant@google.com>
14209
14210 * options.h (class General_options): Define build_id option.
14211 * layout.h (class Layout): Declare write_build_id, create_note,
14212 create_build_id. Add build_id_note_ member.
14213 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14214 "libiberty.h", "md5.h", "sha1.h".
14215 (Layout::Layout): Initialize eh_frame_data_,
14216 eh_frame_hdr_section_, and build_id_note_.
14217 (Layout::finalize): Call create_build_id.
14218 (Layout::create_note): New function, broken out of
14219 Layout::create_gold_note.
14220 (Layout::create_gold_note): Call create_note.
14221 (Layout::create_build_id): New function.
14222 (Layout::write_build_id): New function.
14223 (Close_task_runner::run): Call write_build_id.
14224
14225 * x86_64.cc: Correct license to GPLv3.
14226
14227 2008-03-23 Ian Lance Taylor <iant@google.com>
14228
14229 * options.cc: Include "demangle.h".
14230 (parse_optional_string): New function.
14231 (parse_long_option): Handle takes_optional_argument.
14232 (parse_short_option): Update dash_z initializer. Handle
14233 takes_optional_argument.
14234 (General_options::General_options): Initialize do_demangle_.
14235 (General_options::finalize): Set do_demangle_. Handle demangling
14236 style.
14237 * options.h (parse_optional_string): Declare.
14238 (struct One_option): Add optional_arg field. Update constructor.
14239 Update call constructor calls. Add takes_optional_argument
14240 function.
14241 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14242 (DEFINE_optional_string): Define.
14243 (General_options::demangle): Change from DEFINE_bool to
14244 DEFINE_optional_string.
14245 (General_options::no_demangle): New function.
14246 (General_options::do_demangle): New function.
14247 (General_options::set_do_demangle): New function.
14248 (General_options::execstack_status_): Move definition to end of
14249 class definition.
14250 (General_options::static_): Likewise.
14251 (General_options::do_demangle_): New field.
14252 * object.cc (big_endian>::get_symbol_location_info): Call
14253 Options::do_demangle, not Options::demangle.
14254 * symtab.cc (demangle): Likewise.
14255
14256 2008-03-22 Ian Lance Taylor <iant@google.com>
14257
14258 * gold.h: Include <cstddef> and <sys/types.h>
14259 * options.h: Include <cstring>.
14260
14261 2008-03-21 Ian Lance Taylor <iant@google.com>
14262
14263 * Added source code to GNU binutils.
14264 \f
14265 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14266
14267 Copying and distribution of this file, with or without modification,
14268 are permitted in any medium without royalty provided the copyright
14269 notice and this notice are preserved.
14270
14271 Local Variables:
14272 mode: change-log
14273 left-margin: 8
14274 fill-column: 74
14275 version-control: never
14276 End:
This page took 0.320023 seconds and 5 git commands to generate.