* arm.cc (Target_arm::attributes_accept_div): New function.
[binutils-gdb.git] / gold / ChangeLog
1 2013-01-09 Ben Cheng <bccheng@google.com>
2
3 * arm.cc (Target_arm::attributes_accept_div): New function.
4 (Target_arm::attributes_forbid_div): New function.
5 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
6 attribute using the same new functions as what bfd/elf32_arm.c
7 does.
8
9 2013-01-07 Cary Coutant <ccoutant@google.com>
10
11 PR gold/14993
12 * output.cc (Output_section::add_input_section): For incremental
13 updates, don't track input sections that are allocated from patch
14 space.
15
16 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
17 Ian Lance Taylor <iant@google.com>
18
19 PR gold/14897
20 * configure.ac (--enable-ld): Removed.
21 (install_as_default): Set to yes only for --enable-gold=default
22 or --disable-ld.
23 * configure: Regenerated.
24
25 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
26
27 * options.h (General_options): Add -fuse-ld= for GCC linker
28 option compatibility.
29
30 2013-01-04 Cary Coutant <ccoutant@google.com>
31
32 * configure.ac: Fix typo restoring CXXFLAGS.
33 * configure: Regenerate.
34
35 2013-01-04 Cary Coutant <ccoutant@google.com>
36
37 * testsuite/Makefile.am (CXXLINK_S): New macro.
38 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
39 * testsuite/Makefile.in: Regenerate.
40
41 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
42
43 * version.cc (print_version): Update copyright year to 2013.
44
45 2012-12-20 Ian Lance Taylor <iant@google.com>
46
47 * layout.cc (Layout::special_ordering_of_input_section): New
48 function.
49 (Layout::layout): If input section requires special ordering, must
50 sort input sections.
51 (Layout::make_output_section): May sort .text input sections.
52 (Layout::is_section_name_prefix_grouped): Remove.
53 * layout.h (class Layout): Declare
54 special_ordering_of_input_section. Don't declare
55 is_section_name_prefix_grouped.
56 * output.cc (Output_section::add_input_section): Revert last
57 change.
58 (Output_section::Input_section_sort::match_file_name): Don't crash
59 if called on output section data.
60 (Output_section::Input_section_sort_compare): Sort based on
61 special ordering.
62 (Output_section::Input_section_sort_section_order_index_compare):
63 Revert last patch.
64 (Output_section::sort_attached_input_sections): Likewise.
65
66 2012-12-18 Sriraman Tallam <tmsriram@google.com>
67
68 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
69 * layout.h (Layout::is_section_name_prefix_grouped): New function.
70 * output.cc (Output_section::add_input_section): Check if section
71 name contains special prefix. Keep input sections to sort such
72 sections.
73 (Output_section::Input_section_sort_section_order_index_compare
74 ::operator()): Group sections according to prefixes.
75 (Output_section::sort_attached_input_sections): Add condition to
76 Input_section_entry constructor call.
77 * testsuite/Makefile.am (text_section_grouping): New test.
78 * testsuite/Makefile.in: Regenerate.
79 * testsuite/text_section_grouping.cc: New file.
80 * testsuite/text_section_grouping.sh: New file.
81
82 2012-12-17 Nick Clifton <nickc@redhat.com>
83
84 * Makefile.am: Add copyright notice.
85 * NEWS: Likewise.
86 * README: Likewise.
87 * configure.ac: Likewise.
88 * ftruncate.c: Likewise.
89 * Makefile.in: Regenerate.
90
91 2012-12-14 Cary Coutant <ccoutant@google.com>
92
93 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
94 --no-as-needed flag.
95 (exception_separate_shared_12_test): Likewise.
96 (incremental_copy_test): Likewise.
97 * testsuite/Makefile.in: Regenerate.
98
99 2012-12-14 Cary Coutant <ccoutant@google.com>
100
101 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
102 (Dwp_output_file::Dwp_index::enter_set): Add assert.
103
104 2012-12-12 Alan Modra <amodra@gmail.com>
105
106 * powerpc.cc (class Track_tls): New.
107 (class Relocate, class Scan): Inherit Track_tls.
108 (Target_powerpc::Scan::local, global): Track tls optimization
109 and avoid creating plt entry for __tls_get_addr if all uses
110 are optimized away.
111 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
112
113 2012-12-12 Alan Modra <amodra@gmail.com>
114
115 * options.h (General_options): Add --toc-sort/--no-toc-sort.
116 Replace no_toc_optimize with toc_optimize.
117 * output.h (Output_section::input_sections): Provide non-const variant.
118 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
119 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
120 accessors.
121 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
122 (class Sort_toc_sections): New.
123 (Target_powerpc::do_finalize_sections): Sort toc sections.
124 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
125
126 2012-12-10 Roland McGrath <mcgrathr@google.com>
127
128 * testsuite/binary_unittest.cc (read_all): New function.
129 (Sized_binary_test): Use it instead of ::read.
130 * fileread.cc (do_read): Don't assume pread always reads the whole
131 amount in a single call.
132
133 2012-12-10 Alan Modra <amodra@gmail.com>
134
135 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
136 Set EM_PPC64 or EM_PPC here.
137 (Target_selector_powerpc::do_recognize): Delete.
138
139 2012-12-10 Alan Modra <amodra@gmail.com>
140
141 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
142 stub_table_.
143 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
144
145 2012-12-07 Roland McGrath <mcgrathr@google.com>
146
147 * testsuite/binary_unittest.cc (Sized_binary_test):
148 Use open_descriptor rather than ::open.
149
150 2012-12-07 Alan Modra <amodra@gmail.com>
151
152 * powerpc.cc (Stub_table::do_write): Delete redundant Address
153 typedef and invalid_address constant.
154 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
155 instantiate constants.
156
157 2012-12-06 Roland McGrath <mcgrathr@google.com>
158
159 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
160 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
161 * aclocal.m4: Regenerate.
162 * configure: Regenerate.
163 * Makefile.in: Regenerate.
164 * testsuite/Makefile.in: Regenerate.
165
166 2012-12-07 Alan Modra <amodra@gmail.com>
167
168 * options.h (General_options): Add no_toc_optimize.
169 * powerpc.cc (ok_lo_toc_insn): New function.
170 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
171
172 2012-12-06 Alan Modra <amodra@gmail.com>
173
174 * options.h (General_options): Add plt_align, plt_static_chain,
175 plt_thread_safe. Update stub_group_size help text.
176 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
177 for new plt_thread_safe_ var.
178 (use_plt_offset): Correct comments.
179 (Target_powerpc::do_relax): Look for thread creation symbols to
180 determine default plt_thread_safe value. Clear plt call stubs
181 as well as branch stubs each iteration.
182 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
183 insn constants.
184 (l, hi, ha, write_insn): Move earlier.
185 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
186 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
187 plt stubs too.
188 (Stub_table::update_size): Adjust.
189 (Stub_table::prev_size, set_prev_size): Delete.
190 (Stub_table::stub_align): Let --plt-align affect result.
191 (Stub_table::plt_call_size): Calculate sizes for various stubs.
192 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
193 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
194 (Stub_table::do_write): Support more stub variants.
195
196 2012-12-04 Alan Modra <amodra@gmail.com>
197
198 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
199 (Target_powerpc::do_define_standard_symbols): New function.
200
201 2012-12-03 Alan Modra <amodra@gmail.com>
202
203 * output.h: Formatting, whitespace.
204
205 2012-12-03 Alan Modra <amodra@gmail.com>
206
207 * layout.h (Layout::get_executable_sections): Declare.
208 * layout.cc (Layout::get_executable_sections): New function.
209 * arm.cc (Target_arm::group_sections): Use it.
210 (Arm_output_section::group_sections): Delete now redundant test.
211 * output.cc (Output_reloc::Output_reloc): Add is_relative.
212 param to handle relative relocs.
213 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
214 (Output_data_reloc::add_absolute): Adjust.
215 (Output_data_reloc::add_relative): New function.
216 (Output_data::reset_data_size): New function.
217 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
218 (Output_section::set_addralign): New function.
219 (Output_section::checkpoint_set_addralign): New function.
220 (Output_section::clear_section_offsets_need_adjustment): New function.
221 (Output_section::input_sections): Make public.
222 * powerpc.cc (class Output_data_brlt_powerpc): New.
223 (class Stub_table, class Stub_control): New.
224 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
225 stub_table_, set_stub_table, stub_table): New vectors and accessor
226 functions.
227 (Target_powerpc::do_may_relax, do_relax, push_branch,
228 new_stub_table, stub_tables, brlt_section, group_sections,
229 add_branch_lookup_table, find_branch_lookup_table,
230 write_branch_lookup_table, make_brlt_section): New functions.
231 (Target_powerpc::struct Sort_sections, class Branch_info): New.
232 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
233 branch_info_): New vars.
234 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
235 make call stubs here.
236 (Output_data_glink): Remove all call stub handling from this class.
237 (Target_powerpc::Scan::local, global): Save interesting branch
238 relocs and relocs for ifunc. Adjust calls to plt entry functions.
239 (Target_powerpc::do_finalize_sections): Only make reg save/restore
240 functions on final link.
241 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
242 Handle long branch destinations too.
243 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
244 do_plt_address_for_local): Adjust lookup of plt call stubs.
245
246 2012-11-30 Alan Modra <amodra@gmail.com>
247
248 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
249 relocs against protected symbols when building 32-bit shared libs.
250
251 2012-11-30 Alan Modra <amodra@gmail.com>
252
253 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
254 param. Call got_section() to make .got. Update all callers
255 and their callers and so on.
256
257 2012-11-30 Alan Modra <amodra@gmail.com>
258
259 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
260 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
261 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
262 value if it already exists.
263
264 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
265
266 PR gold/14858
267 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
268
269 2012-11-14 Roland McGrath <mcgrathr@google.com>
270
271 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
272 than bfc instruction for data sandboxing.
273
274 2012-11-08 Alan Modra <amodra@gmail.com>
275
276 * po/POTFILES.in: Regenerate.
277
278 2012-11-05 Alan Modra <amodra@gmail.com>
279
280 * configure.ac: Apply 2012-09-10 change to config.in here.
281 * configure: Regenerate.
282
283 2012-11-05 Alan Modra <amodra@gmail.com>
284
285 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
286 (struct Opd_ent): Use "Address" rather than "Offset".
287 (Output_data_got_powerpc::got_base_offset): Return Valtype.
288 (Target_powerpc::got_section): Make public.
289 (Target_powerpc::scan_relocs): Move code setting symbols..
290 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
291 Create _SDA_BASE_ only when referenced.
292
293 2012-11-02 Roland McGrath <mcgrathr@google.com>
294
295 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
296 from last change.
297
298 2012-11-01 Roland McGrath <mcgrathr@google.com>
299
300 * target.h (Sized_target::relocate_relocs): Use Elf_Off
301 for offset_in_output_section parameter.
302 (Sized_target::relocate_special_relocatable): Likewise.
303 * arm.cc (Target_arm::relocate_relocs): Likewise.
304 (Target_arm::relocate_special_relocatable): Likewise.
305 * i386.cc (Target_i386::relocate_relocs): Likewise.
306 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
307 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
308 * target-reloc.h (relocate_relocs): Likewise.
309 * testsuite/testfile.cc (Target_test): Likewise.
310 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
311 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
312
313 * system.h: Move inclusion of <clocale> to after <libintl.h> in
314 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
315
316 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
317 parameter, which is unused in the [!F_SETFD] case.
318
319 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
320 SYMNDX to off_t before comparing it to this->data_size().
321 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
322 * incremental.cc (Output_section_incremental_inputs::do_write):
323 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
324
325 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
326
327 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
328
329 * gold.cc (Target_arm::do_adjust_elf_header): Add the
330 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
331 in EABI_VER5.
332
333 2012-10-29 Cary Coutant <ccoutant@google.com>
334
335 * dwp.cc (usage): Add file and exit status parameters;
336 add --help and --version options.
337 (print_version): New function.
338 (main): Add --help and --version options.
339
340 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
341
342 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
343 final_layout_sequence.txt.
344 * testsuite/Makefile.in: Regenerated.
345
346 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
347
348 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
349 COMPILE generated by automake.
350 (LINK1): Likewise.
351 (CXXCOMPILE1): Likewise.
352 (CXXLINK1): Likewise.
353 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
354 (LINK): Likewise.
355 (CXXCOMPILE): Likewise.
356 (CXXLINK): Likewise.
357 * testsuite/Makefile.in: Regenerated.
358
359 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
360
361 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
362 on bad fwrite return.
363
364 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
365
366 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
367 on val.
368
369 2012-10-23 Cary Coutant <ccoutant@google.com>
370
371 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
372 * testsuite/Makefile.in: Regenerate.
373 * testsuite/dwp_test.h: New source file.
374 * testsuite/dwp_test_1.cc: New source file.
375 * testsuite/dwp_test_1.s: New source file.
376 * testsuite/dwp_test_1.sh: New source file.
377 * testsuite/dwp_test_1b.cc: New source file.
378 * testsuite/dwp_test_1b.s: New source file.
379 * testsuite/dwp_test_2.cc: New source file.
380 * testsuite/dwp_test_2.s: New source file.
381 * testsuite/dwp_test_2.sh: New source file.
382 * testsuite/dwp_test_main.cc: New source file.
383 * testsuite/dwp_test_main.s: New source file.
384
385 2012-10-23 Cary Coutant <ccoutant@google.com>
386
387 * dwp.h: New header file.
388 * dwp.cc: New source file.
389 * gold.h: Move shared declarations to system.h.
390 * system.h: New header file.
391 * Makefile.am: Add dwp.
392 * Makefile.in: Regenerate.
393
394 2012-10-23 Cary Coutant <ccoutant@google.com>
395
396 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
397 Dwarf_info_reader::read_from_pointer.
398 (Dwarf_pubnames_table::read_header): Likewise.
399 (Dwarf_pubnames_table::next_name): Likewise.
400 (Dwarf_die::read_attributes): Likewise.
401 (Dwarf_die::skip_attributes): Likewise.
402 (Dwarf_info_reader::read_from_pointer): New function template.
403 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
404 (Dwarf_pubnames_table): Likewise.
405 (Dwarf_info_reader::read_from_pointer): New function template.
406 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
407 Dwarf_pubnames_table ctor.
408
409 2012-10-23 Cary Coutant <ccoutant@google.com>
410
411 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
412 abbrev_shndx.
413 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
414 abbrev_shndx_.
415 (Dwarf_info_reader::set_abbrev_shndx): New method.
416 (Dwarf_info_reader::abbrev_shndx_): New data member.
417
418 2012-10-23 Cary Coutant <ccoutant@google.com>
419
420 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
421 from object, not parameters.
422 (Dwarf_info_reader::parse): Likewise.
423 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
424 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
425 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
426 methods.
427
428 2012-10-23 Cary Coutant <ccoutant@google.com>
429
430 * fileread.cc (Input_file::Input_file): New constructor.
431 * fileread.h (class Input_file): Add new constructor.
432
433 2012-10-18 Alan Modra <amodra@gmail.com>
434
435 PR gold/14727
436 * object.cc (Relobj::is_section_name_included): Also match
437 .sdata personality section.
438
439 2012-10-18 Alan Modra <amodra@gmail.com>
440
441 * target-reloc.h (class Default_comdat_behavior): New, package up..
442 (get_comdat_behaviour): ..this.
443 (relocate_section): Add Relocate_comdat_behavior template arg,
444 adjust code to suit.
445 * arm.cc (Target_arm::relocate_section): Adjust to suit.
446 (Target_arm::scan_reloc_section): Likewise.
447 * i386.cc (Target_i386::relocate_section): Likewise.
448 * sparc.cc (Target_sparc::relocate_section): Likewise.
449 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
450 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
451 * powerpc.cc (class Relocate_comdat_behavior): New.
452 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
453 gold::relocate_section with new template arg.
454
455 2012-10-18 Alan Modra <amodra@gmail.com>
456
457 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
458 dynamic relocs for GOT_TPREL got entries, without symbol if
459 resolving locally.
460 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
461 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
462 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
463
464 2012-10-17 Alan Modra <amodra@gmail.com>
465
466 PR gold/14726
467 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
468
469 2012-10-16 Sriraman Tallam <tmsriram@google.com>
470
471 * layout.cc (Layout::include_section): Keep sections marked
472 SHF_EXCLUDE when doing relocatable links.
473
474 2012-10-16 Alan Modra <amodra@gmail.com>
475
476 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
477 (Target_powerpc::do_finalize_sections): Call it.
478 (Output_data_save_res): New class and supporting functions.
479 (Target_powerpc::symval_for_branch): Only look up .opd entry for
480 normal symbols defined in object files.
481
482 2012-10-12 Alan Modra <amodra@gmail.com>
483
484 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
485 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
486 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
487 section if scan_opd_relocs not yet called.
488 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
489
490 2012-10-12 Alan Modra <amodra@gmail.com>
491
492 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
493 add_local_ifunc_entry): Revert last change.
494 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
495
496 2012-10-05 Alan Modra <amodra@gmail.com>
497
498 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
499 do_plt_address_for_global): New functions.
500 (Output_data_got_powerpc::do_write): Don't segfault when linking
501 statically.
502 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
503 add_local_ifunc_entry): Return true on adding entry..
504 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
505 glink->add_entry call. Remove unused symtab param. Adjust calls.
506 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
507 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
508 set up symbols here.
509 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
510 syms here. Do so even when no .iplt. Don't segfault when linking
511 statically.
512 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
513 new variants without reloc param.
514 (Glink_sym_ent::Glink_sym_ent): Likewise.
515 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
516 reloc when refs will resolve to plt call stub.
517 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
518 R_PPC_PLTREL24 to resolve locally.
519 (Target_powerpc::Scan::global): Correct ifunc handling.
520 (Target_powerpc::Relocate::relocate): Correct local sym glink
521 lookup. Don't destroy "value" when we have a plt call stub,
522 and when checking plt call validity.
523 (Target_powerpc::do_dynsym_value): Simplify.
524
525 2012-10-05 Alan Modra <amodra@gmail.com>
526
527 * i386.cc (Output_data_plt_i386::address_for_global,
528 address_for_local): Add plt offset to returned value. Adjust uses.
529 * sparc.cc (Output_data_plt_sparc::address_for_global,
530 address_for_local): Likewise.
531 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
532 address_for_local): Likewise.
533 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
534 address_for_local): Likewise.
535 * target.h (Target::plt_address_for_global, plt_address_for_local):
536 Update comment.
537 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
538 (Output_data_got::Got_entry::write): Nor here.
539 * output.h: Comment fix.
540
541 2012-10-02 Jiong Wang <jiwang@tilera.com>
542
543 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
544 global_offset_table_ value for larget got.
545 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
546
547 2012-09-29 Alan Modra <amodra@gmail.com>
548
549 * powerpc.cc (Target_powerpc::iplt_): New output section.
550 (Target_powerpc::iplt_section, make_iplt_section,
551 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
552 (Target_powerpc::make_plt_entry): Handle ifunc syms.
553 Target_powerpc::plt_entry_count): Count iplt entries too.
554 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
555 reloc section in constructor. New params.
556 (Target_powerpc::make_plt_section): Create reloc section here instead.
557 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
558 functions.
559 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
560 (Output_data_glink::add_entry, find_entry): New functions to
561 deal with local syms.
562 (Glink_sym_ent): Add support for local syms.
563 (Output_data_glink::do_write): Handle ifunc plt entries.
564 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
565 (Target_powerpc::Scan::local, global): Handle ifunc syms.
566 (Target_powerpc::Relocate::relocate): Likewise.
567 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
568
569 2012-09-25 Alan Modra <amodra@gmail.com>
570
571 * object.h (Sized_relobj_file::adjust_local_symbol,
572 do_adjust_local_symbol): New functions.
573 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
574 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
575 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
576 and irregular opd entry spacing.
577 (Powerpc_relobj::do_read_relocs): Add opd size checks.
578 (Global_symbol_visitor_opd): New functor.
579 (Target_powerpc::do_finalize_sections): Omit global symbols defined
580 on deleted opd entries.
581
582 2012-09-15 Jiong Wang <jiwang@tilera.com>
583
584 * tilegx.cc: New file.
585 * Makefile.am (TARGETSOURCES): Add tilegx.cc
586 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
587 * configure.tgt: Add entries for tilegx*.
588 * configure.ac: Likewise.
589 * Makefile.in: Rebuild.
590 * configure: Likewise.
591 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
592 tilegx.
593
594 2012-09-13 Alan Modra <amodra@gmail.com>
595
596 * target-reloc.h (scan_relocs): Call scan.local for relocs
597 against symbols in discarded sections. Pass is_discarded
598 param.
599 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
600 Add is_discarded param.
601 * powerpc (Target_powerpc::Scan::local): Likewise. Use
602 is_discarded to flag opd entry as discarded. Don't emit dyn
603 relocs on such entries.
604 (Target_powerpc::Scan::global): Similarly detect and handle
605 such opd entries.
606 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
607 opd_ent_. Update all uses.
608 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
609 (Target_powerpc::relocate_section): Zero out discarded opd
610 entry relocs.
611
612 2012-09-12 Ian Lance Taylor <iant@google.com>
613
614 PR gold/14570
615 * output.cc: Rename Output_data_got template parameter from size
616 to got_size for all functions. Compile all variants of
617 Output_data_got.
618 (Output_data_got::Got_entry::write): Correct use of size for
619 symbol value. Use local_is_tls rather than casting to
620 Sized_relobj_file.
621 * object.h (class Object): Add local_is_tls and do_local_is_tls.
622 (class Sized_relobj_file): Add do_local_is_tls.
623 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
624
625 2012-09-11 Alan Modra <amodra@gmail.com>
626
627 PR gold/14566
628 * layout.cc (Layout::set_segment_offsets): When using
629 common-page-size alignment, ensure we are on a new max-page-size
630 page.
631 * output.cc (Output_segment::set_section_addresses): Use
632 abi_pagesize, not common_pagesize for relro boundary.
633 (Output_segment::set_offset): Likewise.
634
635 2012-09-11 Alan Modra <amodra@gmail.com>
636
637 * output.h (Output_data_got::add_global_tls, add_local_tls,
638 add_local_tls_pair): New functions.
639 (Output_data_got::add_local_pair_with_rel): Remove second
640 reloc param. Expand comment.
641 (Output_data_got::Got_entry): Rename use_plt_offset_ to
642 use_plt_or_tls_offset_, similarly for constructor param.
643 (Output_data_got::Got_entry::write): Add got_index param.
644 * output.cc (Output_data_got::add_global_tls, add_local_tls,
645 add_local_tls_pair): New functions.
646 (Output_data_got::Got_entry::write): Handle tls symbols
647 with use_plt_or_tls_offset_ set specially.
648 (Output_data_got::add_local_pair_with_rel): Only one reloc.
649 (Output_data_got::do_write): Replace iterator with index, pass
650 index to entry write function.
651 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
652 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
653 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
654 call.
655 * i386.cc (Target_i386::Scan::local): Likewise.
656 * sparc.cc (Target_sparc::Scan::local): Likewise.
657 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
658 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
659 do_tls_offset_for_global): New functions.
660 (Target_powerpc::Scan::local): Correct TLS relocations and got
661 entry values.
662 (Target_powerpc::Scan::global): Don't emit unnecessary
663 dynamic relocations on TLS GOT entries.
664
665 2012-09-10 Matthias Klose <doko@ubuntu.com>
666
667 * config.in: Disable sanity check for kfreebsd.
668
669 2012-09-10 Sterling Augustine <saugustine@google.com>
670
671 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
672 (Gdb_index::pubtypes_read): New parameter.
673 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
674 to calls.
675 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
676 pubtypes_object_.
677
678 2012-09-09 Alan Modra <amodra@gmail.com>
679
680 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
681 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
682 * gc.h (gc_process_relocs): Call target gc_add_reference.
683 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
684 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
685 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
686 unnecessary cast.
687 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
688 to cater for when we don't need code offset. Update use.
689 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
690 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
691 set_opd_valid): New functions.
692 (Target_powerpc::do_gc_add_reference): New function.
693 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
694 stashed refs.
695 (Target_powerpc::do_gc_mark_symbol): New function.
696
697 2012-09-06 Cary Coutant <ccoutant@google.com>
698
699 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
700 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
701 (Dwarf_die::skip_attributes): Likewise.
702 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
703 * testsuite/gdb_index_test.cc (inline_func_1): New function.
704 (main): Call it.
705 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
706
707 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
708
709 * testsuite/script_test_3.t: Add .got.plt output section
710 statement.
711 * testsuite/script_test_4.t: Likewise.
712
713 2012-09-05 Alan Modra <amodra@gmail.com>
714
715 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
716 update all uses and lose "enum" when using type.
717
718 2012-09-05 Alan Modra <amodra@gmail.com>
719
720 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
721 * configure: Regenerate.
722 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
723 (plugin_final_layout.stdout): Likewise.
724 (memory_test): Set page sizes to 0x1000.
725 * testsuite/Makefile.in: Regenerate.
726 * testsuite/discard_locals_test.sh: Add FIXME comment.
727 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
728 * testsuite/pr14265.t: Add .got output section statement.
729 * testsuite/script_test_2.t: Likewise.
730 * testsuite/script_test_3.t: Likewise.
731 * testsuite/script_test_4.t: Likewise.
732 * testsuite/script_test_5.t: Likewise.
733 * testsuite/script_test_6.t: Likewise.
734 * testsuite/script_test_7.t: Likewise.
735 * testsuite/script_test_9.t: Likewise.
736
737 2012-09-05 Alan Modra <amodra@gmail.com>
738
739 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
740 (Powerpc_relocate_functions::Status): New typedef.
741 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
742 (Target_powerpc::Scan::local): Handle REL64.
743 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
744 for REL32 and REL64.
745 (Target_powerpc::symval_for_branch): New function, extracted from..
746 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
747 checks. Report overflow errors.
748
749 2012-09-05 Alan Modra <amodra@gmail.com>
750
751 * object.h (Sized_relobj_file::emit_relocs): Delete.
752 (Sized_relobj_file::emit_relocs_reltype): Delete.
753 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
754 relocate_relocs for --emit-relocs.
755 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
756 * output.h: Update comment.
757 (Output_segment::first_section): New function.
758 (Output_segment::first_section_load_address): Use first_section.
759 * output.cc (Output_segment::first_section): New function extracted..
760 (Output_segment::first_section_load_address): ..from here. Delete.
761 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
762 * target.h (Sized_target::relocate_for_relocatable): Likewise.
763 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
764 adjust call to target.h function.
765 * i386.cc (Target_i386): Likewise.
766 * sparc.cc (Target_sparc): Likewise.
767 * x86_64.cc (Target_x86_64): Likewise.
768 * powerpc.cc (Target_powerpc): Likewise.
769 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
770 first tls section has section symbol for optimised local dynamic
771 output relocs.
772 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
773 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
774 optimised tls code.
775 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
776 Rename to relocate_relocs. Update error message.
777
778 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
779
780 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
781 --just-symbols.
782
783 2012-08-31 Alan Modra <amodra@gmail.com>
784
785 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
786 (Powerpc_relobj::toc_base_offset): New stub function.
787 (Target_powerpc): Add tp_offset, dtp_offset. Rename
788 got_mod_index_offset to tlsld_got_offset. Update all refs.
789 (Target_powerpc::Relocate::enum skip_tls): New.
790 (Target_powerpc::call_tls_get_addr_): New var.
791 (Target_powerpc::is_branch_reloc): Move to file scope.
792 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
793 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
794 New functions.
795 (Target_powerpc::enum Got_type): Delete old values, add new ones.
796 (powerpc_info): Correct common_pagesize for ppc64.
797 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
798 (Powerpc_relocate_functions): Add overflow check enums and functions.
799 Add non-shift version of rela, rela_ua. Delete all rel public
800 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
801 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
802 addr16_ha3, addr14 functions.
803 (Output_data_got_powerpc::add_constant_pair): New function.
804 (Output_data_got_powerpc::got_base_offset): Likewise.
805 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
806 (instruction constants): Sort, add some more.
807 (Output_data_glink::do_write): Add and use Address typedef. Use
808 object->toc_base_offset() stub for 64-bit.
809 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
810 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
811 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
812 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
813 Always treat .opd relocs as against locally defined symbol.
814 Correct condition for RELATIVE relocs.
815 (Target_powerpc::do_finalize_sections): Test for NULL sections.
816 (Target_powerpc::Relocate::relocate): Use plt call stub as value
817 for 32-bit syms with a plt entry. Correct ppc64 toc base
818 calculations. Handle TLS relocs, and more. Add overflow
819 checking and adjust for Powerpc_relocate_functions changes.
820 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
821 Reinstate --emit-relocs code with FIXME.
822
823 2012-08-30 Alan Modra <amodra@gmail.com>
824
825 * layout.cc (Layout::set_segment_offsets): Set p_align to
826 abi_pagesize, not common_pagesize.
827 (Layout::relaxation_loop_body): Similarly use abi_pagesize
828 to determine whether file header can go in segment.
829
830 2012-08-30 Alan Modra <amodra@gmail.com>
831
832 * output.h (Output_reloc::Output_reloc <output section>): Add
833 is_relative param. Adjust calls.
834 (Output_reloc::add_output_section_relative): New functions.
835 * output.cc (Output_reloc::Output_reloc <output section>): Handle
836 is_relative.
837 (Output_reloc::symbol_value): Handle SECTION_CODE.
838
839 2012-08-24 Sriraman Tallam <tmsriram@google.com>
840
841 * gold.cc (queue_middle_tasks): Call layout again when unique
842 segments for sections is desired.
843 * layout.cc (Layout::Layout): Initialize new members.
844 (Layout::get_output_section_flags): New function.
845 (Layout::choose_output_section): Call get_output_section_flags.
846 (Layout::layout): Make output section for mapping to a unique segment.
847 (Layout::insert_section_segment_map): New function.
848 (Layout::attach_allocated_section_to_segment): Make unique segment for
849 output sections marked so.
850 (Layout::segment_precedes): Check for unique segments when sorting.
851 * layout.h (Layout::Unique_segment_info): New struct.
852 (Layout::Section_segment_map): New typedef.
853 (Layout::insert_section_segment_map): New function.
854 (Layout::get_output_section_flags): New function.
855 (Layout::is_unique_segment_for_sections_specified): New function.
856 (Layout::set_unique_segment_for_sections_specified): New function.
857 (Layout::unique_segment_for_sections_specified_): New member.
858 (Layout::section_segment_map_): New member.
859 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
860 Rename is_gc_pass_one to is_pass_one.
861 Rename is_gc_pass_two to is_pass_two.
862 Rename is_gc_or_icf to is_two_pass.
863 Check for which pass based on whether symbols data is present.
864 Make it two pass when unique segments for sections is desired.
865 * output.cc (Output_section::Output_section): Initialize new
866 members.
867 * output.h (Output_section::is_unique_segment): New function.
868 (Output_section::set_is_unique_segment): New function.
869 (Output_section::is_unique_segment_): New member.
870 (Output_section::extra_segment_flags): New function.
871 (Output_section::set_extra_segment_flags): New function.
872 (Output_section::extra_segment_flags_): New member.
873 (Output_section::segment_alignment): New function.
874 (Output_section::set_segment_alignment): New function.
875 (Output_section::segment_alignment_): New member.
876 (Output_segment::Output_segment): Initialize is_unique_segment_.
877 (Output_segment::is_unique_segment): New function.
878 (Output_segment::set_is_unique_segment): New function.
879 (Output_segment::is_unique_segment_): New member.
880 * plugin.cc (allow_unique_segment_for_sections): New function.
881 (unique_segment_for_sections): New function.
882 (Plugin::load): Add new functions to transfer vector.
883 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
884 * Makefile.in: Regenerate.
885 * testsuite/plugin_final_layout.sh: Check if unique segment
886 functionality works.
887 * testsuite/plugin_section_order.c (onload): Check if new interfaces
888 are available.
889 (allow_unique_segment_for_sections): New global.
890 (unique_segment_for_sections): New global.
891 (claim_file_hook): Call allow_unique_segment_for_sections.
892 (all_symbols_read_hook): Call unique_segment_for_sections.
893
894 2012-08-22 Cary Coutant <ccoutant@google.com>
895
896 * layout.cc (Layout::include_section): Don't assert on GROUP
897 sections with --emit-relocs.
898
899 2012-08-21 Cary Coutant <ccoutant@google.com>
900
901 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
902 if --export-dynamic-symbol names an undef symbol.
903
904 2012-08-18 Alan Modra <amodra@gmail.com>
905
906 * powerpc.cc: Formatting and white space.
907 (Powerpc_relobj): Rename got2_section_ to special_.
908 Add opd_ent_shndx_ and opd_ent_off_ vectors.
909 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
910 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
911 (Target_powerpc): Add Address typedef and invalid_address. Use
912 throughout.
913 (Target_powerpc::is_branch_reloc): New function.
914 (Powerpc_relocate_functions): Add Address typedef, use throughout.
915 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
916 for dst_mask, value and addend.
917 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
918 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
919 (Output_data_glink::do_write): Correct toc base. Don't try to use
920 uint16_t for 24-bit offset. Use get_output_section_offset and
921 check return.
922 (Target_powerpc::Scan::local): Handle more relocs.
923 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
924 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
925 Plug in toc restoring insn after plt calls. Translate branches
926 to function descriptor symbols to corresponding entry point.
927 (Target_powerpc::relocate_for_relocatable): Check return from
928 get_output_section_offset.
929 * symtab.h: Comment typo.
930
931 2012-08-14 Ian Lance Taylor <iant@google.com>
932
933 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
934 unsupported_relocal_local to call unsupported_reloc_global.
935
936 2012-08-14 Nick Clifton <nickc@redhat.com>
937
938 PR ld/14265
939 * script-sections.cc (Sections_element::output_section_name): Add
940 keep return parameter.
941 (Output_section_element::match_name): Add keep return parameter.
942 Return the value of the keep_ member.
943 * script-sections.h (class Output_section): Update
944 output_section_name prototype.
945 * layout.cc (Layout::keep_input_section): New public member
946 function.
947 (Layout::choose_output_section): Pass keep parameter to
948 output_section_name.
949 * layout.h (class Layout): Add keep_input_section.
950 * object.cc (Sized_relobj_file::do_layout): Check for kept input
951 sections.
952 * testsuite/Makefile.am: Add a test.
953 * testsuite/Makefile.in: Regenerate.
954 * testsuite/pr14265.c: Source file for the test.
955 * testsuite/pr14265.t: Linker script for the test.
956 * testsuite/pr14265.sh: Shell script for the test.
957
958 2012-08-14 Alan Modra <amodra@gmail.com>
959
960 * target.h (Target::output_section_name): New function.
961 (Target::do_output_section_name): New function.
962 * layout.cc (Layout::choose_output_section): Call the above.
963 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
964
965 2012-08-14 Alan Modra <amodra@gmail.com>
966
967 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
968 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
969 for replace_constant call.
970 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
971 (Output_data_glink::do_print_to_mapfile): New function.
972 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
973 (Target_powerpc::Relocate::relocate): Likewise.
974
975 2012-08-14 Alan Modra <amodra@gmail.com>
976
977 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
978 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
979 (Output_data_glink::add_entry,find_entry): Remove shndx param.
980 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
981 all references to shndx_. Handle special case for R_PPC_PLTREL24
982 here.
983 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
984 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
985 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
986 here.
987 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
988 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
989
990 2012-08-12 Alan Modra <amodra@gmail.com>
991
992 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
993 (glink insn constants): Use uint32_t.
994 (Output_data_glink::add_entry): Use insert, not [] operator.
995
996 2012-08-11 Alan Modra <amodra@gmail.com>
997
998 * object.h (Sized_relobj_file::find_shdr): New function.
999 (Sized_relobj_file::find_special_sections): New function.
1000 * object.cc (Sized_relobj_file::find_shdr): New function.
1001 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1002 (Sized_relobj_file::find_special_sections): New function, split out..
1003 (Sized_relobj_file::do_read_symbols): ..from here.
1004 * output.h (Output_data_got::replace_constant): New function.
1005 (Output_data_got::num_entries): New function.
1006 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1007 (Output_data_got::got_offset): Protected rather than private.
1008 (Output_data_got::replace_got_entry): New function.
1009 * output.cc (Output_data_got::replace_got_entry): New function.
1010 * powerpc.cc (class Powerpc_relobj): New.
1011 (class Powerpc_relocate_functions): Delete all psymval variants or
1012 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1013 Implement _ha functions using corresponding _hi function.
1014 (Powerpc_relobj::find_special_sections): New function.
1015 (Target_powerpc::do_make_elf_object): New function.
1016 (class Output_data_got_powerpc): New.
1017 (class Output_data_glink): New.
1018 (class Powerpc_scan_relocatable_reloc): New.
1019 Many more changes througout file.
1020
1021 2012-08-09 Nick Clifton <nickc@redhat.com>
1022
1023 * po/vi.po: Updated Vietnamese translation.
1024
1025 2012-08-07 Ian Lance Taylor <iant@google.com>
1026
1027 * layout.cc (Layout::add_target_dynamic_tags): If
1028 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1029 plt_rel.
1030
1031 2012-07-30 Nick Clifton <nickc@redhat.com>
1032
1033 * po/gold.pot: Updated template.
1034 * po/es.po: Updated Spanish translation.
1035
1036 2012-07-18 Cary Coutant <ccoutant@google.com>
1037
1038 PR gold/14344
1039 * configure.ac: Add check for -gpubnames support.
1040 * configure: Regenerate.
1041 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1042 support; force -gno-pubnames.
1043 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1044 support.
1045 (gdb_index_test_4): New test.
1046 * testsuite/Makefile.in: Regenerate.
1047 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1048 * testsuite/gdb_index_test_2.sh: Likewise.
1049 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1050 * testsuite/gdb_index_test_4.sh: New script.
1051 * testsuite/gdb_index_test_comm.sh: New script with common code;
1052 don't look for space after colon.
1053
1054 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1055
1056 * gold.cc (queue_middle_tasks): Update function order only after
1057 deferred objects due to plugins are processed.
1058
1059 2012-07-11 Ian Lance Taylor <iant@google.com>
1060
1061 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1062 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1063 (Target_arm::scan_reloc_for_stub): Likewise.
1064 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1065 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1066 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1067 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1068 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1069
1070 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1071 Ian Lance Taylor <iant@google.com>
1072
1073 PR gold/14309
1074 * configure.ac: Test whether std::tr1::hash<off_t> works.
1075 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1076 needed.
1077 * output.h (class Output_fill): Add virtual destructor.
1078 * configure, config.in: Rebuild.
1079
1080 2012-06-22 Roland McGrath <mcgrathr@google.com>
1081
1082 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1083
1084 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1085
1086 * plugin.cc (Plugin::load): Handle position independent executables.
1087
1088 2012-06-06 Cary Coutant <ccoutant@google.com>
1089
1090 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1091 add .debug_macro.
1092 (lines_only_debug_sections): Likewise.
1093 (gdb_fast_lookup_sections): New static array.
1094 (is_gdb_debug_section): Rename formal parameter.
1095 (is_lines_only_debug_section): Likewise.
1096 (is_gdb_fast_lookup_section): New function.
1097 (Layout::include_section): Check for ".zdebug_" prefix; pass
1098 section name suffix to is_gdb_debug_section, et al.; check for
1099 fast-lookup sections when building .gdb_index.
1100 * options.h (--strip-debug-gdb): Update GDB version number.
1101
1102 2012-06-06 Cary Coutant <ccoutant@google.com>
1103
1104 * configure.ac: Add check for fallocate.
1105 * configure: Regenerate.
1106 * config.in: Regenerate.
1107
1108 * options.h (class General_options): Add --mmap-output-file and
1109 --posix-fallocate options.
1110 * output.cc: (posix_fallocate): Remove; replace with...
1111 (gold_fallocate): New function.
1112 (Output_file::map_no_anonymous): Call gold_fallocate.
1113 (Output_file::map): Check --mmap-output-file option.
1114
1115 2012-06-05 Jing Yu <jingyu@google.com>
1116
1117 * gold.h (textdomain): Add do {} to empty while(0).
1118 (bindtextdomain): Likewise.
1119
1120 2012-06-04 Cary Coutant <ccoutant@google.com>
1121
1122 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1123 has_dynsym_index.
1124
1125 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1126
1127 * symtab.cc (Symbol_table::define_special_symbol):
1128 Initialize *poldsym to prevent uninitialized variable errors.
1129
1130 2012-05-23 Cary Coutant <ccoutant@google.com>
1131
1132 * layout.cc (Layout::section_name_mapping): Add rules to handle
1133 exact match on .data.rel.ro.local or .data.rel.ro.
1134 (Layout::output_section_name): Check for exact matches.
1135
1136 2012-05-23 Cary Coutant <ccoutant@google.com>
1137
1138 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1139 more carefully.
1140
1141 2012-05-22 Cary Coutant <ccoutant@google.com>
1142
1143 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1144 object before exporting symbol.
1145
1146 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1147
1148 * testsuite/tls_test.cc: Include "config.h" first.
1149 * testsuite/tls_test_c.c: Likewise.
1150
1151 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1152 Nick Clifton <nickc@redhat.com>
1153
1154 PR 14072
1155 * configure.in: Add check that sysdep.h has been included before
1156 any system header files.
1157 * configure: Regenerate.
1158 * config.in: Regenerate.
1159
1160 2012-05-14 Cary Coutant <ccoutant@google.com>
1161
1162 * layout.cc (Layout::make_output_section): Mark .tdata section
1163 as RELRO.
1164 * testsuite/relro_test.cc: Add a TLS variable.
1165
1166 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1167
1168 PR gold/14091
1169 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1170 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1171 R_X86_64_64.
1172
1173 2012-05-08 Cary Coutant <ccoutant@google.com>
1174
1175 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1176 (lines_only_debug_sections): Likewise.
1177
1178 2012-05-02 Roland McGrath <mcgrathr@google.com>
1179
1180 * nacl.cc: New file.
1181 * nacl.h: New file.
1182 * Makefile.am (CCFILES, HFILES): Add them.
1183 * Makefile.in: Regenerate.
1184 * i386.cc (Output_data_plt_i386_nacl): New class.
1185 (Output_data_plt_i386_nacl_exec): New class.
1186 (Output_data_plt_i386_nacl_dyn): New class.
1187 (Target_i386_nacl): New class.
1188 (Target_selector_i386_nacl): New class.
1189 (target_selector_i386): Use it instead of Target_selector_i386.
1190 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1191 (Target_x86_64_nacl): New class.
1192 (Target_selector_x86_64_nacl): New class.
1193 (target_selector_x86_64, target_selector_x32): Use it instead of
1194 Target_selector_x86_64.
1195 * arm.cc (Output_data_plt_arm_nacl): New class.
1196 (Target_arm_nacl): New class.
1197 (Target_selector_arm_nacl): New class.
1198 (target_selector_arm, target_selector_armbe): Use it instead of
1199 Target_selector_arm.
1200
1201 * target-select.cc (select_target): Take new Input_file* and off_t
1202 arguments, pass them on to recognize method of selector.
1203 * object.cc (make_elf_sized_object): Update caller.
1204 * parameters.cc (parameters_force_valid_target): Likewise.
1205 * incremental.cc (make_sized_incremental_binary): Likewise.
1206 * target-select.h: Update decl.
1207 (Target_selector::recognize): Take new Input_file* argument,
1208 pass it on to do_recognize.
1209 (Target_selector::do_recognize): Take new Input_file* argument.
1210 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1211 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1212 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1213 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1214
1215 * target.h (Target::Target_info): New members isolate_execinstr
1216 and rosegment_gap.
1217 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1218 * arm.cc (Target_arm::arm_info): Update initializer.
1219 * i386.cc (Target_i386::i386_info): Likewise.
1220 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1221 * sparc.cc (Target_sparc::sparc_info): Likewise.
1222 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1223 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1224 * layout.cc (Layout::attach_allocated_section_to_segment):
1225 Take new const Target* argument. If target->isolate_execinstr(), act
1226 like --rosegment.
1227 (Layout::find_first_load_seg): Take new const Target* argument;
1228 if target->isolate_execinstr(), reject PF_X segments.
1229 (Layout::relaxation_loop_body): Update caller.
1230 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1231 reset file offset to zero when we hit LOAD_SEG, and then do a second
1232 loop over the segments before LOAD_SEG to reassign offsets after
1233 addresses have been determined. Handle target->rosegment_gap().
1234 (Layout::attach_section_to_segment): Take new const Target* argument;
1235 pass it to attach_allocated_section_to_segment.
1236 (Layout::make_output_section): Update caller.
1237 (Layout::attach_sections_to_segments): Take new const Target* argument;
1238 pass it to attach_section_to_segment.
1239 * gold.cc (queue_middle_tasks): Update caller.
1240 * layout.h (Layout): Update method decls with new arguments.
1241
1242 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1243 Target_info pointer to use.
1244 (Target_arm::do_make_data_plt): New virtual method.
1245 (Target_arm::make_data_plt): New method that calls it.
1246 (Target_arm::make_plt_entry): Use it.
1247 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1248 for the section alignment.
1249 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1250 method.
1251 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1252 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1253 method.
1254 (Output_data_plt_arm::get_plt_entry_size): Call it.
1255 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1256 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1257 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1258 method.
1259 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1260 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1261 method instead of sizeof(plt_entry).
1262 (Output_data_plt_arm::add_entry): Likewise.
1263 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1264 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1265 than static method.
1266 (Target_arm::plt_entry_size): Likewise.
1267 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1268 Move to ...
1269 (Output_data_plt_arm_standard): ... here, new class.
1270 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1271 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1272 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1273
1274 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1275 Take additional argument for the PLT entry size.
1276 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1277 Use get_plt_entry_size method rather than plt_entry_size variable.
1278 (Output_data_plt_x86_64::reserve_slot): Likewise.
1279 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1280 (Output_data_plt_x86_64::add_entry): Likewise.
1281 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1282 (Output_data_plt_x86_64::address_for_global): Likewise.
1283 (Output_data_plt_x86_64::address_for_local): Likewise.
1284 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1285 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1286 Make method non-static.
1287 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1288 method.
1289 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1290 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1291 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1292 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1293 virtual method.
1294 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1295 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1296 virtual method.
1297 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1298 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1299 virtual method.
1300 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1301 (Output_data_plt_x86_64::plt_entry_size)
1302 (Output_data_plt_x86_64::first_plt_entry)
1303 (Output_data_plt_x86_64::plt_entry)
1304 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1305 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1306 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1307 (Output_data_plt_x86_64_standard): ... here, new class.
1308 (Target_x86_64::Target_x86_64): Take optional argument for the
1309 Target_info pointer to use.
1310 (Target_x86_64::do_make_data_plt): New virtual method.
1311 (Target_x86_64::make_data_plt): New method to call it.
1312 (Target_x86_64::init_got_plt_for_update): Use that.
1313 Call this->plt_->add_eh_frame method here.
1314 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1315 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1316 rather than static method.
1317 (Target_x86_64::plt_entry_size): Likewise.
1318 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1319 rather than plt_entry_size variable. Move guts of PLT filling to...
1320 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1321 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1322 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1323
1324 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1325 additional argument for the section alignment.
1326 Don't do add_eh_frame_for_plt here.
1327 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1328 non-static. Use get_plt_entry_size method rather than plt_entry_size
1329 variable.
1330 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1331 method.
1332 (Output_data_plt_i386::get_plt_entry_size): Call it.
1333 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1334 (Output_data_plt_i386::add_eh_frame): New method to call it.
1335 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1336 method.
1337 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1338 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1339 method.
1340 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1341 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1342 method instead of plt_entry_size.
1343 (Output_data_plt_i386::plt_entry_size)
1344 (Output_data_plt_i386::plt_eh_frame_fde_size)
1345 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1346 (Output_data_plt_i386_standard): ... here, new class.
1347 (Output_data_plt_i386_exec): New class.
1348 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1349 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1350 (Output_data_plt_i386::exec_plt_entry): Move to ...
1351 (Output_data_plt_i386_exec::plt_entry): ... here.
1352 (Output_data_plt_i386_dyn): New class.
1353 (Output_data_plt_i386::first_plt_entry): Move to ...
1354 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1355 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1356 (Output_data_plt_i386_dyn::plt_entry): ... here.
1357 (Target_i386::Target_i386): Take optional argument for the Target_info
1358 pointer to use.
1359 (Target_i386::do_make_data_plt): New virtual method.
1360 (Target_i386::make_data_plt): New method to call it.
1361 (Target_i386::make_plt_section): Use that.
1362 Call this->plt_->add_eh_frame method here.
1363 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1364 rather than plt_entry_size variable.
1365 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1366 (Output_data_plt_i386::address_for_local): Likewise.
1367 (Output_data_plt_i386::do_write): Likewise.
1368 Move guts of PLT filling to...
1369 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1370 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1371 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1372 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1373
1374 2012-05-01 Cary Coutant <ccoutant@google.com>
1375
1376 * dwarf_reader.cc (Dwarf_die::read_attributes)
1377 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1378 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1379 * reduced_debug_output.cc
1380 (Output_reduced_debug_info_section::get_die_end): Remove
1381 DW_FORM_GNU_ref_index. Add default case.
1382
1383 2012-04-26 Mark Wielaard <mjw@redhat.com>
1384
1385 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1386 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1387 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1388 DW_AT_high_pc as offset from DW_AT_low_pc.
1389
1390 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1391 * testsuite/Makefile.in: Regenerate.
1392 * testsuite/gdb_index_test_3.c: New test source file.
1393 * testsuite/gdb_index_test_3.sh: New test source file.
1394
1395 2012-04-25 Ian Lance Taylor <iant@google.com>
1396
1397 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1398 pointer.
1399 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1400 as a class, not a struct.
1401 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1402 (Target_arm::apply_cortex_a8_workaround): Likewise.
1403 * gc.h: Declare Reloc_types as a struct, not a class.
1404 * object.h: Declare Symbols_data as a struct.
1405 * reloc.h: Declare Read_relocs_data as a struct.
1406 * target.h: Declare Relocate_info as a struct.
1407
1408 2012-04-24 David S. Miller <davem@davemloft.net>
1409
1410 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1411 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1412 and R_SPARC_WPLT30.
1413
1414 2012-04-24 Cary Coutant <ccoutant@google.com>
1415
1416 * incremental-dump.cc (find_input_containing_global): Replace
1417 magic number with symbolic constant.
1418 (dump_incremental_inputs): Update version number.
1419 * incremental.cc (Output_section_incremental_inputs): Update version
1420 number; import symbolic constants from Incremental_inputs_reader.
1421 (Incremental_inputs::create_data_sections): Align relocations
1422 section correctly for 64-bit targets.
1423 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1424 constants; add padding.
1425 (Output_section_incremental_inputs::write_header): Add assert for
1426 header_size.
1427 (Output_section_incremental_inputs::write_input_files): Add assert
1428 for input_entry_size.
1429 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1430 add assert for object_info_size, input_section_entry_size,
1431 global_sym_entry_size.
1432 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1433 for data structure sizes; use them.
1434 (Incremental_input_entry_reader): Import symbolic constants from
1435 Incremental_inputs_reader; use them.
1436
1437 2012-04-23 David S. Miller <davem@davemloft.net>
1438
1439 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1440 and elf_flags_set_.
1441 (Target_sparc::Target_sparc): Initialize new fields.
1442 (Target_sparc::do_make_elf_object): New function.
1443 (Target_sparc::do_adjust_elf_header): New function.
1444
1445 2012-04-23 Cary Coutant <ccoutant@google.com>
1446
1447 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1448 CU range table of gdb index.
1449
1450 2012-04-20 David S. Miller <davem@davemloft.net>
1451
1452 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1453 instead of false.
1454
1455 2012-04-16 David S. Miller <davem@davemloft.net>
1456
1457 * sparc.cc (Target_sparc::got_address): New function.
1458 (Sparc_relocate_functions::gdop_hix22): New function.
1459 (Sparc_relocate_functions::gdop_lox10): New function.
1460 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1461 relocs.
1462 (Target_sparc::Scan::local): Likewise if the global symbol is not
1463 preemptible and is not IFUNC.
1464 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1465 transformations for local and non-preemptible non-IFUNC global
1466 symbols.
1467
1468 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1469 writing out 64-bit part of ranges.
1470
1471 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1472 -fpic and -fpie respectively.
1473 * Makefile.in: Regenerate.
1474
1475 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1476 (Target_sparc::Target_sparc): Initialize new field.
1477 (Target_sparc::do_plt_section_for_global): New function.
1478 (Target_sparc::do_plt_section_for_local): New function.
1479 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1480 (Target_sparc::make_plt_section): New function, broken out of
1481 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1482 (Target_sparc::make_plt_entry): Call make_plt_section.
1483 (Target_sparc::make_local_ifunc_plt_entry): New function.
1484 (Target_sparc::rela_ifunc_section): New function.
1485 (Target_sparc::plt_section): Remove const.
1486 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1487 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1488 and ifunc_count_ fields.
1489 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1490 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1491 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1492 (Output_data_plt_sparc::rela_ifunc): New function.
1493 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1494 (Output_data_plt_sparc::has_ifunc_section): New function.
1495 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1496 (Output_data_plt_sparc::address_for_global): New function.
1497 (Output_data_plt_sparc::address_for_local): New function.
1498 (Output_data_plt_sparc::plt_index_to_offset): New function.
1499 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1500 and entry_count.
1501 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1502 entry_count.
1503 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1504 R_SPARC_JMP_IREL to switch.
1505 (Target_sparc::Scan::check_non_pic): Likewise.
1506 (Target_sparc::Scan::local): Handle IFUNC symbols.
1507 (Target_sparc::Scan::local): Likewise.
1508 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1509 and plt_address_for_local.
1510 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1511 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1512
1513 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1514 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1515 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1516 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1517 global relocs too.
1518 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1519 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1520 calls.
1521 * sparc.cc (Target_sparc::Scan::global): Likewise.
1522 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1523
1524 2012-04-16 Cary Coutant <ccoutant@google.com>
1525
1526 * archive.cc (Library_base::should_include_member): Check for
1527 --export-dynamic-symbol.
1528 * options.h (class General_options): Add --export-dynamic-symbol.
1529 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1530 --export-dynamic-symbol.
1531 (Symbol_table::gc_mark_undef_symbols): Likewise.
1532 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1533
1534 2012-04-12 David S. Miller <davem@davemloft.net>
1535
1536 * sparc.cc (Reloc::wdisp10): New relocation method.
1537 (Reloc::h34): Likewise.
1538 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1539 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1540 R_SPARC_WDISP10.
1541 (Target_sparc::Scan::local): Likewise.
1542 (Target_sparc::Scan::global): Likewise.
1543 (Target_sparc::Relocate::relocate): Likewise.
1544
1545 2012-04-09 Cary Coutant <ccoutant@google.com>
1546
1547 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1548 low_pc == 0.
1549
1550 2012-04-06 Ian Lance Taylor <iant@google.com>
1551
1552 * timer.cc: #include <unistd.h>.
1553
1554 2012-04-06 Roland McGrath <mcgrathr@google.com>
1555
1556 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1557 * config.in: Regenerate.
1558 * configure: Regenerate.
1559
1560 2012-04-05 Nick Clifton <nickc@redhat.com>
1561
1562 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1563 (AM_LC_MESSAGES): Add.
1564 * aclocal.m4: Regenerate.
1565 * config.in: Regenerate.
1566 * configure: Regenerate.
1567
1568 2012-03-21 Cary Coutant <ccoutant@google.com>
1569
1570 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1571 * Makefile.in: Regenerate.
1572 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1573 (Sized_elf_reloc_mapper::symbol_section): New function.
1574 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1575 (make_elf_reloc_mapper): New function.
1576 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1577 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1578 (Dwarf_abbrev_table::do_get_abbrev): New function.
1579 (Dwarf_ranges_table::read_ranges_table): New function.
1580 (Dwarf_ranges_table::read_range_list): New function.
1581 (Dwarf_pubnames_table::read_section): New function.
1582 (Dwarf_pubnames_table::read_header): New function.
1583 (Dwarf_pubnames_table::next_name): New function.
1584 (Dwarf_die::Dwarf_die): New function.
1585 (Dwarf_die::read_attributes): New function.
1586 (Dwarf_die::skip_attributes): New function.
1587 (Dwarf_die::set_name): New function.
1588 (Dwarf_die::set_linkage_name): New function.
1589 (Dwarf_die::attribute): New function.
1590 (Dwarf_die::string_attribute): New function.
1591 (Dwarf_die::int_attribute): New function.
1592 (Dwarf_die::uint_attribute): New function.
1593 (Dwarf_die::ref_attribute): New function.
1594 (Dwarf_die::child_offset): New function.
1595 (Dwarf_die::sibling_offset): New function.
1596 (Dwarf_info_reader::check_buffer): New function.
1597 (Dwarf_info_reader::parse): New function.
1598 (Dwarf_info_reader::do_parse): New function.
1599 (Dwarf_info_reader::do_read_string_table): New function.
1600 (Dwarf_info_reader::lookup_reloc): New function.
1601 (Dwarf_info_reader::get_string): New function.
1602 (Dwarf_info_reader::visit_compilation_unit): New function.
1603 (Dwarf_info_reader::visit_type_unit): New function.
1604 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1605 Sized_elf_reloc_mapper.
1606 (Sized_dwarf_line_info::symbol_section): Remove function.
1607 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1608 (Sized_dwarf_line_info::read_line_mappings): Remove object
1609 parameter, adjust callers.
1610 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1611 * dwarf_reader.h: Include <sys/types.h>.
1612 (class Track_relocs): Remove forward declaration.
1613 (class Elf_reloc_mapper): New class.
1614 (class Sized_elf_reloc_mapper): New class.
1615 (class Dwarf_abbrev_table): New class.
1616 (class Dwarf_range_list): New class.
1617 (class Dwarf_ranges_table): New class.
1618 (class Dwarf_pubnames_table): New class.
1619 (class Dwarf_die): New class.
1620 (class Dwarf_info_reader): New class.
1621 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1622 (Sized_dwarf_line_info::symbol_section): Remove member function.
1623 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1624 base class.
1625 * gdb-index.cc: New source file.
1626 * gdb-index.h: New source file.
1627 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1628 and .debug_types sections, call Layout::add_to_gdb_index.
1629 (Sized_relobj_incr::do_section_name): Implement.
1630 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1631 return type; Implement.
1632 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1633 return type.
1634 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1635 parameter list and return type.
1636 (Sized_incr_dynobj::do_section_contents): Likewise.
1637 * layout.cc: Include gdb-index.h.
1638 (Layout::Layout): Initialize gdb_index_data_.
1639 (Layout::init_fixed_output_section): Check for .gdb_index section.
1640 (Layout::add_to_gdb_index): New function. Instantiate.
1641 * layout.h: Add forward declaration for class Gdb_index.
1642 (Layout::add_to_gdb_index): New member function.
1643 (Layout::gdb_index_data_): New data member.
1644 * main.cc: Include gdb-index.h.
1645 (main): Print statistics for gdb index.
1646 * object.cc (Object::section_contents): Move code into
1647 do_section_contents.
1648 (need_decompressed_section): Check for sections needed when building
1649 gdb index.
1650 (build_compressed_section_map): Likewise.
1651 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1652 gdb index.
1653 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1654 sections; call Layout::add_to_gdb_index.
1655 (Sized_relobj_file::do_decompressed_section_contents): Call
1656 do_section_contents directly.
1657 * object.h (Object::do_section_contents): Adjust parameter list and
1658 return type.
1659 (Object::do_decompressed_section_contents): Call do_section_contents
1660 directly.
1661 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1662 return type.
1663 * options.h (class General_options): Add --gdb-index option.
1664 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1665 list and return type.
1666 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1667 * reloc.h (Track_relocs::checkpoint): New function.
1668 (Track_relocs::reset): New function.
1669
1670 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1671 New test cases.
1672 * testsuite/Makefile.in: Regenerate.
1673 * testsuite/gdb_index_test.cc: New test source file.
1674 * testsuite/gdb_index_test_1.sh: New test source file.
1675 * testsuite/gdb_index_test_2.sh: New test source file.
1676
1677 2012-03-19 Doug Kwan <dougkwan@google.com>
1678
1679 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1680 (Target_arm::do_finalize_sections): Remove code which defines
1681 __exidx_start and __exidx_end. Make symbol table parameter
1682 anonymous as it is not used.
1683 * gold.cc (queue_middle_tasks): Call target hook to define any
1684 target-specific symbols.
1685 * target.h (Target::define_standard_symbols): New method.
1686 (Target::do_define_standard_symbols): Same.
1687 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1688 * testsuite/Makefile.in: Regenerate.
1689 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1690 and __exidx_end.
1691 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1692 relocations are generated for __exidx_start and __exidx_end.
1693
1694 2012-03-16 Doug Kwan <dougkwan@google.com>
1695
1696 * testsuite/Makefile.am: Disable test initpri3b.
1697 * testsuite/Makefile.in: Regenerate.
1698
1699 2012-03-15 Doug Kwan <dougkwan@google.com>
1700
1701 * arm.cc (Target_arm::got_section): Make .got section read-only
1702 if -z now is given.
1703
1704 2012-03-15 Ian Lance Taylor <iant@google.com>
1705
1706 PR gold/13850
1707 * layout.cc (Layout::make_output_section): Correctly mark
1708 SHT_INIT_ARRAY, et. al., as relro.
1709
1710 2012-03-14 Doug Kwan <dougkwan@google.com>
1711
1712 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1713 dynamic relocations for protected symbols in shared objects.
1714
1715 2012-03-13 Ian Lance Taylor <iant@google.com>
1716
1717 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1718 keep the larger alignment.
1719
1720 2012-03-12 Cary Coutant <ccoutant@google.com>
1721
1722 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1723 handling of DW_LNE_define_file.
1724
1725 2012-03-12 Cary Coutant <ccoutant@google.com>
1726
1727 * reduced_debug_output.cc
1728 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1729 codes to switch.
1730
1731 2012-02-29 Cary Coutant <ccoutant@google.com>
1732
1733 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1734
1735 2012-02-29 Cary Coutant <ccoutant@google.com>
1736
1737 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1738 Call Object::decompressed_section_contents.
1739 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1740 New dtor.
1741 (Sized_dwarf_line_info::buffer_start_): New data member.
1742 * merge.cc (Output_merge_data::do_add_input_section): Call
1743 Object::decompressed_section_contents.
1744 (Output_merge_string::do_add_input_section): Likewise.
1745 * object.cc (need_decompressed_section): New function.
1746 (build_compressed_section_map): Decompress sections needed later.
1747 (Sized_relobj_file::do_decompressed_section_contents): New function.
1748 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1749 * object.h (Object::decompressed_section_contents): New function.
1750 (Object::discard_decompressed_sections): New function.
1751 (Object::do_decompressed_section_contents): New function.
1752 (Object::do_discard_decompressed_sections): New function.
1753 (Compressed_section_info): New type.
1754 (Compressed_section_map): Include decompressed section contents.
1755 (Sized_relobj_file::do_decompressed_section_contents): New function.
1756 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1757
1758 2012-02-16 Cary Coutant <ccoutant@google.com>
1759
1760 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1761 * testsuite/Makefile.in: Regenerate.
1762
1763 2012-02-14 Cary Coutant <ccoutant@google.com>
1764
1765 * options.cc (General_options::finalize): Disallow -pie and -static.
1766
1767 2012-02-03 Doug Kwan <dougkwan@google.com>
1768
1769 * arm.cc (Arm_relocate_functions::abs8,
1770 Arm_relocate_functions::abs16): Use
1771 Bits::has_signed_unsigned_overflow32.
1772 (Arm_relocate_functions::thm_abs8): Correct range of
1773 overflow check.
1774 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1775 in assertions.
1776
1777 2012-02-02 Doug Kwan <dougkwan@google.com>
1778
1779 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1780 position independent outputs, not just shared objects.
1781
1782 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1783
1784 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1785 * configure: Regenerated.
1786
1787 2012-01-27 Ian Lance Taylor <iant@google.com>
1788
1789 * reloc.h (Bits): New class with static functions, copied from
1790 namespace utils in arm.cc.
1791 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1792 instead.
1793
1794 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1795
1796 * incremental.cc (write_info_blocks): Correct relocation offset.
1797
1798 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1799
1800 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1801 (Relocate::tls_gd_to_le): Likewise.
1802
1803 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1804
1805 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1806
1807 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1808
1809 * configure.ac: Check if -mcmodel=medium works.
1810 * configure: Regenerated.
1811
1812 2012-01-24 Cary Coutant <ccoutant@google.com>
1813
1814 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1815 definition and ...
1816 (read_unsigned_LEB_128_x): ... this new function.
1817 (read_signed_LEB_128): Replaced with inline definition and ...
1818 (read_signed_LEB_128_x): ... this new function.
1819 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1820 (read_unsigned_LEB_128): Add inline definition.
1821 (read_signed_LEB_128_x): New function.
1822 (read_signed_LEB_128): Add inline definition.
1823 * testsuite/Makefile.am (leb128_unittest): New unit test.
1824 * testsuite/Makefile.in: Regenerate.
1825 * testsuite/leb128_unittest.cc: New unit test.
1826
1827 2012-01-23 Ian Lance Taylor <iant@google.com>
1828
1829 PR gold/13617
1830 * i386.cc (Target_i386::do_code_fill): When using a jmp
1831 instruction, pad with nop instructions.
1832 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1833
1834 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1835
1836 * x86_64.cc (gc_process_relocs): Add typename on types used in
1837 template.
1838 (scan_relocs): Likewise.
1839 (relocate_section): Likewise.
1840 (apply_relocation): Likewise.
1841
1842 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1843
1844 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1845 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1846 under x32.
1847
1848 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1849
1850 * x86_64.cc: Initial support for x32.
1851
1852 2012-01-03 Cary Coutant <ccoutant@google.com>
1853
1854 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1855 Use abstract base class for GOT.
1856 * gold/output.h (class Output_data_got_base): New abstract base class.
1857 (class Output_data_got): Derive from new base class, adjust ctors.
1858 (Output_data_got::reserve_slot): Make virtual; rename to
1859 do_reserve_slot; Adjust callers.
1860 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1861 pointer to abstract base class.
1862 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1863
1864 2011-12-18 Ian Lance Taylor <iant@google.com>
1865
1866 * object.h (Relobj::local_symbol_value): New function.
1867 (Relobj::local_plt_offset): New function.
1868 (Relobj::local_has_got_offset): New function.
1869 (Relobj::local_got_offset): New function.
1870 (Relobj::set_local_got_offset): New function.
1871 (Relobj::do_local_symbol_value): New pure virtual function.
1872 (Relobj::do_local_plt_offset): Likewise.
1873 (Relobj::do_local_has_got_offset): Likewise.
1874 (Relobj::do_local_got_offset): Likewise.
1875 (Relobj::do_set_local_got_offset): Likewise.
1876 (Sized_relobj::do_local_has_got_offset): Rename from
1877 local_has_got_offset.
1878 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1879 (Sized_relobj::do_set_local_got_offset): Rename from
1880 set_local_got_offset.
1881 (Sized_relobj_file::do_local_plt_offset): Rename from
1882 local_plt_offset.
1883 (Sized_relobj_file::do_local_symbol_value): New function.
1884 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1885 local_plt_offset.
1886 * output.cc (Output_data_got::Got_entry::write): Change object to
1887 Relobj. Use local_symbol_value.
1888 (Output_data_got::add_global_with_rel): Change rel_dyn to
1889 Output_data_reloc_generic*. Use add_global_generic.
1890 (Output_data_got::add_global_with_rela): Remove. Change all
1891 callers to use add_global_with_rel.
1892 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1893 Output_data_reloc_generic*. Use add_global_generic.
1894 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1895 callers to use add_global_pair_with_rel.
1896 (Output_data_got::add_local): Change object to Relobj*.
1897 (Output_data_got::add_local_plt): Likewise.
1898 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1899 change rel_dyn to Output_data_reloc_generic*. Use
1900 add_local_generic.
1901 (Output_data_got::add_local_with_rela): Remove. Change all
1902 callers to use all_local_with_rel.
1903 (Output_data_got::add_local_pair_with_rel): Change object to
1904 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1905 add_output_section_generic.
1906 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1907 callers to use add_local_pair_with_rel.
1908 (Output_data_got::reserve_local): Change object to Relobj*.
1909 * output.h: (class Output_data_reloc_generic): Add pure virtual
1910 declarations for add_global_generic, add_local_generic,
1911 add_output_section_generic.
1912 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1913 functions for Output_data_reloc_generic. Update declarations for
1914 changes listed in output.cc.
1915 (class Output_data_got): Change template parameter to got_size.
1916 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1917 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1918 function.
1919 (Sized_relobj_incr::do_local_plt_offset): New function.
1920 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1921 add_global_generic.
1922
1923 2011-12-17 Cary Coutant <ccoutant@google.com>
1924
1925 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1926 * resolve.cc (Symbol_table::resolve): Likewise.
1927 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1928 arrays.
1929 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1930
1931 2011-12-16 Ian Lance Taylor <iant@google.com>
1932
1933 * output.h (Output_data_reloc_generic::add): Only call
1934 add_dynamic_reloc if this is a dynamic reloc section.
1935
1936 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1937
1938 PR gold/13505
1939 * target-reloc.h (apply_relocation): Replace <64, false> with
1940 <size, big_endian>.
1941
1942 2011-11-25 Nick Clifton <nickc@redhat.com>
1943
1944 * po/it.po: New Italian translation.
1945
1946 2011-11-17 Sterling Augustine <saugustine@google.com>
1947
1948 * script.cc (script_include_directive): Implement.
1949 (read_script_file): New local variables name and search_path. Update
1950 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1951 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1952 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1953
1954 2011-11-11 Sterling Augustine <saugustine@google.com>
1955
1956 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1957 (file_or_sections_cmd): Likewise.
1958
1959 2011-11-11 Doug Kwan <dougkwan@google.com>
1960
1961 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1962 if --just-symbols is given.
1963
1964 2011-11-10 Doug Kwan <dougkwan@google.com>
1965
1966 PR gold/13362
1967 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1968 when processing data relocs.
1969 * reloc.h (Relocate_functions::rel_unaligned): New method.
1970 (Relocate_functions::pcrel_unaligned): Ditto.
1971 (Relocate_functions::rel32_unaligned): Ditto.
1972 (Relocate_functions::pcrel32_unaligned): Ditto.
1973
1974 2011-11-09 Doug Kwan <dougkwan@google.com>
1975
1976 PR gold/13362
1977 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1978 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1979 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1980 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1981 (Relocate_functions::rel_unaligned): New.
1982 (Relocate_functions::rel32_unaligned): New.
1983 * target-reloc.h (relocate_for_relocatable): Add code to handle
1984 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1985 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1986 arm_unaligned_reloc_r): New targets.
1987 * testsuite/Makefile.in: Regenerate.
1988 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1989 linking.
1990
1991 2011-11-02 Ian Lance Taylor <iant@google.com>
1992
1993 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1994 NATIVE_LINKER.
1995 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1996 * options.cc (General_options::finalize): Use library search path
1997 from configure script if specified. If not native and no sysroot,
1998 only search TOOLLIBDIR.
1999 * options.h (Search_directory::Search_directory): Change name to
2000 const std::string&.
2001 (General_options::add_to_library_path_with_sysroot): Change arg to
2002 const std::string&.
2003 * configure, Makefile.in, config.in: Rebuild.
2004
2005 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2006
2007 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2008 we are working around the ARM1176 Erratum.
2009 * options.h (General_options::fix_arm1176): Add option.
2010 * testsuite/Makefile.am: Add testcases, and keep current ones
2011 working.
2012 * testsuite/Makefile.in: Regenerate.
2013 * testsuite/arm_fix_1176.s: New file.
2014 * testsuite/arm_fix_1176.sh: Likewise.
2015
2016 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2017
2018 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2019 may_use_blx_.
2020 (Target_arm::may_use_blx): Remove method.
2021 (Target_arm::set_may_use_blx): Likewise.
2022 (Target_arm::may_use_v4t_interworking): New method.
2023 (Target_arm::may_use_v5t_interworking): Likewise.
2024 (Target_arm::may_use_blx_): Remove member variable.
2025 (Arm_relocate_functions::arm_branch_common): Check for v5T
2026 interworking.
2027 (Arm_relocate_functions::thumb_branch_common): Likewise.
2028 (Reloc_stub::stub_type_for_reloc): Likewise.
2029 (Target_arm::do_finalize_sections): Correct interworking checks.
2030 * testsuite/Makefile.am: Add new tests.
2031 * testsuite/Makefile.in: Regenerate.
2032 * testsuite/arm_farcall_arm_arm.s: New test.
2033 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2034 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2035 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2036 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2037 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2038 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2039 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2040
2041 2011-10-31 Cary Coutant <ccoutant@google.com>
2042
2043 PR gold/13023
2044 * expression.cc (Expression::eval_with_dot): Add
2045 is_section_dot_assignment parameter.
2046 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2047 absolute and assigning to dot within a section.
2048 * script-sections.cc
2049 (Output_section_element_assignment::set_section_addresses): Pass
2050 dot_section to set_if_absolute.
2051 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2052 as is_section_dot_assignment flag to eval_with_dot.
2053 (Output_section_element_dot_assignment::set_section_addresses):
2054 Likewise.
2055 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2056 parameter. Also set value if relative to dot_section; set the
2057 symbol's output_section.
2058 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2059 parameter. Adjust all callers.
2060 (Expression::eval_maybe_dot): Likewise.
2061 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2062 Adjust all callers.
2063 * testsuite/script_test_2.t: Test assignment of an absolute value
2064 to dot within an output section element.
2065
2066 2011-10-31 Cary Coutant <ccoutant@google.com>
2067
2068 * options.h (class General_options): Add --[no-]gnu-unique options.
2069 * symtab.cc (Symbol_table::sized_write_globals): Convert
2070 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2071
2072 2011-10-31 Cary Coutant <ccoutant@google.com>
2073
2074 PR gold/13359
2075 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2076 unnecessary assertion.
2077 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2078
2079 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2080
2081 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2082 gc_mark_symbol.
2083 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2084 gc_mark_symbol.
2085 Change to just keep the section associated with symbol.
2086 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2087 they are externally visible and --export-dynamic is turned on.
2088 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2089
2090 2011-10-19 Ian Lance Taylor <iant@google.com>
2091
2092 PR gold/13163
2093 * script-sections.cc
2094 (Output_section_element_dot_assignment::needs_output_section): New
2095 function.
2096
2097 2011-10-19 Ian Lance Taylor <iant@google.com>
2098
2099 PR gold/13204
2100 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2101 --section-start option was seen.
2102 * options.h (General_options::any_section_start): New function.
2103
2104 2011-10-18 David S. Miller <davem@davemloft.net>
2105
2106 PR binutils/13301
2107 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2108 member to track relocation locations that have moved during TLS
2109 reloc optimizations.
2110 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2111 (Target_sparc::Relocate::relocate): Adjust view down by 4
2112 bytes if it matches reloc_adjust_addr_.
2113 (Target_sparc::Relocate::relocate_tls): Always move the
2114 __tls_get_addr call delay slot instruction forward 4 bytes when
2115 performing relaxation.
2116
2117 2011-10-18 Cary Coutant <ccoutant@google.com>
2118
2119 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2120 (Output_file::map_no_anonymous): Check for non-zero
2121 return code from posix_fallocate.
2122
2123 2011-10-17 Cary Coutant <ccoutant@google.com>
2124
2125 PR gold/13245
2126 * plugin.cc (is_visible_from_outside): Check for symbols
2127 referenced from dynamic objects.
2128 * resolve.cc (Symbol_table::resolve): Don't count references
2129 from dynamic objects as references from real ELF files.
2130 * testsuite/plugin_test_2.sh: Adjust expected result.
2131
2132 2011-10-17 Cary Coutant <ccoutant@google.com>
2133
2134 * gold.cc: Include timer.h.
2135 (queue_middle_tasks): Stamp time.
2136 (queue_final_tasks): Likewise.
2137 * main.cc (main): Store timer in parameters. Print timers
2138 for each pass.
2139 * parameters.cc (Parameters::Parameters): Initialize timer_.
2140 (Parameters::set_timer): New function.
2141 (set_parameters_timer): New function.
2142 * parameters.h (Parameters::set_timer): New function.
2143 (Parameters::timer): New function.
2144 (Parameters::timer_): New data member.
2145 (set_parameters_timer): New function.
2146 * timer.cc (Timer::stamp): New function.
2147 (Timer::get_pass_time): New function.
2148 * timer.h (Timer::stamp): New function.
2149 (Timer::get_pass_time): New function.
2150 (Timer::pass_times_): New data member.
2151
2152 2011-10-17 Cary Coutant <ccoutant@google.com>
2153
2154 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2155 task for members of lib groups.
2156
2157 2011-10-17 Cary Coutant <ccoutant@google.com>
2158
2159 PR gold/13288
2160 * fileread.cc (File_read::find_view): Add assert.
2161 (File_read::make_view): Move bounds check (replace with assert)...
2162 (File_read::find_or_make_view): ... to here.
2163
2164 2011-10-12 Cary Coutant <ccoutant@google.com>
2165
2166 * output.cc (Output_file::open_base_file): Handle case where
2167 ::read returns less than requested size.
2168
2169 2011-10-10 Cary Coutant <ccoutant@google.com>
2170
2171 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2172 Initialize defined_count_.
2173 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2174 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2175 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2176 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2177 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2178 * incremental.h (Sized_relobj_incr::defined_count_): New data
2179 member.
2180 (Sized_incr_dynobj::defined_count_): New data member.
2181 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2182 Return zeroes instead of internal error.
2183
2184 2011-10-10 Cary Coutant <ccoutant@google.com>
2185
2186 PR gold/13249
2187 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2188 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2189 * output.h (class Output_reloc): Add use_plt_offset flag.
2190 (Output_reloc::type_): Adjust size of bit field.
2191 (Output_reloc::use_plt_offset_): New bit field.
2192 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2193 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2194 flag. Adjust all callers.
2195 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2196 creating RELATIVE relocations.
2197
2198 2011-10-10 Nick Clifton <nickc@redhat.com>
2199
2200 * po/es.po: Updated Spanish translation.
2201 * po/fi.po: Updated Finnish translation.
2202
2203 2011-10-03 Diego Novillo <dnovillo@google.com>
2204
2205 * options.cc (parse_uint): Fix dereference of RETVAL.
2206
2207 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2208
2209 * layout.h (section_order_map_): New member.
2210 (get_section_order_map): New member function.
2211 * output.cc (Output_section::add_input_section): Check for patterns
2212 only when --section-ordering-file is specified.
2213 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2214 output_sections have been formed.
2215 * layout.cc (Layout_Layout): Initialize section_order_map_.
2216 * plugin.cc (update_section_order): Store order in order_map. Do not
2217 update the order.
2218 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2219 * testsuite/Makefile.in: Regenerate.
2220 * testsuite/plugin_section_order.c: New file.
2221 * testsuite/plugin_final_layout.cc: New file.
2222 * testsuite/plugin_final_layout.sh: New file.
2223
2224 2011-09-29 Cary Coutant <ccoutant@google.com>
2225
2226 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2227 Check for NULL.
2228 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2229 symbols during incremental update.
2230 (Symbol_table::add_from_dynobj): Likewise.
2231
2232 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2233 Ian Lance Taylor <iant@google.com>
2234
2235 * symtab.cc (Symbol_table::define_special_symbol): Always
2236 canonicalize version string.
2237
2238 2011-09-26 Cary Coutant <ccoutant@google.com>
2239
2240 * gold.cc (queue_initial_tasks): Move option checks ...
2241 * options.cc (General_options::finalize): ... to here. Disable
2242 some options; make others fatal.
2243
2244 2011-09-26 Cary Coutant <ccoutant@google.com>
2245
2246 gcc PR lto/47247
2247 * plugin.cc (get_symbols_v2): New function.
2248 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2249 (is_referenced_from_outside): New function.
2250 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2251 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2252 (get_symbols): Pass version parameter.
2253 (get_symbols_v2): New function.
2254 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2255 parameter.
2256 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2257 (onload): Add LDPT_GET_SYMBOLS_V2.
2258 (all_symbols_read_hook): Use get_symbols_v2; check for
2259 LDPR_PREVAILING_DEF_IRONLY_EXP.
2260 * testsuite/plugin_test_3.sh: Update expected results.
2261
2262 2011-09-23 Simon Baldwin <simonb@google.com>
2263
2264 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2265 configuration options.
2266 * configure: Regenerate.
2267 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2268 * Makefile.in: Regenerate.
2269 * testsuite/Makefile.in: Regenerate.
2270
2271 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2272
2273 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2274
2275 2011-09-19 Cary Coutant <ccoutant@google.com>
2276
2277 * incremental.cc (can_incremental_update): Fix typo in comment.
2278 * incremental.h (can_incremental_update): Likewise.
2279
2280 2011-09-18 Cary Coutant <ccoutant@google.com>
2281
2282 * incremental.cc (can_incremental_update): New function.
2283 * incremental.h (can_incremental_update): New function.
2284 * layout.cc (Layout::init_fixed_output_section): Call it.
2285 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2286 * object.cc (Sized_relobj_file::do_layout): Call
2287 can_incremental_update.
2288
2289 2011-09-13 Cary Coutant <ccoutant@google.com>
2290
2291 * configure.ac: Check for glibc support for gnu_indirect_function
2292 support with static linking, setting automake conditional
2293 IFUNC_STATIC.
2294 * Makefile.in: Regenerate.
2295 * configure: Regenerate.
2296
2297 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2298 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2299 for IFUNC_STATIC.
2300 * testsuite/Makefile.in: Regenerate.
2301
2302 2011-09-13 Cary Coutant <ccoutant@google.com>
2303
2304 * incremental.cc (Sized_relobj_incr::do_layout): Call
2305 report_comdat_group for kept comdat sections.
2306 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2307 * testsuite/Makefile.in: Regenerate.
2308 * testsuite/incr_comdat_test_1.cc: New source file.
2309 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2310 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2311 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2312
2313 2011-09-13 Ian Lance Taylor <iant@google.com>
2314
2315 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2316 variable external_symbols_offset.
2317
2318 2011-09-12 Ian Lance Taylor <iant@google.com>
2319
2320 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2321 triggered if object has no symbols.
2322
2323 2011-09-09 David S. Miller <davem@davemloft.net>
2324
2325 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2326 (Output_fill_debug_line::do_write): Likewise.
2327
2328 2011-08-29 Cary Coutant <ccoutant@google.com>
2329
2330 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2331 casts to match formatting specs.
2332 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2333
2334 2011-08-26 Cary Coutant <ccoutant@google.com>
2335
2336 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2337 remaining hole size when allocating.
2338 (Layout::make_output_section): Set fill methods for debug sections.
2339 * layout.h (Free_list::Free_list_node): Move from private to
2340 public.
2341 (Free_list::set_min_hole_size): New function.
2342 (Free_list::begin, Free_list::end): New functions.
2343 (Free_list::min_hole_): New data member.
2344 * output.cc: Include dwarf.h.
2345 (Output_fill_debug_info::do_minimum_hole_size): New function.
2346 (Output_fill_debug_info::do_write): New function.
2347 (Output_fill_debug_line::do_minimum_hole_size): New function.
2348 (Output_fill_debug_line::do_write): New function.
2349 (Output_section::Output_section): Initialize new data member.
2350 (Output_section::set_final_data_size): Ensure patch space is larger
2351 than minimum hole size.
2352 (Output_section::do_write): Fill holes in debug sections.
2353 * output.h (Output_fill): New class.
2354 (Output_fill_debug_info): New class.
2355 (Output_fill_debug_line): New class.
2356 (Output_section::set_free_space_fill): New function.
2357 (Output_section::free_space_fill_): New data member.
2358 * testsuite/Makefile.am (incremental_test_3): Add
2359 --incremental-patch option.
2360 (incremental_test_4): Likewise.
2361 (incremental_test_5): Likewise.
2362 (incremental_test_6): Likewise.
2363 (incremental_copy_test): Likewise.
2364 (incremental_common_test_1): Likewise.
2365 * testsuite/Makefile.in: Regenerate.
2366
2367 2011-08-26 Nick Clifton <nickc@redhat.com>
2368
2369 * po/es.po: Updated Spanish translation.
2370
2371 2011-08-01 Cary Coutant <ccoutant@google.com>
2372
2373 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2374 * gold/testsuite/Makefile.in: Regenerate.
2375 * gold/testsuite/justsyms_exec.c: New source file.
2376 * gold/testsuite/justsyms_lib.c: New source file.
2377
2378 2011-08-01 Cary Coutant <ccoutant@google.com>
2379
2380 * layout.cc (Layout::set_segment_offsets): Don't realign text
2381 segment if -Ttext was specified.
2382 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2383 file type.
2384 * object.h (Sized_relobj_file::e_type): New function.
2385 (Sized_relobj_file::e_type_): New data member.
2386 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2387 base address for ET_EXEC files.
2388 * target.cc (Target::do_make_elf_object_implementation): Allow
2389 ET_EXEC files with --just-symbols option.
2390
2391 2011-07-28 Cary Coutant <ccoutant@google.com>
2392
2393 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2394 Add thread_number parameter.
2395 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2396 * workqueue-threads.cc
2397 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2398 current thread if its thread number is greater than desired thread
2399 count.
2400 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2401 Add thread_number parameter.
2402 (Workqueue::should_cancel_thread): Likewise.
2403 (Workqueue::find_runnable_or_wait): Pass thread_number to
2404 should_cancel_thread.
2405 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2406 parameter.
2407
2408 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2409
2410 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2411 only after checking if it cannot be forced local.
2412 * symtab.h (is_externally_visible): Check if the symbol is not forced
2413 local.
2414
2415 2011-07-15 Ian Lance Taylor <iant@google.com>
2416
2417 * options.h (class General_options): Add --print-output-format.
2418 Move -EL next to -EB, for better --help output.
2419 * target-select.cc: Include <cstdio>, "options.h", and
2420 "parameters.h".
2421 (Target_selector::do_target_bfd_name): New function.
2422 (print_output_format): New function.
2423 * target-select.h (class Target_selector): Update declarations.
2424 (Target_selector::target_bfd_name): New function.
2425 (print_output_format): Declare.
2426 * main.cc: Include "target-select.h".
2427 (main): Handle --print-output-format.
2428 * gold.cc: Include "target-select.h".
2429 (queue_initial_tasks): Handle --print-output-format when there are
2430 no input files.
2431 * parameters.cc (parameters_force_valid_target): Give a better
2432 error message if -EB/-EL does not match target.
2433 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2434 function.
2435
2436 2011-07-15 Ian Lance Taylor <iant@google.com>
2437
2438 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2439 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2440 (Output_data_plt_i386::do_write): Write address of .dynamic
2441 section to first entry in .got.plt section.
2442 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2443 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2444 Initialize layout_.
2445 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2446 section to first entry in .got.plt section.
2447 * layout.h (Layout::dynamic_section): New function.
2448
2449 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2450
2451 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2452 to claim_file call.
2453 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2454 input_section_position_, and input_section_glob_.
2455 (read_layout_from_file): Call function section_ordering_specified.
2456 * layout.h (is_section_ordering_specified): New function.
2457 (section_ordering_specified): New function.
2458 (section_ordering_specified_): New boolean member.
2459 * main.cc(main): Call load_plugins after layout object is defined.
2460 * output.cc (Output_section::add_input_section): Use
2461 function section_ordering_specified to check if section ordering is
2462 needed.
2463 * output.cc (Output_section::add_relaxed_input_section): Use
2464 function section_ordering_specified to check if section ordering is
2465 needed.
2466 (Output_section::update_section_layout): New function.
2467 (Output_section::sort_attached_input_sections): Check if input section
2468 must be reordered.
2469 * output.h (Output_section::update_section_layout): New function.
2470 * plugin.cc (get_section_count): New function.
2471 (get_section_type): New function.
2472 (get_section_name): New function.
2473 (get_section_contents): New function.
2474 (update_section_order): New function.
2475 (allow_section_ordering): New function.
2476 (Plugin::load): Add the new interfaces to the transfer vector.
2477 (Plugin_manager::load_plugins): New parameter.
2478 (Plugin_manager::all_symbols_read): New parameter.
2479 (Plugin_manager::claim_file): New parameter. Save the elf object for
2480 unclaimed objects.
2481 (Plugin_manager::get_elf_object): New function.
2482 (Plugin_manager::get_view): Change to directly use the bool to check
2483 if get_view is called from claim_file_hook.
2484 * plugin.h (input_objects): New function
2485 (Plugin__manager::load_plugins): New parameter.
2486 (Plugin_manager::claim_file): New parameter.
2487 (Plugin_manager::get_elf_object): New function.
2488 (Plugin_manager::in_claim_file_handler): New function.
2489 (Plugin_manager::in_claim_file_handler_): New member.
2490 (layout): New function.
2491 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2492 handler with an extra parameter. Make the elf object before calling
2493 claim_file handler.
2494 * testsuite/plugin_test.c (get_section_count): New function pointer.
2495 (get_section_type): New function pointer.
2496 (get_section_name): New function pointer.
2497 (get_section_contents): New function pointer.
2498 (update_section_order): New function pointer.
2499 (allow_section_ordering): New function pointer.
2500 (onload): Check if the new interfaces exist.
2501
2502 2011-07-13 Ian Lance Taylor <iant@google.com>
2503
2504 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2505 relro section.
2506 * x86_64.cc (Target_x86_64::got_section): Likewise.
2507 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2508 (relro_now_test_SOURCES): New variable.
2509 (relro_now_test_DEPENDENCIES): New variable.
2510 (relro_now_test_LDFLAGS): New variable.
2511 (relro_now_test_LDADD): New variable.
2512 (relro_now_test.so): New target.
2513 * testsuite/Makefile.in: Rebuild.
2514
2515 2011-07-12 Ian Lance Taylor <iant@google.com>
2516
2517 PR gold/12980
2518 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2519 GLOB_DAT relocation rather than a RELATIVE relocation for a
2520 protected symbol when creating a shared library.
2521 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2522 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2523 * testsuite/protected_main_1.cc (main): Test that protected
2524 function has same address.
2525
2526 2011-07-11 Ian Lance Taylor <iant@google.com>
2527
2528 PR gold/12979
2529 * options.h (class General_options): Add -Bgroup.
2530 * options.cc (General_options::finalize): If -Bgroup is set,
2531 default to --unresolved-symbols=report-all.
2532 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2533 * target-reloc.h (issue_undefined_symbol_error): Handle
2534 --unresolved-symbols=report-all.
2535
2536 2011-07-08 Ian Lance Taylor <iant@google.com>
2537
2538 PR gold/11985
2539 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2540 if linker script discards key sections.
2541 (Layout::create_dynamic_symtab): Likewise.
2542 (Layout::assign_local_dynsym_offsets): Likewise.
2543 (Layout::sized_create_version_sections): Likewise.
2544 (Layout::create_interp): Likewise.
2545 (Layout::finish_dynamic_section): Likewise.
2546 (Layout::set_dynamic_symbol_size): Likewise.
2547
2548 2011-07-08 Ian Lance Taylor <iant@google.com>
2549
2550 PR gold/12386
2551 * options.h (class General_options): Add --unresolved-symbols.
2552 * target-reloc.h (issue_undefined_symbol_error): Check
2553 --unresolved-symbols. Add comments.
2554
2555 2011-07-08 Ian Lance Taylor <iant@google.com>
2556
2557 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2558 expression more complex.
2559
2560 2011-07-08 Ian Lance Taylor <iant@google.com>
2561
2562 PR gold/11317
2563 * target-reloc.h (issue_undefined_symbol_error): New inline
2564 function, broken out of relocate_section.
2565 (relocate_section): Call issue_undefined_symbol_error.
2566 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2567 there is no TLS segment if we are about to issue an undefined
2568 symbol error.
2569 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2570
2571 2011-07-08 Ian Lance Taylor <iant@google.com>
2572
2573 PR gold/12279
2574 * resolve.cc (Symbol_table::should_override): Add fromtype
2575 parameter. Change all callers. Give error when linking together
2576 TLS and non-TLS symbol.
2577 (Symbol_table::should_override_with_special): Add fromtype
2578 parameter. Change all callers.
2579 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2580 there is no TLS segment if we have reported some errors.
2581 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2582
2583 2011-07-08 Ian Lance Taylor <iant@google.com>
2584
2585 PR gold/12372
2586 * target.h (Target::plt_address_for_global): New function.
2587 (Target::plt_address_for_local): New function.
2588 (Target::plt_section_for_global): Remove.
2589 (Target::plt_section_for_local): Remove.
2590 (Target::do_plt_address_for_global): New virtual function.
2591 (Target::do_plt_address_for_local): New virtual function.
2592 (Target::do_plt_section_for_global): Remove.
2593 (Target::do_plt_section_for_local): Remove.
2594 (Target::register_global_plt_entry): Add Symbol_table and Layout
2595 parameters.
2596 * output.cc (Output_data_got::Got_entry::write): Use
2597 plt_address_for_global and plt_address_for_local.
2598 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2599 address of output section.
2600 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2601 got_irelative_, and irelative_count_ fields. Update
2602 declarations.
2603 (Output_data_plt_i386::has_irelative_section): New function.
2604 (Output_data_plt_i386::entry_count): Add irelative_count_.
2605 (Output_data_plt_i386::set_final_data_size): Likewise.
2606 (class Target_i386): Add got_irelative_ and rel_irelative_
2607 fields. Update declarations.
2608 (Target_i386::Target_i386): Initialize new fields.
2609 (Target_i386::do_plt_address_for_global): New function replacing
2610 do_plt_section_for_global.
2611 (Target_i386::do_plt_address_for_local): New function replacing
2612 do_plt_section_for_local.
2613 (Target_i386::got_section): Create got_irelative_.
2614 (Target_i386::rel_irelative_section): New function.
2615 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2616 fields. Don't define __rel_iplt_{start,end}.
2617 (Output_data_plt_i386::add_entry): Add symtab and layout
2618 parameters. Change all callers. Use different PLT and GOT for
2619 IFUNC symbols.
2620 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2621 layout parameters. Change all callers. Use different PLT and
2622 GOT.
2623 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2624 (Output_data_plt_i386::rel_irelative): New function.
2625 (Output_data_plt_i386::address_for_global): New function.
2626 (Output_data_plt_i386::address_for_local): New function.
2627 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2628 IRELATIVE GOT when changing IFUNC GOT entries.
2629 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2630 reloc.
2631 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2632 if we didn't create an IRELATIVE GOT.
2633 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2634 plt_address_for_local.
2635 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2636 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2637 got_irelative_, and irelative_count_ fields. Update
2638 declarations.
2639 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2640 Initialize new fields. Remove symtab parameter. Change all
2641 callers.
2642 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2643 irelative_count_.
2644 (Output_data_plt_x86_64::has_irelative_section): New function.
2645 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2646 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2647 fields. Update declarations.
2648 (Target_x86_64::Target_x86_64): Initialize new fields.
2649 (Target_x86_64::do_plt_address_for_global): New function replacing
2650 do_plt_section_for_global.
2651 (Target_x86_64::do_plt_address_for_local): New function replacing
2652 do_plt_section_for_local.
2653 (Target_x86_64::got_section): Create got_irelative_.
2654 (Target_x86_64::rela_irelative_section): New function.
2655 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2656 all callers. Don't create __rel_iplt_{start,end}.
2657 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2658 parameters. Change all callers. Use different PLT and GOT for
2659 IFUNC symbols.
2660 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2661 layout parameters. Change all callers. Use different PLT and
2662 GOT.
2663 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2664 parameters. Change all callers. Use different PLT and GOT for
2665 IFUNC symbols.
2666 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2667 (Output_data_plt_x86_64::rela_irelative): New function.
2668 (Output_data_plt_x86_64::address_for_global): New function.
2669 (Output_data_plt_x86_64::address_for_local): New function.
2670 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2671 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2672 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2673 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2674 parameters.
2675 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2676 reloc.
2677 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2678 symbols if we didn't create an IRELATIVE GOT.
2679 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2680 plt_address_for_local.
2681 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2682 * testsuite/ifuncvar1.c: New test file.
2683 * testsuite/ifuncvar2.c: New test file.
2684 * testsuite/ifuncvar3.c: New test file.
2685 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2686 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2687 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2688 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2689 * testsuite/Makefile.in: Rebuild.
2690
2691 2011-07-07 Cary Coutant <ccoutant@google.com>
2692
2693 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2694 (two_file_test_1_ndebug.o): Likewise.
2695 (two_file_test_1b_ndebug.o): Likewise.
2696 (two_file_test_2_ndebug.o): Likewise.
2697 (two_file_test_main_ndebug.o): Likewise.
2698 (incremental_test_2): Link with no-debug versions.
2699
2700 2011-07-06 Cary Coutant <ccoutant@google.com>
2701
2702 * gold/incremental.cc
2703 (Output_section_incremental_inputs::write_info_blocks): Check for
2704 hidden and internal symbols.
2705
2706 2011-07-06 Cary Coutant <ccoutant@google.com>
2707
2708 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2709 Check disposition for startup file.
2710 (Incremental_inputs::report_command_line): Ignore
2711 --incremental-startup-unchanged option.
2712 * options.cc (General_options::parse_incremental_startup_unchanged):
2713 New function.
2714 (General_options::General_options): Initialize new data member.
2715 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2716 (General_options): Add --incremental-startup-unchanged option.
2717 (General_options::incremental_startup_disposition): New function.
2718 (General_options::incremental_startup_disposition_): New data member.
2719
2720 2011-07-06 Cary Coutant <ccoutant@google.com>
2721
2722 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2723 input file index to Script_info ctor.
2724 (Sized_incremental_binary::do_file_has_changed): Find the
2725 command-line argument for files named in scripts.
2726 * incremental.h (Script_info::Script_info): New ctor
2727 with input file index.
2728 (Script_info::input_file_index): New function.
2729 (Script_info::input_file_index_): New data member.
2730 (Incremental_binary::get_library): Add const.
2731 (Incremental_binary::get_script_info): Add const.
2732 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2733 * testsuite/Makefile.am (incremental_test_5): New test case.
2734 (incremental_test_6): New test case.
2735 * testsuite/Makefile.in: Regenerate.
2736
2737 2011-07-06 Cary Coutant <ccoutant@google.com>
2738
2739 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2740 debug output when command lines differ.
2741
2742 2011-07-06 Cary Coutant <ccoutant@google.com>
2743
2744 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2745 --incremental-patch option.
2746 * layout.cc (Free_list::allocate): Extend allocation beyond original
2747 end if enabled.
2748 (Layout::make_output_section): Mark sections that should get
2749 patch space.
2750 * options.cc (parse_percent): New function.
2751 * options.h (parse_percent): New function.
2752 (DEFINE_percent): New macro.
2753 (General_options): Add --incremental-patch option.
2754 * output.cc (Output_section::Output_section): Initialize new data
2755 members.
2756 (Output_section::add_input_section): Print section name when out
2757 of patch space.
2758 (Output_section::add_output_section_data): Likewise.
2759 (Output_section::set_final_data_size): Add patch space when
2760 doing --incremental-full.
2761 (Output_section::do_reset_address_and_file_offset): Remove patch
2762 space.
2763 (Output_segment::set_section_list_addresses): Print debug output
2764 only if --incremental-update.
2765 * output.h (Output_section::set_is_patch_space_allowed): New function.
2766 (Output_section::is_patch_space_allowed_): New data member.
2767 (Output_section::patch_space_): New data member.
2768 * parameters.cc (Parameters::incremental_full): New function.
2769 * parameters.h (Parameters::incremental_full): New function
2770 * testsuite/Makefile.am (incremental_test_2): Add test for
2771 --incremental-patch option.
2772 * testsuite/Makefile.in: Regenerate.
2773 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2774 (t18): Remove function body.
2775
2776 2011-07-05 Doug Kwan <dougkwan@google.com>
2777
2778 PR gold/12771
2779 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2780 Arm_Address type for relocation result.
2781 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2782 overflow check.
2783 (Arm_relocate_functions::abs32): Use unaligned access.
2784 (Arm_relocate_functions::rel32): Ditto.
2785 (Arm_relocate_functions::prel31): Ditto.
2786 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2787 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2788 static data relocations.
2789 * testsuite/Makefile.in: Regnerate.
2790 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2791
2792 2011-07-05 Ian Lance Taylor <iant@google.com>
2793
2794 PR gold/12392
2795 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2796 symbols if necessary.
2797 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2798
2799 2011-07-05 Ian Lance Taylor <iant@google.com>
2800
2801 PR gold/12952
2802 * resolve.cc (Symbol::override_base_with_special): Simply override
2803 version with special symbol version, ignoring previous version.
2804
2805 2011-07-05 Ian Lance Taylor <iant@google.com>
2806
2807 * object.cc (Sized_relobj_file::include_section_group): Add
2808 information to comment about signature location.
2809
2810 2011-07-02 Ian Lance Taylor <iant@google.com>
2811
2812 PR gold/12957
2813 * options.h (class General_options): Add -f and -F.
2814 * options.cc (General_options::finalize): Fatal error if -f/-F
2815 are used without -shared.
2816 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2817
2818 2011-07-02 Ian Lance Taylor <iant@google.com>
2819
2820 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2821
2822 2011-07-01 Ian Lance Taylor <iant@google.com>
2823
2824 PR gold/12525
2825 PR gold/12952
2826 * resolve.cc (Symbol::override_base_with_special): Don't override
2827 the version if the overriding symbol has a different name.
2828 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2829 all callers. If we give an error about an undefined version,
2830 define the base version if necessary.
2831 * dynobj.h (class Versions): Update declaration.
2832 * testsuite/weak_alias_test_5.cc: New file.
2833 * testsuite/weak_alias_test.script: New file.
2834 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2835 and versioned_alias have the right value, and call t2.
2836 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2837 weak_alias_test_5.so.
2838 (weak_alias_test_LDADD): Likewise.
2839 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2840 * testsuite/Makefile.in: Rebuild.
2841
2842 2011-07-01 Ian Lance Taylor <iant@google.com>
2843
2844 PR gold/12525
2845 * options.h (class General_options): Support -z notext.
2846 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2847 -Wl,-z,notext.
2848 (two_file_shared_nonpic.so): Likewise.
2849 (two_file_shared_mixed.so): Likewise.
2850 (two_file_shared_mixed_1.so): Likewise.
2851 (weak_undef_lib_nonpic.so): Likewise.
2852 (alt/weak_undef_lib_nonpic.so): Likewise.
2853 (tls_test_shared_nonpic.so): Likewise.
2854 * testsuite/Makefile.in: Rebuild.
2855
2856 2011-07-01 Ian Lance Taylor <iant@google.com>
2857
2858 PR gold/12525
2859 * configure.ac: Test whether static linking works, setting
2860 the automake conditional HAVE_STATIC.
2861 * testsuite/Makefile.am: Disable tests using -static if
2862 HAVE_STATIC is not true.
2863 * configure, testsuite/Makefile.in: Rebuild.
2864
2865 2011-07-01 Ian Lance Taylor <iant@google.com>
2866
2867 PR gold/12525
2868 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2869 Assert if we see DW_EH_PE_indirect.
2870 * target.h (Target::ehframe_datarel_base): New function.
2871 (Target::do_ehframe_datarel_base): New target function.
2872 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2873 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2874 function.
2875
2876 2011-07-01 Ian Lance Taylor <iant@google.com>
2877
2878 PR gold/12571
2879 * options.h (class General_options): Add
2880 --ld-generated-unwind-info.
2881 * ehframe.cc (Fde::write): Add address parameter. Change all
2882 callers. If associated with PLT, fill in address and size.
2883 (Cie::set_output_offset): Only add merge mapping if there is an
2884 object.
2885 (Cie::write): Add address parameter. Change all callers.
2886 (Eh_frame::add_ehframe_for_plt): New function.
2887 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2888 input_offset_ fields into union u_, with new plt field.
2889 (Fde::Fde): Adjust for new union field.
2890 (Fde::Fde) [Output_data version]: New constructor.
2891 (Fde::add_mapping): Only add merge mapping if there is an object.
2892 (class Cie): Update declarations.
2893 (class Eh_frame): Declare add_ehframe_for_plt.
2894 * layout.cc (Layout::layout_eh_frame): Break out code into
2895 make_eh_frame_section, and call it.
2896 (Layout::make_eh_frame_section): New function.
2897 (Layout::add_eh_frame_for_plt): New function.
2898 * layout.h (class Layout): Update declarations.
2899 * merge.cc (Merge_map::add_mapping): Add assertion.
2900 * i386.cc: Include "dwarf.h".
2901 (class Output_data_plt_i386): Make first_plt_entry,
2902 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2903 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2904 and plt_eh_frame_fde.
2905 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2906 boundary. Call add_eh_frame_for_plt if appropriate.
2907 * x86_64.cc: Include "dwarf.h".
2908 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2909 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2910 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2911 and plt_eh_frame_fde.
2912 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2913 appropriate.
2914
2915 2011-06-29 Ian Lance Taylor <iant@google.com>
2916
2917 PR gold/12629
2918 * object.cc (Sized_relobj_file::layout_section): Change shdr
2919 parameter to be const.
2920 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2921 out of do_layout.
2922 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2923 appropriate. Call layout_eh_frame_section.
2924 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2925 sections.
2926 * object.h (class Sized_relobj_file): Update declarations.
2927
2928 2011-06-29 Ian Lance Taylor <iant@google.com>
2929
2930 PR gold/12652
2931 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2932 modifier.
2933 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2934
2935 2011-06-29 Ian Lance Taylor <iant@google.com>
2936
2937 PR gold/12675
2938 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2939 SHT_X86_64_UNWIND.
2940 * layout.cc (Layout::layout_eh_frame): Likewise.
2941
2942 2011-06-29 Ian Lance Taylor <iant@google.com>
2943
2944 PR gold/12695
2945 * layout.cc (Layout::symtab_section_shndx): New function.
2946 * layout.h (class Layout): Declare symtab_section_shndx.
2947 * output.cc (Output_section::write_header): Call it.
2948
2949 2011-06-29 Ian Lance Taylor <iant@google.com>
2950
2951 PR gold/12818
2952 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2953 symbols which are not used in a relocation.
2954
2955 2011-06-28 Ian Lance Taylor <iant@google.com>
2956
2957 PR gold/12898
2958 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2959 script create indistinguishable segments.
2960 (Layout::set_segment_offsets): Use stable_sort when sorting
2961 segments. Pass this to Compare_segments constructor.
2962 * layout.h (class Layout): Make segment_precedes non-static.
2963 (class Compare_segments): Change from struct to class. Add
2964 layout_ field. Add constructor.
2965 * script-sections.cc
2966 (Script_sections::attach_sections_using_phdrs_clause): Rename
2967 local orphan to is_orphan. Don't report failure to put empty
2968 section in segment. On attachment failure, report name of
2969 section, and attach to first PT_LOAD segment.
2970
2971 2011-06-28 Ian Lance Taylor <iant@google.com>
2972
2973 PR gold/12934
2974 * target-select.cc (Target_selector::Target_selector): Add
2975 emulation parameter. Change all callers.
2976 (select_target_by_bfd_name): Rename from select_target_by_name.
2977 Change all callers.
2978 (select_target_by_emulation): New function.
2979 (supported_emulation_names): New function.
2980 * target-select.h (class Target_selector): Add emulation_ field.
2981 Update declarations.
2982 (Target_selector::recognize_by_bfd_name): Rename from
2983 recognize_by_name. Change all callers.
2984 (Target_selector::supported_bfd_names): Rename from
2985 supported_names. Change all callers.
2986 (Target_selector::recognize_by_emulation): New function.
2987 (Target_selector::supported_emulations): New function.
2988 (Target_selector::emulation): New function.
2989 (Target_selector::do_recognize_by_bfd_name): Rename from
2990 do_recognize_by_name. Change all callers.
2991 (Target_selector::do_supported_bfd_names): Rename from
2992 do_supported_names. Change all callers.
2993 (Target_selector::do_recognize_by_emulation): New function.
2994 (Target_selector::do_supported_emulations): New function.
2995 (select_target_by_bfd_name): Change name in declaration.
2996 (select_target_by_emulation): Declare.
2997 (supported_emulation_names): Declare.
2998 * parameters.cc (parameters_force_valid_target): Try to find
2999 target based on emulation from -m option.
3000 * options.h (class General_options): Change doc string for -m.
3001 * options.cc (help): Print emulations.
3002 (General_options::parse_V): Likewise.
3003 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3004 Add emulation parameter. Change all callers.
3005
3006 2011-06-28 Ian Lance Taylor <iant@google.com>
3007
3008 * target.h (class Target): Add osabi_ field.
3009 (Target::osabi): New function.
3010 (Target::set_osabi): New function.
3011 (Target::Target): Initialize osabi_.
3012 (Target::do_adjust_elf_header): Make pure virtual.
3013 (Sized_target::do_adjust_elf_header): Declare.
3014 * target.cc (Sized_target::do_adjust_elf_header): New function.
3015 (class Sized_target): Instantiate all versions.
3016 * freebsd.h (class Target_freebsd): Remove.
3017 (Target_selector_freebsd::do_recognize): Call set_osabi on
3018 Target.
3019 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3020 (Target_selector_freebsd::set_osabi): Remove.
3021 * i386.cc (class Target_i386): Inherit from Sized_target rather
3022 than Target_freebsd.
3023 * x86_64.cc (class Target_x86_64): Likewise.
3024
3025 2011-06-28 Ian Lance Taylor <iant@google.com>
3026
3027 * target.h (Target::can_check_for_function_pointers): Rewrite.
3028 Make non-virtual.
3029 (Target::can_icf_inline_merge_sections): Likewise.
3030 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3031 (Target::Target_info): Add can_icf_inline_merge_sections field.
3032 (Target::do_can_check_for_function_pointers): New virtual
3033 function.
3034 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3035 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3036 from can_check_for_function_pointers, move in file.
3037 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3038 section_may_have_icf_unsafe_poineters, move in file.
3039 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3040 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3041 Rename from can_check_for_function_pointers, move in file.
3042 (Target_i386::can_icf_inline_merge_sections): Remove.
3043 (Target_i386::i386_info): Initialize
3044 can_icf_inline_merge_sections.
3045 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3046 Initialize can_icf_inline_merge_sections.
3047 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3048 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3049 Rename from can_check_for_function_pointers, move in file.
3050 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3051 (Target_x86_64::x86_64_info): Initialize
3052 can_icf_inline_merge_sections.
3053 * testsuite/testfile.cc (Target_test::test_target_info):
3054 Likewise.
3055 * icf.cc (get_section_contents): Correct formatting.
3056
3057 2011-06-27 Ian Lance Taylor <iant@google.com>
3058
3059 * symtab.cc (Symbol::versioned_name): New function.
3060 (Symbol_table::add_to_final_symtab): Use versioned_name when
3061 appropriate.
3062 (Symbol_table::sized_write_symbol): Likewise.
3063 * symtab.h (class Symbol): Declare versioned_name.
3064 * stringpool.h (class Stringpool_template): Add variant of add
3065 which takes a std::basic_string.
3066 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3067 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3068 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3069 (ver_test_12.o): New target.
3070 * testsuite/Makefile.in: Rebuild.
3071
3072 2011-06-27 Doug Kwan <dougkwan@google.com>
3073
3074 * arm.cc (Arm_relocate_functions::thm_jump8,
3075 Arm_relocate_functions::thm_jump11): Use a wider signed
3076 type to compute offset.
3077 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3078 arm_thm_jump8.
3079 * testsuite/Makefile.in: Regenerate.
3080 * testsuite/arm_branch_in_range.sh: Check test results of
3081 arm_thm_jump11 and arm_thm_jump8.
3082 * testsuite/arm_thm_jump11.s: New test source file.
3083 * testsuite/arm_thm_jump11.t: New linker script.
3084 * testsuite/arm_thm_jump8.s: New test source file.
3085 * testsuite/arm_thm_jump8.t: New linker script.
3086
3087 2011-06-24 Ian Lance Taylor <iant@google.com>
3088
3089 * layout.cc: Include "object.h".
3090 (ctors_sections_in_init_array): New static variable.
3091 (Layout::is_ctors_in_init_array): New function.
3092 (Layout::layout): Add entry to ctors_sections_in_init_array if
3093 appropriate.
3094 * layout.h (class Layout): Declare is_ctors_in_init_array.
3095 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3096 is_ctors_reverse_view is set.
3097 (Sized_relobj_file::write_sections): Add layout parameter. Change
3098 all callers. Set is_ctors_reverse_view field of View_size.
3099 (Sized_relobj_file::reverse_words): New function.
3100 * object.h (Sized_relobj_file::View_size): Add
3101 is_ctors_reverse_view field.
3102 (class Sized_relobj_file): Update declarations.
3103 * testsuite/initpri3.c: New test.
3104 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3105 initpri3b.
3106 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3107 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3108 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3109 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3110 * testsuite/Makefile.in: Rebuild.
3111
3112 2011-06-24 Cary Coutant <ccoutant@google.com>
3113
3114 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3115 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3116 (debug_msg_cdebug.err): New targets.
3117 * testsuite/Makefile.in: Regenerate.
3118 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3119 Fix checks for link with shared library.
3120
3121 2011-06-24 Doug Kwan <dougkwan@google.com>
3122
3123 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3124 skip empty text sections.
3125 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3126
3127 2011-06-22 Ian Lance Taylor <iant@google.com>
3128
3129 PR gold/12910
3130 * options.h (class General_options): Add --ctors-in-init-array.
3131 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3132 friends as SHT_PROGBITS for merging sections.
3133 (Layout::layout): Remove special handling of .init_array and
3134 friends. Don't sort if doing relocatable link. Sort for .ctors
3135 and .dtors if ctors_in_init_array.
3136 (Layout::make_output_section): Force correct section types for
3137 .init_array and friends. Don't sort if doing relocatable link,
3138 Don't sort .ctors and .dtors if ctors_in_init_array.
3139 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3140 (Layout::output_section_name): Add relobj parameter. Change all
3141 callers. Handle .ctors. and .dtors. in code rather than table.
3142 Handle .ctors and .dtors if ctors_in_init_array.
3143 (Layout::match_file_name): New function, moved from output.cc.
3144 * layout.h (class Layout): Update declarations.
3145 * output.cc: Include "layout.h".
3146 (Input_section_sort_entry::get_priority): New function.
3147 (Input_section_sort_entry::match_file_name): Just call
3148 Layout::match_file_name.
3149 (Output_section::Input_section_sort_init_fini_compare::operator()):
3150 Handle .ctors and .dtors. Sort by explicit priority rather than
3151 by name.
3152 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3153 * testsuite/initpri2.c: New test.
3154 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3155 (check_PROGRAMS): Add initpri2.
3156 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3157 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3158 * configure, testsuite/Makefile.in: Rebuild.
3159
3160 2011-06-19 Ian Lance Taylor <iant@google.com>
3161
3162 PR gold/12880
3163 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3164 .interp section to a PT_INTERP segment even if we have seen a
3165 --dynamic-linker option. Don't do it if we have seen a PHDRS
3166 clause in a linker script.
3167 (Layout::finalize): Don't create a .interp section if we've
3168 already create a PT_INTERP segment.
3169 (Layout::create_interp): Always call choose_output_section (revert
3170 patch of 2011-06-17). Don't create PT_INTERP segment.
3171 * script-sections.cc
3172 (Script_sections::create_note_and_tls_segments): Add a .interp
3173 section to a PT_INTERP segment even if we have seen a
3174 --dynamic-linker option.
3175
3176 2011-06-18 Ian Lance Taylor <iant@google.com>
3177
3178 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3179 merely because a non-PT_LOAD segment has a dynamic reloc.
3180
3181 2011-06-18 Ian Lance Taylor <iant@google.com>
3182
3183 * layout.cc (Layout::finish_dynamic_section): Don't create
3184 DT_FLAGS entry if not needed.
3185
3186 2011-06-18 Ian Lance Taylor <iant@google.com>
3187
3188 PR gold/12745
3189 * layout.cc (Layout::layout_eh_frame): Correct handling of
3190 writable .eh_frame section.
3191
3192 2011-06-17 Ian Lance Taylor <iant@google.com>
3193
3194 PR gold/12893
3195 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3196 symbol is redefined with the exact same object and value.
3197
3198 2011-06-17 Ian Lance Taylor <iant@google.com>
3199
3200 PR gold/12880
3201 * layout.h (class Layout): Add interp_segment_ field.
3202 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3203 (Layout::attach_allocated_section_to_segment): If making shared
3204 library, put .interp section in PT_INTERP segment.
3205 (Layout::finalize): Also call create_interp if -dynamic-linker
3206 option was used.
3207 (Layout::create_interp): Assert that there is no PT_INTERP
3208 segment. If not using a SECTIONS clause, use make_output_section.
3209 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3210 * script-sections.cc
3211 (Script_sections::create_note_and_tls_segments): If making shared
3212 library, put .interp section in PT_INTERP segment.
3213
3214 2011-06-17 Ian Lance Taylor <iant@google.com>
3215
3216 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3217 when making a shared library.
3218
3219 2011-06-17 Ian Lance Taylor <iant@google.com>
3220
3221 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3222 parameter. Change all callers. Don't issue warning about PC32
3223 against locally defined symbol.
3224
3225 2011-06-16 Ian Lance Taylor <iant@google.com>
3226
3227 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3228 occurs in same object.
3229
3230 2011-06-14 Alan Modra <amodra@gmail.com>
3231
3232 * po/POTFILES.in: Regenerate.
3233
3234 2011-06-09 Ian Lance Taylor <iant@google.com>
3235
3236 * script-sections.cc
3237 (Orphan_output_section::set_section_addresses): For a relocatable
3238 link set address to 0.
3239
3240 2011-06-09 Cary Coutant <ccoutant@google.com>
3241
3242 PR gold/12804
3243 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3244 used with --compress-debug-sections.
3245 * gold/object.cc (Sized_relobj_file::do_layout): Report
3246 uncompressed size of compressed input sections.
3247
3248 2011-06-08 Cary Coutant <ccoutant@google.com>
3249
3250 PR gold/12804
3251 * testsuite/two_file_test_2_v1.cc: Change initialization of
3252 v2 to keep it in .data.
3253
3254 2011-06-07 Cary Coutant <ccoutant@google.com>
3255
3256 * common.cc (Symbol_table::do_allocate_commons_list): Call
3257 gold_fallback.
3258 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3259 (Errors::fallback): New function.
3260 (gold_fallback): New function.
3261 * errors.h (Errors::fallback): New function.
3262 * gold.cc (gold_exit): Change status parameter to enum; adjust
3263 all callers.
3264 (queue_initial_tasks): Call gold_fallback.
3265 * gold.h: Include cstdlib.
3266 (Exit_status): New enum type.
3267 (gold_exit): Change status parameter to enum.
3268 (gold_fallback): New function.
3269 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3270 (Layout::create_symtab_sections): Likewise.
3271 (Layout::create_shdrs): Likewise.
3272 * main.cc (main): Adjust call to gold_exit.
3273 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3274 (Output_data_got::add_got_entry_pair): Likewise.
3275 (Output_section::add_input_section): Likewise.
3276 (Output_section::add_output_section_data): Likewise.
3277 (Output_segment::set_section_list_addresses): Likewise.
3278 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3279
3280 2011-06-07 Cary Coutant <ccoutant@google.com>
3281
3282 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3283 for incremental links.
3284 * output.cc (Output_segment::set_section_list_addresses): Remove
3285 FIXME and test for TLS or BSS.
3286
3287 2011-06-07 Cary Coutant <ccoutant@google.com>
3288
3289 * testsuite/Makefile.am: Add incremental_copy_test,
3290 incremental_common_test_1.
3291 * testsuite/Makefile.in: Regenerate.
3292 * testsuite/common_test_1_v1.c: New source file.
3293 * testsuite/common_test_1_v2.c: New source file.
3294 * testsuite/copy_test_v1.cc: New source file.
3295
3296 2011-06-07 Cary Coutant <ccoutant@google.com>
3297
3298 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3299 update, allocate common from bss section's free list.
3300 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3301 linker-defined symbols.
3302 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3303 Skip GOT and PLT entries that are no longer referenced.
3304 (Output_section_incremental_inputs::write_info_blocks): Mark
3305 linker-defined symbols.
3306 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3307 * output.cc (Output_section::allocate): New function.
3308 * output.h (Output_section::allocate): New function.
3309 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3310 linker-defined symbols.
3311 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3312 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3313 (Symbol::init_base_output_data): Likewise.
3314 (Symbol::init_base_output_segment): Likewise.
3315 (Symbol::init_base_constant): Likewise.
3316 (Sized_symbol::init_output_data): Likewise.
3317 (Sized_symbol::init_output_segment): Likewise.
3318 (Sized_symbol::init_constant): Likewise.
3319 (Symbol_table::do_define_in_output_data): Likewise.
3320 (Symbol_table::do_define_in_output_segment): Likewise.
3321 (Symbol_table::do_define_as_constant): Likewise.
3322 * symtab.h (Symbol::is_predefined): New function.
3323 (Symbol::init_base_output_data): Add is_predefined parameter.
3324 (Symbol::init_base_output_segment): Likewise.
3325 (Symbol::init_base_constant): Likewise.
3326 (Symbol::is_predefined_): New data member.
3327 (Sized_symbol::init_output_data): Add is_predefined parameter.
3328 (Sized_symbol::init_output_segment): Likewise.
3329 (Sized_symbol::init_constant): Likewise.
3330 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3331
3332 2011-06-07 Cary Coutant <ccoutant@google.com>
3333
3334 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3335 instead of emit_copy_reloc.
3336 (Copy_relocs::emit_copy_reloc): Refactor.
3337 (Copy_relocs::make_copy_reloc): New function.
3338 (Copy_relocs::add_copy_reloc): Remove.
3339 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3340 section.
3341 (Copy_relocs::make_copy_reloc): New function.
3342 (Copy_relocs::add_copy_reloc): Remove.
3343 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3344 unchanged input files.
3345 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3346 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3347 Reserve BSS space for COPY relocations.
3348 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3349 (Output_section_incremental_inputs::write_info_blocks): Record
3350 whether a symbol is copied from a shared object.
3351 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3352 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3353 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3354 (Incremental_input_entry_reader::get_output_symbol_index): Add
3355 is_copy parameter.
3356 (Incremental_binary::emit_copy_relocs): New function.
3357 (Incremental_binary::do_emit_copy_relocs): New function.
3358 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3359 new data member.
3360 (Sized_incremental_binary::add_copy_reloc): New function.
3361 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3362 (Sized_incremental_binary::Copy_reloc): New struct.
3363 (Sized_incremental_binary::Copy_relocs): New typedef.
3364 (Sized_incremental_binary::copy_relocs_): New data member.
3365 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3366 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3367 * target.h (Sized_target::emit_copy_reloc): New function.
3368 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3369
3370 2011-06-02 Cary Coutant <ccoutant@google.com>
3371
3372 PR gold/12163
3373 * gold/archive.cc (Archive::Archive): Initialize new data member.
3374 (Archive::include_all_members): Return if archive has already been
3375 included.
3376 * gold/archive.h (Archive::include_all_members_): New data member.
3377
3378 2011-06-02 Nick Clifton <nickc@redhat.com>
3379
3380 * dynobj.h: Fix spelling mistake in comment.
3381 * output.cc: Likewise.
3382
3383 2011-05-31 Doug Kwan <dougkwan@google.com>
3384 Asier Llano
3385
3386 PR gold/12826
3387 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3388 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3389 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3390 redundant arm_exidx_test.so.
3391 * testsuite/Makefile.in: Regenerate.
3392 (check_SCRIPTS): Add pr12826.sh
3393 (check_DATA): Add pr12826.stdout
3394 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3395 * testsuite/pr12826.sh: New file.
3396 * testsuite/pr12826_1.s: Ditto.
3397 * testsuite/pr12826_1.s: Ditto.
3398
3399 2011-05-30 Ian Lance Taylor <iant@google.com>
3400
3401 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3402 sections.
3403
3404 2011-05-29 Ian Lance Taylor <iant@google.com>
3405
3406 PR gold/12804
3407 * testsuite/Makefile.am: Use different file name for two_file_test
3408 temporary file for each incremental test.
3409 * testsuite/Makefile.in: Rebuild.
3410
3411 2011-05-29 Ian Lance Taylor <iant@google.com>
3412
3413 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3414 binary input file is empty.
3415
3416 2011-05-27 Ian Lance Taylor <iant@google.com>
3417
3418 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3419 (ver_test_9.so): Likewise.
3420 * testsuite/Makefile.in: Rebuild.
3421
3422 2011-05-26 Cary Coutant <ccoutant@google.com>
3423
3424 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3425 * incremental.cc (Incremental_inputs::report_input_section): Fix
3426 comment, indentation.
3427 (Incremental_inputs::report_comdat_group): New function.
3428 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3429 of data for incremental input file entry.
3430 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3431 group count, COMDAT group signatures.
3432 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3433 an unchanged input file.
3434 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3435 Initialize new data member.
3436 (Incremental_object_entry::add_comdat_group): New function.
3437 (Incremental_object_entry::get_comdat_group_count): New function.
3438 (Incremental_object_entry::get_comdat_signature_key): New function.
3439 (Incremental_object_entry::groups_): New data member.
3440 (Incremental_inputs::report_comdat_group): New function.
3441 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3442 data for incremental input file entry.
3443 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3444 (Incremental_input_entry_reader::get_input_section): Adjust size of
3445 data for incremental input file entry.
3446 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3447 (Incremental_input_entry_reader::get_comdat_group_signature): New
3448 function.
3449 * object.cc (Sized_relobj::include_section_group): Report kept
3450 COMDAT groups for incremental links.
3451
3452 2011-05-24 David Meyer <pdox@google.com>
3453
3454 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3455 with name parameter. Add found_name parameter.
3456 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3457 * dirsearch.h (class Dirsearch): Update declaration.
3458
3459 2011-05-24 Ian Lance Taylor <iant@google.com>
3460
3461 * archive.cc (Library_base::should_include_member): Pull in object
3462 from archive if it defines the entry symbol.
3463 * parameters.cc (Parameters::entry): New function.
3464 * parameters.h (class Parameters): Declare entry.
3465 * output.h (class Output_file_header): Remove entry_ field.
3466 * output.cc (Output_file_header::Output_file_header): Remove entry
3467 parameter. Change all callers.
3468 (Output_file_header::entry): Use parameters->entry.
3469 * gold.cc (queue_middle_tasks): Likewise.
3470 * plugin.cc (Plugin_hook::run): Likewise.
3471
3472 2011-05-24 Cary Coutant <ccoutant@google.com>
3473
3474 * gold.cc (queue_initial_tasks): Pass incremental base filename
3475 to Output_file::open_base_file; don't print error message.
3476 * incremental-dump.cc (main): Adjust call to
3477 Output_file::open_for_modification.
3478 * incremental-dump.cc (main): Likewise.
3479 * incremental.cc (Incremental_inputs::report_command_line):
3480 Ignore --incremental-base option when comparing command lines.
3481 Ignore parameter when given as separate argument.
3482 * options.h (class General_options): Add --incremental-base.
3483 * output.cc (Output_file::Output_file):
3484 (Output_file::open_base_file): Add base_name and writable parameters;
3485 read base file into new file; print error message here.
3486 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3487 callers.
3488 * output.h (Output_file::open_for_modification): Rename to...
3489 (Output_file::open_base_file): ...this; add base_name and
3490 writable parameters; adjust all callers.
3491 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3492 callers.
3493 * testsuite/Makefile.am (incremental_test_4): Test
3494 --incremental-base.
3495 * testsuite/Makefile.in: Regenerate.
3496
3497 2011-05-24 Cary Coutant <ccoutant@google.com>
3498
3499 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3500 incremental_test_4.
3501 * testsuite/Makefile.in: Regenerate.
3502 * testsuite/two_file_test_1_v1.cc: New test source file.
3503 * testsuite/two_file_test_1b_v1.cc: New test source file.
3504 * testsuite/two_file_test_2_v1.cc: New test source file.
3505
3506 2011-05-24 Cary Coutant <ccoutant@google.com>
3507
3508 * dynobj.h (Dynobj::do_dynobj): New function.
3509 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3510 flag and soname for shared objects.
3511 * incremental.cc (Incremental_inputs::report_object): Make
3512 either Incremental_object_entry or Incremental_dynobj_entry; add
3513 soname to string table.
3514 (Incremental_inputs::report_input_section): Add assertion.
3515 (Output_section_incremental_inputs::set_final_data_size): Adjust
3516 type of input file entry for shared libraries; adjust size of
3517 shared library info entry.
3518 (Output_section_incremental_inputs::write_input_files): Write
3519 as_needed flag for shared libraries.
3520 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3521 of input file entry for shared libraries; write soname.
3522 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3523 soname from incremental info.
3524 * incremental.h (enum Incremental_input_flags): Add
3525 INCREMENTAL_INPUT_AS_NEEDED.
3526 (Incremental_input_entry::Incremental_input_entry): Initialize new
3527 data member.
3528 (Incremental_input_entry::set_as_needed): New function.
3529 (Incremental_input_entry::as_needed): New function.
3530 (Incremental_input_entry::do_dynobj_entry): New function.
3531 (Incremental_input_entry::as_needed_): New data member.
3532 (Incremental_object_entry::Incremental_object_entry): Don't check
3533 for shared library.
3534 (Incremental_object_entry::do_type): Likewise.
3535 (class Incremental_dynobj_entry): New class.
3536 (Incremental_input_entry_reader::as_needed): New function.
3537 (Incremental_input_entry_reader::get_soname): New function.
3538 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3539 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3540 size of shared library info entry.
3541 * layout.cc (Layout::finish_dynamic_section): Don't test for
3542 incremental link when adding DT_NEEDED entries.
3543 * object.h (Object::Object): Initialize new data member.
3544 (Object::dynobj): New function.
3545 (Object::set_as_needed): New function.
3546 (Object::as_needed): New function.
3547 (Object::do_dynobj): New function.
3548 (Object::as_needed_): New data member.
3549
3550 2011-05-24 Cary Coutant <ccoutant@google.com>
3551
3552 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3553 info; adjust display of GOT entries.
3554 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3555 vector of input objects; remove file_status_.
3556 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3557 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3558 got_plt reader; call target hooks to reserve GOT entries.
3559 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3560 of input file info header and GOT info entry.
3561 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3562 relocation info.
3563 (Got_plt_view_info::got_descriptor): Remove.
3564 (Got_plt_view_info::sym_index): New data member.
3565 (Got_plt_view_info::input_index): New data member.
3566 (Local_got_offset_visitor::visit): Write input file index.
3567 (Global_got_offset_visitor::visit): Write 0 for input file index.
3568 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3569 with sym_index and input_index.
3570 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3571 incremental info GOT entry; replace got_descriptor with input_index.
3572 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3573 map from input file index to object.
3574 (Sized_relobj_incr::do_layout): Replace direct data member reference
3575 with accessor function.
3576 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3577 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3578 Adjust size of input file info header.
3579 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3580 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3581 (Incremental_input_entry_reader::get_input_section): Adjust size of
3582 input file info header.
3583 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3584 of incremental info GOT entry.
3585 (Incremental_got_plt_reader::get_got_desc): Remove.
3586 (Incremental_got_plt_reader::get_got_symndx): New function.
3587 (Incremental_got_plt_reader::get_got_input_index): New function.
3588 (Sized_incremental_binary::Sized_incremental_binary): Remove
3589 file_status_; add input_objects_.
3590 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3591 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3592 (Sized_incremental_binary::file_is_unchanged): Remove.
3593 (Sized_incremental_binary::set_input_object): New function.
3594 (Sized_incremental_binary::input_object): New function.
3595 (Sized_incremental_binary::file_status_): Remove.
3596 (Sized_incremental_binary::input_objects_): New data member.
3597 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3598 references.
3599 (Sized_relobj_incr::invalid_address): Move to base class.
3600 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3601 class.
3602 (Sized_relobj_incr::do_output_section_offset): Likewise.
3603 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3604 (Sized_relobj_incr::section_offsets_): Likewise.
3605 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3606 function.
3607 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3608 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3609 with accessor function.
3610 (Sized_relobj_file::do_layout): Likewise.
3611 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3612 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3613 (Sized_relobj_file::compute_final_local_value): Replace refs to
3614 section_offsets_ with accessor function.
3615 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3616 * object.h (Relobj::Relobj): Initialize new data members.
3617 (Relobj::add_dyn_reloc): New function.
3618 (Relobj::first_dyn_reloc): New function.
3619 (Relobj::dyn_reloc_count): New function.
3620 (Relobj::first_dyn_reloc_): New data member.
3621 (Relobj::dyn_reloc_count_): New data member.
3622 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3623 references.
3624 (Sized_relobj::Address): New typedef.
3625 (Sized_relobj::invalid_address): Move here from child class.
3626 (Sized_relobj::Sized_relobj): Initialize new data members.
3627 (Sized_relobj::sized_relobj): New function.
3628 (Sized_relobj::is_output_section_offset_invalid): Move here from
3629 child class.
3630 (Sized_relobj::get_output_section_offset): Likewise.
3631 (Sized_relobj::local_has_got_offset): Likewise.
3632 (Sized_relobj::local_got_offset): Likewise.
3633 (Sized_relobj::set_local_got_offset): Likewise.
3634 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3635 (Sized_relobj::clear_got_offsets): New function.
3636 (Sized_relobj::section_offsets): Move here from child class.
3637 (Sized_relobj::do_output_section_offset): Likewise.
3638 (Sized_relobj::do_set_section_offset): Likewise.
3639 (Sized_relobj::Local_got_offsets): Likewise.
3640 (Sized_relobj::local_got_offsets_): Likewise.
3641 (Sized_relobj::section_offsets_): Likewise.
3642 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3643 references.
3644 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3645 class.
3646 (Sized_relobj_file::sized_relobj): New function
3647 (Sized_relobj_file::local_has_got_offset): Move to base class.
3648 (Sized_relobj_file::local_got_offset): Likewise.
3649 (Sized_relobj_file::set_local_got_offset): Likewise.
3650 (Sized_relobj_file::get_output_section_offset): Likewise.
3651 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3652 (Sized_relobj_file::do_output_section_offset): Likewise.
3653 (Sized_relobj_file::do_set_section_offset): Likewise.
3654 (Sized_relobj_file::Local_got_offsets): Likewise.
3655 (Sized_relobj_file::local_got_offsets_): Likewise.
3656 (Sized_relobj_file::section_offsets_): Likewise.
3657 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3658 (all constructors).
3659 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3660 (Output_reloc::get_symbol_index): Likewise.
3661 (Output_reloc::local_section_offset): Likewise.
3662 (Output_reloc::get_address): Likewise.
3663 (Output_reloc::symbol_value): Likewise.
3664 (Output_data_got::reserve_slot): Move to class definition.
3665 (Output_data_got::reserve_local): New function.
3666 (Output_data_got::reserve_slot_for_global): Remove.
3667 (Output_data_got::reserve_global): New function.
3668 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3669 (all constructors, two instantiations).
3670 (Output_reloc::get_relobj): New function (two instantiations).
3671 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3672 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3673 (Output_data_reloc::add_global): Adjust type of relobj.
3674 (Output_data_reloc::add_global_relative): Likewise.
3675 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3676 (Output_data_reloc::add_local): Likewise.
3677 (Output_data_reloc::add_local_relative): Likewise.
3678 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3679 (Output_data_reloc::add_local_section): Likewise.
3680 (Output_data_reloc::add_output_section): Likewise.
3681 (Output_data_reloc::add_absolute): Likewise.
3682 (Output_data_reloc::add_target_specific): Likewise.
3683 (Output_data_got::reserve_slot): Move definition here.
3684 (Output_data_got::reserve_local): New function.
3685 (Output_data_got::reserve_global): New function.
3686 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3687 section_offsets_ with accessor function.
3688 (Sized_relobj_file::write_sections): Likewise.
3689 (Sized_relobj_file::do_relocate_sections): Likewise.
3690 * target.h (Sized_target::reserve_local_got_entry): New function.
3691 (Sized_target::reserve_global_got_entry): New function.
3692 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3693 (Target_x86_64::reserve_global_got_entry): New function.
3694 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3695
3696 2011-05-23 Cary Coutant <ccoutant@google.com>
3697
3698 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3699 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3700 bit when checking got_type.
3701 * incremental.cc (Sized_incremental_binary::setup_readers):
3702 Store symbol table and string table locations; initialize bit vector
3703 of file status flags.
3704 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3705 unchanged files.
3706 (Sized_incremental_binary::do_process_got_plt): New function.
3707 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3708 (Output_section_incremental_inputs::set_final_data_size): Record
3709 file index for each input file.
3710 (Output_section_incremental_inputs::write_got_plt): Store file index
3711 instead of input entry offset for each GOT entry.
3712 * incremental.h
3713 (Incremental_input_entry::Incremental_input_entry): Initialize new
3714 data member.
3715 (Incremental_input_entry::set_offset): Store file index.
3716 (Incremental_input_entry::get_file_index): New function.
3717 (Incremental_input_entry::file_index_): New data member.
3718 (Incremental_binary::process_got_plt): New function.
3719 (Incremental_binary::do_process_got_plt): New function.
3720 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3721 data members.
3722 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3723 (Sized_incremental_binary::set_file_is_unchanged): New function.
3724 (Sized_incremental_binary::file_is_unchanged): New function.
3725 (Sized_incremental_binary::do_process_got_plt): New function.
3726 (Sized_incremental_binary::file_status_): New data member.
3727 (Sized_incremental_binary::main_symtab_loc_): New data member.
3728 (Sized_incremental_binary::main_strtab_loc_): New data member.
3729 * output.cc (Output_data_got::Got_entry::write): Add case
3730 RESERVED_CODE.
3731 (Output_data_got::add_global): Call add_got_entry.
3732 (Output_data_got::add_global_plt): Likewise.
3733 (Output_data_got::add_global_with_rel): Likewise.
3734 (Output_data_got::add_global_with_rela): Likewise.
3735 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3736 (Output_data_got::add_global_pair_with_rela): Likewise.
3737 (Output_data_got::add_local): Call add_got_entry.
3738 (Output_data_got::add_local_plt): Likewise.
3739 (Output_data_got::add_local_with_rel): Likewise.
3740 (Output_data_got::add_local_with_rela): Likewise.
3741 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3742 (Output_data_got::add_local_pair_with_rela): Likewise.
3743 (Output_data_got::reserve_slot): New function.
3744 (Output_data_got::reserve_slot_for_global): New function.
3745 (Output_data_got::add_got_entry): New function.
3746 (Output_data_got::add_got_entry_pair): New function.
3747 (Output_section::add_output_section_data): Edit FIXME.
3748 * output.h
3749 (Output_section_data_build::Output_section_data_build): New
3750 constructor with size parameter.
3751 (Output_data_space::Output_data_space): Likewise.
3752 (Output_data_got::Output_data_got): Initialize new data member; new
3753 constructor with size parameter.
3754 (Output_data_got::add_constant): Call add_got_entry.
3755 (Output_data_got::reserve_slot): New function.
3756 (Output_data_got::reserve_slot_for_global): New function.
3757 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3758 (Output_data_got::add_got_entry): New function.
3759 (Output_data_got::add_got_entry_pair): New function.
3760 (Output_data_got::free_list_): New data member.
3761 * target.h (Sized_target::init_got_plt_for_update): New function.
3762 (Sized_target::register_global_plt_entry): New function.
3763 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3764 Initialize new data member; call init; add constructor with PLT count.
3765 (Output_data_plt_x86_64::init): New function.
3766 (Output_data_plt_x86_64::add_relocation): New function.
3767 (Output_data_plt_x86_64::reserve_slot): New function.
3768 (Output_data_plt_x86_64::free_list_): New data member.
3769 (Target_x86_64::init_got_plt_for_update): New function.
3770 (Target_x86_64::register_global_plt_entry): New function.
3771 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3772 incremental updates.
3773 (Output_data_plt_x86_64::add_relocation): New function.
3774 * testsuite/object_unittest.cc (Object_test): Set default options.
3775
3776 2011-05-16 Ian Lance Taylor <iant@google.com>
3777
3778 * options.h (class General_options): Make -i a synonym for -r.
3779
3780 2011-05-16 Ian Lance Taylor <iant@google.com>
3781
3782 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3783
3784 2011-05-10 Cary Coutant <ccoutant@google.com>
3785
3786 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3787 strip_all (-s).
3788
3789 2011-05-06 Ian Lance Taylor <iant@google.com>
3790
3791 * layout.cc (Layout::layout): If the output section flags change,
3792 update the ordering.
3793
3794 2011-04-25 Cary Coutant <ccoutant@google.com>
3795
3796 * incremental-dump.cc (dump_incremental_inputs): Print local
3797 symbol info for each input file.
3798 * incremental.cc
3799 (Output_section_incremental_inputs::set_final_data_size): Add local
3800 symbol info to input file entries in incremental info.
3801 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3802 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3803 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3804 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3805 implementation.
3806 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3807 (Sized_incr_relobj::do_relocate): Write the local symbols.
3808 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3809 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3810 Adjust size of input file header.
3811 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3812 (Incremental_inputs_reader::get_local_symbol_count): New function.
3813 (Incremental_inputs_reader::get_input_section): Adjust size of input
3814 file header.
3815 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3816 (Sized_incr_relobj::This): New typedef.
3817 (Sized_incr_relobj::sym_size): New const data member.
3818 (Sized_incr_relobj::Local_symbol): New struct.
3819 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3820 (Sized_incr_relobj::do_local_symbol_offset): New function.
3821 (Sized_incr_relobj::local_symbol_count_): New data member.
3822 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3823 (Sized_incr_relobj::local_symbol_index_): New data member.
3824 (Sized_incr_relobj::local_symbol_offset_): New data member.
3825 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3826 (Sized_incr_relobj::local_symbols_): New data member.
3827 * object.h (Relobj::output_local_symbol_count): New function.
3828 (Relobj::local_symbol_offset): New function.
3829 (Relobj::do_output_local_symbol_count): New function.
3830 (Relobj::do_local_symbol_offset): New function.
3831 (Sized_relobj::do_output_local_symbol_count): New function.
3832 (Sized_relobj::do_local_symbol_offset): New function.
3833
3834 2011-04-22 Vladimir Simonov <sv@sw.ru>
3835
3836 * descriptors.cc (set_close_on_exec): New function.
3837 (Descriptors::open): Use set_close_on_exec.
3838 * output.cc (S_ISLNK): Define if not defined.
3839
3840 2011-04-22 Cary Coutant <ccoutant@google.com>
3841
3842 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3843 global symbol map.
3844 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3845 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3846 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3847 relocations.
3848 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3849 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3850 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3851 * incremental.h
3852 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3853 function.
3854 (Incremental_binary::apply_incremental_relocs): New function.
3855 (Incremental_binary::do_apply_incremental_relocs): New function.
3856 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3857 data member.
3858 (Sized_incremental_binary::add_global_symbol): New function.
3859 (Sized_incremental_binary::global_symbol): New function.
3860 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3861 (Sized_incremental_binary::symbol_map_): New data member.
3862 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3863 * target.h (Sized_target::apply_relocation): New function.
3864 * target-reloc.h (apply_relocation): New function.
3865 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3866
3867 2011-04-22 Doug Kwan <dougkwan@google.com>
3868
3869 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3870 flag of a SHT_ARM_EXIDX section.
3871 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3872 * testsuite/Makefile.in: Regenerate.
3873 * testsuite/arm_exidx_test.s: New file.
3874 * testsuite/arm_exidx_test.sh: Same.
3875
3876 2011-04-20 Cary Coutant <ccoutant@google.com>
3877
3878 PR gold/12689
3879 * archive.h (Incremental_archive_entry::Archive_member):
3880 Initialize arg_serial_ (second constructor).
3881
3882 2011-04-17 Ian Lance Taylor <iant@google.com>
3883
3884 * object.cc (Relocate_info::location): Simplify location string.
3885 * errors.cc (Errors::error_at_location): Don't print program
3886 name.
3887 (Errors::warning_at_location): Likewise.
3888 (Errors::undefined_symbol): Likewise.
3889 * testsuite/debug_msg.sh: Update accordingly.
3890
3891 2011-04-14 Cary Coutant <ccoutant@google.com>
3892
3893 * gold/layout.cc (Layout::symtab_section_offset): New function.
3894 * gold/layout.h (Layout::symtab_section_offset): New function.
3895 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3896
3897 2011-04-12 Ian Lance Taylor <iant@google.com>
3898
3899 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3900 with MREMAP_MAYMOVE.
3901 * output.h (class Output_file): Add map_is_allocated_ field.
3902 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3903 not available, provide stubs. If mremap is not available, #define
3904 it to gold_mremap.
3905 (MREMAP_MAYMOVE): Define if not defined.
3906 (Output_file::Output_file): Initialize map_is_allocated_.
3907 (Output_file::resize): Check map_is_allocated_.
3908 (Output_file::map_anonymous): If mmap fails, use malloc.
3909 (Output_file::unmap): Don't do anything for an anonymous map.
3910 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3911 is not available, provide stubs.
3912 (File_read::View::~View): Use free rather than delete[].
3913 (File_read::make_view): Use malloc rather than new[]. If mmap
3914 fails, use malloc.
3915 (File_read::find_or_make_view): Use malloc rather than new[].
3916 * gold.h: Remove HAVE_REMAP code.
3917 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3918 exists. Rename mremap to gold_mremap. If mmap is not available
3919 don't do anything.
3920 * configure, config.in: Rebuild.
3921
3922 2011-04-11 Ian Lance Taylor <iant@google.com>
3923
3924 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3925 initialize local variable v.
3926
3927 2011-04-11 Cary Coutant <ccoutant@google.com>
3928
3929 * archive.cc (Archive::include_member): Adjust call to
3930 report_object.
3931 (Add_archive_symbols::run): Track argument serial numbers.
3932 (Lib_group::include_member): Likewise.
3933 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3934 * archive.h (Incremental_archive_entry::Archive_member):
3935 Initialize arg_serial_.
3936 (Archive_member::arg_serial_): New data member.
3937 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3938 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3939 incremental link.
3940 (Sized_dynobj::do_for_all_local_got_entries): New function.
3941 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3942 function.
3943 * fileread.cc (get_mtime): New function.
3944 * fileread.h (get_mtime): New function.
3945 * gold.cc (queue_initial_tasks): Check for incremental update.
3946 (process_incremental_input): New function.
3947 (queue_middle_tasks): Don't force valid target for incremental
3948 update.
3949 * incremental-dump.cc (find_input_containing_global): Adjust
3950 size of symbol info entry.
3951 (dump_incremental_inputs): Dump argument serial number and
3952 in_system_directory flag; bias shndx by 1; print symbol names
3953 when dumping per-file symbol lists; use new symbol info readers.
3954 * incremental.cc
3955 (Output_section_incremental_inputs:update_data_size): New function.
3956 (Sized_incremental_binary::setup_readers): Setup input readers
3957 for each input file; build maps for files added from libraries
3958 and scripts.
3959 (Sized_incremental_binary::check_input_args): New function.
3960 (Sized_incremental_binary::do_check_inputs): Build map of argument
3961 serial numbers to input arguments.
3962 (Sized_incremental_binary::do_file_has_changed): Rename
3963 do_file_is_unchanged to this; compare file modification times.
3964 (Sized_incremental_binary::do_init_layout): New function.
3965 (Sized_incremental_binary::do_reserve_layout): New function.
3966 (Sized_incremental_binary::do_get_input_reader): Remove.
3967 (Sized_incremental_binary::get_symtab_view): New function.
3968 (Incremental_checker::can_incrementally_link_output_file): Remove.
3969 (Incremental_inputs::report_command_line): Exclude --debug options.
3970 (Incremental_inputs::report_archive_begin): Add parameter; track
3971 argument serial numbers; don't put input file entry for archive
3972 before archive members.
3973 (Incremental_inputs::report_archive_end): Put input file entry
3974 for archive after archive members.
3975 (Incremental_inputs::report_object): Add parameter; track argument
3976 serial numbers and in_system_directory flag.
3977 (Incremental_inputs::report_script): Add parameter; track argument
3978 serial numbers.
3979 (Output_section_incremental_inputs::set_final_data_size): Adjust
3980 size of symbol info entry; check for forwarding symbols.
3981 (Output_section_incremental_inputs::write_input_files): Write
3982 in_system_directory flag and argument serial number.
3983 (Output_section_incremental_inputs::write_info_blocks): Map section
3984 indices between incremental info and original input file; store
3985 input section index for each symbol.
3986 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3987 change operator() to visit().
3988 (class Global_got_offset_visitor): Likewise.
3989 (class Global_symbol_visitor_got_plt):
3990 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3991 classes.
3992 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3993 (Sized_incr_relobj::do_read_symbols): New function.
3994 (Sized_incr_relobj::do_layout): New function.
3995 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3996 (Sized_incr_relobj::do_add_symbols): New function.
3997 (Sized_incr_relobj::do_should_include_member): New function.
3998 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3999 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4000 (Sized_incr_relobj::do_section_size): New function.
4001 (Sized_incr_relobj::do_section_name): New function.
4002 (Sized_incr_relobj::do_section_contents): New function.
4003 (Sized_incr_relobj::do_section_flags): New function.
4004 (Sized_incr_relobj::do_section_entsize): New function.
4005 (Sized_incr_relobj::do_section_address): New function.
4006 (Sized_incr_relobj::do_section_type): New function.
4007 (Sized_incr_relobj::do_section_link): New function.
4008 (Sized_incr_relobj::do_section_info): New function.
4009 (Sized_incr_relobj::do_section_addralign): New function.
4010 (Sized_incr_relobj::do_initialize_xindex): New function.
4011 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4012 (Sized_incr_relobj::do_read_relocs): New function.
4013 (Sized_incr_relobj::do_gc_process_relocs): New function.
4014 (Sized_incr_relobj::do_scan_relocs): New function.
4015 (Sized_incr_relobj::do_count_local_symbols): New function.
4016 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4017 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4018 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4019 (Sized_incr_relobj::do_relocate): New function.
4020 (Sized_incr_relobj::do_set_section_offset): New function.
4021 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4022 (Sized_incr_dynobj::do_read_symbols): New function.
4023 (Sized_incr_dynobj::do_layout): New function.
4024 (Sized_incr_dynobj::do_add_symbols): New function.
4025 (Sized_incr_dynobj::do_should_include_member): New function.
4026 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4027 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4028 (Sized_incr_dynobj::do_section_size): New function.
4029 (Sized_incr_dynobj::do_section_name): New function.
4030 (Sized_incr_dynobj::do_section_contents): New function.
4031 (Sized_incr_dynobj::do_section_flags): New function.
4032 (Sized_incr_dynobj::do_section_entsize): New function.
4033 (Sized_incr_dynobj::do_section_address): New function.
4034 (Sized_incr_dynobj::do_section_type): New function.
4035 (Sized_incr_dynobj::do_section_link): New function.
4036 (Sized_incr_dynobj::do_section_info): New function.
4037 (Sized_incr_dynobj::do_section_addralign): New function.
4038 (Sized_incr_dynobj::do_initialize_xindex): New function.
4039 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4040 (make_sized_incremental_object): New function.
4041 (Incremental_library::copy_unused_symbols): New function.
4042 (Incremental_library::do_for_all_unused_symbols): New function.
4043 * incremental.h (enum Incremental_input_flags): New type.
4044 (class Incremental_checker): Remove.
4045 (Incremental_input_entry::Incremental_input_entry): Add argument
4046 serial number.
4047 (Incremental_input_entry::arg_serial): New function.
4048 (Incremental_input_entry::set_is_in_system_directory): New function.
4049 (Incremental_input_entry::is_in_system_directory): New function.
4050 (Incremental_input_entry::arg_serial_): New data member.
4051 (Incremental_input_entry::is_in_system_directory_): New data member.
4052 (class Script_info): Move here from script.h.
4053 (Script_info::Script_info): Add filename parameter.
4054 (Script_info::filename): New function.
4055 (Script_info::filename_): New data member.
4056 (Incremental_script_entry::Incremental_script_entry): Add argument
4057 serial number.
4058 (Incremental_object_entry::Incremental_object_entry): Likewise.
4059 (Incremental_object_entry::add_input_section): Build list of input
4060 sections with map to original shndx.
4061 (Incremental_object_entry::get_input_section_index): New function.
4062 (Incremental_object_entry::shndx_): New data member.
4063 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4064 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4065 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4066 serial number.
4067 (Incremental_inputs::report_archive_begin): Likewise.
4068 (Incremental_inputs::report_object): Likewise.
4069 (Incremental_inputs::report_script): Likewise.
4070 (class Incremental_global_symbol_reader): New class.
4071 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4072 and store flags and input file type.
4073 (Incremental_input_entry_reader::arg_serial): New function.
4074 (Incremental_input_entry_reader::type): Extract type from flags.
4075 (Incremental_input_entry_reader::is_in_system_directory): New function.
4076 (Incremental_input_entry_reader::get_input_section_count): Call
4077 accessor function for type.
4078 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4079 function for type; adjust size of global symbol entry.
4080 (Incremental_input_entry_reader::get_global_symbol_count): Call
4081 accessor function for type.
4082 (Incremental_input_entry_reader::get_object_count): Likewise.
4083 (Incremental_input_entry_reader::get_object_offset): Likewise.
4084 (Incremental_input_entry_reader::get_member_count): Likewise.
4085 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4086 (Incremental_input_entry_reader::get_member_offset): Likewise.
4087 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4088 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4089 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4090 (Incremental_input_entry_reader::get_global_symbol_reader): New
4091 function.
4092 (Incremental_input_entry_reader::get_output_symbol_index): New
4093 function.
4094 (Incremental_input_entry_reader::type_): Remove.
4095 (Incremental_input_entry_reader::flags_): New data member.
4096 (Incremental_inputs_reader::input_file_offset): New function.
4097 (Incremental_inputs_reader::input_file_index): New function.
4098 (Incremental_inputs_reader::input_file): Call input_file_offset.
4099 (Incremental_inputs_reader::input_file_at_offset): New function.
4100 (Incremental_relocs_reader::get_r_type): Reformat.
4101 (Incremental_relocs_reader::get_r_shndx): Reformat.
4102 (Incremental_relocs_reader::get_r_offset): Reformat.
4103 (Incremental_relocs_reader::data): New function.
4104 (Incremental_binary::Incremental_binary): Initialize new data members.
4105 (Incremental_binary::check_inputs): Add cmdline parameter.
4106 (Incremental_binary::file_is_unchanged): Remove.
4107 (Input_reader::arg_serial): New function.
4108 (Input_reader::get_unused_symbol_count): New function.
4109 (Input_reader::get_unused_symbol): New function.
4110 (Input_reader::do_arg_serial): New function.
4111 (Input_reader::do_get_unused_symbol_count): New function.
4112 (Input_reader::do_get_unused_symbol): New function.
4113 (Incremental_binary::input_file_count): New function.
4114 (Incremental_binary::get_input_reader): Change signature to use
4115 index instead of filename.
4116 (Incremental_binary::file_has_changed): New function.
4117 (Incremental_binary::get_input_argument): New function.
4118 (Incremental_binary::get_library): New function.
4119 (Incremental_binary::get_script_info): New function.
4120 (Incremental_binary::init_layout): New function.
4121 (Incremental_binary::reserve_layout): New function.
4122 (Incremental_binary::output_file): New function.
4123 (Incremental_binary::do_check_inputs): New function.
4124 (Incremental_binary::do_file_is_unchanged): Remove.
4125 (Incremental_binary::do_file_has_changed): New function.
4126 (Incremental_binary::do_init_layout): New function.
4127 (Incremental_binary::do_reserve_layout): New function.
4128 (Incremental_binary::do_input_file_count): New function.
4129 (Incremental_binary::do_get_input_reader): Change signature.
4130 (Incremental_binary::input_args_map_): New data member.
4131 (Incremental_binary::library_map_): New data member.
4132 (Incremental_binary::script_map_): New data member.
4133 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4134 new data members.
4135 (Sized_incremental_binary::output_section): New function.
4136 (Sized_incremental_binary::inputs_reader): Add const.
4137 (Sized_incremental_binary::symtab_reader): Add const.
4138 (Sized_incremental_binary::relocs_reader): Add const.
4139 (Sized_incremental_binary::got_plt_reader): Add const.
4140 (Sized_incremental_binary::get_symtab_view): New function.
4141 (Sized_incremental_binary::Inputs_reader): New typedef.
4142 (Sized_incremental_binary::Input_entry_reader): New typedef.
4143 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4144 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4145 (Sized_incremental_binary::do_file_has_changed): New function.
4146 (Sized_incremental_binary::do_init_layout): New function.
4147 (Sized_incremental_binary::do_reserve_layout): New function.
4148 (Sized_input_reader::Inputs_reader): Remove.
4149 (Sized_input_reader::Input_entry_reader): Remove.
4150 (Sized_input_reader::do_arg_serial): New function.
4151 (Sized_input_reader::do_get_unused_symbol_count): New function.
4152 (Sized_input_reader::do_get_unused_symbol): New function.
4153 (Sized_incremental_binary::do_input_file_count): New function.
4154 (Sized_incremental_binary::do_get_input_reader): Change signature;
4155 use index instead of filename.
4156 (Sized_incremental_binary::section_map_): New data member.
4157 (Sized_incremental_binary::input_entry_readers_): New data member.
4158 (class Sized_incr_relobj): New class.
4159 (class Sized_incr_dynobj): New class.
4160 (make_sized_incremental_object): New function.
4161 (class Incremental_library): New class.
4162 * layout.cc (Free_list::num_lists): New static data member.
4163 (Free_list::num_nodes): New static data member.
4164 (Free_list::num_removes): New static data member.
4165 (Free_list::num_remove_visits): New static data member.
4166 (Free_list::num_allocates): New static data member.
4167 (Free_list::num_allocate_visits): New static data member.
4168 (Free_list::init): New function.
4169 (Free_list::remove): New function.
4170 (Free_list::allocate): New function.
4171 (Free_list::dump): New function.
4172 (Free_list::print_stats): New function.
4173 (Layout_task_runner::run): Resize output file for incremental updates.
4174 (Layout::Layout): Initialize new data members.
4175 (Layout::set_incremental_base): New function.
4176 (Layout::init_fixed_output_section): New function.
4177 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4178 incremental updates.
4179 (Layout::create_gold_note): Do not create gold note section for
4180 incremental updates.
4181 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4182 for incremental updates.
4183 (Layout::set_section_offsets): For incremental updates, allocate space
4184 from free list.
4185 (Layout::create_symtab_sections): Layout with offsets relative to
4186 start of section; for incremental updates, allocate space from free
4187 list.
4188 (Layout::create_shdrs): For incremental updates, allocate space from
4189 free list.
4190 (Layout::finish_dynamic_section): For incremental updates, do not
4191 check --as-needed (fixed in subsequent patch).
4192 * layout.h (class Free_list): New class.
4193 (Layout::set_incremental_base): New function.
4194 (Layout::incremental_base): New function.
4195 (Layout::init_fixed_output_section): New function.
4196 (Layout::allocate): New function.
4197 (Layout::incremental_base_): New data member.
4198 (Layout::free_list_): New data member.
4199 * main.cc (main): Print Free_list statistics.
4200 * object.cc (Relobj::finalize_incremental_relocs): Add
4201 clear_counts parameter; clear counts only when clear_counts is set.
4202 (Sized_relobj::Sized_relobj): Initialize new base class.
4203 (Sized_relobj::do_layout): Don't report special sections.
4204 (Sized_relobj::do_for_all_local_got_entries): New function.
4205 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4206 symtab_off to all symbol table offsets.
4207 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4208 * object.h (class Got_offset_list): Move to top of file.
4209 (Object::Object): Allow case where input_file == NULL.
4210 (Object::~Object): Likewise.
4211 (Object::input_file): Assert that input_file != NULL.
4212 (Object::lock): Allow case where input_file == NULL.
4213 (Object::unlock): Likewise.
4214 (Object::is_locked): Likewise.
4215 (Object::token): Likewise.
4216 (Object::release): Likewise.
4217 (Object::is_incremental): New function.
4218 (Object::get_mtime): New function.
4219 (Object::for_all_local_got_entries): New function.
4220 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4221 (Object::set_is_in_system_directory): New function.
4222 (Object::is_in_system_directory): New function.
4223 (Object::do_is_incremental): New function.
4224 (Object::do_get_mtime): New function.
4225 (Object::do_for_all_local_got_entries): New function.
4226 (Object::is_in_system_directory_): New data member.
4227 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4228 (class Sized_relobj_base): New class.
4229 (class Sized_relobj): Derive from Sized_relobj_base.
4230 (class Sized_relobj::Symbols): Redeclare from base class.
4231 (class Sized_relobj::local_got_offset_list): Remove.
4232 (class Sized_relobj::Output_sections): Redeclare from base class.
4233 (class Sized_relobj::do_for_all_local_got_entries): New function.
4234 (class Sized_relobj::write_local_symbols): Add offset parameter.
4235 (class Sized_relobj::local_symbol_offset_): Update comment.
4236 (class Sized_relobj::local_dynsym_offset_): Update comment.
4237 * options.cc (Input_arguments::add_file): Remove const.
4238 * options.h (Input_file_argument::Input_file_argument):
4239 Initialize arg_serial_ (all constructors).
4240 (Input_file_argument::set_arg_serial): New function.
4241 (Input_file_argument::arg_serial): New function.
4242 (Input_file_argument::arg_serial_): New data member.
4243 (Input_arguments::Input_arguments): Initialize file_count_.
4244 (Input_arguments::add_file): Remove const.
4245 (Input_arguments::number_of_input_files): New function.
4246 (Input_arguments::file_count_): New data member.
4247 (Command_line::number_of_input_files): Call
4248 Input_arguments::number_of_input_files.
4249 * output.cc (Output_segment_headers::Output_segment_headers):
4250 Set current size.
4251 (Output_section::Input_section::current_data_size): New function.
4252 (Output_section::Output_section): Initialize new data members.
4253 (Output_section::add_input_section): Don't do merge sections for
4254 an incremental link; allocate space from free list for an
4255 incremental update.
4256 (Output_section::add_output_section_data): Allocate space from
4257 free list for an incremental update.
4258 (Output_section::update_data_size): New function.
4259 (Output_section::set_fixed_layout): New function.
4260 (Output_section::reserve): New function.
4261 (Output_segment::set_section_addresses): Remove const.
4262 (Output_segment::set_section_list_addresses): Remove const; allocate
4263 space from free list for an incremental update.
4264 (Output_segment::set_offset): Adjust size of RELRO segment for an
4265 incremental update.
4266 * output.h (Output_data::current_data_size): Move here from
4267 child classes.
4268 (Output_data::pre_finalize_data_size): New function.
4269 (Output_data::update_data_size): New function.
4270 (Output_section_headers::update_data_size): new function.
4271 (Output_section_data_build::current_data_size): Move to Output_data.
4272 (Output_data_strtab::update_data_size): New function.
4273 (Output_section::current_data_size): Move to Output_data.
4274 (Output_section::set_fixed_layout): New function.
4275 (Output_section::has_fixed_layout): New function.
4276 (Output_section::reserve): New function.
4277 (Output_section::update_data_size): New function.
4278 (Output_section::has_fixed_layout_): New data member.
4279 (Output_section::free_list_): New data member.
4280 (Output_segment::set_section_addresses): Remove const.
4281 (Output_segment::set_section_list_addresses): Remove const.
4282 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4283 New function.
4284 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4285 New function.
4286 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4287 parameter when calling Add_symbols constructor; store argument
4288 serial number for members of a lib group.
4289 (Add_symbols::locks): Allow case where token == NULL.
4290 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4291 (Read_member::~Read_member): New function.
4292 (Read_member::is_runnable): New function.
4293 (Read_member::locks): New function.
4294 (Read_member::run): New function.
4295 (Check_script::~Check_script): New function.
4296 (Check_script::is_runnable): New function.
4297 (Check_script::locks): New function.
4298 (Check_script::run): New function.
4299 (Check_library::~Check_library): New function.
4300 (Check_library::is_runnable): New function.
4301 (Check_library::locks): New function.
4302 (Check_library::run): New function.
4303 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4304 (Add_symbols::library_): New data member.
4305 (class Read_member): New class.
4306 (class Check_script): New class.
4307 (class Check_library): New class.
4308 * reloc.cc (Read_relocs::is_runnable): Allow case where
4309 token == NULL.
4310 (Read_relocs::locks): Likewise.
4311 (Scan_relocs::locks): Likewise.
4312 (Relocate_task::locks): Likewise.
4313 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4314 to clear counters.
4315 (Sized_relobj::incremental_relocs_scan): Fix comment.
4316 (Sized_relobj::do_relocate): Pass output file offset to
4317 write_local_symbols.
4318 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4319 from class declaration.
4320 * script.cc (read_input_script): Allocate Script_info; pass
4321 argument serial number to report_script.
4322 * script.h (class Script_info): Move to incremental.h.
4323 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4324 * symtab.h (Symbol_table::add_from_incrobj): New function.
4325 (Symbol_table::set_file_offset): New function.
4326
4327 2011-04-05 Cary Coutant <ccoutant@google.com>
4328
4329 * incremental-dump.cc (dump_incremental_inputs): Change signature
4330 to take a Sized_incremental_binary; change caller. Use readers
4331 in Sized_incremental_binary.
4332 * incremental.cc
4333 (Sized_incremental_binary::find_incremental_inputs_sections):
4334 Rename do_find_incremental_inputs_sections to this.
4335 (Sized_incremental_binary::setup_readers): New function.
4336 (Sized_incremental_binary::do_check_inputs): Check
4337 has_incremental_info_ flag; move setup code to setup_readers;
4338 use input readers.
4339 (Sized_incremental_binary::do_file_is_unchanged): New function.
4340 (Sized_incremental_binary::do_get_input_reader): New function.
4341 * incremental.h (class Incremental_binary): Move to end of file.
4342 (Incremental_binary::file_is_unchanged): New function.
4343 (Incremental_binary::do_file_is_unchanged): New function.
4344 (Incremental_binary::Input_reader): New class.
4345 (Incremental_binary::get_input_reader): New function.
4346 (class Sized_incremental_binary): Move to end of file.
4347 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4348 input section reader classes.
4349 (Sized_incremental_binary::has_incremental_info): New function.
4350 (Sized_incremental_binary::inputs_reader): New function.
4351 (Sized_incremental_binary::symtab_reader): New function.
4352 (Sized_incremental_binary::relocs_reader): New function.
4353 (Sized_incremental_binary::got_plt_reader): New function.
4354 (Sized_incremental_binary::do_file_is_unchanged): New function.
4355 (Sized_incremental_binary::Sized_input_reader): New class.
4356 (Sized_incremental_binary::get_input_reader): New function.
4357 (Sized_incremental_binary::find_incremental_inputs_sections):
4358 Rename do_find_incremental_inputs_sections to this.
4359 (Sized_incremental_binary::setup_readers): New function.
4360 (Sized_incremental_binary::has_incremental_info_): New data member.
4361 (Sized_incremental_binary::inputs_reader_): New data member.
4362 (Sized_incremental_binary::symtab_reader_): New data member.
4363 (Sized_incremental_binary::relocs_reader_): New data member.
4364 (Sized_incremental_binary::got_plt_reader_): New data member.
4365 (Sized_incremental_binary::current_input_file_): New data member.
4366
4367 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4368
4369 PR gold/12640
4370 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4371 violation.
4372
4373 2011-03-30 Cary Coutant <ccoutant@google.com>
4374
4375 * archive.cc (Archive::include_member): Adjust call to report_object.
4376 (Add_archive_symbols::run): Add script_info to call to
4377 report_archive_begin.
4378 (Lib_group::include_member): Adjust call to report_object.
4379 (Add_lib_group_symbols::run): Adjust call to report_object.
4380 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4381 blocks. Add object count for script input files.
4382 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4383 script_info parameter; change all callers.
4384 (Incremental_inputs::report_object): Add script_info parameter;
4385 change all callers.
4386 (Incremental_inputs::report_script): Store backpointer to
4387 incremental info entry.
4388 (Output_section_incremental_inputs::set_final_data_size): Record
4389 additional information for scripts.
4390 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4391 * incremental.h (Incremental_script_entry::add_object): New function.
4392 (Incremental_script_entry::get_object_count): New function.
4393 (Incremental_script_entry::get_object): New function.
4394 (Incremental_script_entry::objects_): New data member; adjust
4395 constructor.
4396 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4397 (Incremental_inputs::report_object): Add script_info parameter.
4398 (Incremental_inputs_reader::get_object_count): New function.
4399 (Incremental_inputs_reader::get_object_offset): New function.
4400 * options.cc (Input_arguments::add_file): Return reference to
4401 new input argument.
4402 * options.h (Input_argument::set_script_info): New function.
4403 (Input_argument::script_info): New function.
4404 (Input_argument::script_info_): New data member; adjust all
4405 constructors.
4406 (Input_file_group::add_file): Return reference to new input argument.
4407 (Input_file_lib::add_file): Likewise.
4408 (Input_arguments::add_file): Likewise.
4409 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4410 * script.cc (Parser_closure::Parser_closure): Add script_info
4411 parameter; adjust all callers.
4412 (Parser_closure::script_info): New function.
4413 (Parser_closure::script_info_): New data member.
4414 (read_input_script): Report scripts earlier to incremental info.
4415 (script_add_file): Set script_info in Input_argument.
4416 (script_add_library): Likewise.
4417 * script.h (Script_options::Script_info): Rewrite class.
4418
4419 2011-03-29 Cary Coutant <ccoutant@google.com>
4420
4421 * archive.cc (Library_base::should_include_member): Move
4422 method here from class Archive.
4423 (Archive::Archive): Initialize base class.
4424 (Archive::should_include_member): Move to base class.
4425 (Archive::do_for_all_unused_symbols): New function.
4426 (Add_archive_symbols::run): Remove redundant access to
4427 incremental_inputs.
4428 (Lib_group::Lib_group): Initialize base class.
4429 (Lib_group::do_filename): New function.
4430 (Lib_group::include_member): Pass pointer to Lib_group to
4431 report_object.
4432 (Lib_group::do_for_all_unused_symbols): New function.
4433 (Add_lib_group_symbols::run): Report archive information for
4434 incremental links.
4435 * archive.h (class Library_base): New base class.
4436 (class Archive): Derive from Library_base.
4437 (Archive::filename): Move to base class.
4438 (Archive::set_incremental_info): Likewise.
4439 (Archive::incremental_info): Likewise.
4440 (Archive::Should_include): Likewise.
4441 (Archive::should_include_member): Likewise.
4442 (Archive::Armap_entry): Remove.
4443 (Archive::Unused_symbol_iterator): Remove.
4444 (Archive::unused_symbols_begin): Remove.
4445 (Archive::unused_symbols_end): Remove.
4446 (Archive::do_filename): New function.
4447 (Archive::do_get_mtime): New function.
4448 (Archive::do_for_all_unused_symbols): New function.
4449 (Archive::task_): Move to base class.
4450 (Archive::incremental_info_): Likewise.
4451 (class Lib_group): Derive from Library_base.
4452 (Lib_group::do_filename): New function.
4453 (Lib_group::do_get_mtime): New function.
4454 (Lib_group::do_for_all_unused_symbols): New function.
4455 (Lib_group::task_): Move to base class.
4456 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4457 function.
4458 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4459 function.
4460 * incremental.cc (Incremental_inputs::report_archive_begin):
4461 Use Library_base; call library's get_mtime; add incremental inputs
4462 entry before members.
4463 (class Unused_symbol_visitor): New class.
4464 (Incremental_inputs::report_archive_end): Use Library_base; use
4465 visitor class to record unused symbols; don't add incremental inputs
4466 entry after members.
4467 (Incremental_inputs::report_object): Use Library_base.
4468 * incremental.h
4469 (Incremental_archive_entry::Incremental_archive_entry): Remove
4470 unused Archive parameter.
4471 (Incremental_inputs::report_archive_begin): Use Library_base.
4472 (Incremental_inputs::report_archive_end): Likewise.
4473 (Incremental_inputs::report_object): Likewise.
4474 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4475 function.
4476 * object.h (Object::for_all_global_symbols): New function.
4477 (Object::do_for_all_global_symbols): New function.
4478 (Sized_relobj::do_for_all_global_symbols): New function.
4479 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4480 function.
4481 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4482 function.
4483
4484 2011-03-27 Ian Lance Taylor <iant@google.com>
4485
4486 * archive.cc (Archive::interpret_header): Return -1 if something
4487 goes wrong. Change callers accordingly.
4488
4489 2011-03-25 Cary Coutant <ccoutant@google.com>
4490
4491 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4492 * testsuite/Makefile.in: Regenerate.
4493
4494 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4495
4496 * plugin.cc (get_view): New.
4497 (Plugin::load): Pass get_view to the plugin.
4498 (Plugin_manager::get_view): New.
4499
4500 2011-03-21 Ian Lance Taylor <iant@google.com>
4501
4502 * testsuite/final_layout.sh: Rewrite to not use dc.
4503 * testsuite/relro_test.sh: Fail if dc is not present.
4504
4505 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4506
4507 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4508 Change == to -eq.
4509 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4510 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4511 Change == to -eq.
4512 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4513 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4514
4515 2011-03-14 Ian Lance Taylor <iant@google.com>
4516
4517 * script-sections.cc (Sort_output_sections::script_compare):
4518 Rename from is_before, change return type.
4519 (Sort_output_sections::operator()): Adjust accordingly.
4520
4521 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4522
4523 PR gold/12572
4524 * testsuite/odr_violation2.cc: Add comment to make all error line
4525 numbers double digits.
4526 * testsuite/debug_msg.sh: Adjust expected errors.
4527
4528 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4529
4530 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4531 but mark earlier ones as non-canonical
4532 (offset_to_iterator): Update search target and example
4533 (do_addr2line): Return extra lines in a vector*
4534 (format_file_lineno): Extract from do_addr2line
4535 (one_addr2line): Add vector* out-param
4536 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4537 when a lineno entry appeared last for its instruction
4538 (Dwarf_line_info): Add vector* out-param
4539 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4540 * symtab.cc (Odr_violation_compare): Include the lineno in the
4541 comparison again.
4542 (linenos_from_loc): New. Combine the canonical line for an
4543 address with its other lines.
4544 (True_if_intersect): New. Helper functor to make
4545 std::set_intersection a query.
4546 (detect_odr_violations): Compare sets of lines instead of just
4547 one line for each function. This became less deterministic, but
4548 has fewer false positives.
4549 * symtab.h: Declarations.
4550 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4551 mix an optimized and non-optimized object in the same binary
4552 (odr_violation2.so): Same.
4553 * testsuite/Makefile.in: Regenerate from Makefile.am.
4554 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4555 * testsuite/debug_msg.sh: Update line numbers and add
4556 assertions.
4557 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4558 non-optimized context.
4559 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4560 isn't inlined, and use OdrDerived in an optimized context.
4561 * testsuite/odr_header1.h: Defines OdrDerived, where
4562 optimization will change the
4563 first-instruction-in-the-destructor's file and line number.
4564 * testsuite/odr_header2.h: Defines OdrBase.
4565
4566 2011-03-09 Ian Lance Taylor <iant@google.com>
4567
4568 * fileread.cc (File_read::clear_views): Don't delete the whole
4569 file view.
4570
4571 2011-03-08 Ian Lance Taylor <iant@google.com>
4572
4573 PR gold/12525
4574 * fileread.cc: #include <climits>.
4575 (GOLD_IOV_MAX): Define.
4576 (File_read::read_multiple): Limit number of entries by iov_max.
4577 * fileread.h (class File_read): Always set max_readv_entries to
4578 128.
4579
4580 2011-03-07 Ian Lance Taylor <iant@google.com>
4581
4582 PR gold/12525
4583 * options.h (class General_options): Add -dy and -dn.
4584
4585 2011-03-02 Cary Coutant <ccoutant@google.com>
4586
4587 * testsuite/script_test_9.t: Add TLS segment.
4588
4589 2011-03-02 Simon Baldwin <simonb@google.com>
4590
4591 * configure.ac: Add check for gnu_indirect_function support in
4592 the toolchain building binutils.
4593 * configure: Rebuild.
4594
4595 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4596
4597 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4598 plugin only symbols.
4599 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4600 in plugin files as not needed in the symbol table.
4601
4602 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4603
4604 * output.cc (Output_section::add_input_section): Delay fill
4605 generation for section ordering.
4606
4607 2011-02-09 Ian Lance Taylor <iant@google.com>
4608
4609 PR gold/12316
4610 * object.h (class Sized_relobj): Remove clear_local_symbols.
4611 * reloc.cc (Sized_relobj::do_relocate): Don't call
4612 clear_local_symbols.
4613
4614 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4615
4616 * plugin.cc (is_visible_from_outside): Return true for symbols
4617 in the -u option.
4618
4619 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4620
4621 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4622 filename.
4623
4624 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4625
4626 * icf.h (is_section_foldable_candidate): Change type of parameter
4627 to std::string.
4628 * icf.cc (Icf::find_identical_sections): Change type of local variable
4629 section_name to be std::string.
4630 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4631
4632 2011-01-25 Ian Lance Taylor <iant@google.com>
4633
4634 * script.cc (script_add_extern): Rewrite to use
4635 add_symbol_reference.
4636
4637 2011-01-25 Doug Kwan <dougkwan@google.com>
4638
4639 * icf.cc (get_section_contents): Always lock section's object.
4640
4641 2011-01-24 Ian Lance Taylor <iant@google.com>
4642
4643 * options.h (class General_options): Accept
4644 --no-detect-odr-violations.
4645
4646 2011-01-24 Ian Lance Taylor <iant@google.com>
4647
4648 * version.cc (version_string): Bump to 1.11.
4649
4650 2011-01-24 Ian Lance Taylor <iant@google.com>
4651
4652 * plugin.cc (class Plugin_rescan): Define new class.
4653 (Plugin_manager::claim_file): Set any_claimed_.
4654 (Plugin_manager::save_archive): New function.
4655 (Plugin_manager::save_input_group): New function.
4656 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4657 necessary.
4658 (Plugin_manager::new_undefined_symbol): New function.
4659 (Plugin_manager::rescan): New function.
4660 (Plugin_manager::rescannable_defines): New function.
4661 (Plugin_manager::add_input_file): Set any_added_.
4662 * plugin.h (class Plugin_manager): define new fields rescannable_,
4663 undefined_symbols_, any_claimed_, and any_added_. Declare
4664 Plugin_rescan as friend. Declare new functions.
4665 (Plugin_manager::Rescannable): Define type.
4666 (Plugin_manager::Rescannable_list): Define type.
4667 (Plugin_manager::Undefined_symbol_list): Define type.
4668 (Plugin_manager::Plugin_manager): Initialize new fields.
4669 * archive.cc (Archive::defines_symbol): New function.
4670 (Add_archive_symbols::run): Pass archive to plugins if any.
4671 * archive.h (class Archive): Declare defines_symbol.
4672 * readsyms.cc (Input_group::~Input_group): New function.
4673 (Finish_group::run): Pass input_group to plugins if any.
4674 * readsyms.h (class Input_group): Declare destructor.
4675 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4676 any.
4677
4678 2011-01-10 Ian Lance Taylor <iant@google.com>
4679
4680 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4681 section as relro.
4682 (Layout::set_segment_offsets): Reset increase_relro before calling
4683 set_section_addresses a second time.
4684
4685 2011-01-04 Cary Coutant <ccoutant@google.com>
4686
4687 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4688 sections before NOBITS sections.
4689
4690 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4691
4692 * version.cc (print_version): Update copyright to 2011.
4693
4694 2010-12-23 Cary Coutant <ccoutant@google.com>
4695
4696 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4697 of OS to this->add. Add OD parameter to second form of the function.
4698
4699 2010-12-20 Ian Lance Taylor <iant@google.com>
4700
4701 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4702 second of two consecutive entries with same offset.
4703
4704 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4705
4706 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4707 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4708 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4709 to avoid unneeded links against $(LDADD).
4710 * testsuite/Makefile.in: Regenerate.
4711
4712 2010-12-15 Ian Lance Taylor <iant@google.com>
4713
4714 PR gold/12324
4715 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4716 for R_X86_64_32 and R_X86_64_PC32.
4717 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4718 ver_matching_def_pic.o.
4719 (ver_matching_def_pic.o): New target.
4720
4721 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4722
4723 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4724 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4725 Move definition before File_read::View member definitions.
4726 (File_read::View::~View): Initialize and hold lock before
4727 updating current_mapped_bytes.
4728
4729 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4730
4731 * dwarf_reader.cc: Remove outdated comment.
4732 * gold-threads.cc: Fix typo in error message.
4733 * archive.cc: Fix typos in comments.
4734 * archive.h: Likewise.
4735 * arm-reloc-property.cc: Likewise.
4736 * arm-reloc-property.h: Likewise.
4737 * arm-reloc.def: Likewise.
4738 * arm.cc: Likewise.
4739 * attributes.h: Likewise.
4740 * cref.cc: Likewise.
4741 * ehframe.cc: Likewise.
4742 * fileread.h: Likewise.
4743 * gold.h: Likewise.
4744 * i386.cc: Likewise.
4745 * icf.cc: Likewise.
4746 * incremental.h: Likewise.
4747 * int_encoding.cc: Likewise.
4748 * layout.h: Likewise.
4749 * main.cc: Likewise.
4750 * merge.h: Likewise.
4751 * object.cc: Likewise.
4752 * object.h: Likewise.
4753 * options.cc: Likewise.
4754 * readsyms.cc: Likewise.
4755 * reduced_debug_output.cc: Likewise.
4756 * reloc.cc: Likewise.
4757 * script-sections.cc: Likewise.
4758 * sparc.cc: Likewise.
4759 * symtab.h: Likewise.
4760 * target-reloc.h: Likewise.
4761 * target.cc: Likewise.
4762 * target.h: Likewise.
4763 * timer.cc: Likewise.
4764 * timer.h: Likewise.
4765 * x86_64.cc: Likewise.
4766
4767 2010-12-09 Cary Coutant <ccoutant@google.com>
4768
4769 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4770 stack.
4771 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4772 parameter; change all callers.
4773 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4774 * options.h (warn_execstack): New option.
4775
4776 2010-12-07 Doug Kwan <dougkwan@google.com>
4777
4778 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4779 like function call relocations.
4780
4781 2010-12-07 Ian Lance Taylor <iant@google.com>
4782
4783 * archive.cc (Archive::get_elf_object_for_member): Permit
4784 punconfigured to be NULL.
4785 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4786 (Archive::include_member): Pass NULL to get_elf_object_for_member
4787 if we searched for the archive and this is the first included
4788 object.
4789
4790 2010-12-01 Ian Lance Taylor <iant@google.com>
4791
4792 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4793 track_relocs_type_ field.
4794 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4795 Set track_relocs_type_.
4796 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4797 contents when using RELA relocs.
4798 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4799 reloc_map_.
4800 * reloc.cc (Track_relocs::next_addend): New function.
4801 * reloc.h (class Track_relocs): Declare next_addend.
4802
4803 2010-12-01 Ian Lance Taylor <iant@google.com>
4804
4805 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4806 virtual destructor.
4807
4808 2010-12-01 Ian Lance Taylor <iant@google.com>
4809
4810 * README: Update compilers known to work and fail.
4811
4812 2010-11-23 Matthias Klose <doko@ubuntu.com>
4813
4814 * configure.in: For --enable-gold, handle value `default' instead of
4815 `both*'. Always install ld as ld.bfd, install as ld if gold is
4816 not the default.
4817 * configure: Regenerate.
4818
4819 2010-11-18 Doug Kwan <dougkwan@google.com>
4820
4821 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4822 and right_alignment to be zero. Store result alignment only if it is
4823 greater than existing alignment.
4824
4825 2010-11-16 Cary Coutant <ccoutant@google.com>
4826
4827 PR gold/12220
4828 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4829 Check for ".zdebug_line".
4830
4831 2010-11-16 Doug Kwan <dougkwan@google.com>
4832 Cary Coutant <ccoutant@google.com>
4833
4834 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4835 by reference; adjust all callers.
4836 * output.cc (Output_segment::set_section_addresses): Adjust references
4837 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4838 list is empty.
4839 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4840 end at page boundary.
4841
4842 2010-11-16 Cary Coutant <ccoutant@google.com>
4843
4844 PR gold/12220
4845 * layout.cc (Layout::choose_output_section): Transform names of
4846 compressed sections even when using a script with a SECTIONS clause.
4847 (Layout::output_section_name): Remove code to transform
4848 compressed debug section names.
4849 * output.cc (Output_section::add_input_section): Use uncompressed
4850 section size when tracking input sections.
4851
4852 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4853
4854 * symtab.h (Symbol::NON_PIC_REF): Remove.
4855 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4856 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4857 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4858 (Symbol::use_plt_offset): Take a flags argument and pass it
4859 directly to needs_dynamic_reloc. Restrict check for undefined
4860 weak symbols to function calls.
4861 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4862 (Target_arm::Scan::global): Use it.
4863 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4864 (Target_arm::Relocate::relocate): Likewise.
4865 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4866 parameter with an r_type parameter. Use get_reference_flags
4867 to get the flags.
4868 (Target_arm::Relocate::relocate): Update accordingly.
4869 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4870 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4871 (Target_i386::Scan::global): Likewise.
4872 (Target_i386::Relocate::relocate): Likewise.
4873 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4874 parameter with an r_type parameter. Use get_reference_flags
4875 to get the flags.
4876 (Target_i386::Relocate::relocate): Update accordingly.
4877 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4878 (Target_powerpc::Scan::global): Use it.
4879 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4880 (Target_powerpc::Relocate::relocate): Likewise.
4881 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4882 (Target_sparc::Scan::global): Use it.
4883 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4884 (Target_sparc::Relocate::relocate): Likewise.
4885 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4886 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4887 (Target_x86_64::Scan::global): Likewise.
4888 (Target_x86_64::Relocate::relocate): Likewise.
4889
4890 2010-11-08 Doug Kwan <dougkwan@google.com>
4891 Cary Coutant <ccoutant@google.com>
4892
4893 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4894 (Arm_exidx_merge_section::section_contents_): New data member.
4895 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4896 (Arm_input_section::~Arm_input_section): De-allocate memory.
4897 (Arm_input_section::original_contents_): New data member.
4898 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4899 in parameters instead of calling Object::section_contents without
4900 locking.
4901 (Arm_output_section::group_section): New parameter TASK. Pass it
4902 to callees that need locking objects.
4903 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4904 to lock EXIDX input sections. Fix a formatting issue. Call
4905 Arm_exidx_merged_section::build_contents to create merged section
4906 contents.
4907 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4908 to lock object of stub table owner.
4909 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4910 TEXT_SIZE to initialize data member TEXT_SIZE_.
4911 (Arm_exidx_input_section::addralign): Fix typo in comment.
4912 (Arm_exidx_input_section::text_size): New method.
4913 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4914 that require locking objects. Lock objects before scanning for stubs
4915 and updating local symbols.
4916 (Arm_input_section<big_endian>::init): Copy contents of original
4917 input section.
4918 (Arm_input_section<big_endian>::do_write): Use saved contents of
4919 original input section instead of calling Object::section_contents
4920 without locking.
4921 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4922 size without calling Object::section_size().
4923 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4924 for size. Allocate a buffer for merged EXIDX entries.
4925 (Arm_exidx_merged_section::build_contents): New method.
4926 (Arm_exidx_merged_section::do_write): Move merge section contents
4927 building code to Arm_exidx_merged_section::build_contetns. Write
4928 out contetns in buffer instead of building it on the fly.
4929 (Arm_relobj::make_exidx_input_section): Also pass text section size
4930 to Arm_exidx_input_section constructor.
4931 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4932 (Arm_dynobj::do_read_symbols): Fix memory leak.
4933 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4934 * target.h: (class Task): Add forward declaration.
4935 (Target::relax): Add new parameter TASK and pass it to
4936 Target::do_relax().
4937 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4938
4939 2010-11-05 Cary Coutant <ccoutant@google.com>
4940
4941 PR gold/10708
4942 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4943 object when reading from the file.
4944 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4945 second layout pass.
4946 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4947 when reading section contents.
4948 (get_section_contents): Likewise.
4949 (icf::find_identical_sections): Likewise.
4950 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4951 object when reading from the file.
4952 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4953 the object when doing deferred section layout.
4954
4955 2010-11-03 Nick Clifton <nickc@redhat.com>
4956
4957 PR gold/12001
4958 * script.h (class Symbol_assignment: name): New member. Returns
4959 the name of the symbol.
4960 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4961 Returns true if the given symbol name is on the list of
4962 assignments wating to be processed.
4963 * archive.cc (should_incldue_member): If the symbol is undefined,
4964 check to see if it is on the list of symbols pending assignment.
4965
4966 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4967
4968 * script-sections.cc (Script_sections::find_memory_region): Check
4969 for a NULL output section pointer.
4970
4971 2010-10-29 Doug Kwan <dougkwan@google.com>
4972
4973 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4974 Output_section::add_relaxed_input_section.
4975 * output.cc (Output_section::add_relaxed_input_section): Add new
4976 arguments LAYOUT and NAME. Set section order index.
4977 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4978 Copy section order index.
4979 * output.h (Output_section::add_relaxed_input_section): Add new
4980 arguments LAYOUT and NAME.
4981
4982 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4983
4984 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4985 NATIVE_OR_CROSS_LINKER.
4986 * testsuite/Makefile.in: Regenerate.
4987
4988 2010-10-20 Doug Kwan <dougkwan@google.com>
4989
4990 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4991 without SHF_LINK_ORDER flags.
4992 * layout.cc (Layout::choose_output_section): Do not filter
4993 SHF_LINK_ORDER flag in a relocatable link.
4994
4995 2010-10-17 Cary Coutant <ccoutant@google.com>
4996
4997 * output.h (Output_segment::set_section_addresses): Change function
4998 signature. Update all callers.
4999 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5000 sections.
5001 (Output_segment::set_section_addresses): Align after last TLS
5002 section. Add padding before last relro section instead of after.
5003
5004 2010-10-17 Doug Kwan <dougkwan@google.com>
5005
5006 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5007 GOT output section to be writable.
5008
5009 2010-10-14 Cary Coutant <ccoutant@google.com>
5010
5011 * debug.h (DEBUG_INCREMENTAL): New flag.
5012 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5013 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5014 mode.
5015 * incremental.cc (report_command_line): Ignore all forms of
5016 --incremental.
5017 * layout.cc (Layout::Layout): Check parameters for incremental link
5018 mode.
5019 * options.cc (General_options::parse_incremental): New function.
5020 (General_options::parse_no_incremental): New function.
5021 (General_options::parse_incremental_full): New function.
5022 (General_options::parse_incremental_update): New function.
5023 (General_options::incremental_mode_): New data member.
5024 (General_options::finalize): Check incremental_mode_.
5025 * options.h (General_options): Update help text for --incremental.
5026 Add --no-incremental, --incremental-full, --incremental-update.
5027 (General_options::Incremental_mode): New enum type.
5028 (General_options::incremental_mode): New function.
5029 (General_options::incremental_mode_): New data member.
5030 * parameters.cc (Parameters::incremental_mode_): New data member.
5031 (Parameters::set_options): Set incremental_mode_.
5032 (Parameters::set_incremental_full): New function.
5033 (Parameters::incremental): New function.
5034 (Parameters::incremental_update): New function.
5035 (set_parameters_incremental_full): New function.
5036 * parameters.h (Parameters::set_incremental_full): New function.
5037 (Parameters::incremental): New function.
5038 (Parameters::incremental_update): New function.
5039 (Parameters::incremental_mode_): New data member.
5040 (set_parameters_incremental_full): New function.
5041 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5042 incremental link mode.
5043 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5044 (Sized_relobj::do_relocate_sections): Likewise.
5045 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5046 option.
5047 * testsuite/Makefile.in: Regenerate.
5048 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5049
5050 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5051
5052 * script-sections.h (class Script_sections): Make
5053 Sections_elements typedef public.
5054 * script-sections.cc (class Sort_output_sections): Add elements_
5055 field. Add constructor which sets it; change all callers.
5056 (Sort_output_sections::is_before): New function.
5057 (Sort_output_sections::operator()): Call is_before.
5058 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5059 conditional.
5060 * testsuite/script_test_10.sh: New test. Test script section
5061 order.
5062 * testsuite/script_test_10.t: Likewise.
5063 * testsuite/script_test_10.s: Likewise.
5064 * testsuite/Makefile.am: Wrap the cross linker tests and the
5065 common tests into NATIVE_OR_CROSS_LINKER.
5066 (check_SCRIPTS): Add script_test_10.sh.
5067 (check_DATA): Add script_test_10.stdout.
5068 (script_test_10.o, script_test_10): New targets.
5069 (script_test_10.stdout): New target.
5070 * configure, testsuite/Makefile.in: Regenerate.
5071
5072 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5073
5074 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5075 error for the deprecated relocations.
5076 (Target_arm::Scan::global): Likewise.
5077 (Target_arm::Relocate::relocate): Likewise.
5078
5079 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5080
5081 * fileread.cc (Input_file::find_file): Initialize *found_name
5082 and *namep when using the fallback search for case 4.
5083
5084 2010-10-11 Cary Coutant <ccoutant@google.com>
5085
5086 * options.h (class General_options): Redefine -z lazy as an alias for
5087 the negation of -z now.
5088
5089 2010-10-11 Ian Lance Taylor <iant@google.com>
5090
5091 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5092 binding.
5093
5094 2010-10-06 Nick Clifton <nickc@redhat.com>
5095
5096 * script-sections.cc(class Memory_region): Remove
5097 current_lma_offset_ field. Rename current_vma_offset_ to
5098 current_offset_. Add last_section_ field.
5099 (Memory_region::get_current_vma_address): Rename to
5100 get_current_address.
5101 (Memory_region::get_current_lma_address): Delete.
5102 (Memory_region::increment_vma_offset): Rename to
5103 increment_offset.
5104 (Memory_region::increment_lma_offset): Delete.
5105 (Memory_region::attributes_compatible): New method. Returns
5106 true if the provided section is compatible with the region.
5107 (Memory_region::get_last_section): New method. Returns the last
5108 section to use the region.
5109 (Memory_region::set_last_section): New method. Stores the last
5110 section to use the region.
5111 (Script_sections::block_in_region): New method. Returns true if
5112 a block of memory is contained within a region.
5113 (Script_sections::find_memory_region): New method. Locates a
5114 memory region to be used to set a VMA or LMA address.
5115 (Output_section_definition::set_section_addresses): Add code to
5116 check for addresses set by memory regions.
5117 (Output_segment::set_section_addresses): Remove memory region
5118 walking code.
5119 (Script_sections::create_segment): Add a warning if a header
5120 segment is created outside of any region.
5121 * script-sections.h (class Script_sections): Add prototypes for
5122 find_memory_region and block_in_region methods.
5123 * testsuite/memory_test.s: Use .long instead of .word.
5124 * testsuite/memory_test.t: Add some more output sections.
5125 * testsuite/memory_test.sh: Update expected output.
5126
5127 2010-10-02 Doug Kwan <dougkwan@google.com>
5128
5129 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5130 defintion to symtab.h
5131 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5132 declaration to defintion.
5133
5134 2010-10-01 Nick Clifton <nickc@redhat.com>
5135
5136 * expression.cc (eval): Replace dummy argument with NULL.
5137 (eval_maybe_dot): Check for a NULL result section pointer.
5138 (Symbol_expression::value): Likewise.
5139 (Dot_expression::value): Likewise.
5140 (BINARY_EXPRESSION): Likewise.
5141 (Max_expression::value): Likewise.
5142 (Min_expression::value): Likewise.
5143 (Absolute_expression::value): Likewise.
5144 (Addr_expression::value_from_output_section): Likewise.
5145 (Loaddddr_expression::value_from_output_section): Likewise.
5146 (Segment_start_expression::value): Likewise.
5147 * script-sections.cc
5148 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5149 argument with NULL.
5150 (Sections_elememt_dot_assignment::set_section_addresses):
5151 Likewise.
5152 (Output_data_expression::do_write_to_buffer): Likewise.
5153 (Output_section_definition::finalize_symbols): Likewise.
5154 (Output_section_definition::set_section_addresses): Likewise.
5155
5156 2010-09-30 Doug Kwan <dougkwan@google.com>
5157
5158 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5159
5160 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5161
5162 * target.h (Target::can_icf_inline_merge_sections): New virtual
5163 function.
5164 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5165 virtual function.
5166 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5167 virtual function.
5168 * icf.cc (get_section_contents): Inline merge sections only when
5169 target allows it.
5170
5171 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5172
5173 * configure: Regenerate.
5174
5175 2010-09-17 Ian Lance Taylor <iant@google.com>
5176
5177 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5178 * testsuite/Makefile.am (memory_test.o): New target.
5179 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5180 memory_test.t.
5181 * testsuite/Makefile.in: Rebuild.
5182
5183 2010-09-17 Doug Kwan <dougkwan@google.com>
5184
5185 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5186 defintion if relocation uses GOT entries of the symbol.
5187 * testsuite/icf_safe_test.sh: Fix test.
5188 * testsuite/icf_safe_so_test.sh: Fix test.
5189
5190 2010-09-16 Cary Coutant <ccoutant@google.com>
5191
5192 * script_sections.cc (class Memory_region): Remove "NULL" from
5193 vector initializations.
5194
5195 2010-09-15 Cary Coutant <ccoutant@google.com>
5196
5197 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5198 Resolve forwarding symbols.
5199
5200 2010-09-15 Doug Kwan <dougkwan@google.com>
5201
5202 * gold/testsuite/script_test_3.t: Add ARM special sections.
5203 * gold/testsuite/script_test_4.t: Same.
5204 * gold/testsuite/script_test_5.t: Same.
5205 * gold/testsuite/script_test_6.t: Same.
5206 * gold/testsuite/script_test_7.t: Same.
5207 * gold/testsuite/script_test_7.t: Same.
5208 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5209
5210 2010-09-14 Cary Coutant <ccoutant@google.com>
5211
5212 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5213 (Target_x86_64::Relocate::relocate_tls): Replace check for
5214 saw_tls_block_reloc_ with test for executable section.
5215
5216 2010-09-12 Cary Coutant <ccoutant@google.com>
5217
5218 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5219 position-independent executables to shared libraries need dynamic
5220 relocations.
5221 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5222 position-independent executables.
5223 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5224 * testsuite/Makefile.in: Regenerate.
5225
5226 2010-09-10 Nick Clifton <nickc@redhat.com>
5227
5228 PR gold/11997
5229 * testsuite/memory_test.t: Discard any sections that are not
5230 needed.
5231
5232 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5233
5234 PR gold/11996
5235 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5236 "This::" to work around a bug in gcc 4.2.
5237
5238 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5239
5240 2010-09-09 Rafael Espindola <espindola@google.com>
5241
5242 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5243 sections with different PF_X flags in the same segment.
5244 (Layout::find_first_load_seg): Search all segments to find the first
5245 one.
5246 * options.h (rosegment): New.
5247
5248 2010-09-08 Rafael Espindola <espindola@google.com>
5249
5250 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5251
5252 2010-09-08 Doug Kwan <dougkwan@google.com>
5253
5254 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5255 (Arm_relobj::do_relocate_sections): Add new parameter for output
5256 file to match the parent.
5257 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5258 of local symbols instead of input values. Update code to track
5259 changes in gold::relocate_section.
5260 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5261 (Sized_relobj::compute_final_local_value_internal): New methods.
5262 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5263 body into private version of Sized_relobj::compute_final_local_value.
5264 Call the inline method.
5265 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5266 merged symbol value if there is one.
5267 (Symbol_value::has_output_value): New method defintiion.
5268 (Sized_relobj::Compute_final_local_value_status): New enum type.
5269 (Sized_relobj::compute_final_local_value): New methods.
5270 (Sized_relobj::compute_final_local_value_internal): New methods.
5271 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5272 and arm_cortex_a8.sh.
5273 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5274 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5275 New tests.
5276 * Makefile.in: Regenerate.
5277 * testsuite/arm_bl_out_of_range.s: Update test.
5278 * testsuite/thumb_bl_out_of_range.s: Ditto.
5279 * testsuite/thumb_blx_out_of_range.s: Ditto.
5280 * testsuite/arm_branch_out_of_range.sh: New file.
5281 * testsuite/arm_cortex_a8.sh: Ditto.
5282 * testsuite/arm_cortex_a8_b.s: Ditto.
5283 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5284 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5285 * testsuite/arm_cortex_a8_bl.s: Ditto.
5286 * testsuite/arm_cortex_a8_blx.s: Ditto.
5287 * testsuite/arm_cortex_a8_local.s: Ditto.
5288 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5289 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5290
5291 2010-09-08 Rafael Espindola <espindola@google.com>
5292
5293 * Makefile.am (memory_test.stdout): Run readelf with -W.
5294 * Makefile.in: Regenerate.
5295 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5296 64 bit output.
5297
5298 2010-09-08 Rafael Espindola <espindola@google.com>
5299
5300 * script-sections.cc (Script_sections::add_memory_region): Convert
5301 field precision to int.
5302 * script.cc (script_set_section_region, script_set_section_region):
5303 Convert field precision to int.
5304
5305 2010-09-08 Rafael Espindola <espindola@google.com>
5306
5307 * arm.cc (do_finalize_sections): Create the __exidx_start and
5308 __exdix_end symbols even when the section is missing.
5309
5310 2010-09-08 Nick Clifton <nickc@redhat.com>
5311
5312 * README: Remove claim that MEMORY is not supported.
5313 * expression.cc (script_exp_function_origin)
5314 (script_exp_function_length): Move from here to ...
5315 * script.cc: ... here.
5316 (script_set_section_region, script_add_memory)
5317 (script_parse_memory_attr, script_include_directive): New
5318 functions.
5319 * script-sections.cc
5320 (class Memory_region): New class.
5321 (class Output_section_definition): Add set_memory_region,
5322 set_section_vma, set_section_lma and get_section_name methods.
5323 (class Script_Sections): Add add_memory_region,
5324 find_memory_region, find_memory_region_origin,
5325 find_memory_region_length and set_memory_region methods.
5326 Have set_section_addresses method walk the list of set memory
5327 regions.
5328 Extend the print methos to display memory regions.
5329 * script-sections.h: Add prototypes for new methods.
5330 Add enum for MEMORY region attributes.
5331 * yyscript.y: Add support for parsing MEMORY regions.
5332 * script-c.h: Add prototypes for new functions.
5333 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5334 * testsuite/Makefile.in: Regenerate.
5335 * testsuite/memory_test.sh: New script.
5336 * testsuite/memory_test.s: New assembler source file.
5337 * testsuite/memory_test.t: New linker script.
5338
5339 2010-08-27 Doug Kwan <dougkwan@google.com>
5340
5341 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5342 reference override an existing dynamic weak reference.
5343 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5344 * testsuite/Makefile.in: Regenerate.
5345 * testsuite/dyn_weak_ref.sh: New file.
5346 * testsuite/dyn_weak_ref_1.c: Ditto.
5347 * testsuite/dyn_weak_ref_2.c: Ditto.
5348
5349 2010-08-27 Ian Lance Taylor <iant@google.com>
5350
5351 * incremental.h (class Incremental_input_entry): Add virtual
5352 destructor.
5353
5354 2010-08-27 Ian Lance Taylor <iant@google.com>
5355
5356 * testsuite/start_lib_test_3.c: Mark t3 as used.
5357
5358 2010-08-27 Nick Clifton <nickc@redhat.com>
5359
5360 * options.cc (version_script): Fix small typo in previous
5361 whitespace tidyup.
5362
5363 2010-08-25 Nick Clifton <nickc@redhat.com>
5364
5365 * archive.cc: Formatting fixes: Remove whitespace between
5366 typename and following asterisk. Remove whitespace between
5367 function name and opening parenthesis.
5368 * archive.h: Likewise.
5369 * arm.cc: Likewise.
5370 * attributes.cc: Likewise.
5371 * attributes.h: Likewise.
5372 * common.cc: Likewise.
5373 * copy-relocs.cc: Likewise.
5374 * dirsearch.h: Likewise.
5375 * dynobj.cc: Likewise.
5376 * ehframe.cc: Likewise.
5377 * ehframe.h: Likewise.
5378 * expression.cc: Likewise.
5379 * fileread.cc: Likewise.
5380 * fileread.h: Likewise.
5381 * gc.h: Likewise.
5382 * gold-threads.cc: Likewise.
5383 * gold.cc: Likewise.
5384 * i386.cc: Likewise.
5385 * icf.h: Likewise.
5386 * incremental-dump.cc: Likewise.
5387 * incremental.cc: Likewise.
5388 * layout.cc: Likewise.
5389 * layout.h: Likewise.
5390 * main.cc: Likewise.
5391 * merge.cc: Likewise.
5392 * merge.h: Likewise.
5393 * object.cc: Likewise.
5394 * object.h: Likewise.
5395 * options.cc: Likewise.
5396 * options.h: Likewise.
5397 * output.cc: Likewise.
5398 * output.h: Likewise.
5399 * plugin.cc: Likewise.
5400 * plugin.h: Likewise.
5401 * powerpc.cc: Likewise.
5402 * reloc.cc: Likewise.
5403 * script-c.h: Likewise.
5404 * script-sections.cc: Likewise.
5405 * script.cc: Likewise.
5406 * stringpool.cc: Likewise.
5407 * symtab.cc: Likewise.
5408 * symtab.h: Likewise.
5409 * target.cc: Likewise.
5410 * timer.cc: Likewise.
5411 * timer.h: Likewise.
5412 * version.cc: Likewise.
5413 * x86_64.cc: Likewise.
5414
5415 2010-08-24 Nick Clifton <nickc@redhat.com>
5416
5417 PR 11899
5418 * layout.cc (segment_precedes): Sort segments by their physical
5419 addresses, if they have been set.
5420
5421 2010-08-23 Cary Coutant <ccoutant@google.com>
5422
5423 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5424 symbols data.
5425 (Lib_group::include_member): Unlock object after deleting its
5426 symbols data.
5427 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5428 the bug fixed here.
5429
5430 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5431 Cary Coutant <ccoutant@google.com>
5432
5433 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5434 constructor, and set_blocker.
5435 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5436 readsyms_blocker_.
5437 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5438 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5439 * testsuite/Makefile.am (start_lib_test): New test case.
5440 * testsuite/Makefile.in: Regenerate.
5441 * testsuite/start_lib_test_main.c: New file.
5442 * testsuite/start_lib_test_1.c: New file.
5443 * testsuite/start_lib_test_2.c: New file.
5444 * testsuite/start_lib_test_3.c: New file.
5445
5446 2010-08-19 Ian Lance Taylor <iant@google.com>
5447
5448 * Makefile.in: Rebuild with automake 1.11.1.
5449 * aclocal.m4: Likewise.
5450 * testsuite/Makefile.in: Likewise.
5451
5452 2010-08-19 Ian Lance Taylor <iant@google.com>
5453
5454 PR 10893
5455 * i386.cc (class Output_data_plt_i386): Update declarations.
5456 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5457 local_ifuncs_ fields.
5458 (Target_i386::do_plt_section_for_global): New function.
5459 (Target_i386::do_plt_section_for_local): New function.
5460 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5461 parameter; change all callers. Initialize global_ifuncs_ and
5462 local_ifuncs_. If doing a static link define __rel_iplt_start and
5463 __rel_iplt_end.
5464 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5465 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5466 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5467 symbols.
5468 (Target_i386::make_plt_section): New function, broken out of
5469 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5470 (Target_i386::make_plt_entry): Call make_plt_section.
5471 (Target_i386::make_local_ifunc_plt_entry): New function.
5472 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5473 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5474 R_386_IRELATIVE to switch.
5475 (Target_i386::Scan::global): Likewise.
5476 (Target_i386::Relocate::relocate): Likewise.
5477 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5478 switch.
5479 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5480 (Target_x86_64::do_plt_section_for_global): New function.
5481 (Target_x86_64::do_plt_section_for_local): New function.
5482 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5483 parameter; change all callers. If doing a static link define
5484 __rela_iplt_start and __rela_iplt_end.
5485 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5486 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5487 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5488 to point to .plt.
5489 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5490 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5491 switch.
5492 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5493 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5494 R_X86_64_IRELATIVE to switch.
5495 (Target_x86_64::Scan::global): Likewise.
5496 (Target_x86_64::Relocate::relocate): Likewise.
5497 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5498 switch.
5499 * target.h (class Target): Add plt_section_for_global and
5500 plt_section_for_local functions. Add do_plt_section_for_global
5501 and do_plt_section_for_local virtual functions.
5502 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5503 clarifying comments.
5504 (Symbol::use_plt_offset): Handle IFUNC symbol.
5505 * object.cc (Sized_relobj::Sized_relobj): Initialize
5506 local_plt_offsets_.
5507 (Sized_relobj::local_has_plt_offset): New function.
5508 (Sized_relobj::local_plt_offset): New function.
5509 (Sized_relobj::set_local_plt_offset): New function.
5510 (Sized_relobj::do_count): Handle IFUNC symbol.
5511 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5512 a bit away from input_shndx_ field. Add set_is_func_symbol and
5513 is_ifunc_symbol functions.
5514 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5515 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5516 local_plt_offsets_ field.
5517 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5518 * output.h (class Output_section_data): Add non-const
5519 output_section function.
5520 (class Output_data_got): Update declarations.
5521 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5522 Add use_plt_offset parameter to global and local constructors.
5523 Change all callers. Change local_sym_index_ field to 31 bits.
5524 Change GSYM_CODE and CONSTANT_CODE accordingly.
5525 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5526 doing a static link don't set sh_link field.
5527 (Output_data_got::Got_entry::write): Use PLT offset if
5528 appropriate.
5529 (Output_data_got::add_global_plt): New function.
5530 (Output_data_got::add_local_plt): New function.
5531 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5532 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5533 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5534 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5535 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5536 IFUNC conditional.
5537 * testsuite/ifunc-sel.h: New file.
5538 * testsuite/ifuncmain1.c: New file.
5539 * testsuite/ifuncmain1vis.c: New file.
5540 * testsuite/ifuncmod1.c: New file.
5541 * testsuite/ifuncdep2.c: New file.
5542 * testsuite/ifuncmain2.c: New file.
5543 * testsuite/ifuncmain3.c: New file.
5544 * testsuite/ifuncmod3.c: New file.
5545 * testsuite/ifuncmain4.c: New file.
5546 * testsuite/ifuncmain5.c: New file.
5547 * testsuite/ifuncmod5.c: New file.
5548 * testsuite/ifuncmain6pie.c: New file.
5549 * testsuite/ifuncmod6.c: New file.
5550 * testsuite/ifuncmain7.c: New file.
5551 * configure, testsuite/Makefile.in: Rebuild.
5552
5553 2010-08-18 Ian Lance Taylor <iant@google.com>
5554
5555 * incremental.cc
5556 (Output_section_incremental_inputs::write_input_files): Add cast
5557 to avoid signed/unsigned comparison warning.
5558 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5559
5560 2010-08-12 Cary Coutant <ccoutant@google.com>
5561
5562 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5563
5564 2010-08-13 Ian Lance Taylor <iant@google.com>
5565
5566 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5567
5568 2010-08-12 Cary Coutant <ccoutant@google.com>
5569 Doug Kwan <dougkwan@google.com>
5570
5571 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5572 defintion overrides non-weak undef, remember that the original undef
5573 is not weak.
5574 * symtab.cc (Symbol_table::sized_write_global): For undef without
5575 an original weak binding, set binding to global in output.
5576 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5577 * testsuite/Makefile.in: Regenerate.
5578 * testsuite/strong_ref_weak_def.sh: New file.
5579 * testsuite/strong_ref_weak_def_1.c: Ditto.
5580 * testsuite/strong_ref_weak_def_2.c: Ditto.
5581
5582 2010-08-12 Cary Coutant <ccoutant@google.com>
5583
5584 * testsuite/incremental_test.sh: Rewrite.
5585 * testsuite/incremental_test_1.c: Rewrite.
5586 * testsuite/incremental_test_2.c: Rewrite.
5587
5588 2010-08-12 Cary Coutant <ccoutant@google.com>
5589
5590 * arm.cc (Target_arm::got_size): Add const.
5591 (Target_arm::got_entry_count): New function.
5592 (Target_arm::plt_entry_count): New function.
5593 (Target_arm::first_plt_entry_offset): New function.
5594 (Target_arm::plt_entry_size): New function.
5595 (Output_data_plt_arm::entry_count): New function.
5596 (Output_data_plt_arm::first_plt_entry_offset): New function.
5597 (Output_data_plt_arm::get_plt_entry_size): New function.
5598 * i386.cc (Target_i386::got_size): Add const.
5599 (Target_i386::got_entry_count): New function.
5600 (Target_i386::plt_entry_count): New function.
5601 (Target_i386::first_plt_entry_offset): New function.
5602 (Target_i386::plt_entry_size): New function.
5603 (Output_data_plt_i386::entry_count): New function.
5604 (Output_data_plt_i386::first_plt_entry_offset): New function.
5605 (Output_data_plt_i386::get_plt_entry_size): New function.
5606 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5607 find_incremental_inputs_sections. Dump incremental_got_plt section.
5608 * incremental.cc: Include target.h.
5609 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5610 parameter. Adjust all callers. Find incremental_got_plt section.
5611 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5612 section.
5613 (Output_section_incremental_inputs::set_final_data_size): Calculate
5614 size of incremental_got_plt section.
5615 (Output_section_incremental_inputs::do_write): Write the
5616 incremental_got_plt section.
5617 (Got_plt_view_info): New struct.
5618 (Local_got_offset_visitor): New class.
5619 (Global_got_offset_visitor): New class.
5620 (Global_symbol_visitor_got_plt): New class.
5621 (Output_section_incremental_inputs::write_got_plt): New function.
5622 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5623 Add parameter. Adjust all callers.
5624 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5625 (Incremental_inputs::got_plt_section): New function.
5626 (Incremental_inputs::got_plt_section_): New data member.
5627 (Incremental_got_plt_reader): New class.
5628 * layout.cc (Layout::create_incremental_info_sections): Add the
5629 incremental_got_plt section.
5630 * object.h (Got_offset_list::get_list): New function.
5631 (Got offset_list::for_all_got_offsets): New function.
5632 (Sized_relobj::local_got_offset_list): New function.
5633 * powerpc.cc (Target_powerpc::got_size): Add const.
5634 (Target_powerpc::got_entry_count): New function.
5635 (Target_powerpc::plt_entry_count): New function.
5636 (Target_powerpc::first_plt_entry_offset): New function.
5637 (Target_powerpc::plt_entry_size): New function.
5638 (Output_data_plt_powerpc::entry_count): New function.
5639 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5640 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5641 * sparc.cc (Target_sparc::got_size): Add const.
5642 (Target_sparc::got_entry_count): New function.
5643 (Target_sparc::plt_entry_count): New function.
5644 (Target_sparc::first_plt_entry_offset): New function.
5645 (Target_sparc::plt_entry_size): New function.
5646 (Output_data_plt_sparc::entry_count): New function.
5647 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5648 (Output_data_plt_sparc::get_plt_entry_size): New function.
5649 * symtab.h (Symbol::got_offset_list): New function.
5650 (Symbol_table::for_all_symbols): New function.
5651 * target.h (Sized_target::got_entry_count): New function.
5652 (Sized_target::plt_entry_count): New function.
5653 (Sized_target::plt_entry_size): New function.
5654 * x86_64.cc (Target_x86_64::got_size): Add const.
5655 (Target_x86_64::got_entry_count): New function.
5656 (Target_x86_64::plt_entry_count): New function.
5657 (Target_x86_64::first_plt_entry_offset): New function.
5658 (Target_x86_64::plt_entry_size): New function.
5659 (Output_data_plt_x86_64::entry_count): New function.
5660 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5661 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5662
5663 2010-08-12 Cary Coutant <ccoutant@google.com>
5664
5665 * archive.cc: Include incremental.h.
5666 (Archive::Archive): Initialize incremental_info_.
5667 (Archive::include_member): Record archive members in incremental info.
5668 (Add_archive_symbols::run): Record begin and end of an archive in
5669 incremental info.
5670 (Lib_group::include_member): Record objects in incremental info.
5671 * archive.h (Incremental_archive_entry): Forward declaration.
5672 (Archive::set_incremental_info): New member function.
5673 (Archive::incremental_info): New member function.
5674 (Archive::Unused_symbol_iterator): New class.
5675 (Archive::unused_symbols_begin): New member function.
5676 (Archive::unused_symbols_end): New member function.
5677 (Archive::incremental_info_): New data member.
5678 * incremental-dump.cc (find_input_containing_global): New function.
5679 (dump_incremental_inputs): Dump new incremental info sections.
5680 * incremental.cc: Include symtab.h.
5681 (Output_section_incremental_inputs): New class.
5682 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5683 new incremental info sections.
5684 (Sized_incremental_binary::do_check_inputs): Likewise.
5685 (Incremental_inputs::report_archive): Remove.
5686 (Incremental_inputs::report_archive_begin): New function.
5687 (Incremental_inputs::report_archive_end): New function.
5688 (Incremental_inputs::report_object): New function.
5689 (Incremental_inputs::finalize_inputs): Remove.
5690 (Incremental_inputs::report_input_section): New function.
5691 (Incremental_inputs::report_script): Rewrite.
5692 (Incremental_inputs::finalize): Do nothing but finalize string table.
5693 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5694 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5695 (Incremental_inputs::create_data_sections): New function.
5696 (Incremental_inputs::relocs_entsize): New function.
5697 (Output_section_incremental_inputs::set_final_data_size): New function.
5698 (Output_section_incremental_inputs::do_write): New function.
5699 (Output_section_incremental_inputs::write_header): New function.
5700 (Output_section_incremental_inputs::write_input_files): New function.
5701 (Output_section_incremental_inputs::write_info_blocks): New function.
5702 (Output_section_incremental_inputs::write_symtab): New function.
5703 * incremental.h (Incremental_script_entry): Forward declaration.
5704 (Incremental_object_entry): Forward declaration.
5705 (Incremental_archive_entry): Forward declaration.
5706 (Incremental_inputs): Forward declaration.
5707 (Incremental_inputs_header_data): Remove.
5708 (Incremental_inputs_header): Remove.
5709 (Incremental_inputs_header_write): Remove.
5710 (Incremental_inputs_entry_data): Remove.
5711 (Incremental_inputs_entry): Remove.
5712 (Incremental_inputs_entry_write): Remove.
5713 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5714 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5715 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5716 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5717 Likewise.
5718 (Incremental_input_entry): New class.
5719 (Incremental_script_entry): New class.
5720 (Incremental_object_entry): New class.
5721 (Incremental_archive_entry): New class.
5722 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5723 (Incremental_inputs::report_inputs): Remove.
5724 (Incremental_inputs::report_archive): Remove.
5725 (Incremental_inputs::report_archive_begin): New function.
5726 (Incremental_inputs::report_archive_end): New function.
5727 (Incremental_inputs::report_object): Change prototype.
5728 (Incremental_inputs::report_input_section): New function.
5729 (Incremental_inputs::report_script): Change prototype.
5730 (Incremental_inputs::get_reloc_count): New function.
5731 (Incremental_inputs::set_reloc_count): New function.
5732 (Incremental_inputs::create_data_sections): New function.
5733 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5734 (Incremental_inputs::inputs_section): New function.
5735 (Incremental_inputs::symtab_section): New function.
5736 (Incremental_inputs::relocs_section): New function.
5737 (Incremental_inputs::get_stringpool): Add const.
5738 (Incremental_inputs::command_line): Add const.
5739 (Incremental_inputs::inputs): Remove.
5740 (Incremental_inputs::command_line_key): New function.
5741 (Incremental_inputs::input_file_count): New function.
5742 (Incremental_inputs::input_files): New function.
5743 (Incremental_inputs::relocs_entsize): New function.
5744 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5745 (Incremental_inputs::finalize_inputs): Remove.
5746 (Incremental_inputs::Input_info): Remove.
5747 (Incremental_inputs::lock_): Remove.
5748 (Incremental_inputs::inputs_): Change type.
5749 (Incremental_inputs::inputs_map_): Remove.
5750 (Incremental_inputs::current_object_entry_): New data member.
5751 (Incremental_inputs::inputs_section_): New data member.
5752 (Incremental_inputs::symtab_section_): New data member.
5753 (Incremental_inputs::relocs_section_): New data member.
5754 (Incremental_inputs::reloc_count_): New data member.
5755 (Incremental_inputs_reader): New class.
5756 (Incremental_symtab_reader): New class.
5757 (Incremental_relocs_reader): New class.
5758 * layout.cc (Layout::finalize): Move finalization of incremental info
5759 and creation of incremental info sections to follow finalization of
5760 symbol table. Set offsets for postprocessing sections.
5761 (Layout::create_incremental_info_sections): Call
5762 Incremental_inputs::create_data_sections. Add incremental symtab
5763 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5764 sections to layout after input sections.
5765 * layout.h (struct Timespec): Forward declaration.
5766 (Layout::incremental_inputs): Add const.
5767 (Layout::create_incremental_info_sections): Add parameter.
5768 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5769 * object.cc: Include incremental.h.
5770 (Relobj::finalize_incremental_relocs): New function.
5771 (Sized_relobj::do_layout): Record input sections in incremental info.
5772 * object.h (Object::output_section): New function.
5773 (Object::output_section_offset): Moved from Relobj.
5774 (Object::get_incremental_reloc_base): New function.
5775 (Object::get_incremental_reloc_count): New function.
5776 (Object::do_output_section): New function.
5777 (Object::do_output_section_offset): Moved from Relobj.
5778 (Object::do_get_incremental_reloc_base): New function.
5779 (Object::do_get_incremental_reloc_count): New function.
5780 (Object::Object): Initialize new data members.
5781 (Relobj::output_section): Renamed do_output_section and moved to
5782 protected.
5783 (Relobj::output_section_offset): Moved to Object.
5784 (Relobj::do_get_incremental_reloc_base): New function.
5785 (Relobj::do_get_incremental_reloc_count): New function.
5786 (Relobj::allocate_incremental_reloc_counts): New function.
5787 (Relobj::count_incremental_reloc): New function.
5788 (Relobj::finalize_incremental_relocs): New function.
5789 (Relobj::next_incremental_reloc_index): New function.
5790 (Relobj::reloc_counts_): New data member.
5791 (Relobj::reloc_bases_): New data member.
5792 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5793 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5794 (Sized_relobj::incremental_relocs_scan): New function.
5795 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5796 (Sized_relobj::incremental_relocs_write): New function.
5797 (Sized_relobj::incremental_relocs_write_reltype): New function.
5798 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5799 incremental link.
5800 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5801 archives and object files elsewhere.
5802 (Add_symbols::run): Report object files here.
5803 (Finish_group::run): Report end of archive at end of group.
5804 * reloc.cc: Include layout.h, incremental.h.
5805 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5806 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5807 (Sized_relobj::incremental_relocs_scan): New function.
5808 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5809 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5810 (Sized_relobj::incremental_relocs_write): New function.
5811 (Sized_relobj::incremental_relocs_write_reltype): New function.
5812 * script.cc (read_input_script): Rewrite test for incremental link.
5813 Change call to Incremental_inputs::report_script.
5814 * symtab.h (Symbol_table::first_global_index): New function.
5815 (Symbol_table::output_count): New function.
5816
5817 2010-08-12 Doug Kwan <dougkwan@google.com>
5818
5819 * arm.cc (Target_arm::merge_object_attributes): Check command line
5820 options --no-wchar-size-warning and --no-enum-size-warning.
5821 * options.h (General_options): Add ld-compatible options
5822 --no-enum-size-warning and --no-wchar-size-warning.
5823
5824 2010-08-04 Ian Lance Taylor <iant@google.com>
5825
5826 * x86_64.cc (Target_x86_64::Scan::local): Use
5827 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5828 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5829 (Target_x86_64::Scan::global): Likewise.
5830 (Target_x86_64::Relocate::relocate): Likewise.
5831 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5832 Likewise.
5833
5834 2010-08-03 Cary Coutant <ccoutant@google.com>
5835
5836 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5837 to reserve space in merged_strings vector. Keep total input size
5838 for stats.
5839 (Output_merge_string::do_print_merge_stats): Print total input size.
5840 * merge.h (Output_merge_string): Add input_size_ field.
5841 * stringpool.cc (Stringpool_template::string_length): Move
5842 implementations out of Stringpool_template class and place in
5843 stringpool.h.
5844 * stringpool.h (string_length): Move out of Stringpool_template.
5845
5846 2010-08-03 Ian Lance Taylor <iant@google.com>
5847
5848 PR 11712
5849 * layout.cc (relaxation_loop_body): If address of load segment is
5850 set, adjust address to include headers if possible.
5851
5852 2010-08-03 Ian Lance Taylor <iant@google.com>
5853
5854 * version.cc (version_string): Bump to 1.10.
5855
5856 2010-08-03 Ian Lance Taylor <iant@google.com>
5857
5858 PR 11805
5859 * layout.h (enum Output_section_order): Define.
5860 (class Layout): Update declarations.
5861 * layout.cc (Layout::get_output_section): Add order parameter.
5862 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5863 is_first_non_relro parameters. Change all callers.
5864 (Layout::choose_output_section): Likewise.
5865 (Layout::add_output_section_data): Likewise.
5866 (Layout::make_output_section): Likewise. Set order.
5867 (Layout::default_section_order): New function.
5868 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5869 * output.cc (Output_section::Output_section): Initialize order_.
5870 Don't initialize deleted fields.
5871 (Output_segment::Output_segment): Don't initialize deleted
5872 fields.
5873 (Output_segment::add_output_section_to_load): New function
5874 replacing add_output_section. Change all callers to call this or
5875 add_output_section_to_nonload.
5876 (Output_segment::add_output_section_to_nonload): New function.
5877 (Output_segment::remove_output_section): Rewrite.
5878 (Output_segment::add_initial_output_data): Likewise.
5879 (Output_segment::has_any_data_sections): Likewise.
5880 (Output_segment::is_first_section_relro): Likewise.
5881 (Output_segment::maximum_alignment): Likewise.
5882 (Output_segment::has_dynamic_reloc): New function replacing
5883 dynamic_reloc_count. Change all callers.
5884 (Output_segment::has_dynamic_reloc_list): New function replacing
5885 dynamic_reloc_count_list. Change all callers.
5886 (Output_segment::set_section_addresses): Rewrite.
5887 (Output_segment::set_offset): Rewrite.
5888 (Output_segment::find_first_and_last_list): Remove.
5889 (Output_segment::set_tls_offsets): Rewrite.
5890 (Output_segment::first_section_load_address): Likewise.
5891 (Output_segment::output_section_count): Likewise.
5892 (Output_segment::section_with_lowest_load_address): Likewise.
5893 (Output_segment::write_section_headers): Likewise.
5894 (Output_segment::print_sections_to_map): Likewise.
5895 * output.h (class Output_data): Remove dynamic_reloc_count_
5896 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5897 (Output_data::add_dynamic_reloc): Rewrite.
5898 (Output_data::has_dynamic_reloc): New function.
5899 (Output_data::dynamic_reloc_count): Remove.
5900 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5901 is_last_relro_, is_first_non_relro_, is_interp_,
5902 is_dynamic_linker_section_ fields. Add order and set_order
5903 functions. Remove is_relro_local, set_is_relro_local,
5904 is_last_relro, set_is_last_relro, is_first_non_relro,
5905 set_is_first_non_relro functions, is_interp, set_is_interp,
5906 is_dynamic_linker_section, and set_is_dynamic_linker_section
5907 functions.
5908 (class Output_segment): Change Output_data_list from std::list to
5909 std:;vector. Add output_lists_ field. Remove output_data_ and
5910 output_bss_ fields. Update declarations.
5911
5912 2010-08-02 Ian Lance Taylor <iant@google.com>
5913
5914 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5915 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5916 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5917
5918 2010-08-02 Ian Lance Taylor <iant@google.com>
5919
5920 PR 11855
5921 * script.cc (Script_options::Script_options): Initialize
5922 symbol_definitions_ and symbol_references_.
5923 (Script_options::add_symbol_assignment): Update
5924 symbol_definitions_ and symbol_references_.
5925 (Script_options::add_symbol_reference): New function.
5926 (script_symbol): New function.
5927 * script.h (class Script_options): Add symbol_definitions_ and
5928 symbol_references_ fields.
5929 (Script_options::referenced_const_iterator): New type.
5930 (Script_options::referenced_begin): New function.
5931 (Script_options::referenced_end): New function.
5932 (Script_options::is_referenced): New function.
5933 (Script_options::any_unreferenced): New function.
5934 * script-c.h (script_symbol): Declare.
5935 * yyscript.y (exp): Call script_symbol.
5936 * symtab.cc: Include "script.h".
5937 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5938 Change all callers. Check symbols referenced by scripts.
5939 (Symbol_table::add_undefined_symbols_from_command_line): Add
5940 layout parameter. Change all callers.
5941 (Symbol_table::do_add_undefined_symbols_from_command_line):
5942 Likewise. Break out loop body. Check symbols referenced by
5943 scripts.
5944 (Symbol_table::add_undefined_symbol_from_command_line): New
5945 function broken out of
5946 do_add_undefined_symbols_from_command_line.
5947 * symtab.h (class Symbol_table): Update declarations.
5948 * archive.cc: Include "layout.h".
5949 (Archive::should_include_member): Add layout parameter. Change
5950 all callers. Check for symbol mentioned in expression.
5951 * archive.h (class Archive): Update declaration.
5952 * object.cc (Sized_relobj::do_should_include_member): Add layout
5953 parameter.
5954 * object.h (Object::should_include_member): Add layout parameter.
5955 Change all callers.
5956 (Object::do_should_include_member): Add layout parameter.
5957 (class Sized_relobj): Update declaration.
5958 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5959 parameter.
5960 * dynobj.h (class Sized_dynobj): Update declaration.
5961 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5962 layout parameter.
5963 * plugin.h (class Sized_pluginobj): Update declaration.
5964
5965 2010-08-02 Ian Lance Taylor <iant@google.com>
5966
5967 PR 11866
5968 * output.cc (Output_segment::set_offset): Search for the first and
5969 last sections rather than assuming that the list is in order.
5970 (Output_segment::find_first_and_last_list): New function.
5971 * output.h (class Output_segment): Update declarations.
5972 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5973 (relro_strip_test_SOURCES): New variable.
5974 (relro_strip_test_DEPENDENCIES): New variable.
5975 (relro_strip_test_LDFLAGS): New variable.
5976 (relro_strip_test_LDADD): New variable.
5977 (relro_strip_test.so): New target.
5978
5979 2010-08-02 Ian Lance Taylor <iant@google.com>
5980
5981 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5982 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5983 (Target_i386::got_tlsdesc_section): New function.
5984 (Target_i386::got_section): Create space for GOT entries for
5985 TLSDESC relocations.
5986 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5987 R_386_TLS_GOTDESC.
5988 (Target_i386::Scan::global): Likewise.
5989 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5990 using TLSDESC GOT.
5991 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5992 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5993 (Target_x86_64::got_tlsdesc_section): New function.
5994 (Target_x86_64::got_section): Create space for GOT entries for
5995 TLSDESC relocations.
5996 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5997 R_386_TLS_GOTDESC.
5998 (Target_x86_64::Scan::global): Likewise.
5999 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6000 using TLSDESC GOT.
6001
6002 2010-08-02 Ian Lance Taylor <iant@google.com>
6003
6004 * testsuite/final_layout.sh: Use dc to convert from hex to
6005 decimal.
6006
6007 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6008
6009 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6010 paramter to the call to gold::gc_process_relocs.
6011 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6012 paramter to the call to gold::gc_process_relocs.
6013 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6014 parameter to the call to gold::gc_process_relocs.
6015 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6016 template parameter to the call to gold::gc_process_relocs.
6017 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6018 paramter to the call to gold::gc_process_relocs.
6019 * gc.h (get_embedded_addend_size): New function.
6020 (gc_process_relocs): Save the size of the reloc for use by ICF.
6021 * icf.cc (get_section_contents): Get the addend from the text section
6022 for SHT_REL relocation sections.
6023 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6024 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6025 * int_encoding.h (read_from_pointer): New overloaded function.
6026 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6027 * testsuite/icf_sht_rel_addend_test.sh: New file.
6028 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6029 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6030
6031 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6032
6033 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6034 * Makefile.in: Regenerate.
6035 * testsuite/Makefile.in: Regenerate.
6036
6037 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6038
6039 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6040 * gold/testsuite/debug_msg.cc: Likewise.
6041 * gold/testsuite/odr_violation1.cc
6042 * gold/testsuite/odr_violation2.cc
6043
6044 2010-07-21 Cary Coutant <ccoutant@google.com>
6045
6046 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6047 string, and length fields.
6048 (Output_merge_string::Merged_strings_list): New type.
6049 (Output_merge_string::Merged_strings_lists): New typedef.
6050 (Output_merge_string): Replace merged_strings_ with
6051 merged_strings_lists_.
6052 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6053 Merged_strings_list per input object and section. Don't store pointer
6054 to the string. Don't store length with each merged string entry.
6055 (Output_merge_string::finalize_merged_data): Loop over list of merged
6056 strings lists. Recompute length of each merged string.
6057
6058 2010-07-15 Cary Coutant <ccoutant@google.com>
6059
6060 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6061 here.
6062
6063 2010-07-14 Ian Lance Taylor <iant@google.com>
6064
6065 * descriptors.cc (Descriptors::open): Report correct name in error
6066 message.
6067
6068 2010-07-13 Doug Kwan <dougkwan@google.com>
6069
6070 * arm.cc (Arm_input_section::Arm_input_section): For a
6071 SHT_ARM_EXIDX section, always keeps the input sections.
6072 (Arm_input_section::set_exidx_section_link): New method.
6073 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6074 has_errors_ to false.
6075 (Arm_exidx_input_section::has_errors,
6076 Arm_exidx_input_section::set_has_errors): New methods.
6077 (Arm_exidx_input_section::has_errors_): New data member.
6078 (Arm_relobj::get_exidx_shndx_list): New method.
6079 (Arm_output_section::append_text_sections_to_list): Do not skip
6080 section without SHF_EXECINSTR.
6081 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6082 errors.
6083 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6084 section header. Make error messages more verbose. Check for
6085 a non-executable section linked to an EXIDX section.
6086 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6087 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6088 check that there is no deferred EXIDX section if we exit early.
6089 Instead of not making an EXIDX section in case of an error, make one
6090 and set the has_errors flag of it.
6091 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6092 in a relocatable link.
6093 (Target_arm::do_relax): Look for the EXIDX output section instead of
6094 assuming that it is called .ARM.exidx.
6095 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6096 section list. Do not check for SHF_EXECINSTR section flags but
6097 skip any input section with errors.
6098 * output.cc (Output_section::Output_section): Initialize
6099 always_keeps_input_sections_ to false.
6100 (Output_section::add_input_section): Check for
6101 always_keeps_input_sections_.
6102 * output.h (Output_section::always_keeps_input_sections,
6103 Output_section::set_always_keeps_input_sections): New methods.
6104 (Output_section::always_keeps_input_sections): New data member.
6105
6106 2010-07-13 Rafael Espindola <espindola@google.com>
6107
6108 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6109 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6110
6111 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6112 Ian Lance Taylor <iant@google.com>
6113
6114 * output.h (Output_section_lookup_maps::add_merge_section):
6115 Correct check of whether value was inserted.
6116 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6117 (Output_section_lookup_maps::add_relaxed_input_section):
6118 Likewise.
6119 * arm.cc (Target_arm::got_section): Remove used local os.
6120 * i386.cc (Target_i386::got_section): Likewise.
6121 * x86_64.cc (Target_x86_64::got_section): Likewise.
6122 * sparc.cc (Target_sparc::got_section): Likewise.
6123 (Target_sparc::relocate): Remove unused local have_got_offset.
6124 * powerpc.cc (Target_powerpc::relocate): Likewise.
6125
6126 2010-07-13 Ian Lance Taylor <iant@google.com>
6127
6128 * compressed_output.cc (zlib_decompress): Fix signature in
6129 !HAVE_ZLIB_H case.
6130
6131 * archive.cc (Archive::include_member): Unlock an external member
6132 of a thin archive. Don't bother to delete an object we know is
6133 NULL.
6134
6135 2010-07-12 Cary Coutant <ccoutant@google.com>
6136
6137 * compressed_output.cc (zlib_decompress): New function.
6138 (get_uncompressed_size): New function.
6139 (decompress_input_section): New function.
6140 * compressed_output.h (get_uncompressed_size): New function.
6141 (decompress_input_section): New function.
6142 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6143 Handle compressed debug sections.
6144 * layout.cc (is_compressed_debug_section): New function.
6145 (Layout::output_section_name): Map compressed section names to
6146 canonical names.
6147 * layout.h (is_compressed_debug_section): New function.
6148 (is_debug_info_section): Recognize compressed debug sections.
6149 * merge.cc: Include compressed_output.h.
6150 (Output_merge_data::do_add_input_section): Handle compressed
6151 debug sections.
6152 (Output_merge_string::do_add_input_section): Handle compressed
6153 debug sections.
6154 * object.cc: Include compressed_output.h.
6155 (Sized_relobj::Sized_relobj): Initialize new data members.
6156 (build_compressed_section_map): New function.
6157 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6158 * object.h (Object::section_is_compressed): New method.
6159 (Object::do_section_is_compressed): New method.
6160 (Sized_relobj::Compressed_section_map): New type.
6161 (Sized_relobj::do_section_is_compressed): New method.
6162 (Sized_relobj::compressed_sections_): New data member.
6163 * output.cc (Output_section::add_input_section): Handle compressed
6164 debug sections.
6165 * reloc.cc: Include compressed_output.h.
6166 (Sized_relobj::write_sections): Handle compressed debug sections.
6167
6168 2010-07-08 Cary Coutant <ccoutant@google.com>
6169
6170 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6171 weak when resolving to a dynamic def.
6172 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6173 for weak undef/dynamic def cases. Adjust callers.
6174 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6175 undef_binding_weak_.
6176 (Symbol_table::sized_write_globals): Adjust symbol binding.
6177 (Symbol_table::sized_write_symbol): Add binding parameter.
6178 * symtab.h (Symbol::set_undef_binding): New method.
6179 (Symbol::is_undef_binding_weak): New method.
6180 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6181 (Symbol_table::should_override): Add new parameter.
6182 (Symbol_table::sized_write_symbol): Add new parameter.
6183
6184 * testsuite/weak_undef_file1.cc: Add new test case.
6185 * testsuite/weak_undef_file2.cc: Fix header comment.
6186 * testsuite/weak_undef_test.cc: Add new test case.
6187
6188 2010-06-29 Doug Kwan <dougkwan@google.com>
6189
6190 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6191 Initialize USE_SYMBOL_.
6192 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6193 definition.
6194 (Arm_reloc_property::uses_symbol_): New data member declaration.
6195 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6196 uses symbol value and symbol is undefined but not weakly undefined.
6197
6198 2010-06-28 Rafael Espindola <espindola@google.com>
6199
6200 * plugin.cc (Plugin::load): Use dlerror.
6201
6202 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6203
6204 * symtab.cc (detect_odr_violations): When reporting an ODR
6205 violation, report an object where the symbol is defined.
6206
6207 2010-06-25 Doug Kwan <dougkwan@google.com>
6208
6209 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6210 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6211 definition.
6212 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6213 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6214 target hook to detect function points.
6215 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6216 * icf.h (Icf::check_section_for_function_pointers): Change type of
6217 parameter SECTION_NAME to const reference to std::string. Use
6218 target hook to determine if section may have unsafe pointers.
6219 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6220 method definition.
6221
6222 2010-06-21 Rafael Espindola <espindola@google.com>
6223
6224 * fileread.cc (Input_file::find_fie): New
6225 (Input_file::open): Use Input_file::find_fie.
6226 * fileread.h (Input_file::find_fie): New
6227 * plugin.cc (set_extra_library_path): New.
6228 (Plugin::load): Add set_extra_library_path to the transfer vector.
6229 (Plugin_manager::set_extra_library_path): New.
6230 (Plugin_manager::add_input_file): Use the extra search path if set.
6231 (set_extra_library_path(): New.
6232 * plugin.h (Plugin_manager): Add set_extra_library_path and
6233 extra_search_path_.
6234
6235 2010-06-19 Cary Coutant <ccoutant@google.com>
6236
6237 * layout.cc (gdb_sections): Add .debug_types.
6238 (lines_only_debug_sections): Likewise.
6239
6240 2010-06-18 Rafael Espindola <espindola@google.com>
6241
6242 * plugin.cc (add_input_file,add_input_library)
6243 (Plugin_manager::add_input_file): Make filename arguments const.
6244 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6245 const.
6246
6247 2010-06-16 Doug Kwan <dougkwan@google.com>
6248
6249 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6250 .ARM.attributes section if we have not merged any input
6251 attributes sections.
6252
6253 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6254
6255 * arm.cc: Allow combining objects with no EABI version
6256 information.
6257
6258 2010-06-15 Rafael Espindola <espindola@google.com>
6259
6260 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6261
6262 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6263
6264 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6265 (struct iovec): Correct !HAVE_READV definition.
6266
6267 2010-06-10 Cary Coutant <ccoutant@google.com>
6268
6269 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6270 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6271 reloc sections.
6272 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6273
6274 PR 11683
6275 * symtab.h (Symbol::is_placeholder): New member function.
6276 * target-reloc.h (relocate_section): Check for placeholder symbols.
6277
6278 * testsuite/Makefile.am (plugin_test_8): New test.
6279 (plugin_test_9): New test.
6280 * testsuite/Makefile.in: Regenerate.
6281
6282 2010-06-09 Nick Clifton <nickc@redhat.com>
6283
6284 * yyscript.y (input_list_element): Allow strings prefixed with
6285 the '-' character. Treat these as libraries.
6286 * script.cc (script_add_library): New function. Adds a library
6287 specified by "-l<name>" found in an input script.
6288 * script-c.h: Add prototype for script_add_library.
6289
6290 2010-06-07 Doug Kwan <dougkwan@google.com>
6291
6292 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6293 Restrict stub-group size to be within long conditional branch
6294 range when working around cortex-A8 erratum.
6295
6296 2010-06-07 Damien Diederen <dd@crosstwine.com>
6297
6298 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6299 #ifdef typo.
6300
6301 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6302
6303 PR gold/11658
6304 * output.cc
6305 (Output_section::Input_section_sort_entry::compare_section_ordering):
6306 Change to return non-zero correctly.
6307 (Output_section::Input_section_sort_section_order_index_compare
6308 ::operator()): Change to fix ambiguity in comparisons.
6309
6310 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6311
6312 * gold.h (is_wildcard_string): New function.
6313 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6314 (Layout::layout_eh_frame): Ditto.
6315 (Layout::find_section_order_index): New method.
6316 (Layout::read_layout_from_file): New method.
6317 * layout.h (Layout::find_section_order_index): New method.
6318 (Layout::read_layout_from_file): New method.
6319 (Layout::input_section_position_): New private member.
6320 (Layout::input_section_glob_): New private member.
6321 * main.cc (main): Call read_layout_from_file here.
6322 * options.h (--section-ordering-file): New option.
6323 * output.cc (Output_section::input_section_order_specified_): New
6324 member.
6325 (Output_section::Output_section): Initialize new member.
6326 (Output_section::add_input_section): Add new parameter.
6327 Keep input sections when --section-ordering-file is used.
6328 (Output_section::set_final_data_size): Sort input sections when
6329 section ordering file is specified.
6330 (Output_section::Input_section_sort_entry): Add new parameter.
6331 Check sorting type.
6332 (Output_section::Input_section_sort_entry::compare_section_ordering):
6333 New method.
6334 (Output_section::Input_section_sort_compare::operator()): Change to
6335 consider section_order_index.
6336 (Output_section::Input_section_sort_init_fini_compare::operator()):
6337 Change to consider section_order_index.
6338 (Output_section::Input_section_sort_section_order_index_compare
6339 ::operator()): New method.
6340 (Output_section::sort_attached_input_sections): Change to sort
6341 according to section order when specified.
6342 (Output_section::add_input_section<32, true>): Add new parameter.
6343 (Output_section::add_input_section<64, true>): Add new parameter.
6344 (Output_section::add_input_section<32, false>): Add new parameter.
6345 (Output_section::add_input_section<64, false>): Add new parameter.
6346 * output.h (Output_section::add_input_section): Add new parameter.
6347 (Output_section::input_section_order_specified): New
6348 method.
6349 (Output_section::set_input_section_order_specified): New method.
6350 (Input_section::Input_section): Initialize section_order_index_.
6351 (Input_section::section_order_index): New method.
6352 (Input_section::set_section_order_index): New method.
6353 (Input_section::section_order_index_): New member.
6354 (Input_section::Input_section_sort_section_order_index_compare): New
6355 struct.
6356 (Output_section::input_section_order_specified_): New member.
6357 * script-sections.cc (is_wildcard_string): Delete and move modified
6358 method to gold.h.
6359 (Output_section_element_input::Output_section_element_input): Modify
6360 call to is_wildcard_string.
6361 (Output_section_element_input::Input_section_pattern
6362 ::Input_section_pattern): Ditto.
6363 (Output_section_element_input::Output_section_element_input): Ditto.
6364 * testsuite/Makefile.am (final_layout): New test case.
6365 * testsuite/Makefile.in: Regenerate.
6366 * testsuite/final_layout.cc: New file.
6367 * testsuite/final_layout.sh: New file.
6368
6369 2010-06-01 Rafael Espindola <espindola@google.com>
6370
6371 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6372
6373 2010-06-01 Rafael Espindola <espindola@google.com>
6374
6375 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6376 visibility of symbols.
6377
6378 2010-05-27 Doug Kwan <dougkwan@google.com>
6379
6380 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6381 from start of output section instead of address for a local symbol
6382 in a merged or relaxed section when doing a relocatable link.
6383
6384 2010-05-26 Rafael Espindola <espindola@google.com>
6385
6386 PR 11604
6387 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6388 adding sections the garbage collector removed.
6389 * gold/testsuite/Makefile.am: Add test.
6390 * gold/testsuite/Makefile.in: Regenerate.
6391 * gold/testsuite/plugin_test_7.sh: New.
6392 * gold/testsuite/plugin_test_7_1.c: New.
6393 * gold/testsuite/plugin_test_7_2.c: New.
6394
6395 2010-05-26 Rafael Espindola <espindola@google.com>
6396
6397 * script-sections.cc (Output_section_definition::set_section_addresses):
6398 Check for --section-start.
6399
6400 2010-05-26 Doug Kwan <dougkwan@google.com>
6401
6402 * arm.cc (Arm_scan_relocatable_relocs): New class.
6403 (Target_arm::relocate_special_relocatable): New method.
6404 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6405 (Arm_relocate_functions::thumb_branch_common): Same.
6406 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6407 instead of Default_scan_relocatable_relocs.
6408 * target-reloc.h (relocate_for_relocatable): Let target handle
6409 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6410 * target.h (Sized_target::relocate_special_relocatable): New method.
6411
6412 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6413
6414 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6415
6416 2010-05-23 Doug Kwan <dougkwan@google.com>
6417
6418 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6419 instead of a cast.
6420 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6421 with a direct branch, not a conditional branch, to a stub.
6422 * merge.cc (Output_merge_base::record_input_section): New method
6423 defintion.
6424 (Output_merge_data::do_add_input_section): Record input section if
6425 keeps-input-sections flag is set.
6426 (Output_merge_string::do_add_input_section): Ditto.
6427 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6428 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6429 INPUT_SECTIONS_.
6430 (Output_merge_base::keeps_input_sections,
6431 Output_merge_base::set_keeps_input_sections,
6432 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6433 method definitions.
6434 (Output_merge_base::Input_sections): New type declaration.
6435 (Output_merge_base::input_sections_begin,
6436 Output_merge_base::input_sections_end,
6437 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6438 (Output_merge_base::bool keeps_input_sections_,
6439 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6440 Output_merge_base::input_sections_): New data members.
6441 (Output_merge_data::do_set_keeps_input_sections): New method
6442 defintion.
6443 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6444 * output.cc (Output_section::Input_section::relobj): Move method
6445 defintion from class declaration to here and handle merge sections.
6446 (Output_section::Input_section::shndx): Ditto.
6447 (Output_section::Output_section): Remove initializations of removed
6448 data members and initialize new data member LOOKUP_MAPS_.
6449 (Output_section::add_input_section): Set keeps-input-sections flag
6450 for a newly created merge output section as appropriate. Adjust code
6451 to use Output_section_lookup_maps class.
6452 (Output_section::add_relaxed_input_section): Adjst code for lookup
6453 maps code refactoring.
6454 (Output_section::add_merge_input_section): Add a new parameter
6455 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6456 class. If adding input section to a newly created merge output
6457 section fails, remove the new merge section.
6458 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6459 Adjust code for use of the Output_section_lookup_maps class.
6460 (Output_section::find_merge_section): Ditto.
6461 (Output_section::build_lookup_maps): New method defintion.
6462 (Output_section::find_relaxed_input_section): Adjust code to use
6463 Output_section_lookup_maps class.
6464 (Output_section::get_input_sections): Export merge sections. Adjust
6465 code to use Output_section_lookup_maps class.
6466 (Output_section:::add_script_input_section): Adjust code to use
6467 Output_section_lookup_maps class. Update lookup maps for merge
6468 sections also.
6469 (Output_section::discard_states): Use Output_section_lookup_maps.
6470 (Output_section::restore_states): Same.
6471 * output.h (Merge_section_properties): Move class defintion out of
6472 Output_section.
6473 (Output_section_lookup_maps): New class.
6474 (Output_section::Input_section::is_merge_section): New method
6475 defintion.
6476 (Output_section::Input_section::relobj): Move defintion out of class
6477 defintion. Declare method only.
6478 (Output_section::Input_section::shndx): Ditto.
6479 (Output_section::Input_section::output_merge_base): New method defintion.
6480 (Output_section::Input_section::u2_.pomb): New union field.
6481 (Output_section::Merge_section_by_properties_map,
6482 Output_section::Output_section_data_by_input_section_map,
6483 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6484 Remove types.
6485 (Output_section::add_merge_input_section): Add new parameter
6486 KEEPS_INPUT_SECTIONS.
6487 (Output_section::build_lookup_maps): New method declaration.
6488 (Output_section::merge_section_map_,
6489 Output_section::merge_section_by_properties_map_,
6490 Output_section::relaxed_input_section_map_,
6491 Output_section::is_relaxed_input_section_map_valid_): Remove data
6492 members.
6493 (Output_section::lookup_maps_): New data member.
6494
6495 2010-05-21 Doug Kwan <dougkwan@google.com>
6496
6497 PR gold/11619
6498 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6499 avoid a compilation error.
6500
6501 2010-05-19 Rafael Espindola <espindola@google.com>
6502
6503 * script-sections.cc (Output_section_definition::allocate_to_segment):
6504 Update the phdrs_list even when the output section is NULL.
6505 * testsuite/Makefile.am: Add test.
6506 * testsuite/Makefile.in: Regenerate.
6507 * testsuite/script_test_9.cc: New.
6508 * testsuite/script_test_9.sh: New.
6509 * testsuite/script_test_9.t: New.
6510
6511 2010-05-19 Doug Kwan <dougkwan@google.com>
6512
6513 * arm.cc (Arm_input_section::original_size): New method.
6514 (Arm_input_section::do_addralign): Add a cast.
6515 (Arm_input_section::do_output_offset): Remove static cast.
6516 (Arm_input_section::original_addralign,
6517 Arm_input_section::original_size_): Change type to uint32_t.
6518 (Arm_input_section::init): Add safe casts for section alignment
6519 and size.
6520 (Arm_input_section::set_final_data_size): Do not set address and
6521 offset of stub table.
6522 (Arm_output_section::fix_exidx_coverage): Change use of of
6523 Output_section::Simple_input_section to that of
6524 Output_section::Input_section.
6525 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6526 except for the first pass.
6527 * output.cc (Output_section::get_input_sections): Change type of
6528 input_sections to std::list<Input_section>.
6529 (Output_section::add_script_input_section): Rename from
6530 Output_section::add_simple_input_section. Change type of SIS
6531 parameter from Simple_input_section to Input_section.
6532 * output.h (Output_section::Simple_input_section): Remove class.
6533 (Output_section::Input_section): Change class visibility to public.
6534 (Output_section::Input_section::addralign): Use stored alignments
6535 for special input sections if set.
6536 (Output_section::Input_section::set_addralign): New method.
6537 (Output_section::get_input_sections): Change parameter type from
6538 list of Simple_input_section to list of Input_section.
6539 (Output_section::add_script_input_section): Rename from
6540 Output_section::add_simple_input_section. Change first parameter's
6541 type from Simple_input_section to Input_section and remove the
6542 second and third parameters.
6543 * script-sections.cc (Input_section::Input_section_list): Change
6544 type to list of Output_section::Input_section/
6545 (Input_section_info::Input_section_info): Change parameter type of
6546 INPUT_SECTION to Output_section::Input_section.
6547 (Input_section_info::input_section): Change return type.
6548 (Input_section_info::input_section_): Change type to
6549 Output_section::Input_section.
6550 (Output_section_element_input::set_section_addresses): Adjust code
6551 to use Output_section::Input_section instead of
6552 Output_section::Simple_input_section. Adjust code for renaming
6553 of Output_section::add_simple_input_section.
6554 (Orphan_output_section::set_section_addresses): Ditto.
6555
6556 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6557
6558 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6559 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6560
6561 2010-05-18 Rafael Espindola <espindola@google.com>
6562
6563 * options.cc (General_options::finalize): Handle -nostdlib.
6564 * options.h (nostdlib): New option.
6565 * script.cc (script_add_search_dir): Handle -nostdlib.
6566
6567 2010-05-12 Doug Kwan <dougkwan@google.com>
6568
6569 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6570 attributes section only if there no attributes section after merging.
6571 (Target_arm::merge_object_attributes): Move value of
6572 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6573 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6574 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6575 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6576 and arm_attr_merge_7.stdout.
6577 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6578 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6579 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6580 arm_attr_merge_7b.o): New rules.
6581 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6582 arm_attr_merge_7
6583 * testsuite/Makefile.in: Regenerate.
6584 * testsuite/arm_attr_merge.sh: New file.
6585 * testsuite/arm_attr_merge_[67][ab].s: Same.
6586
6587 2010-05-05 Nick Clifton <nickc@redhat.com>
6588
6589 * po/es.po: Updated Spanish translation.
6590
6591 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6592
6593 * Makefile.am (install-exec-local): Properly install gold as
6594 default cross linker.
6595 * Makefile.in: Regenerated.
6596
6597 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6598 Nick Clifton <nickc@redhat.com>
6599
6600 * configure.ac (install_as_default): Define and set to false
6601 unless --enable-gold or --enable-gold=both/gold has been
6602 specified.
6603 * configure: Regenerate.
6604
6605 * Makefile.am (install-exec-local): Install the executable as
6606 'ld.gold'. If install_as_default is true then also install it as
6607 'ld'.
6608 * Makefile.in: Regenerated.
6609
6610 2010-04-24 Ian Lance Taylor <iant@google.com>
6611
6612 * layout.cc (Layout::layout_reloc): In relocatable link don't
6613 combine reloc sections for grouped sections.
6614
6615 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6616
6617 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6618 sections that are not ordinary to icf.
6619 * icf.cc (get_section_contents): Handle relocation pointing to section
6620 with no object or shndx information.
6621 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6622 * testsuite/Makefile.in: Regenerate.
6623 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6624 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6625
6626 2010-04-22 Ian Lance Taylor <iant@google.com>
6627
6628 * expression.cc (Expression::Expression_eval_info): Add
6629 result_alignment_pointer field.
6630 (Expression::eval_with_dot): Add result_alignment_pointer
6631 parameter. Change all callers.
6632 (Expression::eval_maybe_dot): Likewise.
6633 (class Binary_expression): Add alignment_pointer parameter to
6634 left_value and right_value. Change all callers.
6635 (BINARY_EXPRESSION): Set result alignment.
6636 (class Trinary_expression): Add alignment_pointer parameter to
6637 arg2_value and arg3_value. Change all callers.
6638 (Trinary_cond::value): Set result alignment.
6639 (Max_expression::value, Min_expression::value): Likewise.
6640 (Align_expression::value): Likewise.
6641 * script-sections.cc (class Sections_element): Add dot_alignment
6642 parameter to set_section_addresses virtual function. Update
6643 instantiations.
6644 (class Output_section_element): Likewise.
6645 (Script_sections::create_segments): Add dot_alignment parameter.
6646 Change all callers.
6647 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6648 (Script_sections::set_phdrs_clause_addresses): Likewise.
6649 * script-sections.h: Update declarations.
6650 * script.h: Update declarations.
6651 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6652 min_p_align.
6653 * testsuite/script_test_3.t: Set large alignment.
6654 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6655 segment has expected alignment.
6656
6657 2010-04-22 Nick Clifton <nickc@redhat.com>
6658
6659 * po/gold.pot: Updated by the Translation project.
6660 * po/vi.po: Updated Vietnamese translation.
6661
6662 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6663
6664 * testsuite/Makefile.am (check_PROGRAMS): Add
6665 icf_virtual_function_folding_test.
6666 * testsuite/Makefile.in: Regenerated.
6667
6668 2010-04-15 Andrew Haley <aph@redhat.com>
6669
6670 * options.h (merge_exidx_entries): New option.
6671 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6672 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6673 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6674 (Target_arm::merge_exidx_entries): New function.
6675 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6676 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6677 to Arm_exidx_fixup constructor.
6678 Add new arg, merge_exidx_entries.
6679 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6680 Arm_output_section::fix_exidx_coverage.
6681
6682 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6683
6684 * icf.cc (get_section_contents): Check for preemptible functions.
6685 Ignore addend when appropriate.
6686 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6687 section folded.
6688 (add_from_relobj): Check for section folded.
6689 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6690 * symtab.h (should_add_dynsym_entry): Add new parameter.
6691 * target-reloc.h (scan_relocs): Check for section folded.
6692 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6693 Check reloc types for function pointers in shared objects.
6694 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6695 case.
6696 (icf_preemptible_functions_test): New test case.
6697 (icf_string_merge_test): New test case.
6698 * testsuite.Makefile.in: Regenerate.
6699 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6700 bar_glob. Refactor code.
6701 * testsuite/icf_preemptible_functions_test.cc: New file.
6702 * testsuite/icf_preemptible_functions_test.sh: New file.
6703 * testsuite/icf_string_merge_test.cc: New file.
6704 * testsuite/icf_string_merge_test.sh: New file.
6705 * testsuite/icf_virtual_function_folding_test.cc: New file.
6706 * testsuite/icf_virtual_function_folding_test.sh: New file.
6707
6708 2010-04-14 Doug Kwan <dougkwan@google.com>
6709
6710 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6711 for local symbol recounting if we remove a section due to ICF.
6712 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6713 there are no regular objects in input.
6714
6715 2010-04-13 Doug Kwan <dougkwan@google.com>
6716
6717 * arm.cc (Arm_input_section::set_final_data_size): Compute
6718 accurate final data size instead of using current data size.
6719
6720 2010-04-09 Doug Kwan <dougkwan@google.com>
6721
6722 * layout.cc (Layout::choose_output_section): Handle script section
6723 types.
6724 (Layout::make_output_section_for_script): Add section type parameter.
6725 Handle script section types.
6726 * layout.h (Layout::make_output_section_for_script): Add section
6727 type parameter.
6728 * output.cc (Output_section::Output_section): Initialize data member
6729 is_noload_.
6730 (Output_section::do_reset_address_and_file_offset): Do not set address
6731 to 0 if section is a NOLOAD section.
6732 * output.h (Output_section::is_noload): New method.
6733 (Output_section::set_is_noload): Ditto.
6734 (Output_section::is_noload_): New data member.
6735 * script-c.h (Script_section_type): New enum type.
6736 (struct Parser_output_section_header): Add new file section_type.
6737 * script-sections.cc (Sections_element::output_section_name): Add
6738 parameter for returning script section type.
6739 (Output_section_definition::output_section_name): Ditto.
6740 (Output_section_definition::section_type)P; New method.
6741 (Output_section_definiton::script_section_type_name): Ditto.
6742 (Output_section_definition::script_section_type_): New data member.
6743 (Output_section_definition::Output_section_definition): Initialize
6744 data member Output_section_definition::script_section_type_.
6745 (Output_section_definition::create_sections): Pass script section type
6746 to Layout::make_output_section_for_script.
6747 (Output_section_definition::output_section_name): Return script
6748 section type to caller.
6749 (Output_section_definition::set_section_address): Do not advance
6750 dot value and load address if section type is NOLOAD. Set address
6751 of NOLOAD sections regardless of section flags.
6752 (Output_section_definition::print): Print section type if it is
6753 not SCRIPT_SECTION_TYPE_NONE.
6754 (Output_section_definition::section_type): New method.
6755 (Output_section_definition::script_section_type_name): Ditto.
6756 (Script_sections::output_section_name): Add new parameter
6757 PSECTION_TYPE for returning script section type. Pass it to
6758 section elements. Handle discard sections.
6759 (Sort_output_sections::operator()): Handle NOLOAD sections.
6760 * script-sections.h (Script_sections::Section_type): New enum type.
6761 (Script_sections::output_section_name): Add a new parameter for
6762 returning script section type.
6763 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6764 INFO and NOLOAD.
6765 * yyscript.y (union): Add new field SECTION_TYPE.
6766 (COPY, DSECT, INFO, NOLOAD): New tokens.
6767 (opt_address_and_section_type): Change type to output_section_header.
6768 (section_type): New non-terminal
6769 (section_header): Handle section type.
6770 (opt_address_and_section_type): Return section type value.
6771
6772 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6773
6774 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6775 * testsuite/plugin_common_test_2.c (foo): Likewise.
6776
6777 2010-04-08 Doug Kwan <dougkwan@google.com>
6778
6779 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6780 Output_merge_data.
6781 * output.cc (Output_section::add_merge_input_section): Simplify
6782 code and return status of Output_merge_base::add_input_section.
6783 Update merge section map only if Output_merge_base::add_input_section
6784 returns true.
6785
6786 2010-04-07 Doug Kwan <dougkwan@google.com>
6787
6788 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6789 if section is marked as containing instructions but has no mapping
6790 symbols.
6791 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6792 correct section index.
6793 (Arm_relobj::find_linked_text_section): Ditto.
6794
6795 2010-04-07 Cary Coutant <ccoutant@google.com>
6796
6797 * archive.cc (include_member): Destroy Read_symbols_data object before
6798 releasing file.
6799 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6800 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6801 (Read_symbols_data::~Read_symbols_data) New destructor.
6802 (Section_relocs::Section_relocs) New constructor.
6803 (Section_relocs::~Section_relocs) New destructor.
6804 (Read_relocs_data::Read_relocs_data) New constructor.
6805 (Read_relocs_data::~Read_relocs_data) New destructor.
6806 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6807 pointers to NULL after deleting.
6808
6809 2010-04-07 Doug Kwan <dougkwan@google.com>
6810
6811 * arm.cc: Replace "endianity" with "endianness" in comments.
6812 (Arm_exidx_cantunwind): Ditto.
6813 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6814 (Arm_relobj::merge_flags_and_attributes): New method.
6815 (Arm_relobj::merge_flags_and_attributes_): New data member.
6816 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6817 (Arm_relobj::scan_sections_for_stubs): Ditto.
6818 (Arm_relobj::do_read_symbols): Check to see if we really want to
6819 merge processor-specific flags and attributes. Exit early if
6820 an object is empty except for section names and the undefined symbol.
6821 (Target_arm::do_finalize_sections): Move check for ELF format to
6822 Arm_relobj::do_read_symbols. Merge processor specific flags and
6823 attributes from a regular object only when we have determined that
6824 it is aapropriate. Do not create an .ARM.attributes section in
6825 output if there is no regular input object.
6826 (Target_arm::merge_processor_specific_flags): Check
6827 --warn-mismatch before printing any error.
6828 (Target_arm::merge_object_attributes): Ditto.
6829 * gold.cc (queue_middle_tasks): Handle the case in which there is
6830 no regular object in input.
6831 * options.cc (General_options::parse_EB): New method.
6832 (General_options::parse_EL): Same.
6833 (General_options::General_options): Initialize endianness_.
6834 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6835 New options.
6836 (General_options::Endianness): New enum.
6837 (General_options::endianness): New method.
6838 (General_options::endianness_): New data member.
6839 * parameters.cc (Parameters::set_options): Check target endianness.
6840 (Parameters::set_target_once): Ditto.
6841 (Parameters::check_target_endianness): New method.
6842 (parameters_force_valid_target): If either -EL or -EB is specified,
6843 use it to define endianness of default target.
6844 * parameters.h (Parameters::check_target_endianness): New method
6845 declaration.
6846 * target.h (class Target): Change "endianity" to "endianness"
6847 in comments.
6848
6849 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6850
6851 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6852 * configure: Regenerate.
6853 * Makefile.in: Regenerate.
6854 * testsuite/Makefile.in: Regenerate.
6855
6856 2010-04-06 Cary Coutant <ccoutant@google.com>
6857
6858 gcc PR lto/42757
6859 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6860 prevailing definitions of common symbols.
6861 * testsuite/plugin_test_6.sh: New test case.
6862 * testsuite/plugin_common_test_1.c: New test case.
6863 * testsuite/plugin_common_test_2.c: New test case.
6864 * testsuite/Makefile.am (plugin_test_6): New test case.
6865 * testsuite/Makefile.in: Regenerate.
6866
6867 2010-04-06 Nick Clifton <nickc@redhat.com>
6868
6869 * po/vi.po: New Vietnamese translation.
6870
6871 2010-03-30 Doug Kwan <dougkwan@google.com>
6872
6873 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6874
6875 2010-03-25 Doug Kwan <dougkwan@google.com>
6876
6877 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6878 to avoid a conversion warning on a 32-bit host.
6879
6880 2010-03-24 Ian Lance Taylor <iant@google.com>
6881
6882 * testsuite/script_test_3.t: Add a TLS segment.
6883 * testsuite/Makefile.am (check_PROGRAMS): Add
6884 tls_phdrs_script_test.
6885 (tls_phdrs_script_test_SOURCES): Define.
6886 (tls_phdrs_script_test_DEPENDENCIES): Define.
6887 (tls_phdrs_script_test_LDFLAGS): Define.
6888 (tls_phdrs_script_test_LDADD): Define.
6889 * testsuite/Makefile.in: Rebuild.
6890
6891 2010-03-23 Cary Coutant <ccoutant@google.com>
6892
6893 * fileread.cc (find_or_make_view): Fix comment.
6894
6895 2010-03-23 Ian Lance Taylor <iant@google.com>
6896
6897 * script-sections.cc (class Orphan_section_placement): Define
6898 PLACE_TLS and PLACE_TLS_BSS.
6899 (Orphan_section_placement::Orphan_section_placement): Initialize
6900 new places.
6901 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6902 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6903 (tls_script_test_SOURCES): Define.
6904 (tls_script_test_DEPENDENCIES): Define.
6905 (tls_script_test_LDFLAGS): Define.
6906 (tls_script_test_LDADD): Define.
6907 * testsuite/Makefile.in: Rebuild.
6908
6909 2010-03-22 Doug Kwan <dougkwan@google.com>
6910
6911 * arm.cc (Arm_relocate_functions::abs8,
6912 Arm_relocate_functions::abs16): Use correct check for overflow
6913 specified in the ARM ELF specs.
6914 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6915 target of a BLX instruction specially.
6916 (Reloc_stub::stub_type_for_reloc): Ditto.
6917 (Relocate::relocate): Use symbolic names instead of numeric relocation
6918 codes to report error.
6919 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6920 workaround.
6921 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6922 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6923 thumb2_blx_out_of_range.stdout
6924 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6925 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6926 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6927 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6928 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6929 thumb2_blx_in_range, thumb2_blx_in_range.o,
6930 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6931 thumb2_blx_out_of_range.o): New rules.
6932 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6933 thumb2_blx_in_range and thumb2_blx_out_of_range.
6934 * testsuite/Makefile.in: Regenerate.
6935 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6936 * testsuite/thumb_blx_in_range.s: New file.
6937 * testsuite/thumb_blx_out_of_range.s: New file.
6938
6939 2010-03-22 Rafael Espindola <espindola@google.com>
6940
6941 * archive.cc (Should_include): Move to archive.h.
6942 (should_include_member): Make it a member of Archive.
6943 (Lib_group): New.
6944 (Add_lib_group_symbols): New.
6945 * archive.h: Include options.h.
6946 (Archive_member): Moved from Archive.
6947 (Should_include): Moved from archive.cc.
6948 (Lib_group): New.
6949 (Add_lib_group_symbols): New.
6950 * dynobj.cc (do_should_include_member): New.
6951 * dynobj.h (do_should_include_member): New.
6952 * gold.cc (queue_initial_tasks): Update call to queue.
6953 * main.cc (main): Print lib group stats.
6954 * object.cc (do_should_include_member): New.
6955 * object.h: Include archive.h.
6956 (Object::should_include_member): New.
6957 (Object::do_should_include_member): New.
6958 (Sized_relobj::do_should_include_member): New.
6959 * options.cc (General_options::parse_start_lib): New.
6960 (General_options::parse_end_lib): New.
6961 (Input_arguments::add_file): Handle lib groups.
6962 (Input_arguments::start_group): Check we are not in a lib.
6963 (Input_arguments::start_lib): New.
6964 (Input_arguments::end_lib): New.
6965 * options.h (General_options): Add start_lib and end_lib.
6966 (Input_argument::lib_): New.
6967 (Input_argument::lib): New.
6968 (Input_argument::is_lib): New.
6969 (Input_file_lib): New.
6970 (Input_arguments::in_lib_): New.
6971 (Input_arguments::in_lib): New.
6972 (Input_arguments::start_lib): New.
6973 (Input_arguments::end_lib_): New.
6974 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6975 in unused members as preempted.
6976 (Sized_pluginobj::do_should_include_member): New.
6977 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6978 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6979 return the blocker.
6980 (Read_symbols::do_whole_lib_group): New.
6981 (Read_symbols::do_lib_group): New.
6982 (Read_symbols::do_read_symbols): Handle lib groups.
6983 (Read_symbols::get_name): Handle lib groups.
6984 * readsyms.h (Read_symbols): Add an archive member pointer.
6985 (Read_symbols::do_whole_lib_group): New.
6986 (Read_symbols::do_lib_group): New.
6987 (Read_symbols::member_): New.
6988 * script.cc (read_input_script): Update call to queue_soon.
6989
6990 2010-03-19 Doug Kwan <dougkwan@google.com>
6991
6992 * arm.cc (Stub_table::Stub_table): Initialize new data members
6993 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6994 (Stub_table::add_reloc_stub): Assign stub offset and update
6995 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6996 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6997 New data members.
6998 (Stub_table::update_data_size_and_addralign): Use
6999 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7000 instead of going over all reloc stubs.
7001 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7002 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7003 Stringpool_template::offset_ to size of Stringpool_char.
7004 (Stringpool_template::new_key_offset): Remove code to initialize
7005 Stringpool_template::offset_.
7006 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7007 Stringpool_template::offset_ to zero.
7008
7009 2010-03-15 Doug Kwan <dougkwan@google.com>
7010
7011 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7012 offset_.
7013 (Stringpool_template::new_key_offset): New method.
7014 (Stringpool_template::add_string): Assign offsets when adding new
7015 strings.
7016 (Stringpool_template::set_string_offsets): Do not set string offsets
7017 when not optimizing.
7018 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7019 member size_.
7020 (Chunked_vector::clear): Clear size_.
7021 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7022 (Chunked_vector::size): Return size_.
7023 (Chunked_vector::push_back): Use size_ to find insert position.
7024 (Chunked_vector::size_): New data member.
7025 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7026 (Stringpool_template::new_key_offset): New method declaration.
7027 (Stringpool_template::offset_): New data member.
7028
7029 2010-03-15 Rafael Espindola <espindola@google.com>
7030
7031 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7032 Add_symbols' constructor.
7033 * readsyms.h (Add_symbols): Remove the input_group member.
7034
7035 2010-03-10 Ian Lance Taylor <iant@google.com>
7036
7037 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7038 target to ask whether a reference to a symbol requires a stack
7039 split.
7040 * target.h (Target::is_call_to_non_split): New function.
7041 (Target::do_is_call_to_non_split): Declare virtual function.
7042 * target.cc: Include "symtab.h".
7043 (Target::do_is_call_to_non_split): New function.
7044 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7045
7046 2010-03-10 Cary Coutant <ccoutant@google.com>
7047
7048 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7049 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7050 (File_read::open[2]): Add whole_file_view_ to list of views.
7051 (File_read::make_view): Remove test of whole_file_view_.
7052 (File_read::find_or_make_view): Create whole_file_view_ if
7053 necessary.
7054 (File_read::clear_views): Replace bool parameter with enum;
7055 adjust all callers. Don't delete views with permanent data;
7056 do delete cached views and views from archives if
7057 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7058 if clearing the corresponding view.
7059 * fileread.h (File_read::Clear_views_mode): New enum.
7060 (File_read::View::is_permanent_view): New method.
7061 (File_read::clear_views): Replace bool parameter
7062 with enum; adjust all callers.
7063 * options.h (General_options): Change keep_files_mapped option;
7064 add map_whole_files.
7065 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7066 releasing the file.
7067 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7068 the file.
7069
7070 2010-03-10 David S. Miller <davem@davemloft.net>
7071
7072 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7073
7074 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7075
7076 * icf.cc (get_section_contents): Add '@' marker after processing the
7077 merge reloc.
7078
7079 2010-03-08 Doug Kwan <dougkwan@google.com>
7080
7081 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7082 due to a conversion warning.
7083 (Arm_relobj::update_output_local_symbol_count): Check for local
7084 symbol with unset output index.
7085
7086 2010-03-05 Ian Lance Taylor <iant@google.com>
7087
7088 * options.h (class General_options): Add --spare-dynamic-tags.
7089 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7090 --spare-dynamic-tags.
7091
7092 2010-03-05 Ian Lance Taylor <iant@google.com>
7093
7094 * incremental.cc: Include "libiberty.h".
7095
7096 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7097
7098 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7099 function, is_info_ member.
7100 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7101 (Versions::Versions): Update caller.
7102 (Versions::define_base_version): Likewise.
7103 (Versions::add_def): Likewise.
7104
7105 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7106
7107 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7108 (Scan::possible_function_pointer_reloc): New function.
7109 (Scan::local_reloc_may_be_function_pointer): Change to call
7110 possible_function_pointer_reloc.
7111 (Scan::global_reloc_may_be_function_pointer): Ditto.
7112 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7113 relocations in ".data.rel.ro._ZTV" section.
7114 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7115 * testsuite/icf_safe_so_test.cc: Ditto.
7116 * testsuite/icf_safe_test.cc: Ditto.
7117 * testsuite/icf_safe_test.sh: Ditto.
7118
7119 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7120 Ian Lance Taylor <iant@google.com>
7121
7122 * target-reloc.h (relocate_section): Check the symbol table index
7123 for -1U before setting the local symbol index.
7124 (scan_relocatable_relocs): If copying the relocation, record that
7125 the local symbol is required.
7126 * object.h (Symbol_value::is_output_symtab_index_set): New
7127 function.
7128 (Symbol_value::may_be_discarded_from_output_symtab): New
7129 function.
7130 (Symbol_value::has_output_symtab_entry): New function.
7131 (Symbol_value::needs_output_symtab_entry): Remove.
7132 (Symbol_value::output_symtab_index): Make sure the symbol index is
7133 set.
7134 (Symbol_value::set_output_symtab_index): Make sure the symbol
7135 index is not set. Make sure the new index is valid.
7136 (Symbol_value::set_must_have_output_symtab_entry): New function.
7137 (Symbol_value::has_output_dynsym_entry): New function.
7138 (Symbol_value::set_output_dynsym_index): Make sure the new index
7139 is valid.
7140 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7141 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7142 local symbol if permitted.
7143 (Sized_relobj::do_finalize_local_symbols): Call
7144 is_output_symtab_index_set rather than needs_output_symtab_entry.
7145 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7146 rather than needs_output_symtab_entry. Call
7147 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7148 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7149 is_output_symtab_index_set rather than needs_output_symtab_entry.
7150 * testsuite/discard_locals_relocatable_test.c: New file.
7151 * testsuite/discard_locals_test.sh: Test -r.
7152 * testsuite/Makefile.am (check_DATA): Add
7153 discard_locals_relocatable_test1.syms,
7154 discard_local_relocatable_test2.syms.
7155 (MOSTLYCLEANFILES): Likewise. Also add
7156 discard_locals_relocatable_test1.lout and
7157 discard_locals_relocatable_test2.out.
7158 (discard_locals_relocatable_test1.syms): New target.
7159 (discard_locals_relocatable_test.o): New target.
7160 (discard_locals_relocatable_test1.out): New target.
7161 (discard_locals_relocatable_test2.syms): New target.
7162 (discard_locals_relocatable_test2.out): New target.
7163 (various): Add missing ../ld-new dependencies.
7164 * testsuite/Makefile.in: Rebuild.
7165
7166 2010-03-03 Nick Clifton <nickc@redhat.com>
7167
7168 * po/fi.po: New Finnish translation.
7169
7170 2010-03-01 Doug Kwan <dougkwan@google.com>
7171
7172 * layout.cc (Layout::Layout): Force section types of .init_array*,
7173 .preinit_array* and .fini_array* sections.
7174 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7175 Fix check of return value of std::string::find.().
7176 (Output_section::Input_section_sort_compare::operator()): Remove
7177 comment about .init_array.
7178 (Output_section::Input_section_sort_init_fini_compare::operator()):
7179 New method.
7180 (Output_section::sort_attached_input_sections): Handle .init_array
7181 and .fini_array specially.
7182 * output.h (Output_section::Inut_section_sort_compare): Update
7183 comment.
7184 (Output_section::Input_section_sort_init_fini_compare): New struct.
7185
7186 2010-02-26 Doug Kwan <dougkwan@google.com>
7187
7188 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7189 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7190 * testsuite/debug_msg.sh: Avoid matching source line number for
7191 use of global variable undef_int.
7192
7193 2010-02-26 Doug Kwan <dougkwan@google.com>
7194
7195 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7196 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7197 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7198 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7199 * options.cc (General_options::General_options): Initialize member
7200 fix_v4bx_.
7201 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7202 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7203 and rm_no_fix_v4bx.stdout
7204 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7205 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7206 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7207 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7208 and arm_no_fix_v4bx.
7209 * Makefile.in: Regenerate.
7210 * testsuite/arm_fix_v4bx.s: New file.
7211 * testsuite/arm_fix_v4bx.sh: Ditto.
7212
7213 2010-02-24 Doug Kwan <dougkwan@google.com>
7214
7215 * arm.cc (Target_arm::got_section): Make the .got section the first
7216 non RELRO section in the data segment.
7217 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7218 suffixes of section names.
7219
7220 2010-02-24 Doug Kwan <dougkwan@google.com>
7221
7222 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7223 flags and attributes merging if an input file is a binary file.
7224 * fileread.cc (Input_file::open): Record format of original file.
7225 * fileread.h (Input_file::Format): New enum type.
7226 (Input_file::Input_file): Initialize data member format_.
7227 (Input_file::format): New method definition.
7228 (Input_file::format_):: New data member.
7229
7230 2010-02-24 Doug Kwan <dougkwan@google.com>
7231
7232 * arm.cc (Arm_output_data_got): New class.
7233 (ARM_TCB_SIZE): New constant
7234 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7235 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7236 If user uses a script with a SECTIONS clause, issue only a warning
7237 for a misplaced EXIDX input section. Otherwise, issue an error.
7238 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7239 garbage collection.
7240 (Target_arm::got_mode_index_entry): Handle static linking.
7241 (Target_arm::Scan::local): Ditto.
7242 (Target_arm::Scan::global): Ditto.
7243 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7244 all incorrectly implemented relocations.
7245 (Target_arm::fix_exidx_coverage): Pass layout to
7246 Arm_output_section::fix_exidx_coverage.
7247 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7248 from ".ARM.exidx." and ".ARM.extab.".
7249
7250 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7251
7252 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7253 section if it does not already exist.
7254 * attributes.cc (Attributes_section_data::Attributes_section_data):
7255 Don't crash if size is zero.
7256
7257 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7258 Ian Lance Taylor <iant@google.com>
7259
7260 * gold.cc (queue_middle_tasks): If no input files were opened,
7261 exit.
7262 * workqueue.h (Task_function::Task_function): Assert that there is
7263 a blocker.
7264
7265 2010-02-22 Doug Kwan <dougkwan@google.com>
7266
7267 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7268 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7269 types to avoid warnings due to different uint64_t implementations
7270 on different hosts.
7271
7272 2010-02-21 Doug Kwan <dougkwan@google.com>
7273
7274 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7275 handling of the maximum backward branch offset.
7276 (Arm_relocate_functions::thumb_branch_common): Ditto.
7277 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7278 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7279 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7280 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7281 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7282 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7283 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7284 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7285 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7286 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7287 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7288 thumb2_bl_out_of_range.o): New rules.
7289 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7290 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7291 thumb2_bl_out_of_range
7292 * testsuite/Makefile.in: Regenerate.
7293 * testsuite/arm_bl_in_range.s: New file.
7294 * testsuite/arm_bl_out_of_range.s: Ditto.
7295 * testsuite/arm_branch_in_range.sh: Ditto.
7296 * testsuite/arm_branch_range.t: Ditto.
7297 * testsuite/thumb2_branch_range.t: Ditto.
7298 * testsuite/thumb_bl_in_range.s: Ditto.
7299 * testsuite/thumb_bl_out_of_range.s: Ditto.
7300 * testsuite/thumb_branch_range.t: Ditto.
7301
7302 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7303
7304 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7305 Add reloc offset information.
7306 * icf.cc (get_section_contents): Change iterators to point to the new
7307 vectors. Add reloc offset information to the contents.
7308 * icf.h (Icf::Sections_reachable_info): New typedef.
7309 (Icf::Sections_reachable_list): New typedef.
7310 (Icf::Offset_info): New typedef.
7311 (Icf::Reloc_info): New struct typedef.
7312 (Icf::Reloc_info_list): New typedef.
7313 (Icf::symbol_reloc_list): Delete method.
7314 (Icf::addend_reloc_list): Delete method.
7315 (Icf::section_reloc_list): Delete method.
7316 (Icf::reloc_info_list): New method.
7317 (Icf::reloc_info_list_): New member.
7318
7319 2010-02-19 Doug Kwan <dougkwan@google.com>
7320
7321 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7322 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7323 * arm.cc (Arm_relocation_functions): New forward declaration.
7324 (Target_arm::Target_arm): Initialize new data members
7325 got_mod_index_offset_ and tls_base_symbol_defined_.
7326 (Target_arm::Relocate::relocate_tls): New method.
7327 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7328 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7329 New methods.
7330 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7331 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7332 (Target_arm::got_mod_index_offset_,
7333 Target_arm::tls_base_symbol_defined_): New data members.
7334 (Target_arm::Scan::local, Target::Scan::global,
7335 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7336 relocations.
7337
7338 2010-02-18 Doug Kwan <dougkwan@google.com>
7339
7340 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7341 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7342 text section as a parameter becuase some broken tools may not set
7343 the link in section header.
7344 (Target_arm::has_got_section): New method.
7345 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7346 without any mapping symbol as data only. Remove warning.
7347 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7348 link in its section header, try to discover the link by inspecting the
7349 REL31 relocation at the beginning of the section.
7350 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7351 in error message.
7352 (Target_arm::Scan::global): Treat any reference to the symbol
7353 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7354
7355 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7356
7357 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7358 (Scan::global_reloc_may_be_function_pointer): New function.
7359 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7360 (Scan::global_reloc_may_be_function_pointer): New function.
7361 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7362 (Scan::global_reloc_may_be_function_pointer): New function.
7363 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7364 (Scan::global_reloc_may_be_function_pointer): New function.
7365 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7366 (Scan::global_reloc_may_be_function_pointer): New function.
7367 (Scan::possible_function_pointer_reloc): New function.
7368 (Target_x86_64::can_check_for_function_pointers): New function.
7369 * gc.h (gc_process_relocs): Scan relocation types to determine if
7370 function pointers were taken for targets that support it.
7371 * icf.cc (Icf::find_identical_sections): Include functions for
7372 folding in safe ICF whose pointer is not taken.
7373 * icf.h (Secn_fptr_taken_set): New typedef.
7374 (fptr_section_id_): New member.
7375 (section_has_function_pointers): New function.
7376 (set_section_has_function_pointers): New function.
7377 (check_section_for_function_pointers): New function.
7378 * options.h: Fix comment for safe ICF option.
7379 * target.h (can_check_for_function_pointers): New function.
7380 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7381 Modify icf_safe_test for X86-64.
7382 * testsuite/Makefile.in: Regenerate.
7383 * testsuite/icf_safe_so_test.cc: New file.
7384 * testsuite/icf_safe_so_test.sh: New file.
7385 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7386 (main): Change to take pointer to function kept_func_3.
7387 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7388 folding is done correctly for X86-64.
7389
7390 2010-02-12 David S. Miller <davem@davemloft.net>
7391
7392 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7393 is_symbolless parameter.
7394 (Output_reloc<SHT_REL>::is_symbolless): New.
7395 (Output_reloc<SHT_REL>::is_symbolless_): New.
7396 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7397 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7398 (Output_reloc<SHT_RELA>::is_symbolless): New.
7399 (Output_data_reloc::add_global): Handle is_symbolless.
7400 (Output_data_reloc::add_global_relative): Likewise.
7401 (Output_data_reloc::add_local): Likewise.
7402 (Output_data_reloc::add_local_relative): Likewise.
7403 (Output_data_reloc::add_symbolless_global_addend): New.
7404 (Output_data_reloc::add_symbolless_local_addend): New.
7405 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7406 is_symbolless.
7407 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7408 instead of ->is_relative_
7409 (Output_reloc::write): Likewise.
7410 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7411 (Output_reloc::write_rel): Simplify.
7412
7413 * sparc.cc (Target_sparc::Scan::local): Use
7414 ->add_symbolless_local_addend as needed.
7415 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7416 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7417 based upon relocation offset.
7418
7419 2010-02-11 Doug Kwan <dougkwan@google.com>
7420
7421 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7422 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7423 beginning of function.
7424 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7425 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7426 parameter is_32bit in calls to should_apply_static_reloc.
7427 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7428 (check_DATA): Add arm_abs_global.stdout.
7429 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7430 arm_abs_global.stdout): New rules.
7431 (MOSTLLYCLEANFILES): Add arm_abs_global
7432 * Makefile.in: Regenerate.
7433 * testsuite/arm_abs_global.s: New file.
7434 * testsuite/arm_abs_global.sh: Ditto.
7435 * testsuite/arm_abs_lib.s: Ditto.
7436
7437 2010-02-11 Ian Lance Taylor <iant@google.com>
7438
7439 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7440 Read_relocs task.
7441 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7442 Allocate_commons_task first.
7443 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7444 task, rather than symtab_lock_.
7445 (Gc_process_relocs::~Gc_process_relocs): New function.
7446 (Gc_process_relocs::is_runnable): Check this_blocker_.
7447 (Gc_process_relocs::locks): Use next_blocker_ rather than
7448 blocker_.
7449 (Scan_relocs::~Scan_relocs): New function.
7450 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7451 symtab_lock_.
7452 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7453 next_blocker_.
7454 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7455 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7456 constructor accordingly.
7457 (class Gc_process_relocs): Likewise.
7458 (class Scan_relocs): Likewise.
7459 * common.h (class Allocate_commons_task): Remove symtab_lock_
7460 field, and corresponding constructor parameter.
7461 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7462 symtab_lock_.
7463 (Allocate_commons_task::locks): Likewise.
7464
7465 2010-02-11 Ian Lance Taylor <iant@google.com>
7466
7467 * gold-threads.h (class Once): Define.
7468 (class Initialize_lock): Rewrite as child of Once.
7469 * gold-threads.cc (class Once_initialize): Define.
7470 (once_pointer_control): New static variable.
7471 (once_pointer, once_arg): New static variables.
7472 (c_run_once): New static function.
7473 (Once::Once, Once::run_once, Once::internal_run): New functions.
7474 (class Initialize_lock_once): Remove.
7475 (initialize_lock_control): Remove.
7476 (initialize_lock_pointer): Remove.
7477 (initialize_lock_once): Remove.
7478 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7479 (Initialize_lock::initialize): Rewrite.
7480 (Initialize_lock::do_run_once): New function.
7481 * archive.cc (Archive::interpret_header): Only clear name if it is
7482 not already empty.
7483 * fileread.cc: Include "gold-threads.h"
7484 (file_counts_lock): New static variable.
7485 (file_counts_initialize_lock): Likewise.
7486 (File_read::release): Only increment counts when using --stats.
7487 Use a lock around the increment.
7488 * parameters.cc (class Set_parameters_target_once): Define.
7489 (set_parameters_target_once): New static variable.
7490 (Parameters::Parameters): Move here from parameters.h.
7491 (Parameters::set_target): Rewrite.
7492 (Parameters::set_target_once): New function.
7493 (Parameters::clear_target): Move here and rewrite.
7494 * parameters.h (class Parameters): Update declarations. Add
7495 set_parameters_target_once_ field.
7496 (Parameters::Parameters): Move to parameters.cc.
7497 (Parameters::clear_target): Likewise.
7498 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7499 task.
7500 (Start_group::~Start_group): New function.
7501 (Start_group::is_runnable): New function.
7502 (Start_group::locks, Start_group::run): New functions.
7503 (Finish_group::run): Change saw_undefined to size_t.
7504 * readsyms.h (class Start_group): Define.
7505 (class Finish_group): Change saw_undefined_ field to size_t.
7506 (Finish_group::Finish_group): Remove saw_undefined and
7507 this_blocker parameters. Change all callers.
7508 (Finish_group::set_saw_undefined): New function.
7509 (Finish_group::set_blocker): New function.
7510 * symtab.h (class Symbol_table): Change saw_undefined to return
7511 size_t. Change saw_undefined_ field to size_t.
7512 * target-select.cc (Set_target_once::do_run_once): New function.
7513 (Target_selector::Target_selector): Initialize set_target_once_
7514 field. Don't initialize lock_ and initialize_lock_ fields.
7515 (Target_selector::instantiate_target): Rewrite.
7516 (Target_selector::set_target): New function.
7517 * target-select.h (class Set_target_once): Define.
7518 (class Target_selector): Update declarations. Make
7519 Set_target_once a friend. Remove lock_ and initialize_lock_
7520 fields. Add set_target_once_ field.
7521
7522 2010-02-10 Ian Lance Taylor <iant@google.com>
7523
7524 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7525 queueing any tasks.
7526 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7527 (queue_middle_tasks): Add all blockers before queueing any tasks.
7528 (queue_final_tasks): Likewise.
7529 * token.h (Task_token::add_blockers): New function.
7530 * object.h (Input_objects::number_of_relobjs): New function.
7531
7532 2010-02-10 Ian Lance Taylor <iant@google.com>
7533
7534 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7535 shared, not if not position independent.
7536 * x86_64.cc (Relocate::relocate_tls): Likewise.
7537 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7538 (tls_pie_pic_test): New target.
7539 * testsuite/Makefile.in: Rebuild.
7540
7541 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7542 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7543 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7544 * testsuite/Makefile.in: Rebuild.
7545
7546 2010-02-09 David S. Miller <davem@davemloft.net>
7547
7548 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7549 R_SPARC_RELATIVE using ->add_local_relative().
7550 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7551
7552 * output.h (Output_data_dynamic::add_section_size): New method
7553 that takes two Output_data objects.
7554 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7555 entry param. Handle it in initializers.
7556 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7557 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7558 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7559 arg.
7560 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7561 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7562 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7563 for dynrel_includes_plt.
7564 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7565 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7566 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7567 before .rela.plt
7568 (Target_sparc::do_finalize_sections): Update to pass true for
7569 dynrel_includes_plt.
7570 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7571 output before .rela.plt
7572 (Target_powerpc::do_finalize_sections): Update to pass true for
7573 dynrel_includes_plt when 32-bit.
7574
7575 2010-02-08 Doug Kwan <dougkwan@google.com>
7576
7577 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7578 method.
7579 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7580 Arm_relobj::scan_section_for_cortex_a8_stubs,
7581 Arm_relobj::do_relocation_section): Instead of calling
7582 Output_section::output_address, use faster
7583 Arm_relobj::simple_input_section_output_address.
7584
7585 2010-02-08 David S. Miller <davem@davemloft.net>
7586
7587 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7588 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7589 relocation helper function.
7590
7591 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7592 just like R_SPARC_GOT{10,13,22}.
7593 (Target_sparc::Scan::local): Likewise.
7594 (Target_sparc::Relocate:relocate): Likewise.
7595
7596 2010-02-06 Ian Lance Taylor <iant@google.com>
7597
7598 * configure.ac: Rewrite targetobjs duplicate removal code to use
7599 only shell constructs.
7600 * configure: Rebuild.
7601
7602 2010-02-05 Doug Kwan <dougkwan@google.com>
7603
7604 PR 11247
7605 * arm.cc (Arm_relobj::section_is_scannable): New method.
7606 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7607 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7608
7609 2010-02-04 Doug Kwan <dougkwan@google.com>
7610
7611 PR 11247
7612 * arm-reloc-property.cc (cstdio): Include.
7613 * configure.ac (targetobjs): Remove duplicates.
7614 * configure: Regenerate.
7615 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7616 big and little endian version for a given address size.
7617
7618 2010-02-03 Doug Kwan <dougkwan@google.com>
7619
7620 * arm-reloc-property.cc
7621 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7622 definition.
7623 * arm-reloc-property.h
7624 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7625 New method definition.
7626 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7627 declaration.
7628 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7629 overflow to N.
7630 (GOT_PREL): Change implemented to Y.
7631 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7632 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7633 (Arm_relocate_functions::movw_abs_nc): Remove method.
7634 (Arm_relocate_functions::movt_abs): Ditto.
7635 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7636 (Arm_relocate_functions::thm_movt_abs): Ditto.
7637 (Arm_relocate_functions::movw_rel_nc): Ditto.
7638 (Arm_relocate_functions::movw_rel): Ditto.
7639 (Arm_relocate_functions::movt_rel): Ditto.
7640 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7641 (Arm_relocate_functions:thm_movw_rel): Ditto.
7642 (Arm_relocate_functions:thm_movt_rel): Ditto.
7643 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7644 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7645 New method definitions.
7646 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7647 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7648 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7649 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7650 (Target_arm::Relocate::relocate): Check for non-static or
7651 unimplemented relocation code and exit early. Change calls to
7652 Target_arm::reloc_uses_thumb_bit and
7653 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7654 instead. Refactor code to handle similar relocations to increase
7655 code sharing. Remove check for unsupported relocation code in switch
7656 statement.
7657 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7658 relocation property table to find out size. Change error message to
7659 print out the name of a relocation code instead of the numeric value.
7660 (Target_arm::scan_reloc_for_stub): Use relocation property table
7661 instead of calling Target_arm::reloc_uses_thumb_bit().
7662
7663 2010-02-02 Doug Kwan <dougkwan@google.com>
7664
7665 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7666 types of relaxed input section.
7667
7668 2010-02-02 Doug Kwan <dougkwan@google.com>
7669
7670 * Makefile.am (HFILES): Add arm-reloc-property.h.
7671 (DEFFILES): New.
7672 (TARGETSOURCES): Add arm-reloc-property.cc
7673 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7674 (libgold_a_SOURCES): $(DEFFILES)
7675 * Makefile.in: Regenerate.
7676 * arm-reloc-property.cc: New file.
7677 * arm-reloc-property.h: New file.
7678 * arm-reloc.def: New file.
7679 * arm.cc: Update comments.
7680 (arm-reloc-property.h): New included header.
7681 (arm_reloc_property_table): New global variable.
7682 (Target_arm::do_select_as_default_target): New method definition.
7683 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7684 arm-reloc-property to targ_extra_obj.
7685 * parameters.cc (set_parameters_target): Call
7686 Target::select_as_default_target().
7687 * target.h (Target::select_as_default_target): New method definition.
7688 (Target::do_select_as_default_target): Same.
7689
7690 2010-02-01 Doug Kwan <dougkwan@google.com>
7691
7692 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7693 first_output_text_section_.
7694 (Arm_exidx_fixup::first_output_text_section): New method definition.
7695 (Arm_exidx_fixup::first_output_text_section_): New data member.
7696 (Arm_exidx_fixup::process_exidx_section): Record the first text
7697 output section seen.
7698 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7699 and entsize in output section header.
7700
7701 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7702
7703 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7704 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7705 (Arm_relocate_functions::thm_alu11): New Method.
7706 (Arm_relocate_functions::thm_pc8): New Method.
7707 (Arm_relocate_functions::thm_pc12): New Method.
7708 (Target_arm::Scan::local): Handle the relocations.
7709 (Target_arm::Scan::global): Likewise.
7710 (Target_arm::Relocate::relocate): Likewise.
7711 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7712
7713 2010-01-29 Doug Kwan <dougkwan@google.com>
7714
7715 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7716 of relocation types as ld.
7717
7718 2010-01-29 Doug Kwan <dougkwan@google.com>
7719
7720 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7721 to public.
7722 (Arm_relocate_functions::thumb_branch_common): Ditto.
7723 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7724 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7725 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7726 Arm_relocate_functions::jump24): Remove.
7727 (Target_arm::Relocate::relocate): Adjust code to call
7728 Arm_relocation_functions::arm_branch_common and
7729 Arm_relocation_functions::thumb_branch_common instead of their removed
7730 wrappers. Merge switch-cases together to reduce source code size.
7731
7732 2010-01-29 Doug Kwan <dougkwan@google.com>
7733
7734 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7735 output_local_symbol_count_needs_update_.
7736 (Arm_relobj::output_local_symbol_count_needs_update,
7737 Arm_relobj::set_output_local_symbol_count_needs_update,
7738 Arm_relobj::update_output_local_symbol_count): New methods.
7739 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7740 member.
7741 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7742 of pointed function as in a R_ARM_PREL31 relocation.
7743 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7744 for output local symbol count updating.
7745 (Target_arm::do_relax): Update output local symbol counts in objects
7746 if necessary.
7747 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7748
7749 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7750
7751 * arm.cc: Added support for the ARM relocations:
7752 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7753 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7754 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7755 movw_prel_nc).
7756 (Arm_relocate_functions::movw_rel): New method.
7757 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7758 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7759 thm_movw_prel_nc).
7760 (Arm_relocate_functions::thm_movw_rel): New method.
7761 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7762 thm_movt_prel).
7763 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7764 relocations.
7765 (Target_arm::Scan::global): Likewise.
7766 (Target_arm::Relocate::relocate): Likewise.
7767 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7768 Likewise.
7769
7770 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7771
7772 * arm.cc: Added support for ARM group relocations.
7773 (Target_arm::reloc_needs_sym_origin): New method.
7774 (Arm_relocate_functions::calc_grp_kn): New method.
7775 (Arm_relocate_functions::calc_grp_residual): New method.
7776 (Arm_relocate_functions::calc_grp_gn): New method.
7777 (Arm_relocate_functions::arm_grp_alu): New Method.
7778 (Arm_relocate_functions::arm_grp_ldr): New Method.
7779 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7780 (Arm_relocate_functions::arm_grp_ldc): New Method.
7781 (Target_arm::Scan::local): Handle the ARM group relocations.
7782 (Target_arm::Scan::global): Likewise.
7783 (Target_arm::Relocate::relocate): Likewise.
7784 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7785 Likewise.
7786
7787 2010-01-26 Doug Kwan <dougkwan@google.com>
7788
7789 * arm.cc (set): Include.
7790 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7791 pointer type.
7792 (Arm_output_section::Text_section_list): New type.
7793 (Arm_output_section::append_text_sections_to_list): New method.
7794 (Arm_output_section::fix_exidx_coverage): Ditto.
7795 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7796 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7797 Relobj::set_section_offset() instead of
7798 Sized_relobj::invalidate_section_offset().
7799 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7800 parameter for section headers. Ignore relocation sections for
7801 unallocated sections and EXIDX sections.
7802 (Target_arm::fix_exidx_coverage): New method.
7803 (Target_arm::output_section_address_less_than): New type.
7804 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7805 linked text section instead of the EXIDX section.
7806 (Arm_output_section::create_stub_group): Add an assertion to check
7807 that this is not an EXIDX output section.
7808 (Arm_output_section::append_text_sections_to_list): New method.
7809 (Arm_output_section::fix_exidx_coverage): Ditto.
7810 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7811 Arm_relobj::section_needs_reloc_stub_scanning.
7812 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7813 first pass.
7814 (Target_arm::fix_exidx_coverage): New method.
7815 * object.h (Relobj::set_output_section): New method.
7816 (Sized_relobj::invalidate_section_offset): Remove method.
7817 (Sized_relobj::do_invalidate_section_offset): Remove method.
7818 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7819
7820 2010-01-25 Doug Kwan <dougkwan@google.com>
7821
7822 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7823 Fix warning due to signed and unsigned comparison on a 32-bit host.
7824
7825 2010-01-22 Doug Kwan <dougkwan@google.com>
7826
7827 * arm.cc (Target_arm::do_relax): Record an output section for section
7828 offset adjustment it contains any stub table that has changed.
7829 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7830 offsets in an output section if necessary.
7831 * output.cc (Output_section::Output_section): Initialize
7832 section_offsets_need_adjustments_.
7833 (Output_section::add_input_section_for_script): Renamed to
7834 Output_section::add_simple_input_section.
7835 (Output_section::save_states): Add a comment.
7836 (Output_section::discard_states): New method defintion.
7837 (Output_section::adjust_section_offsets): Same.
7838 * output.h (Output_section::add_input_section_for_script): Renamed to
7839 Output_section::add_simple_input_section.
7840 (Output_section::discard_states): New method declaration.
7841 (Output_section::adjust_section_offsets): Same.
7842 (Output_section::section_offsets_need_adjustment,
7843 Output_section::set_section_offsets_need_adjustment): New method
7844 definitions.
7845 (Output_section::section_offsets_need_adjustment_): New data member.
7846 * script-sections.cc
7847 (Output_section_element_input::set_section_address): Adjust code for
7848 renaming of Output_section::add_input_section_for_script.
7849 (Orphan_output_section::set_section_address): Same.
7850
7851 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7852
7853 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7854 Fix_v4bx enum values .
7855 * gold/options.h (General_options): New option definitions.
7856 (General_options::fix_v4bx): New method.
7857 (General_options::Fix_v4bx): New enum.
7858 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7859 (General_options::parse_fix_v4bx_interworking): New method.
7860
7861 2010-01-22 Doug Kwan <dougkwan@google.com>
7862
7863 * arm.cc (Arm_exidx_fixup): New class.
7864
7865 2010-01-21 Doug Kwan <dougkwan@google.com>
7866
7867 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7868 classes.
7869 (Arm_exidx_section_offset_map): New type.
7870
7871 2010-01-21 Doug Kwan <dougkwan@google.com>
7872
7873 * arm.cc (Arm_exidx_input_section): New class.
7874 (Arm_relobj::exidx_input_section_by_link,
7875 Arm_relobj::exidx_input_section_by_shndx,
7876 Arm_relobj::make_exidx_input_section): New methods.
7877 (read_arm_attributes_section): Remove.
7878 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7879 information about them.
7880 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7881 to here.
7882
7883 2010-01-20 Doug Kwan <dougkwan@google.com>
7884
7885 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7886 Input_section_specifier to Section_id.
7887 (Target_arm::new_arm_input_section: Adjust code for change of key
7888 type.
7889 (Target_arm::find_arm_input_section): Ditto.
7890 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7891 (Section_id): Remove.
7892 (Garbage_collection::Section_id_hash): Remove.
7893 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7894 (Section_id): Remove.
7895 (Icf::Section_id_hash): Remove.
7896 * object.h (Section_id, Const_section_id, Section_id_hash,
7897 Const_section_id_hash): New type definitions.
7898 * output.cc (Output_section::add_relaxed_input_section): Change to
7899 use Const_section_id instead of Input_section_specifier as key type.
7900 (Output_section::add_merge_input_section): Ditto.
7901 (Output_section::build_relaxation_map): Change to use Section_id
7902 instead of Input_section_specifier as key type.
7903 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7904 Ditto.
7905 (Output_section::convert_input_sections_to_relaxed_sections): Change
7906 to use Const_section_id instead of Input_section_specifier as key type.
7907 (Output_section::find_merge_section): Ditto.
7908 (Output_section::find_relaxed_input_section): Ditto.
7909 * output.h (Input_section_specifier): Remove class.
7910 (Output_section::Output_section_data_by_input_section_map): Change
7911 key type to Const_section_id.
7912 (Output_section::Output_relaxed_input_section_by_input_section_map):
7913 Ditto.
7914 (Output_section::Relaxation_map): Change key type to Section_id.
7915
7916 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7917
7918 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7919 (class Arm_v4bx_stub): New class.
7920 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7921 (Stub_factory::make_arm_v4bx_stub): New method.
7922 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7923 (Stub_table::empty): Handle v4bx stubs.
7924 (Stub_table::add_arm_v4bx_stub): New method.
7925 (Stub_table::find_arm_v4bx_stub): New method.
7926 (Arm_relocate_functions::v4bx): New method.
7927 (Target_arm::fix_v4bx): New method.
7928 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7929 (Stub_table::relocate_stubs): Likewise.
7930 (Stub_table::do_write): Likewise.
7931 (Stub_table::update_data_size_and_addralign): Likewise.
7932 (Stub_table::finalize_stubs): Likewise.
7933 (Target_arm::Scan::local): Likewise.
7934 (Target_arm::Scan::global): Likewise.
7935 (Target_arm::do_finalize_sections): Likewise.
7936 (Target_arm::Relocate::relocate): Likewise.
7937 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7938 Likewise.
7939 (Target_arm::scan_reloc_for_stub): Likewise.
7940 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7941
7942 2010-01-19 Ian Lance Taylor <iant@google.com>
7943
7944 * output.cc (Output_section_headers::do_sized_write): Write large
7945 segment count to sh_info field.
7946 (Output_file_header::do_sized_write): For large segment count,
7947 write PN_XNUM to e_phnum field.
7948
7949 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7950
7951 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7952 (Arm_relocate_functions::thm_jump8): New function.
7953 (Arm_relocate_functions::thm_jump11): New function.
7954 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7955 R_ARM_THM_JUMP11.
7956 (Target_arm::Scan::global): Likewise.
7957 (Target_arm::Relocate::relocate): Likewise.
7958 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7959 Likewise.
7960
7961 2010-01-14 Doug Kwan <dougkwan@google.com>
7962
7963 * arm.cc (map, utility): Include headers.
7964 (Target_arm::apply_cortex_a8_workaround): New method.
7965 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7966 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7967 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7968 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7969 the --[no-]fix-cortex-a8 command line options.
7970 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7971 (Target_arm::relocate_stub): Use addend in instruction template.
7972 * options.h (DEFINE_bool): Set the user-set flag.
7973 (General_options): Add --[no-]-fix-cortex options.
7974 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7975 : Update fast look-up map after conversion.
7976
7977 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7978
7979 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7980 in the first pass of do_layout.
7981
7982 2010-01-13 Doug Kwan <dougkwan@google.com>
7983
7984 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7985 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7986 apparent compiler problem of not folding static constant integral
7987 data members of elfcpp::Elf_sizes<32>.
7988
7989 2010-01-13 Doug Kwan <dougkwan@google.com>
7990
7991 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7992 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7993 Arm_relobj::scan_section_for_cortex_a8_erratum,
7994 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7995 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7996 sections to scan for relocation stubs into a new method
7997 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7998 relocation and Cortex-A8 stub scanning.
7999 (Target_arm::do_relax): Force stubs to be after stubbed sections
8000 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8001 the beginning of a new relaxation pass. Update a comment.
8002 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8003
8004 2010-01-12 Ian Lance Taylor <iant@google.com>
8005
8006 * target-reloc.h (visibility_error): New inline function.
8007 (relocate_section): Call visibility_error.
8008 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8009 (MOSTLYCLEANFILES): Likewise.
8010 (protected_4_pic.o, protected_3.err): New targets.
8011 * testsuite/protected_4.cc: New file.
8012
8013 2010-01-12 Doug Kwan <dougkwan@google.com>
8014
8015 * arm.cc (Cortex_a8_reloc): New class.
8016 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8017 and cortex_a8_relocs_info_.
8018 (Target_arm::fix_cortex_a8): New method definition.
8019 (Target_arm::Cortex_a8_relocs_info): New type.
8020 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8021 New data member declarations.
8022 (Target_arm::scan_reloc_for_stub): Record information about
8023 relocations for THUMB branches that might be exempted from the
8024 Cortex-A8 workaround.
8025 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8026 at the beginning of a relaxation pass.
8027
8028 2010-01-12 Doug Kwan <dougkwan@google.com>
8029
8030 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8031 (Arm_relobj::Mapping_symbol_position,
8032 Arm_reloj::Mapping_symbol_position_less,
8033 Arm_relobj::Mapping_symbols_info): New types.
8034 (Target_arm::is_mapping_symbol_name): New method definition.
8035 (Arm_relobj::do_count_local_symbols): Save information about mapping
8036 symbols.
8037
8038 2010-01-11 Doug Kwan <dougkwan@google.com>
8039
8040 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8041 Arm_relocate_functions::thumb32_branch_upper,
8042 Arm_relocate_functions::thumb32_branch_lower,
8043 Arm_relocate_functions::thumb32_cond_branch_offset,
8044 Arm_relocate_functions::thumb32_cond_branch_upper,
8045 Arm_relocate_functions::thumb32_cond_branch_lower,
8046 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8047 branch offset encoding.
8048 (Arm_relocate_functions::thumb_branch_common): Use new branch
8049 offset encoding methods to avoid code duplication.
8050 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8051 (Stub_addend_reader::operator()): Use new branch encoding method
8052 to avoid code duplication.
8053
8054 2010-01-11 Doug Kwan <dougkwan@google.com>
8055
8056 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8057 (Target_arm::do_finalize_sections): Define special EXIDX section
8058 symbols only if referenced.
8059 * gc.h (Garbage_collection::add_reference): New method.
8060 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8061 code duplication.
8062
8063 2010-01-11 Ian Lance Taylor <iant@google.com>
8064
8065 * script.cc (Version_script_info::build_expression_list_lookup):
8066 Change complaing about duplicate wildcard match from error to
8067 warning.
8068
8069 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8070 of 2009-12-30.
8071 (Version_script_info::Version_script_info): Initialize globs_,
8072 default_version_, default_is_global_, and exact_. Don't
8073 initialize globals_ or locals_.
8074 (Version_script_info::build_lookup_tables): Build local symbols
8075 first.
8076 (Version_script_info::unquote): New function.
8077 (Version_script_info::add_exact_match): New function.
8078 (Version_script_info::build_expression_list_lookup): Remove lookup
8079 parameter. Add is_global parameter. Change all callers. Handle
8080 wildcard pattern specially. Unquote pattern. Call
8081 add_exact_match.
8082 (Version_script_info::get_name_to_match): New function.
8083 (Version_script_info::get_symbol_version): New function.
8084 (Version_script_info::get_symbol_version_helper): Remove.
8085 (Version_script_info::check_unmatched_names): Call unquote.
8086 * script.h (class Version_script_info): Change get_symbol_version
8087 to be non-inline and add is_global parameter; change all callers.
8088 Rewrite symbol_is_local. Update declarations. Define struct
8089 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8090 Remove globals_ and locals_ members. Add exact_, globs_,
8091 default_version_, is_global_.
8092 (Version_script_info::Glob): Remove pattern, add expression and
8093 is_global. Update constructor. Change all callers.
8094 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8095 default version.
8096 (Versions::symbol_section_contents): If a symbol is undefined, or
8097 defined in a dynamic object, set the version index to
8098 VER_NDX_LOCAL.
8099 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8100 symbol_is_local.
8101 (Symbol_table::add_from_pluginobj): Likewise.
8102 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8103
8104 2010-01-11 Doug Kwan <dougkwan@google.com>
8105
8106 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8107 (incremental_dump_LDADD): Add linking option for libintl.
8108 * Makefile.in: Regenerate.
8109
8110 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8111
8112 PR gold/11144
8113 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8114 instead of -Ds.
8115 * testsuite/Makefile.in: Regenerated.
8116
8117 2010-01-10 Doug Kwan <dougkwan@google.com>
8118
8119 * options.h (DEFINE_var): Use parentheses around argument varname__
8120 in macro body to avoid any unintended subsequent substitutions.
8121
8122 2010-01-10 Ian Lance Taylor <iant@google.com>
8123
8124 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8125 candidates before doing symbol resolution.
8126
8127 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8128 ODR candidates if only one is weak.
8129
8130 2010-01-08 Ian Lance Taylor <iant@google.com>
8131
8132 * script.cc (Version_script_info::build_expression_list_lookup):
8133 Don't warn about ambiguous version, just record the ambiguity.
8134 (Version_script_info::get_symbol_version_helper): Give error if
8135 version is ambiguous.
8136
8137 2010-01-08 Doug Kwan <dougkwan@google.com>
8138
8139 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8140 prev_data_size_ and prev_addralign_. Remove initializer for
8141 deleted data member has_been_changed_.
8142 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8143 to determine if the table is empty.
8144 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8145 Remove.
8146 (Stub_table::add_reloc_stub): Define method in class definition
8147 instead of just declaring it there.
8148 (Stub_table::add_cortex_a8_stub): New method definition.
8149 (Stub_table::update_data_size_and_addralign): Ditto.
8150 (Stub_table::finalize_stubs): Ditto.
8151 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8152 (Stub_table::do_addralign_): Return address alignment in the
8153 (Stub_table::do_reset_address_and_file_offset): Define method in
8154 class definition instead of declaring it there. Set current data
8155 size to be the data size of the previous pass.
8156 (Stub_table::set_final_data_size): Use current data size as the
8157 final data size.
8158 (Stub_table::relocate_stub): Change parameter type of stub from
8159 Reloc_stub pointer to Stub pointer.
8160 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8161 (Stub_table::Cortex_a8_stub_list): New typedef.
8162 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8163 Stub_table::prev_addralign_): New data member.
8164 (Arm_relobj::Arm_relobj): Initialize data member
8165 section_has_cortex_a8_workaround_.
8166 (Arm_relobj::section_has_cortex_a8_workaround,
8167 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8168 definitions.
8169 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8170 declarations.
8171 (Target_arm::relocate_stub): Change parameter type of stub from
8172 Reloc_stub pointer to Stub pointer.
8173 (Insn_template::size, Insn_template::alignment): Handle
8174 THUMB16_SPECIAL_TYPE.
8175 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8176 Stub_table::update_data_size_and_addralign,
8177 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8178 definitions.
8179 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8180 (Stub_table::do_write): Ditto.
8181 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8182
8183 2010-01-08 Ian Lance Taylor <iant@google.com>
8184
8185 PR 11108
8186 * symtab.h (class Symbol): Remove fields is_target_special_ and
8187 has_plt_offset_. Add field is_defined_in_discarded_section_.
8188 (Symbol::is_defined_in_discarded_section): New function.
8189 (Symbol::set_is_defined_in_discarded_section): New function.
8190 (Symbol::has_plt_offset): Rewrite.
8191 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8192 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8193 Don't initialize is_target_special_ or has_plt_offset_.
8194 Initialize is_defined_in_discarded_section_.
8195 (Symbol_table::add_from_relobj): If appropriate, set
8196 is_defined_in_discarded_section.
8197 * resolve.cc (Symbol::override_base_with_special): Don't test
8198 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8199 * target-reloc.h (relocate_section): Do special handling for
8200 symbols defined in discarded sections for global symbols as well
8201 as local symbols.
8202
8203 2010-01-08 Ian Lance Taylor <iant@google.com>
8204
8205 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8206 the SHT_SYMTAB case.
8207
8208 2010-01-08 Ian Lance Taylor <iant@google.com>
8209
8210 * object.cc (Sized_relobj::do_layout): Don't get confused if
8211 layout_eh_frame returns NULL.
8212
8213 2010-01-08 Ian Lance Taylor <iant@google.com>
8214
8215 PR 11084
8216 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8217 dynamic symbol table, use the normal symbol table.
8218 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8219 symbol table.
8220
8221 2010-01-08 Ian Lance Taylor <iant@google.com>
8222
8223 PR 11072
8224 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8225 sections.
8226
8227 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8228
8229 * version.cc (print_version): Change to "Copyright 2010".
8230
8231 2010-01-08 Ian Lance Taylor <iant@google.com>
8232
8233 PR 10287
8234 PR 11063
8235 * i386.cc (class Target_i386): Change return type of plt_section
8236 to be non-const.
8237 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8238 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8239 tls_desc_rel_ field.
8240 (Output_data_plt_i386::rel_tls_desc): New function.
8241 (Target_i386::rel_tls_desc_section): New function.
8242 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8243 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8244 R_386_TLS_DESC reloc in rel_tls_desc_section.
8245 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8246 Define struct Tlsdesc_info.
8247 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8248 (Target_x86_64::do_reloc_symbol_index): New function.
8249 (Target_x86_64::add_tlsdesc_info): New function.
8250 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8251 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8252 tlsdesc_rel_ field.
8253 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8254 all callers.
8255 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8256 (Target_x86_64::rela_tlsdesc_section): New function.
8257 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8258 handling.
8259 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8260 (Target_x86_64::do_reloc_addend): New function.
8261 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8262 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8263 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8264 (Output_reloc::type): New function.
8265 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8266 (Output_reloc::is_target_specific): New function.
8267 (Output_reloc::target_arg): New function.
8268 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8269 absolute relocs and target specific relocs.
8270 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8271 add_target_specific.
8272 (class Output_data_reloc) [SHT_RELA]: Likewise.
8273 * output.cc (Output_reloc::Output_reloc): Add four new versions
8274 for absolute relocs and target specific relocs.
8275 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8276 (Output_reloc::get_symbol_index): Likewise.
8277 (Output_reloc::local_section_offset): Check that local_sym_index_
8278 is not TARGET_CODE or 0.
8279 (Output_reloc::symbol_value): Likewise.
8280 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8281 reloc.
8282 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8283 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8284 functions.
8285 * layout.cc (add_target_dynamic_tags): Use output section for
8286 DT_PLTRELSZ and DT_JMPREL.
8287
8288 2010-01-07 Ian Lance Taylor <iant@google.com>
8289
8290 PR 11061
8291 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8292 function.
8293 (class Output_data_reloc_generic): Define.
8294 (class Output_data_reloc_base): Change base class to
8295 Output_data_reloc_generic. Change add() method to call
8296 bump_relative_reloc_count for a relative reloc. Remove
8297 sort_relocs_ field.
8298 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8299 to sort_relocs().
8300 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8301 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8302 appropriate.
8303 * layout.h (class Layout): Update declaration.
8304
8305 2010-01-07 Ian Lance Taylor <iant@google.com>
8306
8307 * output.h (class Output_data): Add const version of
8308 output_section and do_output_section.
8309 (class Output_section_data): Add const version of
8310 do_output_section.
8311 (class Output_section): Likewise.
8312 * layout.cc (Layout::add_target_dynamic_tags): New function.
8313 * layout.h (class Layout): Update declarations.
8314 * arm.cc (Target_arm::do_finalize_sections): Use
8315 add_target_dynamic_tags.
8316 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8317 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8318 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8319 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8320
8321 2010-01-07 Ian Lance Taylor <iant@google.com>
8322
8323 PR 11042
8324 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8325 object as needed.
8326
8327 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8328 Ian Lance Taylor <iant@google.com>
8329
8330 PR 11019
8331 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8332 Xindex::read_symtab_xindex.
8333
8334 2010-01-07 Doug Kwan <dougkwan@google.com>
8335
8336 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8337 (Insn_template::thumb16_bcond_insn): New method declaration.
8338 (Insn_template): Fix spelling.
8339 (Stub::thumb16_special): New method declaration.
8340 (Stub::do_write): Define virtual method which was previously pure
8341 virtual.
8342 (Stub::do_thumb16_special): New method declaration.
8343 (Stub::do_fixed_endian_write): New template member.
8344 (Reloc_stub::do_write): Remove.
8345 (Reloc_stub::do_fixed_endian_write): Remove.
8346 (Cortex_a8_stub): New class definition.
8347 (Stub_factory::make_cortex_a8_stub): New method definition.
8348 (Stub_factory::Stub_factory): Add missing static storage class
8349 qualifier for elf32_arm_stub_a8_veneer_blx.
8350
8351 2010-01-07 Ian Lance Taylor <iant@google.com>
8352
8353 PR 10980
8354 * options.h (class General_options): Add --warn-unresolved-symbols
8355 and --error-unresolved-symbols.
8356 * errors.cc (Errors::undefined_symbol): Implement
8357 --warn-unresolved-symbols.
8358
8359 * options.h (class General_options): Add -z text and -z textoff.
8360 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8361
8362 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8363
8364 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8365 (Garbage_collection::cident_sections): New function.
8366 (Garbage_collection::add_cident_section): New function.
8367 (Garbage_collection::cident_sections_): New member.
8368 (gc_process_relocs): Add references to sections whose names are C
8369 identifiers.
8370 * gold.h (cident_section_start_prefix): New constant.
8371 (cident_section_stop_prefix): New constant.
8372 (is_cident): New function.
8373 * layout.cc (Layout::define_section_symbols): Replace string constants
8374 with the newly defined constants.
8375 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8376 C identifiers.
8377 * testsuite/Makefile.am: Add gc_orphan_section_test.
8378 * testsuite/Makefile.in: Regenerate.
8379 * testsuite/gc_orphan_section_test.cc: New file.
8380 * testsuite/gc_orphan_section_test.sh: New file.
8381
8382 2010-01-06 Ian Lance Taylor <iant@google.com>
8383
8384 PR 10980
8385 * options.h (class General_options): Add --warn-shared-textrel.
8386 * layout.cc (Layout::finish_dynamic_section): Implement
8387 --warn-shared-textrel.
8388
8389 PR 10980
8390 * options.h (class General_options): Add --warn-multiple-gp.
8391
8392 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8393
8394 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8395 $(THREADSLIB) and $(LIBDL).
8396 * Makefile.in: Rebuild.
8397
8398 2010-01-06 Ian Lance Taylor <iant@google.com>
8399
8400 PR 10980
8401 * options.cc (General_options::parse_section_start): New function.
8402 (General_options::section_start): New function.
8403 (General_options::General_options): Initialize all members.
8404 * options.h: Include <map>
8405 (class General_options): Add --section-start. Add section_starts_
8406 member.
8407 * layout.cc (Layout::attach_allocated_section_to_segment): If
8408 --section-start was used, set the address of the segment. Remove
8409 local sort_sections.
8410 (Layout::relaxation_loop_body): If the address of the load segment
8411 has been set by --section-start, don't use it.
8412 * output.h (Output_segment::update_flags_for_output_section): New
8413 function.
8414 * output.cc (Output_segment::add_output_section): Call
8415 update_flags_for_output_section.
8416
8417 2010-01-05 Ian Lance Taylor <iant@google.com>
8418
8419 PR 10980
8420 * options.h (class General_options): Add --undefined-version.
8421 * script.cc (struct Version_expression): Add was_matched_by_symbol
8422 field.
8423 (Version_script_info::matched_symbol): New function.
8424 (Version_script_info::get_symbol_version_helper): Call
8425 matched_symbol.
8426 (Version_script_info::check_unmatched_names): New function.
8427 * script.h (class Version_script_info): Update declarations.
8428 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8429
8430 * options.h (class General_options): Use DEFINE_bool_alias for
8431 allow_multiple_definition.
8432 * resolve.cc (Symbol_table::should_override): Don't test
8433 allow_multiple_definition.
8434
8435 PR 10980
8436 * options.h (class General_options): Add --cref.
8437 * main.cc (main): Print cref table if --cref. Don't close mapfile
8438 until after printing cref table.
8439 * cref.cc: Include "symtab.h".
8440 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8441 (Cref_table_compare::operator()): New function.
8442 (Cref_inputs::gather_cref): New function.
8443 (filecol): New static const.
8444 (Cref_inputs::print_cref): New function.
8445 (Cref::print_cref): New function.
8446 * cref.h: Include <cstdio>.
8447 (class Cref): Update declarations.
8448 * mapfile.h (Mapfile::file): New function.
8449 * object.h (class Object): Define Symbols. Declare virtual
8450 do_get_global_symbols.
8451 (Object::get_global_symbols): New function.
8452 * object.cc (Input_objects::add_object): Pass object to cref_ if
8453 --cref.
8454 (Input_objects::archive_start): Likewise.
8455 (Input_objects::archive_stop): Likewise.
8456 (Input_objects::print_cref): New function.
8457 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8458 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8459 --cref.
8460 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8461 function.
8462 * plugin.h (class Sized_pluginobj): Update declarations.
8463
8464 2010-01-05 Ian Lance Taylor <iant@google.com>
8465
8466 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8467 to is_default_version. Rename insdef to insdefault.
8468 (Symbol_table::add_from_relobj): Rename def to is_default_version
8469 and local to is_forced_local.
8470 (Symbol_table::add_from_pluginobj): Likewise.
8471 (Symbol_table::add_from_dynobj): Likewise.
8472 (Symbol_table::define_special_symbol): Rename insdef to
8473 insdefault.
8474
8475 2010-01-04 Ian Lance Taylor <iant@google.com>
8476
8477 PR 10980
8478 * options.h (class General_options): Add
8479 --allow-multiple-definition and -z muldefs.
8480 * resolve.cc (Symbol_table::should_override): Don't warn about a
8481 multiple symbol definition if --allow-multiple-definition or -z
8482 muldefs.
8483
8484 PR 10980
8485 * options.h (class General_options): Add --add-needed and
8486 --copy-dt-needed-entries. Tweak --as-needed help entry.
8487 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8488 error if --copy-dt-needed-entries aka --add-needed is used and
8489 would cause a change in behaviour.
8490
8491 PR 10980
8492 * options.h (class General_options): Add -G as a short version of
8493 --shared. Add no-op options -assert, -g, and -i.
8494
8495 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8496
8497 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8498 check for .text or .gnu.linkonce.t sections.
8499 * icf.cc (Icf::find_identical_sections): Ditto.
8500 Change the detection for mangled function name within the section
8501 name.
8502 * icf.h (is_section_foldable_candidate): New function.
8503
8504 2009-12-30 Ian Lance Taylor <iant@google.com>
8505
8506 PR 10980
8507 * options.h (class General_options): Permit two dashes with
8508 --retain-symbols-file.
8509
8510 2009-12-30 Ian Lance Taylor <iant@google.com>
8511
8512 PR 10979
8513 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8514 don't put the file header and segment headers in the text
8515 segment.
8516
8517 PR 10979
8518 * common.cc (Sort_commons::operator()): Stabilize sort when both
8519 entries are NULL.
8520 (Symbol_table::do_allocate_commons_list): When allocating common
8521 symbols, skip a symbol which is no longer common.
8522 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8523 an object before checking its type.
8524 * testsuite/common_test_2.c: New file.
8525 * testsuite/common_test_3.c: New file.
8526 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8527 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8528 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8529 (common_test_2_pic.o, common_test_2.so): New targets.
8530 (common_test_3_pic.o, common_test_3.so): New targets.
8531 * testsuite/Makefile.in: Rebuild.
8532
8533 PR 10979
8534 * script.cc (read_input_script): If we see a new SECTIONS clause,
8535 and we have added an input section, give an error.
8536 * layout.h (class Layout): Add have_added_input_section function.
8537 Add have_added_input_section_ field.
8538 * layout.cc (Layout::Layout): Initialize
8539 have_added_input_section_.
8540 (Layout::layout): Set have_added_input_section_.
8541 (Layout::layout_eh_frame): Likewise.
8542
8543 2009-12-30 Ian Lance Taylor <iant@google.com>
8544
8545 PR 10931
8546 * options.h (class General_options): Add --sort-common option.
8547 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8548 * common.cc (Sort_common): Add sort_order parameter to
8549 constructor. Add sort_order_ field.
8550 (Sort_commons::operator): Check sort_order_.
8551 (Symbol_table::allocate_commons): Determine the sort order.
8552 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8553 Change all callers.
8554 (Symbol_table::do_allocate_commons_list): Likewise.
8555
8556 2009-12-30 Ian Lance Taylor <iant@google.com>
8557
8558 PR 10916
8559 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8560 symbols from this object, don't change the visibility of an
8561 undefined symbol.
8562 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8563
8564 2009-12-30 Ian Lance Taylor <iant@google.com>
8565
8566 PR 10861
8567 * script.h (class Version_script_info): Define Language enum.
8568 Update declarations. Define Glob, Exact, and Lookup types. Add
8569 new fields globals_, locals_, and is_finalized_.
8570 * script.cc: Various formatting fixes.
8571 (class Parser_closure): Change language_stack_ from a vector of
8572 std::string to one of Version_script_info::Language. Adjust all
8573 uses accordingly.
8574 (class Lazy_demangler): Remove.
8575 (struct Version_expression): Change language from std::string to
8576 Version_script_info::Language.
8577 (Version_script_info::Version_script_info): New function.
8578 (Version_script_info::~Version_script_info): Don't call clear.
8579 (Version_script_info::finalize): New function.
8580 (Version_script_info::build_lookup_tables): New function.
8581 (Version_script_info::build_expression_list_lookup): New
8582 function.
8583 (Version_script_info::get_symbol_version_helper): Rewrite to use
8584 lookup tables.
8585 (Version_script_info::print_expression_list): Adjust to use
8586 Version_script_info::Language.
8587 (script_push_lex_into_version_mode): Check that the version script
8588 has not been finalized.
8589 (version_script_push_lang): Change language string to
8590 Version_script_info::Language.
8591 * options.cc (Command_line::version_script): New function.
8592 * options.h (class General_options): Add finalize_dynamic_list
8593 function. Change version_script from declaration to definition.
8594 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8595 * testsuite/version_script.map: Remove duplicate def of foo.
8596 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8597 version_script.map.
8598 * testsuite/Makefile.in: Rebuild.
8599
8600 2009-12-30 Ian Lance Taylor <iant@google.com>
8601
8602 PR 10843
8603 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8604 if the input symbol index is 0, make the output symbol index 0.
8605
8606 2009-12-30 Ian Lance Taylor <iant@google.com>
8607
8608 PR 10670
8609 * options.h (class General_options): Add -x/--discard-all.
8610 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8611 --discard-all. If the local symbol needs a dynamic entry, check
8612 that before handling --discard-locals.
8613
8614 2009-12-30 Ian Lance Taylor <iant@google.com>
8615
8616 PR 10450
8617 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8618 flags to PF_R.
8619 (Output_segment::add_output_section): Don't change the flags if
8620 the type is PT_TLS.
8621
8622 PR 10450
8623 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8624 GNU hash table if they need a dynamic value. Otherwise, don't add
8625 them if they are defined in a dynamic object or are forced local.
8626
8627 2009-12-29 Ian Lance Taylor <iant@google.com>
8628
8629 PR 10450
8630 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8631 .gnu.hash table for a 32-bit target.
8632
8633 PR 10450
8634 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8635 regular and a dynamic object only needs a dynamic symbol table
8636 entry if it is externally visible.
8637
8638 PR 10450
8639 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8640 constructor. Add global_offset_table_ field.
8641 (Target_i386::got_section): Set global_offset_table_.
8642 (Target_i386::do_finalize_sections): Set global_offset_table_
8643 size.
8644 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8645 in constructor. Add global_offset_table_ field.
8646 (Target_x86_64::got_section): Set global_offset_table_.
8647 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8648 size.
8649
8650 * layout.cc (Layout::Layout): Initialize increase_relro_.
8651 (Layout::get_output_section): Add is_relro, is_last_relro, and
8652 is_first_non_relro parameters. Change all callers.
8653 (Layout::choose_output_section): Likewise.
8654 (Layout::add_output_section_data): Likewise.
8655 (Layout::make_output_section): Likewise.
8656 (Layout::set_segment_offsets): Clear increase_relro when using a
8657 linker script.
8658 * layout.h (class Layout): Add increase_relro method. Add
8659 increase_relro_ field. Update declarations.
8660 * output.cc (Output_section::Output_section): Initialize
8661 is_last_relro_ and is_first_non_relro_.
8662 (Output_segment::add_output_section): Group relro sections is
8663 do_sort is true. Handle is_last_relro and is_first_non_relro.
8664 (Output_segment::maximum_alignment): Remove relro handling.
8665 (Output_segment::set_section_addresses): Add increase_relro
8666 parameter. Change all callers. Add initial alignment to align
8667 relro sections on separate page. Remove old relro handling.
8668 (Output_segment::set_section_list_addresses): Remove in_relro
8669 parameter. Change all callers.
8670 (Output_segment::set_offset): Add increase parameter. Change all
8671 callers. Remove old relro handling.
8672 * output.h (class Output_section): Add new methods: is_last_relro,
8673 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8674 Add is_last_relro_ and is_first_non_relro_ fields.
8675 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8676 Create separate .got.plt section. Call increase_relro.
8677 * x86_64.cc (Target_x86_64::got_section): Likewise.
8678 * testsuite/relro_script_test.t: Add .got.plt.
8679
8680 PR 10450
8681 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8682 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8683 (Layout::finalize): Call set_dynamic_symbol_size.
8684 (Layout::set_dynamic_symbol_size): New function.
8685 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8686 set_dynamic_symbol_size.
8687
8688 PR 10450
8689 * output.h (class Output_section): Add is_entsize_zero_ field.
8690 * output.cc (Output_section::Output_section): Initialize
8691 is_entsize_zero_.
8692 (Output_section::set_entsize): If two different entsizes are
8693 requested, force it to zero.
8694 (Output_section::add_input_section): Set flags for .debug_str
8695 before updating section flags. Set entsize.
8696 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8697 and SHF_STRING if all input sections have those flags.
8698
8699 2009-12-29 Rafael Espindola <espindola@google.com>
8700
8701 * main.cc (main): Fix the sys time reporting.
8702 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8703 reporting.
8704
8705 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8706
8707 * options.cc (General_options::parse_version): Allow -v to exit
8708 without an error if there is nothing to link.
8709
8710 2009-12-29 Ian Lance Taylor <iant@google.com>
8711
8712 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8713 using a version of gcc before 4.1.
8714 * configure: Rebuild.
8715
8716 2009-12-28 Chris Demetriou <cgd@google.com>
8717
8718 * attributes.cc (Output_attributes_section_data::do_write): Use
8719 std::vector::front rather than std::vector::data.
8720
8721 2009-12-28 Ian Lance Taylor <iant@google.com>
8722
8723 * symtab.h (class Symbol_table): Add enum Defined.
8724 * resolve.cc (Symbol_table::should_override): Add defined
8725 parameter. Change all callers. Test whether object is NULL
8726 before calling a method on it.
8727 (Symbol_table::report_resolve_problem): Add defined parameter.
8728 Change all callers.
8729 (Symbol_table::should_override_with_special): Likewise.
8730 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8731 parameter. Change all callers.
8732 (Symbol_table::do_define_in_output_data): Likewise.
8733 (Symbol_table::define_in_output_segment): Likewise.
8734 (Symbol_table::do_define_in_output_segment): Likewise.
8735 (Symbol_table::define_as_constant): Likewise.
8736 (Symbol_table::do_define_as_constant): Likewise.
8737 * script.h (class Symbol_assignment): Add is_defsym parameter to
8738 constructor; change all callers.
8739 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8740 parameter. Change all callers. Add is_defsym_ field.
8741 (class Parser_closure): Add parsing_defsym parameter to
8742 constructor; change all callers. Add parsing_defsym accessor
8743 function. Add parsing_defsym_ field.
8744
8745 2009-12-28 Ian Lance Taylor <iant@google.com>
8746
8747 * gold.cc (queue_middle_tasks): Fix formatting.
8748 * object.cc (Relobj::is_section_name_included): Likewise.
8749
8750 2009-12-23 Ian Lance Taylor <iant@google.com>
8751
8752 * i386.cc (Target_i386::do_calls_non_split): Recognize
8753 -fsplit-stack prologue for a function with a static chain.
8754 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8755 -fsplit-stack prologue when using %r11.
8756
8757 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8758
8759 * options.cc (General_options::parse_version): Make -v continue and do
8760 the link like GNU ld does.
8761
8762 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8763
8764 * Makefile.am (CCFILES): Add timer.cc.
8765 (HFILES): Add timer.h.
8766 * configure.ac: Check for sysconf and times.
8767 * main.cc: include timer.h.
8768 (main): Use Timer instead of get_run_time.
8769 * timer.cc: New.
8770 * timer.h: New.
8771 * workqueue.cc: include timer.h.
8772 (Workqueue::find_and_run_task):
8773 Report user, sys and wall time.
8774 * Makefile.in: Regenerate.
8775 * config.in: Regenerate.
8776 * configure: Regenerate.
8777
8778 2009-12-16 Doug Kwan <dougkwan@google.com>
8779
8780 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8781 sections.
8782 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8783 relaxed input sections.
8784 * output.cc (Output_section::find_relaxed_input_section): Change
8785 return type to Output_relaxed_input_section pointer. Adjust code
8786 for new type of relaxed_input_section_map_.
8787 * output.h (Output_section::find_relaxed_input_section): Change
8788 return type to Output_relaxed_input_section pointer.
8789 (Output_section::Output_relaxed_input_section_by_input_section_map):
8790 New type.
8791 (Output_section::relaxed_input_section_map_): Change type to
8792 Output_section::Output_relaxed_input_section_by_input_section_map.
8793 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8794 input section.
8795
8796 2009-12-15 Ian Lance Taylor <iant@google.com>
8797
8798 * layout.cc (Layout::create_shstrtab): Only write out after input
8799 sections if we are compressing debug sections.
8800
8801 2009-12-15 Ian Lance Taylor <iant@google.com>
8802
8803 * archive.cc (Archive::add_symbols): Only look up a symbol without
8804 a version if there is, in fact, a version.
8805
8806 2009-12-14 Ian Lance Taylor <iant@google.com>
8807
8808 Revert -Wshadow changes, all changes from:
8809 2009-12-11 Doug Kwan <dougkwan@google.com>
8810 2009-12-11 Nick Clifton <nickc@redhat.com>
8811 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8812
8813 2009-12-11 Doug Kwan <dougkwan@google.com>
8814
8815 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8816 due to -Wshadow.
8817 * attributes.cc (Object_attribute::size): Ditto.
8818 (Attributes_section_data::size): Ditto.
8819 (Attributes_section_data::Attributes_section_data): Ditto.
8820 (Output_attributes_section_data::do_write): Ditto.
8821 * attributes.h (Object_attribute::set_type): Ditto.
8822 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8823
8824 2009-12-11 Nick Clifton <nickc@redhat.com>
8825
8826 * archive.cc: Fix shadowed variable warnings.
8827 * arm.cc: Likewise.
8828 * compressed_output.cc: Likewise.
8829 * compressed_output.h: Likewise.
8830 * configure: Likewise.
8831 * dwarf_reader.cc: Likewise.
8832 * dynobj.cc: Likewise.
8833 * dynobj.h: Likewise.
8834 * ehframe.cc: Likewise.
8835 * ehframe.h: Likewise.
8836 * errors.cc: Likewise.
8837 * expression.cc: Likewise.
8838 * fileread.cc: Likewise.
8839 * fileread.h: Likewise.
8840 * freebsd.h: Likewise.
8841 * i386.cc: Likewise.
8842 * icf.cc: Likewise.
8843 * incremental.h: Likewise.
8844 * layout.cc: Likewise.
8845 * layout.h: Likewise.
8846 * mapfile.cc: Likewise.
8847 * merge.cc: Likewise.
8848 * merge.h: Likewise.
8849 * object.cc: Likewise.
8850 * object.h: Likewise.
8851 * options.h: Likewise.
8852 * output.cc: Likewise.
8853 * output.h: Likewise.
8854 * parameters.cc: Likewise.
8855 * plugin.cc: Likewise.
8856 * powerpc.cc: Likewise.
8857 * reduced_debug_output.cc: Likewise.
8858 * reduced_debug_output.h: Likewise.
8859 * reloc.cc: Likewise.
8860 * reloc.h: Likewise.
8861 * resolve.cc: Likewise.
8862 * script-sections.cc: Likewise.
8863 * script.cc: Likewise.
8864 * script.h: Likewise.
8865 * sparc.cc: Likewise.
8866 * symtab.cc: Likewise.
8867 * symtab.h: Likewise.
8868 * target-select.cc: Likewise.
8869 * target-select.h: Likewise.
8870 * token.h: Likewise.
8871 * workqueue.cc: Likewise.
8872 * workqueue.h: Likewise.
8873 * x86_64.cc: Likewise.
8874
8875 2009-12-10 Doug Kwan <dougkwan@google.com>
8876
8877 * arm.cc (attributes.h): New include.
8878 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8879 (Arm_relobj::~Arm_relobj): Delete object pointed by
8880 attributes_section_data_.
8881 (Arm_relobj::attributes_section_data): New method definition.
8882 (Arm_relobj::attributes_section_data_): New data member declaration.
8883 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8884 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8885 attributes_section_data_.
8886 (Arm_dynobj::attributes_section_data): New method definition.
8887 (Arm_dynobj::attributes_section_data_): New data member declaration.
8888 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8889 initialization value of may_use_blx_ to false.
8890 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8891 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8892 object attributes to compute results instead of hard-coding.
8893 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8894 Target_arm::get_secondary_compatible_arch,
8895 Target_arm::set_secondary_compatible_arch
8896 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8897 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8898 New method declarations.
8899 (Target_arm::get_aeabi_object_attribute): New method definition.
8900 (Target_arm::attributes_section_data_): New data member declaration.
8901 (read_arm_attributes_section): New template definition.
8902 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8903 (Arm_dynobj::do_read_symbols): Ditto.
8904 (Target_arm::do_finalize_sections): Merge attributes sections from
8905 input. Check for BLX use after attributes section merging.
8906 Fix __exidx_start and __exidx_end visibility. Create an
8907 .ARM.attributes section if necessary.
8908 (Target_arm::get_secondary_compatible_arch,
8909 Target_arm::set_secondary_compatible_arch,
8910 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8911 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8912 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8913 New method definitions.
8914
8915 2009-12-09 Ian Lance Taylor <iant@google.com>
8916
8917 * plugin.cc (Plugin::load): Don't cast from void* to a function
8918 pointer.
8919
8920 2009-12-09 Ian Lance Taylor <iant@google.com>
8921
8922 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8923 information fields.
8924
8925 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8926
8927 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8928 Replace two_file_shared_1.so with two_file_shared_2.so.
8929 * testsuite/Makefile.in: Regenerated.
8930
8931 2009-12-08 Doug Kwan <dougkwan@google.com>
8932
8933 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8934 (HFILES): Add attributes.h and int_encoding.h.
8935 * Makefile.in: Regenerate.
8936 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8937 function definitions to int_encoding.cc
8938 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8939 prototypes to int_encoding.h
8940 * reduced_debug_output.cc (int_encoding.h): New include.
8941 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8942 function definitions to int_encoding.cc
8943 (insert_into_vector, read_from_pointer): Move template definitions to
8944 int_encoding.h
8945 * attributes.cc: New file.
8946 * attributes.h: New file.
8947 * int_encoding.cc: New file.
8948 * int_encoding.h: New file.
8949
8950 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8951
8952 PR gold/11055
8953 * incremental-dump.cc (dump_incremental_inputs): New.
8954 (main): Use dump_incremental_inputs.
8955
8956 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8957
8958 PR gold/10893
8959 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8960 checking elfcpp::STT_FUNC.
8961 (Target_i386::Relocate::relocate): Likewise.
8962 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8963
8964 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8965 symbols from shared libraries into normal FUNC symbols.
8966
8967 * symtab.h (Symbol): Add is_func and use it.
8968
8969 2009-12-05 Doug Kwan <dougkwan@google.com>
8970
8971 * arm.cc (Target_arm::arm_info): Initialize new fields
8972 attributes_section and attributes_vendor.
8973 * i386.cc (Target_i386::i386_info): Same.
8974 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8975 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8976 fields attributes_section and attributes_vendor.
8977 * sparc.cc (Target_sparc::sparc_info): Same.
8978 * target.h (Target::attributes_section, Target::attributes_vendor,
8979 Target::is_attributes_section, Target::attribute_arg_type,
8980 Target::attributes_order): New method definitions.
8981 (Target::Target_info::attributes_section,
8982 Target::Target_info::attributes_vendor): New fields.
8983 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8984 virtual method definitions.
8985 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8986 attributes_section and attributes_vendor.
8987 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8988
8989 2009-12-05 Doug Kwan <dougkwan@google.com>
8990
8991 * arm.cc: Update comments about interworking and stub generation.
8992 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8993 considered as non-PIC.
8994 (Arm_relocate_functions::base_abs): Fix formatting.
8995 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8996 of function to use GOT entry address instead of offset.
8997 (Target_arm::Scan::global): Issue an error if a symbol would need a
8998 PLT does not get one because it is untyped. Remove code to create
8999 dynamic symbols for relative branches.
9000 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9001 takes unsigned integer instead of boolean.
9002
9003 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9004
9005 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9006 (two_file_test_LDADD): Likewise.
9007 (common_test_1_LDADD): Likewise.
9008 (exception_test_LDADD) Likewise.
9009 (weak_test_LDADD): Likewise.
9010 (many_sections_test_LDADD): Likewise.
9011 (initpri1_LDADD): Likewise.
9012 (script_test_1_LDADD): Likewise.
9013 (script_test_2_LDADD): Likewise.
9014 (justsyms_LDADD): Likewise.
9015 (binary_test_LDADD): Likewise.
9016 (large_LDADD): Likewise.
9017 * testsuite/Makefile.in: Regenerated.
9018
9019 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9020
9021 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9022 (Symbol_table::override_with_special): Likewise.
9023 (Symbol_table::add_from_object): Likewise.
9024
9025 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9026
9027 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9028 Don't set the data_offset twice.
9029
9030 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9031
9032 * testsuite/Makefile.in: Regenerate.
9033
9034 2009-12-03 Doug Kwan <dougkwan@google.com>
9035
9036 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9037 (Target_arm::do_finalize_sections): Add parameter for symbol table
9038 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9039 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9040 parameter for symbol table pointer.
9041 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9042 an additional parameter for a pointer to symbol table.
9043 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9044 parameter for a symbol table pointer.
9045 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9046 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9047 Ditto.
9048 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9049 parameter for a symbol table pointer.
9050
9051 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9052
9053 * incremental.cc (Incremental_inputs_header)
9054 (Incremental_inputs_header_write, Incremental_inputs_entry)
9055 (Incremental_inputs_entry_write): Move ...
9056 * incremental.h (Incremental_inputs_header)
9057 (Incremental_inputs_header_write, Incremental_inputs_entry)
9058 (Incremental_inputs_entry_write): here.
9059
9060 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9061
9062 * incremental.cc (make_sized_incremental_binary): Set the target.
9063 Error if it is incompatible.
9064 * output.h (Output_file): Add filename method.
9065
9066 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9067
9068 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9069 from the get_* methods.
9070
9071 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9072
9073 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9074 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9075 Write 0 for the data_offset of scripts.
9076
9077 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9078
9079 * testsuite/Makefile.am: Add the incremental_test.sh test.
9080 * testsuite/incremental_test.sh: New.
9081 * testsuite/incremental_test_1.c: New.
9082 * testsuite/incremental_test_2.c: New.
9083
9084 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9085
9086 * incremental-dump.cc (main): Fix typos.
9087
9088 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9089
9090 PR gold/11025
9091 * incremental-dump.cc (main): Use llu to print 64 bit values.
9092
9093 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9094 H.J. Lu <hongjiu.lu@intel.com>
9095
9096 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9097 $(LIBDL).
9098 (incremental_dump_LDADD): Likewise.
9099 * Makefile.in: Regenerated.
9100
9101 2009-11-25 Doug Kwan <dougkwan@google.com>
9102
9103 Revert:
9104
9105 2009-11-25 Doug Kwan <dougkwan@google.com>
9106
9107 * arm.cc (Target_arm::Target_arm): Move method definition
9108 outside of class definition. Add code to handle
9109 --target1-rel, --target1-abs and --target2= options.
9110 (Target_arm::get_reloc_reloc_type): Change method to be
9111 non-static and const.
9112 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9113 New data member declaration.
9114 (Target_arm::Scan::local, Target_arm::Scan::global,
9115 Target_arm::Relocate::relocate,
9116 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9117 Adjust call to Target_arm::get_real_reloc_type.
9118 (Target_arm::get_real_reloc_type): Use command line options
9119 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9120 * options.h (--target1-rel, --target1-abs, --target2): New
9121 ARM-only options.
9122
9123 2009-11-25 Doug Kwan <dougkwan@google.com>
9124
9125 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9126 class definition. Add code to handle --target1-rel, --target1-abs
9127 and --target2= options.
9128 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9129 and const.
9130 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9131 member declaration.
9132 (Target_arm::Scan::local, Target_arm::Scan::global,
9133 Target_arm::Relocate::relocate,
9134 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9135 call to Target_arm::get_real_reloc_type.
9136 (Target_arm::get_real_reloc_type): Use command line options to
9137 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9138 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9139 options.
9140
9141 2009-11-25 Doug Kwan <dougkwan@google.com>
9142
9143 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9144 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9145 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9146 formatting.
9147 (Arm_relocate_functions::thm_call): Replace body with a call to
9148 Arm_relocate_functions::thumb_branch_common.
9149 (Arm_relocate_functions::thm_jump24,
9150 Arm_relocate_functions::thm_xpc22): New method definitions.
9151 (Arm_relocate_functions::thumb_branch_common): New method definition.
9152 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9153 operator.
9154 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9155 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9156
9157 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9158
9159 * Makefile.am: Build incremental-dump
9160 * Makefile.in: Regenerate.
9161 * incremental-dump.cc: New.
9162 * incremental.cc (Incremental_inputs_header_data,
9163 Incremental_inputs_entry_data): Move to incremental.h
9164 * incremental.h: (Incremental_inputs_header_data,
9165 Incremental_inputs_entry_data): Move from incremental.cc
9166
9167 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9168
9169 * incremental.cc (Incremental_inputs_header,
9170 Incremental_inputs_header_write, Incremental_inputs_entry,
9171 Incremental_inputs_entry_write): Add a typedef with the data type.
9172
9173 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9174
9175 * incremental.cc (Incremental_inputs_header,
9176 Incremental_inputs_header_write, Incremental_inputs_entry,
9177 Incremental_inputs_entry_write): Update comment about which
9178 type has the filed descriptions.
9179
9180 2009-11-15 Doug Kwan <dougkwan@google.com>
9181
9182 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9183 (Arm_relocate_functions::arm_branch_common): Change method defintion
9184 in class definition to a method declaration and update list of formal
9185 parameters.
9186 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9187 Arm_relocation_functions::jump24): Adjust call to
9188 Arm_relocate_functions::arm_branch_common. Update list of formal
9189 parameters.
9190 (Arm_relocate_functions::xpc25): New method definition.
9191 (Arm_relocate_functions::arm_branch_common): Move method defintion
9192 out from class definition. Use stubs for mode-switching and extending
9193 branch ranges.
9194 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9195 specially. Change code to enable use of stubs in ARM branches.
9196
9197 2009-11-10 Doug Kwan <dougkwan@google.com>
9198
9199 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9200 in method declaration.
9201 (Target_arm::relocate_stub): New method declaration.
9202 (Target_arm::default_target): Change to return a pointer instead of
9203 a const reference.
9204 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9205 Target_arm::default_target.
9206 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9207 method definition.
9208 (Target_arm::relocate_section): Adjust view.
9209 (Target_arm::relocate_stub): New method definition.
9210
9211 2009-11-10 Doug Kwan <dougkwan@google.com>
9212
9213 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9214 a format warning.
9215 * incremental.cc (open_incremental_binary): Initialized local
9216 variables to avoid warnings.
9217 * object.cc (make_elf_object): Ditto.
9218 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9219 a format warning.
9220
9221 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9222
9223 PR gold/10930
9224 * testsuite/plugin_test.c: Include "config.h".
9225
9226 2009-11-09 Doug Kwan <dougkwan@google.com>
9227
9228 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9229 (arm_symbol_value): Remove.
9230 (Arm_relocate_functions::arm_branch_common,
9231 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9232 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9233 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9234 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9235 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9236 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9237 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9238 Arm_relocate_functions::thm_mobw_abs_nc,
9239 Arm_relocate_functions::thm_mov_abs,
9240 Arm_relocate_functions::movw_prel_nc,
9241 Arm_relocate_functions::thm_movt_abs,
9242 Arm_relocate_functions::movt_prel,
9243 Arm_relocate_functions::thm_movw_prel_nc,
9244 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9245 (Target_arm::Relocate::relocate): Only decompose address into two
9246 parts if relocation type uses the thumb-bit and pass the actual
9247 bit instead of a flag indicating that the thumb-bit is used. Adjust
9248 calls to methods in Arm_relocate_functions for this change.
9249
9250 2009-11-08 Ian Lance Taylor <iant@google.com>
9251
9252 PR 10925
9253 * reloc.cc: Instantiate
9254 Sized_relobj::initialize_input_to_output_maps and
9255 Sized_relobj:free_input_to_output_maps.
9256
9257 2009-11-06 Ian Lance Taylor <iant@google.com>
9258
9259 PR 10876
9260 * defstd.cc (in_segment): Set only_if_ref true for "end".
9261
9262 2009-11-06 Doug Kwan <dougkwan@google.com>
9263
9264 * arm.cc (class Reloc_stub): Correct a comment.
9265 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9266 (Target_arm::scan_section_for_stubs): New method declaration.
9267 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9268 Change methods from private to protected.
9269 (Target_arm::do_may_relax): New method definition.
9270 (Target_arm::do_relax, Target_arm::group_sections,
9271 Target_arm::scan_reloc_for_stub,
9272 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9273 (Target_arm::arm_input_section_map_): New data member declaration.
9274 (Target_arm::scan_reloc_for_stub,
9275 Target_arm::scan_reloc_section_for_stubs,
9276 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9277 Target_arm::do_relax): New method definitions.
9278
9279 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9280
9281 * configure.ac: Check for (struct stat)::st_mtim
9282 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9283 * config.in: Regenerate.
9284 * configure: Regenerate.
9285
9286 2009-11-05 Ian Lance Taylor <iant@google.com>
9287
9288 PR 10910
9289 * output.cc (Output_segment::add_output_section): Add missing
9290 return statement.
9291
9292 2009-11-04 Ian Lance Taylor <iant@google.com>
9293
9294 PR 10880
9295 * object.h (class Object): Add is_needed and set_is_needed
9296 methods. Add is_needed_ field. Make bool fields into bitfields.
9297 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9298 defined in a dynamic object and referenced by a regular object,
9299 set is_needed for the dynamic object.
9300 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9301 if the file is marked with as_needed and it is not needed.
9302
9303 2009-11-04 Ian Lance Taylor <iant@google.com>
9304
9305 PR 10887
9306 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9307 tags if data is discarded by linker script.
9308 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9309 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9310 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9311 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9312
9313 2009-11-04 Ian Lance Taylor <iant@google.com>
9314
9315 * layout.cc (Layout::get_output_section): Add is_interp and
9316 is_dynamic_linker_section parameters. Change all callers.
9317 (Layout::choose_output_section): Likewise.
9318 (Layout::make_output_section): Likewise.
9319 (Layout::add_output_section_data): Add is_dynamic_linker_section
9320 parameter. Change all callers.
9321 * layout.h (class Layout): Update declarations.
9322 * output.h (class Output_section): Add is_interp, set_is_interp,
9323 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9324 Add is_interp_, is_dynamic_linker_section_ fields. Change
9325 generate_code_fills_at_write_ to a bitfield.
9326 * output.cc (Output_section::Output_sections): Initialize new
9327 fields.
9328 (Output_segment::add_output_section): Add do_sort parameter.
9329 Change all callers.
9330
9331 2009-11-03 Ian Lance Taylor <iant@google.com>
9332
9333 PR 10860
9334 * options.h (class General_options): Add --warn-common.
9335 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9336 merging two common symbols.
9337 (Symbol_table::should_override): Handle --warn-common when merging
9338 a common symbol with a defined symbol. Use report_resolve_problem
9339 for multiple definitions.
9340 (Symbol_table::report_resolve_problem): New function.
9341 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9342
9343 2009-11-03 Doug Kwan <dougkwan@google.com>
9344
9345 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9346 stub_factory_.
9347 (Target_arm::stub_factory): New method definition.
9348 (Target_arm::new_arm_input_section,
9349 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9350 Target_arm::reloc_uses_thumb_bit): New method declarations.
9351 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9352 New type definitions.
9353 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9354 member declarations.
9355 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9356 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9357 New method definitions.
9358
9359 2009-11-03 Ian Lance Taylor <iant@google.com>
9360
9361 * options.h (class General_options): Add --warn_constructors.
9362
9363 2009-11-03 Ian Lance Taylor <iant@google.com>
9364
9365 PR 10893
9366 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9367 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9368
9369 2009-11-03 Ian Lance Taylor <iant@google.com>
9370
9371 PR 10895
9372 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9373 --msgid-bugs-address.
9374 (install-pdf): New target.
9375 (install-data_yes): Look up one directory to find mkinstalldirs.
9376
9377 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9378
9379 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9380 tree.
9381
9382 2009-10-30 Doug Kwan <dougkwan@google.com>
9383
9384 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9385
9386 2009-10-30 Doug Kwan <dougkwan@google.com>
9387
9388 * arm.cc (Stub_addend_reader): New struct template definition
9389 and partial specializations.
9390 (Stub_addend_reader::operator()): New method definition for a
9391 partially specialized template.
9392
9393 2009-10-30 Doug Kwan <dougkwan@google.com>
9394
9395 * arm.cc (Arm_relobj::processor_specific_flags): New method
9396 definition.
9397 (Arm_relobj::do_read_symbols): New method declaration.
9398 (Arm_relobj::processor_specific_flags_): New data member declaration.
9399 (Arm_dynobj): New class definition.
9400 (Target_arm::do_finalize_sections): Add input_objects parameter.
9401 (Target_arm::do_adjust_elf_header): New method declaration.
9402 (Target_arm::are_eabi_versions_compatible,
9403 (Target_arm::merge_processor_specific_flags): New method declaration.
9404 (Target_arm::do_make_elf_object): New overloaded method definitions
9405 and declaration.
9406 (Arm_relobj::do_read_symbols): New method definition.
9407 (Arm_dynobj::do_read_symbols): Ditto.
9408 (Target_arm::do_finalize_sections): Add input_objects parameters.
9409 Merge processor-specific flags from all input objects.
9410 (Target_arm::are_eabi_versions_compatible,
9411 Target_arm::merge_processor_specific_flags,
9412 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9413 New method definitions.
9414 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9415 Input_objects pointer type parameter.
9416 * layout.cc (Layout::finalize): Pass input objects to target's.
9417 finalize_sections function.
9418 * output.cc (Output_file_header::do_sized_write): Set ELF file
9419 header's processor-specific flags.
9420 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9421 Input_objects pointer type parameter.
9422 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9423 * target.h (Input_objects): New forward class declaration.
9424 (Target::processor_specific_flags,
9425 Target::are_processor_specific_flags_sect): New method definitions.
9426 (Target::finalize_sections): Add input_objects parameter.
9427 (Target::Target): Initialize processor_specific_flags_ and
9428 are_processor_specific_flags_set_.
9429 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9430 parameter.
9431 (Target::set_processor_specific_flags): New method definition.
9432 (Target::processor_specific_flags_,
9433 Target::are_processor_specific_flags_set_): New data member
9434 declarations.
9435 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9436 Input_objects pointer type parameter.
9437
9438 2009-10-30 Doug Kwan <dougkwan@google.com>
9439
9440 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9441
9442 2009-10-28 Ian Lance Taylor <iant@google.com>
9443
9444 * object.h (class Relobj): Drop options parameter from
9445 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9446 do_scan_relocs, do_relocate. Change all callers.
9447 (class Sized_relobj): Drop options parameters from
9448 do_gc_process_relocs, do_scan_relocs, do_relocate,
9449 do_relocate_sections, relocate_sections, emit_relocs_scan,
9450 emit_relocs_scan_reltype. Change all callers.
9451 (struct Relocate_info): Remove options field and all references to
9452 it.
9453 * reloc.h (class Read_relocs): Remove options constructor
9454 parameter and options_ field. Change all callers.
9455 (class Gc_process_relocs, class Scan_relocs): Likewise.
9456 (class Relocate_task): Likewise.
9457 * target-reloc.h (scan_relocs): Remove options parameter. Change
9458 all callers.
9459 (scan_relocatable_relocs): Likewise.
9460 * target.h (class Sized_target): Remove options parameter from
9461 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9462 all callers.
9463 * gc.h (gc_process_relocs): Remove options parameter. Change all
9464 callers.
9465 * arm.cc: Update functions to remove options parameters.
9466 * i386.cc: Likewise.
9467 * powerpc.cc: Likewise.
9468 * sparc.cc: Likewise.
9469 * x86_64.cc: Likewise.
9470 * testsuite/testfile.cc: Likewise.
9471
9472 2009-10-28 Doug Kwan <dougkwan@google.com>
9473
9474 * arm.cc (Arm_relobj): New class definition.
9475 (Arm_relobj::scan_sections_for_stubs,
9476 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9477 New method definitions.
9478
9479 2009-10-28 Cary Coutant <ccoutant@google.com>
9480
9481 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9482 (Plugin::cleanup_done_): New member.
9483 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9484 (Plugin_manager::cleanup_done_): Remove.
9485 (Plugin_manager::add_input_file): Edit error message.
9486 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9487 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9488
9489 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9490
9491 * fileread.cc: (File_read::View::~View): Use the new
9492 data_ownership_ filed.
9493 (File_read::~File_read): Dispose the new whole_file_view_.
9494 (File_read::open): Mmap the whole file if needed.
9495 (File_read::open): Use whole_file_view_ instead of contents_.
9496 (File_read::find_view): Use whole_file_view_ if applicable.
9497 (File_read::do_read): Use whole_file_view_ instead of contents_.
9498 (File_read::make_view): Use whole_file_view_ instead of contents_,
9499 update File_read::View::View call.
9500 (File_read::find_or_make_view): Update File_read::View::View
9501 call.
9502 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9503 remove contents_
9504 (File_read::View::Data_ownership): New enum.
9505 (File_read::View::View): Replace bool mapped_ with Data_ownership
9506 argument.
9507 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9508 (File_read::View::data_ownership_): New field.
9509 (File_read::contents_): Remove (replaced by whole_file_view_).
9510 (File_read::whole_file_view_): New field.
9511 * options.h (class General_options): Add --keep-files-mapped.
9512
9513 2009-10-27 Cary Coutant <ccoutant@google.com>
9514
9515 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9516 * testsuite/Makefile.am (plugin_test_5): New test case.
9517 * testsuite/Makefile.in: Regenerate.
9518
9519 2009-10-25 Doug Kwan <dougkwan@google.com>
9520
9521 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9522 from private to protected to allow access by child class.
9523 (Sized_relobj::do_relocate_sections): New method declaration.
9524 (Sized_relobj::relocate_sections): Virtualize.
9525 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9526 Sized_relobj::relocate_sections. Instantiate template explicitly
9527 for different target sizes and endianity.
9528
9529 2009-10-24 Doug Kwan <dougkwan@google.com>
9530
9531 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9532 (Arm_input_section::as_arm_input_section): New method.
9533 (Arm_output_section): New class definition.
9534 (Arm_output_section::create_stub_group,
9535 Arm_output_section::group_sections): New method definitions.
9536
9537 2009-10-22 Doug Kwan <dougkwan@google.com>
9538
9539 * arm.cc (Arm_input_section): New class definition.
9540 (Arm_input_section::init, Arm_input_section:do_write,
9541 Arm_input_section::set_final_data_size,
9542 Arm_input_section::do_reset_address_and_file_offset): New method
9543 definitions.
9544
9545 2009-10-21 Doug Kwan <dougkwan@google.com>
9546
9547 * arm.cc (Stub_table, Arm_input_section): New forward class
9548 declarations.
9549 (Stub_table): New class defintion.
9550 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9551 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9552 New method definition.
9553
9554 2009-10-21 Doug Kwan <dougkwan@google.com>
9555
9556 * arm.cc: Update copyright comments.
9557 (Target_arm): New forward class template declaration.
9558 (Arm_address): New type.
9559 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9560 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9561 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9562 constants.
9563 (Insn_template): Same.
9564 (DEF_STUBS): New macro.
9565 (Stub_type): New enum type.
9566 (Stub_template): New class definition.
9567 (Stub): Same.
9568 (Reloc_stub): Same.
9569 (Stub_factory): Same.
9570 (Target_arm::Target_arm): Initialize may_use_blx_ and
9571 should_force_pic_veneer_.
9572 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9573 Target_arm::should_force_pic_veneer,
9574 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9575 Target_arm::using_thumb_only, Target_arm:;default_target): New
9576 method defintions.
9577 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9578 New data member declarations.
9579 (Insn_template::size, Insn_template::alignment): New method defintions.
9580 (Stub_template::Stub_template): New method definition.
9581 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9582 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9583 (Stub_factory::Stub_factory): New method definition.
9584 * gold.h (string_hash): New template.
9585 * output.h (Input_section_specifier::hash_value): Use
9586 gold::string_hash.
9587 (Input_section_specifier::string_hash): Remove.
9588 * stringpool.cc (Stringpool_template::string_hash): Use
9589 gold::string_hash.
9590
9591 2009-10-20 Doug Kwan <dougkwan@google.com>
9592
9593 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9594 symbols of relaxed input sections.
9595 * output.h (Output_section::find_relaxed_input_section): Make
9596 method public.
9597
9598 2009-10-16 Doug Kwan <dougkwan@google.com>
9599
9600 * dynobj.cc (Versions::Versions): Initialize version_script_.
9601 Only insert base version symbol definition for a shared object
9602 if version script defines any version versions.
9603 (Versions::define_base_version): New method definition.
9604 (Versions::add_def): Check that base version is not needed.
9605 (Versions::add_need): Define base version lazily.
9606 * dynobj.h (Versions::define_base_version): New method declaration.
9607 (Versions::needs_base_version_): New data member declaration.
9608 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9609 (check_DATA): Add no_version_test.stdout.
9610 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9611 New make rules.
9612 * testsuite/Makefile.in: Regenerate.
9613 * testsuite/no_version_test.c: New file.
9614 * testsuite/no_version_test.sh: Ditto.
9615
9616 2009-10-16 Doug Kwan <dougkwan@google.com>
9617
9618 * expression.cc (class Segment_start_expression): New class definition.
9619 (Segment_start_expression::value): New method definition.
9620 (script_exp_function_segment_start): Return a new
9621 Segment_start_expression.
9622 * gold/script-c.h (script_saw_segment_start_expression): New function
9623 prototype.
9624 * script-sections.cc (Script_sections::Script_sections): Initialize
9625 SAW_SEGMENT_START_EXPRESSION_ to false.
9626 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9627 and -Tbbs options to specify section addresses if given in
9628 command line and no SEGMENT_START expression is seen in a script.
9629 * script-sections.h (Script_sections::saw_segment_start_expression,
9630 Script_sections::set_saw_segment_start_expression): New method
9631 definition.
9632 (Script_sections::saw_segment_start_expression_): New data member
9633 declaration.
9634 * script.cc (script_saw_segment_start_expression): New function.
9635 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9636 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9637 script_test_7.sh and script_test_8.sh.
9638 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9639 script_test_8.stdout.
9640 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9641 (script_test_6, script_test_6.stdout, script_test_7,
9642 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9643 * Makefile.in: Regenerate.
9644 * testsuite/script_test_6.sh: New file.
9645 * testsuite/script_test_6.t: Same.
9646 * testsuite/script_test_7.sh: Same.
9647 * testsuite/script_test_7.t: Same.
9648 * testsuite/script_test_8.sh: Same.
9649
9650 2009-10-16 Doug Kwan <dougkwan@google.com>
9651
9652 * output.cc (Output_segment::set_section_list_address): Cast
9653 expressions to unsigned long long type to avoid format warnings.
9654
9655 2009-10-15 Ian Lance Taylor <iant@google.com>
9656
9657 * script.cc (Script_options::add_symbol_assignment): Always add a
9658 dot assignment to script_sections_.
9659 * script-sections.cc (Script_sections::add_dot_assignment):
9660 Initialize if necessary.
9661
9662 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9663 program headers with no load segment if there is a linker script.
9664
9665 * layout.cc (Layout::set_segment_offsets): Align the file offset
9666 to the segment aligment for -N or -n with no load segment.
9667 * output.cc (Output_segment::add_output_section): Don't crash if
9668 the first section is a TLS section.
9669 (Output_segment::set_section_list_addresses): Print an error
9670 message if the address moves backward in a linker script.
9671 * script-sections.cc
9672 (Output_section_element_input::set_section_addresses): Don't
9673 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9674 (Orphan_output_section::set_section_addresses): Likewise.
9675
9676 2009-10-15 Doug Kwan <dougkwan@google.com>
9677
9678 * layout.cc (Layout::finish_dynamic_section): Generate tags
9679 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9680 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9681 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9682
9683 2009-10-14 Ian Lance Taylor <iant@google.com>
9684
9685 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9686 fields.
9687 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9688 data_shdr fields of relinfo.
9689 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9690 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9691 R_386_TLS_LDO_32, adjust based on section flags.
9692 (Target_i386::Relocate::fix_up_ldo): Remove.
9693
9694 2009-10-13 Ian Lance Taylor <iant@google.com>
9695
9696 Add support for -pie.
9697 * options.h (class General_options): Add -pie and
9698 --pic-executable.
9699 (General_options::output_is_position_independent): Test -pie.
9700 (General_options::output_is_executable): Return true if not shared
9701 and not relocatable.
9702 (General_options::output_is_pie): Remove.
9703 * options.cc (General_options::finalize): Reject incompatible uses
9704 of -pie.
9705 * gold.cc (queue_middle_tasks): A -pie link is not static.
9706 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9707 * symtab.cc (Symbol::final_value_is_known): Return false if
9708 output_is_position_independent.
9709 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9710 output_is_position_independent.
9711 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9712 output_is_position_independent.
9713 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9714 output_is_position_independent.
9715 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9716 two_file_pie_test.
9717 (basic_pie_test.o, basic_pie_test): New targets.
9718 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9719 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9720 (two_file_pie_test): New target.
9721 * testsuite/Makefile.in: Rebuild.
9722 * README: Remove note saying that -pie is not supported.
9723
9724 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9725
9726 * options.h (class General_options): Add -init and -fini.
9727 * layout.cc (Layout::finish_dynamic_section): Emit
9728 given init and fini functions.
9729
9730 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9731
9732 * gc.h (gc_process_relocs): Check if icf is enabled using new
9733 function.
9734 * gold.cc (queue_initial_tasks): Likewise.
9735 (queue_middle_tasks): Likewise.
9736 * object.cc (do_layout): Likewise.
9737 * symtab.cc (is_section_folded): Likewise.
9738 * main.cc (main): Likewise.
9739 * reloc.cc (Read_relocs::run): Likewise.
9740 (Sized_relobj::do_scan_relocs): Likewise.
9741 * icf.cc (is_function_ctor_or_dtor): New function.
9742 (Icf::find_identical_sections): Check if function is ctor or dtor when
9743 safe icf is chosen.
9744 * options.h (General_options::icf): Change option to be an enum.
9745 (Icf_status): New enum.
9746 (icf_enabled): New method.
9747 (icf_safe_folding): New method.
9748 (set_icf_status): New method.
9749 (icf_status_): New variable.
9750 * (options.cc) (General_options::finalize): Set icf_status_.
9751 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9752 icf_test and icf_keep_unique_test to use the --icf enum flag.
9753 * testsuite/icf_safe_test.sh: New file.
9754 * testsuite/icf_safe_test.cc: New file.
9755
9756 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9757
9758 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9759 includes to gc.h and icf.h.
9760 * arm.cc: Include gc.h.
9761 * gold.cc: Likewise.
9762 * i386.cc: Likewise.
9763 * powerpc.cc: Likewise.
9764 * sparc.cc: Likewise.
9765 * x86_64.cc: Likewise.
9766 * gc.h: Include icf.h.
9767
9768 2009-10-11 Ian Lance Taylor <iant@google.com>
9769
9770 * plugin.cc: Include "gold.h" before other header files.
9771
9772 2009-10-10 Chris Demetriou <cgd@google.com>
9773
9774 * options.h (Input_file_argument::Input_file_type): New enum.
9775 (Input_file_argument::is_lib_): Replace with...
9776 (Input_file_argument::type_): New member.
9777 (Input_file_argument::Input_file_argument): Take Input_file_type
9778 'type' rather than boolean 'is_lib' as second argument.
9779 (Input_file_argument::is_lib): Use type_.
9780 (Input_file_argument::is_searched_file): New function.
9781 (Input_file_argument::may_need_search): Handle is_searched_file.
9782 * options.cc (General_options::parse_library): Support -l:filename.
9783 (General_options::parse_just_symbols): Update for Input_file_argument
9784 changes.
9785 (Command_line::process): Likewise.
9786 * archive.cc (Archive::get_file_and_offset): Likewise.
9787 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9788 * script.cc (read_script_file, script_add_file): Likewise.
9789 * fileread.cc (Input_file::Input_file): Likewise.
9790 (Input_file::will_search_for): Handle is_searched_file.
9791 (Input_file::open): Likewise.
9792 * readsyms.cc (Read_symbols::get_name): Likewise.
9793 * testsuite/Makefile.am (searched_file_test): New test.
9794 * testsuite/Makefile.in: Regenerate.
9795 * testsuite/searched_file_test.cc: New file.
9796 * testsuite/searched_file_test_lib.cc: New file.
9797
9798 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9799 Ian Lance Taylor <iant@google.com>
9800
9801 * descriptor.cc: Include <cstdio> and "binary-io.h".
9802 (Descriptors::open): Open the files in binary mode always.
9803 * script.cc (Lex::get_token): Treat \r as whitespace.
9804
9805 2009-10-09 Ian Lance Taylor <iant@google.com>
9806
9807 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9808
9809 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9810 Ian Lance Taylor <iant@google.com>
9811
9812 * configure.ac: Check for readv function also.
9813 * fileread.cc (readv): Define if not HAVE_READV.
9814 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9815 does not exist.
9816 * config.in: Regenerate.
9817 * configure: Regenerate.
9818
9819 2009-10-09 Doug Kwan <dougkwan@google.com>
9820
9821 * layout.cc (Layout::make_output_section): Call target hook to make
9822 ordinary output section.
9823 (Layout::finalize): Adjust parameter list of call the
9824 Target::may_relax().
9825 * layout.h (class Layout::section_list): New method.
9826 * merge.h (Output_merge_base::entsize): Change visibility to public.
9827 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9828 New methods.
9829 (Output_merge_string::do_is_string): New method.
9830 * object.cc (Sized_relobj::do_setup): renamed from
9831 Sized_relobj::set_up.
9832 * object.h (Sized_relobj::adjust_shndx,
9833 Sized_relobj::initializ_input_to_output_maps,
9834 Sized_relobj::free_input_to_output_maps): Change visibilities to
9835 protected.
9836 (Sized_relobj::setup): Virtualize.
9837 (Sized_relobj::do_setup): New method declaration.
9838 (Sized_relobj::invalidate_section_offset,
9839 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9840 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9841 * options.cc (parse_int): New function.
9842 * options.h (parse_int): New declaration.
9843 (DEFINE_int): New macro.
9844 (stub_group_size): New option.
9845 * output.cc (Output_section::Output_section): Initialize memebers
9846 merge_section_map_, merge_section_by_properties_map_,
9847 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9848 (Output_section::add_input_section): Handled deferred code-fill
9849 generation and remove an old comment.
9850 (Output_section::add_relaxed_input_section): New method definition.
9851 (Output_section::add_merge_input_section): Use merge section by
9852 properties map to speed to search. Update merge section maps
9853 as appropriate.
9854 (Output_section::build_relaxation_map): New method definition.
9855 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9856 Same.
9857 (Output_section::relax_input_section): Renamed to
9858 Output_section::convert_input_sections_to_relaxed_sections and change
9859 interface to take a vector of pointers to relaxed sections.
9860 (Output_section::find_merge_section,
9861 Output_section::find_relaxed_input_section): New method definitions.
9862 (Output_section::is_input_address_mapped,
9863 Output_section::output_offset, Output_section::output_address):
9864 Use output section data maps to speed up searching.
9865 (Output_section::find_starting_output_address): Add comments.
9866 (Output_section::do_write,
9867 Output_section::write_to_postprocessing_buffer): Do code-fill
9868 generation as appropriate.
9869 (Output_section::get_input_sections): Invalidate relaxed input section
9870 map.
9871 (Output_section::restore_states): Adjust type of checkpoint .
9872 Invalidate relaxed input section map.
9873 * output.h (Output_merge_base): New class declaration.
9874 (Input_section_specifier): New class defintion.
9875 (class Output_relaxed_input_section) Change base class to
9876 Output_section_data_build.
9877 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9878 base class initializer.
9879 (Output_section::add_relaxed_input_section): New method declaration.
9880 (Output_section::Input_section): Change visibility to protected.
9881 (Output_section::Input_section::relobj,
9882 Output_section::Input_section::shndx): Handle relaxed input sections.
9883 Output_section::input_sections) Change visibility to protected. Also
9884 define overload to return a non-const pointer.
9885 (Output_section::Merge_section_properties): New class defintion.
9886 (Output_section::Merge_section_by_properties_map,
9887 Output_section::Output_section_data_by_input_section_map,
9888 Output_section::Relaxation_map): New types.
9889 (Output_section::relax_input_section): Rename method to
9890 Output_section::convert_input_sections_to_relaxed_sections and change
9891 interface to take a vector of relaxed section pointers.
9892 (Output_section::find_merge_section,
9893 Output_section::find_relaxed_input_section,
9894 Output_section::build_relaxation_map,
9895 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9896 New method declarations.
9897 (Output_section::merge_section_map_
9898 Output_section::merge_section_by_properties_map_,
9899 Output_section::relaxed_input_section_map_,
9900 Output_section::is_relaxed_input_section_map_valid_,
9901 Output_section::generate_code_fills_at_write_): New data members.
9902 * script-sections.cc
9903 (Output_section_element_input::set_section_addresses): Call
9904 current_data_size and addralign methods of relaxed input sections.
9905 (Orphan_output_section::set_section_addresses): Call current_data_size
9906 and addralign methods of relaxed input sections.
9907 * symtab.cc (Symbol_table::compute_final_value): Extract template
9908 from the body of Symbol_table::sized_finalize_symbol.
9909 (Symbol_table::sized_finalized_symbol): Call
9910 Symbol_table::compute_final_value.
9911 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9912 (Symbol_table::compute_final_value): New templated method declaration.
9913 * target.cc (Target::do_make_output_section): New method defintion.
9914 * target.h (Target::make_output_section): New method declaration.
9915 (Target::relax): Add more parameters for input objects, symbol table
9916 and layout. Adjust call to do_relax.
9917 (Target::do_make_output_section): New method declaration.
9918 (Target::do_relax): Add parameters for input objects, symbol table
9919 and layout.
9920
9921 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9922
9923 * pread.c: Include stdio.h.
9924
9925 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9926
9927 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9928 defined.
9929
9930 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9931
9932 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9933 Change read_shndx type to unsigned int.
9934 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9935 int.
9936 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9937 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9938 Change read_shndx type to unsigned int.
9939 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9940 int.
9941 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9942 * layout.cc (Layout::create_symtab_sections): Cast the result of
9943 local_symcount * symsize to off_t in the gold_assert.
9944
9945 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9946
9947 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9948 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9949 R_ARM_BASE_ABS.
9950 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9951 (Arm_relocate_functions::thm_abs5): New function.
9952 (Arm_relocate_functions::abs12): New function.
9953 (Arm_relocate_functions::abs16): New function.
9954 (Arm_relocate_functions::base_abs): New function.
9955 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9956 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9957 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9958 R_ARM_BASE_ABS.
9959 (Scan::global): Likewise.
9960 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9961 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9962 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9963 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9964 R_ARM_BASE_ABS.
9965
9966 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9967
9968 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9969 (Arm_relocate_functions::movt_prel): New function.
9970 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9971 (Arm_relocate_functions::thm_movt_prel): New function.
9972 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9973 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9974 (Scan::global, Relocate::relocate): Likewise.
9975 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9976
9977 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9978
9979 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9980 Incremental_checker.
9981 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9982 unsigned int.
9983 (class Incremental_inputs_header): New class.
9984 (Incremental_inputs_header_writer): Edit comment.
9985 (Incremental_inputs_entry): New class.
9986 (Incremental_inputs_entry_writer): Edit comment.
9987 (Sized_incremental_binary::do_find_incremental_inputs_section):
9988 Add *strtab_shndx parameter, fill it.
9989 (Sized_incremental_binary::do_check_inputs): New method.
9990 (Incremental_checker::can_incrementally_link_output_file): Use
9991 Sized_incremental_binary::check_inputs.
9992 (Incremental_inputs::report_command_line): Save command line in
9993 command_line_.
9994 * incremental.h:
9995 (Incremental_binary::find_incremental_inputs_section): New
9996 method.
9997 (Incremental_binary::do_find_incremental_inputs_section): Add
9998 strtab_shndx parameter.
9999 (Incremental_binary::do_check_inputs): New pure virtual method.
10000 (Sized_incremental_binary::do_check_inputs): Declare.
10001 (Incremental_checker::Incremental_checker): Add incremental_inputs
10002 parameter, use it to initialize incremental_inputs_.
10003 (Incremental_checker::incremental_inputs_): New field.
10004 (Incremental_checker::command_line): New method.
10005 (Incremental_checker::inputs): New method.
10006 (Incremental_checker::command_line_): New field.
10007
10008 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10009
10010 * incremental.cc: Include <cstdarg> and "target-select.h".
10011 (vexplain_no_incremental): New function.
10012 (explain_no_incremental): New function.
10013 (Incremental_binary::error): New method.
10014 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10015 method.
10016 (make_sized_incremental_binary): New function.
10017 (open_incremental_binary): New function.
10018 (can_incrementally_link_file): Add checks if output is ELF and has
10019 inputs section.
10020 * incremental.h: Include "elfcpp_file.h" and "output.h".
10021 (Incremental_binary): New class.
10022 (Sized_incremental_binary): New class.
10023 (open_incremental_binary): Declare.
10024 * object.cc (is_elf_object): Use
10025 elfcpp::Elf_recognizer::is_elf_file.
10026 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10027 * output.h (Output_file::filesize): New method.
10028
10029 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10030
10031 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10032 New function.
10033 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10034 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10035 function.
10036 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10037 function.
10038 (Arm_relocate_functions::movw_abs_nc): New function.
10039 (Arm_relocate_functions::movt_abs): New function.
10040 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10041 (Arm_relocate_functions::thm_movt_abs): New function.
10042 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10043 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10044 (Scan::global): Likewise.
10045 (Relocate::relocate): Likewise.
10046 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10047
10048 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10049
10050 * arm.cc (Arm_relocate_functions::got_prel) New function.
10051 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10052 (Relocate::relocate): Likewise.
10053 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10054
10055 2009-10-06 Ian Lance Taylor <iant@google.com>
10056
10057 * options.h (class General_options): Define
10058 split_stack_adjust_size parameter.
10059 * object.h (class Object): Add uses_split_stack_ and
10060 has_no_split_stack_ fields. Add uses_split_stack and
10061 has_no_split_stack accessor functions. Declare
10062 handle_split_stack_section.
10063 (class Reloc_symbol_changes): Define.
10064 (class Sized_relobj): Define Function_offsets. Declare
10065 split_stack_adjust, split_stack_adjust_reltype, and
10066 find_functions.
10067 * object.cc (Object::handle_split_stack_section): New function.
10068 (Sized_relobj::do_layout): Call handle_split_stack_section.
10069 * dynobj.cc (Sized_dynobj::do_layout): Call
10070 handle_split_stack_section.
10071 * reloc.cc (Sized_relobj::relocate_sections): Call
10072 split_stack_adjust for executable sections in split_stack
10073 objects. Pass reloc_map to relocate_section.
10074 (Sized_relobj::split_stack_adjust): New function.
10075 (Sized_relobj::split_stack_adjust_reltype): New function.
10076 (Sized_relobj::find_functions): New function.
10077 * target-reloc.h: Include "object.h".
10078 (relocate_section): Add reloc_symbol_changes parameter. Change
10079 all callers.
10080 * target.h (class Target): Add calls_non_split method. Declare
10081 do_calls_non_split virtual method. Declare match_view and
10082 set_view_to_nop.
10083 * target.cc: Include "elfcpp.h".
10084 (Target::do_calls_non_split): New function.
10085 (Target::match_view): New function.
10086 (Target::set_view_to_nop): New function.
10087 * gold.cc (queue_middle_tasks): Give an error if mixing
10088 split-stack and non-split-stack objects with -r.
10089 * i386.cc (Target_i386::relocate_section): Add
10090 reloc_symbol_changes parameter.
10091 (Target_i386::do_calls_non_split): New function.
10092 * x86_64.cc (Target_x86_64::relocate_section): Add
10093 reloc_symbol_changes parameter.
10094 (Target_x86_64::do_calls_non_split): New function.
10095 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10096 parameter.
10097 * powerpc.cc (Target_powerpc::relocate_section): Add
10098 reloc_symbol_changes parameter.
10099 * sparc.cc (Target_sparc::relocate_section): Add
10100 reloc_symbol_changes parameter.
10101 * configure.ac: Call AM_CONDITIONAL for the default target.
10102 * configure: Rebuild.
10103 * testsuite/Makefile.am (TEST_AS): New variable.
10104 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10105 (check_DATA): Add split_i386 and split_x86_64 files.
10106 (SPLIT_DEFSYMS): Define.
10107 (split_i386_[1234n].o): New targets.
10108 (split_i386_[124]): New targets.
10109 (split_i386_[1234r].stdout): New targets.
10110 (split_x86_64_[1234n].o): New targets.
10111 (split_x86_64_[124]): New targets.
10112 (split_x86_64_[1234r].stdout): New targets.
10113 (MOSTLYCLEANFILES): Add new executables.
10114 * testsuite/split_i386.sh: New file.
10115 * testsuite/split_x86_64.sh: New file.
10116 * testsuite/split_i386_1.s: New file.
10117 * testsuite/split_i386_2.s: New file.
10118 * testsuite/split_i386_3.s: New file.
10119 * testsuite/split_i386_4.s: New file.
10120 * testsuite/split_i386_n.s: New file.
10121 * testsuite/split_x86_64_1.s: New file.
10122 * testsuite/split_x86_64_2.s: New file.
10123 * testsuite/split_x86_64_3.s: New file.
10124 * testsuite/split_x86_64_4.s: New file.
10125 * testsuite/split_x86_64_n.s: New file.
10126 * testsuite/testfile.cc (Target_test): Update relocation_section
10127 function.
10128 * testsuite/Makefile.in: Rebuild.
10129
10130 2009-10-06 Ian Lance Taylor <iant@google.com>
10131
10132 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10133 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10134 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10135 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10136 the address on ldo_addrs_.
10137 (Target_i386::Relocate::fix_up_ldo): New function.
10138
10139 2009-10-06 Rafael Espindola <espindola@google.com>
10140
10141 * plugin.cc (add_input_library): New.
10142 (Plugin::load): Add add_input_library to tv.
10143 (Plugin_manager::add_input_file): Add the is_lib argument.
10144 (add_input_file): Update call to Plugin_manager::add_input_file.
10145 (add_input_library): New.
10146 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10147
10148 2009-09-30 Doug Kwan <dougkwan@google.com>
10149
10150 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10151 symbol and call Symbol::may_need_copy_reloc to determine if
10152 a copy reloc is needed.
10153 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10154 nocopyreloc is given in command line.
10155 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10156 given in command line.
10157 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10158 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10159 of the removed Target_i386::may_need_copy_reloc.
10160 * options.h (copyreloc): New option with default value false.
10161 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10162 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10163 instead of the removed Target_powerpc::may_need_copy_reloc.
10164 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10165 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10166 instead of the removed Target_sparc::may_need_copy_reloc.
10167 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10168 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10169 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10170 instead of the removed Target_x86_64::may_need_copy_reloc.
10171
10172 2009-09-30 Ian Lance Taylor <iant@google.com>
10173
10174 * object.h (class Object): Remove target_ field, and target,
10175 sized_target, and set_target methods.
10176 (Object::sized_target): Remove.
10177 (class Sized_relobj): Update declarations. Remove sized_target.
10178 * object.cc (Sized_relobj::setup): Remove target parameter.
10179 Change all callers.
10180 (Input_objects::add_object): Don't do anything with the target.
10181 (make_elf_sized_object): Add punconfigured parameter. Change all
10182 callers. Set or test parameter target.
10183 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10184 Change all callers.
10185 * parameters.cc (Parameters::set_target): Change parameter type to
10186 be non-const.
10187 (Parameters::default_target): Remove.
10188 (set_parameters_target): Change parameter type to be non-const.
10189 (parameters_force_valid_target): New function.
10190 (parameters_clear_target): New function.
10191 * parameters.h (class Parameters): Update declarations. Remove
10192 default_target method. Add sized_target and clear_target
10193 methods. Change target_ to be non-const.
10194 (set_parameters_target): Update declaration.
10195 (parameters_force_valid_target): Declare.
10196 (parameters_clear_target): Declare.
10197 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10198 as NULL if we aren't searching.
10199 (Add_symbols::run): Don't check for compatible target.
10200 * fileread.cc (Input_file::open_binary): Call
10201 parameters_force_valid_target.
10202 * gold.cc (queue_middle_tasks): Likewise.
10203 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10204 set_target on object.
10205 * dynobj.h (class Sized_dynobj): Update declarations.
10206 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10207 make_elf_object returns NULL.
10208 (Archive::include_member): Don't check whether object target is
10209 compatible.
10210 * output.cc (Output_section::add_input_section): Get target from
10211 parameters.
10212 (Output_section::relax_input_section): Likewise.
10213 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10214 parameters.
10215 (Sized_relobj::do_scan_relocs): Likewise.
10216 (Sized_relobj::relocate_sections): Likewise.
10217 * resolve.cc (Symbol_table::resolve): Likewise.
10218 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10219 parameter. Change all callers.
10220 (Symbol_table::add_from_object): Get target from parameters.
10221 (Symbol_table::add_from_relobj): Don't check object target.
10222 (Symbol_table::add_from_dynobj): Likewise.
10223 (Symbol_table::define_special_symbol): Get target from
10224 parameters.
10225 * symtab.h (class Symbol_table): Update declaration.
10226 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10227 parameter. Change all callers. Clear parameter target.
10228 (Binary_test): Test target here.
10229 * testsuite/object_unittest.cc (gold_testsuite): Remove
10230 target_test_pointer parameter. Change all callers.
10231 (Object_test): Test target here.
10232
10233 2009-09-26 Ian Lance Taylor <iant@google.com>
10234
10235 * testsuite/initpri1.c: Don't try to use constructor priorities if
10236 compiling with gcc before 4.3.
10237
10238 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10239
10240 * testsuite/retain_symbols_file_test.sh (check_present): Change
10241 output file name to retain_symbols_file_test.stdout.
10242 (check_absent): Likewise.
10243
10244 2009-09-18 Craig Silverstein <csilvers@google.com>
10245
10246 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10247 * options.cc: Include <cerrno> and <fstream>.
10248 (General_options::finalize): Parse -retain-symbols-file tag.
10249 * options.h: New flag.
10250 (General_options): New method should_retain_symbol, new
10251 variable symbols_to_retain.
10252 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10253 should_retain_symbol map.
10254 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10255 * testsuite/Makefile.in: Regenerate.
10256 * testsuite/retain_symbols_file_test.sh: New file.
10257
10258 2009-09-18 Nick Clifton <nickc@redhat.com>
10259
10260 * po/es.po: Updated Spanish translation.
10261
10262 2009-09-17 Doug Kwan <dougkwan@google.com>
10263
10264 * debug.h (DEBUG_RELAXATION): New constant.
10265 (DEBUG_ALL): Add DEBUG_RELAXATION.
10266 (debug_string_to_enum): Add relaxation debug option.
10267 * layout.cc
10268 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10269 Layout::Relaxation_debug_check::read_sections,
10270 Layout::Relaxation_debug_check::read_sections): New method definitions.
10271 (Layout::Layout): Initialize data members
10272 record_output_section_data_from_scrips_,
10273 script_output_section_data_list_ and relaxation_debug_check_.
10274 (Layout::save_segments, Layout::restore_segments,
10275 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10276 Layout::relaxation_loop_body): New method definitions.
10277 (Layout::finalize): Support relaxation. Move section layout code to
10278 Layout::relaxation_loop_body.
10279 (Layout::set_asection_address_from_script): Move code for orphan
10280 section placement out.
10281 (Layout::place_orphan_sections_in_script): New method definition.
10282 * layout.h (Output_segment_headers, Output_file_header):
10283 New forward class declarations.
10284 (Layout::~Layout): Define.
10285 (Layout::new_output_section_data_from_script): New method definition.
10286 (Layout::place_orphan_sections_in_script): New method declaration.
10287 (Layout::Segment_states): New type declaration.
10288 (Layout::save_segments, Layout::restore_segments,
10289 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10290 Layout::relaxation_loop_body): New method declarations.
10291 (Layout::Output_section_data_list): New type declaration.
10292 (Layout::Relaxation_debug_check): New class definition.
10293 (Layout::record_output_section_data_from_script_,
10294 Layout::script_output_section_data_list_, Layout::segment_states_,
10295 Layout::relaxation_debug_check_): New data members.
10296 * output.cc: (Output_section_headers::do_size): New method definition.
10297 (Output_section_headers::Output_section_headers): Move size
10298 computation to Output_section_headers::do_size.
10299 (Output_segment_headers::do_size): New method definition.
10300 (Output_file_header::Output_file_header): Move size computation to
10301 Output_file_header::do_size and call it.
10302 (Output_file_header::do_size): New method definition.
10303 (Output_data_group::Output_data_group): Adjust call to
10304 Output_section_data.
10305 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10306 (Output_symtab_xindex::do_write): Add array bound check.
10307 (Output_section::Input_section::print_to_mapfile): Handle
10308 RELAXED_INPUT_SECTION_CODE.
10309 (Output_section::Output_section): Initialize data member checkpoint_.
10310 (Output_section::~Output_section): Delete checkpoint object pointed
10311 by checkpoint_.
10312 (Output_section::add_input_section): Always add an Input_section if
10313 relaxing.
10314 (Output_section::add_merge_input_section): Add assert.
10315 (Output_section::relax_input_section): New method definition.
10316 (Output_section::set_final_data_size): Set load address to zero for
10317 an unallocated section.
10318 (Output_section::do_address_and_file_offset_have_reset_values):
10319 New method definition.
10320 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10321 Handle relaxed input section.
10322 (Output_section::sort_attached_input_sections): Checkpoint input
10323 section list lazily.
10324 (Output_section::get_input_sections): Change type of input_sections to
10325 list of Simple_input_section pointers. Checkpoint input section list
10326 lazily. Also handle relaxed input sections.
10327 (Output_section::add_input_section_for_script): Take a reference to
10328 a Simple_input_section object instead of Relobj pointer and section
10329 index as parameter. Handle relaxed input sections.
10330 (Output_section::save_states, Output_section::restore_states): New
10331 method definitions.
10332 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10333 (Output_data::is_data_size_fixed): New method definition.
10334 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10335 if it is fixed.
10336 (Output_data::address_and_file_offset_have_reset_values): New method
10337 definition.
10338 (Output_data::do_address_and_file_offset_have_reset_values): New method
10339 definition.
10340 (Output_data::set_data_size): Check that data size is not fixed.
10341 (Output_data::fix_data_size): New method definition.
10342 (Output_data::is_data_size_fixed_): New data member.
10343 (Output_section_headers::set_final_data_size): New method definition.
10344 (Output_section_headers::do_size): New method declaration.
10345 (Output_segment_headers::set_final_data_size): New method definition.
10346 (Output_segment_headers::do_size): New method declaration.
10347 (Output_file_header::set_final_data_size)::New method definition.
10348 (Output_file_header::do_size)::New method declaration.
10349 (Output_section_data::Output_section_data): Add new parameter
10350 is_data_size_fixed and use it to fix data size.
10351 (Output_data_const::Output_data_const): Adjust call to base class
10352 constructor and fix data size.
10353 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10354 base class constructor and fix data size.
10355 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10356 base class constructor and fix data size.
10357 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10358 class constructor and fix data size.
10359 (Output_data_group::set_final_data_size): New method definition.
10360 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10361 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10362 class constructor and fix data size.
10363 (Output_relaxed_input_section): New class definition.
10364 (Output_section::Simple_input_section): New class definition.
10365 (Output_section::get_input_sections): Adjust parameter list.
10366 (Output_section::add_input_section_for_script): Same.
10367 (Output_section::save_states, Output_section::restore_states,
10368 Output_section::do_address_and_file_offset_have_reset_values,
10369 (Output_section::Input_section::Input_section): Handle
10370 RELAXED_INPUT_SECTION_CODE. Add new overload for
10371 Output_relaxed_input_section.
10372 (Output_section::Input_section::is_input_section,
10373 Output_section::Input_section::set_output_section): Handle relaxed
10374 input section.
10375 (Output_section::Input_section::is_relaxed_input_section,
10376 Output_section::Input_section::output_section_data,
10377 Output_section::Input_section::relaxed_input_section): New method
10378 definitions.
10379 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10380 value.
10381 (Output_section::Input_section::u1_): Update comments.
10382 (Output_section::Input_section::u2_): Add new union member poris.
10383 (Output_section::Checkpoint_output_section): New classs definition.
10384 (Output_section::relax_input_section): New method declaration.
10385 (Output_section::checkpoint_): New data member.
10386 (Output_segment): Update comments.
10387 (Output_segment::Output_segment): Un-privatize copy constructor.
10388 (Output_segment::operator=): Un-privatize.
10389 * script-sections.cc (Output_section_element::Input_section_list):
10390 Change element type to Output_section::Simple_input_section.
10391 (Output_section_element_dot_assignment::set_section_addresses):
10392 Register output section data for relaxation clean up.
10393 (Output_data_exression::Output_data_expression): Adjust call to base
10394 constructor to fix data size.
10395 (Output_section_element_data::set_section_addresses): Register
10396 Output_data_expression object for relaxation clean up.
10397 (struct Input_section_info): Replace Relobj pointer and section index
10398 pair with Output_section::Simple_input_section and Convert struct to a
10399 class.
10400 (Input_section_sorter::operator()): Adjust access to
10401 Input_section_info data member to use accessors.
10402 (Output_section_element_input::set_section_addresses): Use layout
10403 parameter. Adjust code to use Output_section::Simple_input_section
10404 and Input_secction_info classes. Register filler for relaxation
10405 clean up.
10406 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10407 and section index pair with Output_section::Simple_input_section
10408 class. Adjust code accordingly.
10409 (Phdrs_element::release_segment): New method definition.
10410 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10411 segment list.
10412 (Script_sections::release_segments): New method definition.
10413 * gold/script-sections.h (Script_sections::release_segments): New
10414 method declaration.
10415 * gold/target.h (Target::may_relax, Target::relax,
10416 Target::do_may_relax, Target::do_relax): New method definitions.
10417
10418 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10419
10420 * arm.cc (has_signed_unsigned_overflow): New function.
10421 (Arm_relocate_functions::abs8): New function.
10422 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10423 (Target_arm::Scan::global): Likewise.
10424 (Target_arm::relocate::relocate): Likewise.
10425 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10426 Likewise.
10427
10428 2009-09-16 Cary Coutant <ccoutant@google.com>
10429
10430 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10431 * testsuite/Makefile.in: Regenerate.
10432
10433 2009-09-11 Nick Clifton <nickc@redhat.com>
10434
10435 * po/gold.pot: Updated by the Translation project.
10436
10437 2009-09-08 Cary Coutant <ccoutant@google.com>
10438
10439 * output.cc (Output_file::open): Add execute permission to empty file.
10440 * testsuite/Makefile.am (permission_test): New test.
10441 * testsuite/Makefile.in: Regenerate.
10442
10443 2009-09-02 Ian Lance Taylor <iant@google.com>
10444
10445 * output.cc (Output_file::resize): Call map_no_anonymous rather
10446 than map.
10447
10448 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10449
10450 * gold.cc: Include "incremental.h".
10451 (queue_initial_tasks): Call Incremental_checker methods.
10452 * incremental.cc: Include "output.h".
10453 (Incremental_checker::can_incrementally_link_output_file): New
10454 method.
10455 * incremental.h (Incremental_checker): New class.
10456
10457 * output.cc (Output_file::open_for_modification): New method.
10458 (Output_file::map_anonymous): Changed return type to bool. Record
10459 map in base_ field.
10460 (Output_file::map_no_anonymous): New method, broken out of map.
10461 (Output_file::map): Use map_no_anonymous and map_anonymous.
10462 * output.h (class Output_file): Update declarations.
10463
10464 2009-08-24 Cary Coutant <ccoutant@google.com>
10465
10466 * options.h (Command_line::Pre_options): New class.
10467 (Command_line::pre_options): New member.
10468 * options.cc (gold::options::ready_to_register): New variable.
10469 (One_option::register_option): Do nothing if not registering options.
10470 Assert if same short option registered twice.
10471 (General_options::General_options): Turn off option registration when
10472 done constructing.
10473 (Command_line::Pre_options::Pre_options): New constructor.
10474
10475 2009-08-24 Cary Coutant <ccoutant@google.com>
10476
10477 * options.h (General_options::no_keep_memory): Remove incorrect
10478 short option.
10479
10480 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10481
10482 * Makefile.am (am__skiplex, am__skipyacc): New.
10483 * Makefile.in: Regenerate.
10484
10485 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10486
10487 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10488 (INCLUDES): ... this.
10489 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10490 (AM_CPPFLAGS): Renamed from ...
10491 (INCLUDE): ... this.
10492 * Makefile.in, testsuite/Makefile.in: Regenerate.
10493
10494 * Makefile.in: Regenerate.
10495 * aclocal.m4: Likewise.
10496 * config.in: Likewise.
10497 * configure: Likewise.
10498 * testsuite/Makefile.in: Likewise.
10499
10500 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10501 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10502 * Makefile.in: Regenerate.
10503 * testsuite/Makefile.in: Regenerate.
10504
10505 2009-08-19 Cary Coutant <ccoutant@google.com>
10506
10507 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10508 symbols in shared libraries overridden by hidden or internal symbols
10509 in the main program.
10510
10511 2009-08-19 Chris Demetriou <cgd@google.com>
10512
10513 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10514 checking source file names in error messages.
10515
10516 2009-08-18 Doug Kwan <dougkwan@google.com>
10517
10518 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10519 an elcpp::Ehdr as parameter. Adjust call to set_target.
10520 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10521 an elfcpp::Ehdr as parameter.
10522 * object.cc (Object::set_target): Remove the version that looks up
10523 a target and sets it.
10524 (Sized_relobj::setup): Take a Target object instead of
10525 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10526 (make_elf_sized_object): Find target and ask target to
10527 make an ELF object.
10528 * object.h: (Object::set_target): Remove the version that looks up
10529 a target and sets it.
10530 (Sized_relobj::setup): Take a Target object instead of
10531 an elfcpp:Ehdr as parameter.
10532 * target.cc: Include dynobj.h.
10533 (Target::do_make_elf_object_implementation): New.
10534 (Target::do_make_elf_object): New.
10535 * target.h (Target::make_elf_object): New template declaration.
10536 (Target::do_make_elf_object): New method declarations.
10537 (Target::do_make_elf_object_implementation): New template declaration.
10538
10539 2009-08-14 Ian Lance Taylor <iant@google.com>
10540
10541 * gold.h (FUNCTION_NAME): Define.
10542 (gold_unreachable): Use FUNCTION_NAME.
10543
10544 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10545
10546 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10547 symbol in the --keep-unique list is not found.
10548
10549 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10550
10551 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10552 been maked as --keep-unique.
10553 (Icf::unfold_section): New function.
10554 * icf.h (Icf::unfold_section): New function.
10555 * options.h (General_options::keep_unique): New option.
10556 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10557 * testsuite/Makefile.in: Regenerate.
10558 * testsuite/icf_keep_unique_test.sh: New file.
10559 * testsuite/icf_keep_unique_test.cc: New file.
10560
10561 2009-08-12 Cary Coutant <ccoutant@google.com>
10562
10563 PR 10471
10564 * resolve.cc (Symbol_table::resolve): Check for references from
10565 dynamic objects to hidden and internal symbols.
10566 * testsuite/Makefile.am (hidden_test.sh): New test.
10567 * testsuite/Makefile.in: Regenerate.
10568 * testsuite/hidden_test.sh: New script.
10569 * testsuite/hidden_test_1.c: New test source.
10570 * testsuite/hidden_test_main.c: New test source.
10571
10572 2009-08-11 Doug Kwan <dougkwan@google.com>
10573
10574 * arm.cc: Update comments.
10575 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10576 segment to locate the .ARM.exidx section if present.
10577
10578 2009-08-09 Doug Kwan <dougkwan@google.com>
10579
10580 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10581 patch.
10582
10583 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10584 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10585 compiler warnings.
10586
10587 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10588
10589 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10590 valid tls_segment only for non-debug-section relocations.
10591 * testsuite/Makefile.am: Add gc_tls_test.
10592 * testsuite/Makefile.in: Regenerate.
10593 * testsuite/gc_tls_test.cc: New file.
10594 * testsuite/gc_tls_test.sh: New file.
10595
10596 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10597
10598 * icf.cc: New file.
10599 * icf.h: New file.
10600 * Makefile.am (CCFILES): Add icf.cc.
10601 (HFILES): Add icf.h
10602 * Makefile.in: Regenerate.
10603 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10604 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10605 section, symbol and addend information for the relocs.
10606 * gold.cc (queue_middle_tasks): Call identical code folding.
10607 * gold.h: Add defines for multimap.
10608 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10609 to the call of finalize_local_symbols.
10610 * main.cc (main): Create object of class Icf.
10611 * object.cc (Sized_relobj::do_layout): Allow this function to be
10612 called twice during icf.
10613 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10614 to sections marked as identical by icf.
10615 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10616 when available.
10617 (Sized_relobj::do_section_entsize): New function.
10618 * object.h (Object::section_entsize): New function.
10619 (Object::do_section_entsize): New pure virtual function.
10620 (Relobj::finalize_local_symbols): Add new parameter.
10621 (Relobj::do_section_entsize): New function.
10622 * options.h (General_options::icf): New option.
10623 (General_options::icf_iterations): New option.
10624 (General_options::print_icf_sections): New option.
10625 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10626 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10627 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10628 icf.
10629 * symtab.cc (Symbol_table::is_section_folded): New function.
10630 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10631 to sections marked as identical by icf.
10632 * symtab.h (Symbol_table::set_icf): New function.
10633 (Symbol_table::icf): New function.
10634 (Symbol_table::is_section_folded): New function.
10635 (Symbol_table::icf_): New data member.
10636 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10637 * testsuite/Makefile.am: Add commands to build icf_test.
10638 * testsuite/Makefile.in: Regenerate.
10639 * testsuite/icf_test.sh: New file.
10640 * testsuite/icf_test.cc: New file.
10641
10642 2009-07-24 Chris Demetriou <cgd@google.com>
10643
10644 * layout.cc (is_compressible_debug_section): Fix incorrect
10645 comment about compressed section names.
10646
10647 2009-07-20 Ian Lance Taylor <ian@airs.com>
10648
10649 PR 10419
10650 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10651
10652 2009-07-16 Ian Lance Taylor <iant@google.com>
10653
10654 PR 10400
10655 * layout.h: #include <map>.
10656 (class Kept_section): Change from struct to class. Add accessors
10657 and setters. Add section size to Comdat_group mapping. Change
10658 Comdat_group to std::map. Add is_comdat_ field. Add
10659 linkonce_size field in union.
10660 (class Layout): Update declaration of find_or_add_kept_section.
10661 Don't declare find_kept_object.
10662 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10663 parameter. Add object, shndx, is_comdat, and is_group_name
10664 parameters. Change all callers. Adjust for new Kept_section.
10665 (Layout::find_kept_object): Remove.
10666 * object.cc (Sized_relobj::include_section_group): Update use of
10667 Kept_section. Rename secnum to shndx. Only record
10668 Kept_comdat_section if sections are the same size.
10669 (Sized_relobj::include_linkonce_section): Update use of
10670 Kept_section. Only record Kept_comdat_section if sections are the
10671 same size. Set size of linkonce section.
10672 (Sized_relobj::map_to_kept_section): Update call to
10673 get_kept_comdat_section.
10674 * object.h (class Sized_relobj): Rename fields in
10675 Kept_comdat_section to drop trailing underscores; change object
10676 field to Relobj*. Change Kept_comdat_section_table to store
10677 struct rather than pointer.
10678 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10679 Add kept_object and kept_shndx parameters. Change all callers.
10680 (Sized_relobj::get_kept_comdat_section): Change return type to
10681 bool. Add kept_object and kept_shndx parameters. Change all
10682 callers.
10683 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10684 Layout::find_or_add_kept_section.
10685
10686 2009-07-09 Ian Lance Taylor <iant@google.com>
10687
10688 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10689 Reserve space in the hash table.
10690
10691 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10692
10693 * fileread.cc (File_read::get_mtime): New method.
10694 * fileread.h (Timespec): New structure.
10695 (File_read::get_mtime): New method.
10696 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10697 Renamed from timestamp_nsec.
10698 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10699 Elf_Xword.
10700 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10701 timestamp_nsec.
10702 (Incremental_inputs::report_archive): Save mtime; style fix.
10703 (Incremental_inputs::report_obejct): Save mtime; style fix.
10704 (Incremental_inputs::report_script): Save mtime; style fix.
10705 (Incremental_inputs::finalize_inputs): Style fix.
10706 (Incremental_inputs::finalize): Style fix.
10707 (Incremental_inputs::create_input_section_data): Store inputs
10708 mtime.
10709 * incremental.h (Incremental_inputs::report_script): Add mtime
10710 argument.
10711 (Incremental_inputs::Input_info::Input_info): Intialize only one
10712 union member.
10713 (Incremental_inputs::Input_info::archive): Move to nameless
10714 union.
10715 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10716 (Incremental_inputs::Input_info::script): Move to nameless union.
10717 (Incremental_inputs::mtime): New field.
10718 * script.cc (read_input_script): Pass file mtime to
10719 Incremental_input.
10720 * script.h (Script_info::inputs): Style fix.
10721
10722 2009-07-01 Ian Lance Taylor <ian@airs.com>
10723
10724 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10725 instead of 32.
10726
10727 2009-06-24 Ian Lance Taylor <iant@google.com>
10728
10729 PR 10156
10730 * layout.cc (Layout::choose_output_section): If we find an
10731 existing section, update the flags.
10732 (Layout::create_notes): New function, broken out of
10733 Layout::finalize.
10734 (Layout::finalize): Don't create note sections.
10735 (Layout::create_note): Don't crash if linker script discards
10736 section.
10737 (Layout::create_gold_note): Likewise.
10738 (Layout::create_build_id): Likewise. Don't set
10739 after_input_sections on the section.
10740 (Layout::create_executable_stack_info): Remove target parameter.
10741 Change caller.
10742 * layout.h (class Layout): Declare create_notes. Update
10743 declaration of create_executable_stack_info.
10744 * gold.cc (queue_middle_tasks): Call create_notes.
10745 * output.cc (Output_section::update_flags_for_input_section): Move
10746 here from output.h. If SHF_ALLOC flag is newly set, mark address
10747 invalid.
10748 * output.h (Output_data::mark_address_invalid): New function.
10749 (class Output_section): Only declare, not define,
10750 update_flags_for_input_section. Remove set_flags.
10751
10752 2009-06-24 Ian Lance Taylor <iant@google.com>
10753
10754 * script-sections.cc (Output_section_definition::
10755 set_section_addresses): Rename shadowing local load_address to
10756 laddr.
10757
10758 2009-06-24 Ian Lance Taylor <iant@google.com>
10759
10760 PR 10244
10761 * reloc.cc (relocate_sections): Skip empty relocation sections.
10762
10763 2009-06-23 Ian Lance Taylor <iant@google.com>
10764
10765 PR 10156
10766 * layout.cc (Layout::create_note): Use choose_output_section
10767 rather than make_output_section.
10768
10769 2009-06-23 Ian Lance Taylor <iant@google.com>
10770
10771 PR 10237
10772 * options.cc (General_options::parse_V): Set printed_version_.
10773 (General_options::General_options): Initialize printed_version_.
10774 * options.h (class General_options): Add printed_version_ field.
10775 * gold.cc (queue_initial_tasks): If there are no input files,
10776 don't give a fatal error if we printed the version information.
10777 (queue_middle_tasks): If using -r with a shared object, give a
10778 fatal error rather than an ordinary error.
10779
10780 2009-06-23 Ian Lance Taylor <iant@google.com>
10781
10782 PR 10219
10783 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10784 (Layout::make_output_section): Set have_stabstr_section_ if we see
10785 a .stab*str section.
10786 (Layout::finalize): Call link_stabs_sections.
10787 (Layout::link_stabs_sections): New file.
10788 * layout.h (class Layout): Add have_stabstr_section_ field.
10789 Declare link_stabs_sections.
10790
10791 2009-06-23 Doug Kwan <dougkwan@google.com>
10792
10793 * Makefile.am (libgold_a_LIBADD): New.
10794 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10795 * Makefile.in: Regenerate.
10796 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10797 * configure: Regenerate.
10798 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10799 * fileread.cc: Include sys/state.h
10800 * gold.h: Declare memmem and strndup if found missing.
10801 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10802
10803 2009-06-23 Ian Lance Taylor <iant@google.com>
10804
10805 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10806 * configure: Rebuild.
10807
10808 2009-06-23 Ian Lance Taylor <iant@google.com>
10809
10810 PR 10147
10811 * object.cc (Object::section_contents): Don't try to get a view if
10812 the section has length zero.
10813 (Object::handle_gnu_warning_section): If the section is empty, use
10814 the name of the section as the warning.
10815
10816 2009-06-23 Ian Lance Taylor <iant@google.com>
10817
10818 PR 10133
10819 * stringpool.h (class Stringpool_template): Add optimize_ field.
10820 (Stringpool_template::set_optimize): New function.
10821 * stringpool.cc (Stringpool_template::Stringpool_template):
10822 Initialize optimize_ field.
10823 (Stringpool_template::set_string_offsets): Test local optimize
10824 fild rather than parameter.
10825 * layout.cc (Layout::Layout): Call set_optimize on the section
10826 name stringpool.
10827
10828 2009-06-22 Ian Lance Taylor <iant@google.com>
10829
10830 PR 10030
10831 * yyscript.y: Parse TARGET.
10832 * script.cc (script_set_target): New function.
10833 * script-c.h (script_set_target): Declare.
10834 * options.cc (General_options::string_to_object_format): Rename
10835 from string_to_object_format in anonymous namespace. Change
10836 callers.
10837 * options.h (class General_options): Declare
10838 string_to_object_format.
10839
10840 2009-06-22 Ian Lance Taylor <iant@google.com>
10841
10842 * script-sections.cc (Script_sections::create_segments): Don't put
10843 program headers in a PT_LOAD segment if -n or -N.
10844
10845 2009-06-22 Ian Lance Taylor <iant@google.com>
10846
10847 PR 10141
10848 * options.h (class General_options): Add -z lazy and -z now. Sort
10849 -z options into alphabetical order.
10850 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10851
10852 2009-06-21 Ian Lance Taylor <iant@google.com>
10853
10854 * layout.cc (Layout::make_output_section): Call
10855 Target::new_output_section.
10856 (Layout::attach_allocated_section_to_segment): Put large section
10857 sections in a separate load segment with the large segment flag
10858 set.
10859 (Layout::segment_precedes): Sort large data segments after other
10860 load segments.
10861 (align_file_offset): New static function.
10862 (Layout::set_segment_offsets): Use align_file_offset.
10863 * output.h (class Output_section): Add is_small_section_ and
10864 is_large_section_ fields.
10865 (Output_section::is_small_section): New function.
10866 (Output_section::set_is_small_section): New function.
10867 (Output_section::is_large_section): New function.
10868 (Output_section::set_is_large_section): New function.
10869 (Output_section::is_large_data_section): New function.
10870 (class Output_segment): Add is_large_data_segment_ field.
10871 (Output_segment::is_large_data_segment): New function.
10872 (Output_segment::set_is_large_data_segment): New function.
10873 * output.cc (Output_section::Output_section): Initialize new
10874 fields.
10875 (Output_segment::Output_segment): Likewise.
10876 (Output_segment::add_output_section): Add assertion that large
10877 data sections always go in large data segments. Force small data
10878 sections to the end of the list of data sections. Force small BSS
10879 sections to the start of the list of BSS sections. For large BSS
10880 sections to the end of the list of BSS sections.
10881 * symtab.h (class Symbol): Declare is_common_shndx.
10882 (Symbol::is_defined): Check Symbol::is_common_shndx.
10883 (Symbol::is_common): Likewise.
10884 (class Symbol_table): Define enum Commons_section_type. Update
10885 declarations. Add small_commons_ and large_commons_ fields.
10886 * symtab.cc (Symbol::is_common_shndx): New function.
10887 (Symbol_table::Symbol_table): Initialize new fields.
10888 (Symbol_table::add_from_object): Put small and large common
10889 symbols in the right list.
10890 (Symbol_table::sized_finalized_symbol): Check
10891 Symbol::is_common_shndx.
10892 (Symbol_table::sized_write_globals): Likewise.
10893 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10894 common symbol lists. Don't call do_allocate_commons_list if the
10895 list is empty.
10896 (Symbol_table::do_allocate_commons_list): Remove is_tls
10897 parameter. Add comons_section_type parameter. Change all
10898 callers. Handle small and large common symbols.
10899 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10900 Symbol::is_common_shndx.
10901 * resolve.cc (symbol_to_bits): Likewise.
10902 * target.h (Target::small_common_shndx): New function.
10903 (Target::small_common_section_flags): New function.
10904 (Target::large_common_shndx): New function.
10905 (Target::large_common_section_flags): New function.
10906 (Target::new_output_section): New function.
10907 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10908 small_common_section_flags, and large_common_section_flags
10909 fields.
10910 (Target::do_new_output_section): New virtual function.
10911 * arm.cc (Target_arm::arm_info): Initialize new fields.
10912 * i386.cc (Target_i386::i386_info): Likewise.
10913 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10914 Likewise.
10915 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10916 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10917 (Target_x86_64::do_new_output_section): New function.
10918 * configure.ac: Define conditional MCMODEL_MEDIUM.
10919 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10920 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10921 (large_LDFLAGS): Define.
10922 * testsuite/large.c: New file.
10923 * testsuite/testfile.cc (Target_test::test_target_info):
10924 Initialize new fields.
10925 * configure, testsuite/Makefile.in: Rebuild.
10926
10927 2009-06-05 Doug Kwan <dougkwan@google.com>
10928
10929 * Makefile.am (CCFILES): Add target.cc.
10930 * Makefile.in: Regenerate.
10931 * i386.cc (class Target_i386): Define new virtual method to
10932 override do_is_local_label_name in parent.
10933 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10934 local symbols if --discard-locals or -X is given.
10935 * options.h (class General_options): Declare new options
10936 '--discard-locals' and '-X' for discarding locals.
10937 * target.h (class Target): Define new methods is_local_label_name.
10938 Declare new virtual method do_is_local_label_name.
10939 * target.cc: New file.
10940 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10941 (check_SCRIPTS): Add discard_locals_test.sh.
10942 (check_DATA): Add discard_local_tests.syms.
10943 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10944 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10945 * testsuite/Makefile.in: Regenerate.
10946 * testsuite/discard_locals_test.c: New file.
10947 * testsuite/discard_locals_test.sh: Same.
10948
10949 2009-06-05 Doug Kwan <dougkwan@google.com>
10950
10951 * object.cc (Sized_relobj::Sized_relobj): Initialize
10952 discarded_eh_frame_shndx_ to -1U.
10953 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10954 section.
10955 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10956 a discarded .eh_frame section.
10957 (Sized_relobj::do_finalize_local_symbols): Ditto.
10958 * object.h (class Sized_relobj): Declare new member
10959 discarded_eh_frame_shndx_.
10960 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10961 (local_labels_test.o, local_labels_test): New rules.
10962 * testsuite/Makefile.in: Regenerate.
10963
10964 2009-06-04 Doug Kwan <dougkwan@google.com>
10965
10966 * layout.cc (Layout::section_name_mapping): Add mapping for
10967 special ARM sections.
10968
10969 2009-06-03 Doug Kwan <dougkwan@google.com>
10970
10971 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10972 (utils::has_overflow): Same.
10973
10974 2009-06-03 Ian Lance Taylor <iant@google.com>
10975
10976 * layout.cc (Layout::section_name_mapping): New array, replacing
10977 Layout::linkonce_mapping.
10978 (Layout::section_name_mapping_count): New variable, replacing
10979 Layout::linkonce_mapping_count.
10980 (Layout::linkonce_output_name): Remove.
10981 (Layout::output_section_name): Rewrite.
10982 * layout.h (class Layout): Rename Linkonce_mapping to
10983 Section_name_mapping, linkonce_mapping to section_name_mapping,
10984 linkonce_mapping_count to section_name_mapping_count. Don't
10985 declare linkonce_output_name.
10986
10987 2009-06-03 Doug Kwan <dougkwan@google.com>
10988
10989 * gold/arm.cc (namespace utils): New.
10990 (Target_arm::reloc_is_non_pic): Define new method.
10991 (class Arm_relocate_functions): New.
10992 (Target_arm::Relocate::relocate): Handle relocation types used by
10993 Android.
10994
10995 2009-06-03 Ian Lance Taylor <iant@google.com>
10996
10997 * arm.cc (Target_arm::scan::global): Use || instead of |.
10998
10999 2009-06-02 Doug Kwan <dougkwan@google.com>
11000
11001 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11002 issued_non_pic_error_.
11003 (class Target_arm::Scan): Declare new method check_non_pic.
11004 Define new method symbol_needs_plt_entry.
11005 Declare new data member issued_non_pic_error_.
11006 (class Target_arm::Relocate): Declare new method
11007 should_apply_static_reloc.
11008 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11009 (Target_arm::Scan::check_non_pic): Define new method.
11010 (Target_arm::Scan::local): Handle a small subset of reloc types used
11011 by Android.
11012 (Target_arm::Scan::local): Same.
11013 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11014
11015 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11016
11017 * incremental.cc (Incremental_inputs::report_command_line): Filter
11018 out --incremental-* options.
11019
11020 2009-05-29 Doug Kwan <dougkwan@google.com>
11021
11022 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11023 template class.
11024 (class Target_arm): Update comment.
11025 (Target_arm::Target_arm): Initialize new data members GOT_,
11026 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11027 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11028 and Target_arm::rel_dyn_section.
11029 Declare new_enum Target_arm::Got_type.
11030 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11031 and DYNBSS_.
11032 Update commments for member do_dynsym_value.
11033 (Target_arm::got_size, Target_arm::plt_section,
11034 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11035 new methods inside class defintion.
11036 (Target_arm::got_section): Define new method.
11037 (Target_arm::rel_dyn_section): Same.
11038 (Output_data_plt_arm): New template class.
11039 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11040 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11041 (Output_data_plt_arm::add_entry): Same.
11042 (Output_data_plt_arm::first_plt_entry): Define new
11043 static data member for PLT instruction template.
11044 (Output_data_plt_arm::plt_entry): Same.
11045 (Output_data_plt_arm::do_write): Define new method.
11046 (Target_arm::make_plt_entry): Same.
11047 (Target_arm::do_finalize_sections): Same.
11048 (Target_arm::do_dynsym_value): Same.
11049
11050 2009-05-28 Doug Kwan <dougkwan@google.com>
11051
11052 * Makefile.am (TARGETSOURCES): Add arm.cc.
11053 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11054 * Makefile.in: Regenerate.
11055 * arm.cc: New file.
11056 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11057
11058 2009-05-26 Doug Kwan <dougkwan@google.com>
11059
11060 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11061 (General_options::check_excluded_libs): Strip off directories in
11062 archive name before matching like GNU ld does.
11063 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11064 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11065 (exclude_libs_test_LDFLAGS): Add linker option
11066 -Wl,--exclude-libs,libexclude_libs_test_3
11067 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11068 an explicit archive without using -l.
11069 (alt/libexclude_libs_test_3.a): New make rule.
11070 * testsuite/Makefile.in: Regenerate.
11071 * testsuite/exclude_libs_test.c : Declare lib3_default().
11072 (main): Call it.
11073 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11074 * exclude_libs_test_3.c: New file.
11075
11076 2009-05-26 Nick Clifton <nickc@redhat.com>
11077
11078 * po/id.po: New Indonesian translation.
11079 * po/gold.pot: Updated template file.
11080
11081 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11082
11083 * testsuite/Makefile.am: Add -ffunction-sections to compile
11084 gc_comdat_test files. Add -Wl,--gc-sections to build
11085 gc_comdat_test.
11086 * testsuite/Makefile.in: Regenerate.
11087 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11088
11089 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11090
11091 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11092 kept comdat section was garbage collected.
11093 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11094 * testsuite/Makefile.in: Regenerate.
11095 * testsuite/gc_comdat_test.sh: New file.
11096 * testsuite/gc_comdat_test_1.cc: New file.
11097 * testsuite/gc_comdat_test_2.cc: New file.
11098
11099 2009-05-19 Doug Kwan <dougkwan@google.com>
11100
11101 * archive.cc (Archive::Archive): Move constructor from archive.h
11102 to here. Initialize no_export_.
11103 (Archive::get_elf_object_for_member): Set no_export flag of object.
11104 * archive.h (Archive::Archive): Move constructor body to
11105 archive.cc.
11106 (Archive::no_export): New method.
11107 (Archive::no_export_): New field.
11108 * object.h (Object::Object): Initialize no_export_ to false.
11109 (Object::no_export, Object::set_no_export): New methods.
11110 (Object::no_export_): New field.
11111 * options.cc (General_options::parse_exclude_libs): New method.
11112 (General_options::check_excluded_libs) Same.
11113 * options.h (exclude_libs): New option.
11114 (General_options::check_excluded_libs): New method declaration.
11115 (General_options::excluded_libs_): New field.
11116 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11117 default or protected visibility if an object has no-export flag set.
11118 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11119 (check_SCRIPTS): Add exclude_libs_test.sh.
11120 (check_DATA): Add exclude_libs_test.syms.
11121 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11122 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11123 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11124 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11125 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11126 libexclude_libs_test_2.a): New rules.
11127 * testsuite/Makefile.in: Regenerate.
11128 * testsuite/exclude_libs_test.c: New file.
11129 * testsuite/exclude_libs_test.sh: Ditto.
11130 * testsuite/exclude_libs_test_1.c: Ditto.
11131 * testsuite/exclude_libs_test_2.c: Ditto.
11132
11133 2009-05-15 Ian Lance Taylor <iant@google.com>
11134
11135 * configure.ac: Check for declarations for cases where libiberty.h
11136 checks HAVE_DECL_xxx.
11137 * configure, config.in: Rebuild.
11138
11139 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11140
11141 * gold.h (Incremental_argument_list): Remove (invalid) forward
11142 declaration.
11143 * incremental.cc (Incremental_inputs::report_achive): New method.
11144 (Incremental_inputs::report_object): New method.
11145 (Incremental_inputs::report_script): New method.
11146 (Incremental_inputs::finalize_inputs): New method.
11147 (Incremental_inputs::finalize): Call finalize_inputs().
11148 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11149 Create inputs entries.
11150 * incremental.h (Incremental_input_type): New enum.
11151 (Incremental_inputs::Incremental_input): Initialize new fields.
11152 (Incremental_inputs::report_inputs): New method.
11153 (Incremental_inputs::report_achive): New method.
11154 (Incremental_inputs::report_object): New method.
11155 (Incremental_inputs::report_script): New method.
11156 (Incremental_inputs::finalize_inputs): New method.
11157 (Incremental_inputs::Input_info): New struct.
11158 (Incremental_inputs::Input_info_map): New typedef.
11159 (Incremental_inputs::lock_): New field.
11160 (Incremental_inputs::Inputs_): New field.
11161 (Incremental_inputs::Inputs_map): New field.
11162 * main.cc (main): Call Incremental_input::report_inputs.
11163 * options.h (Input_argument_list): Typedef moved from
11164 Input_arguments.
11165 (Input_file_group::Files): Remove, use ::Input_argument_list.
11166 (Input_file_group::Input_argument_list): Remove, use
11167 ::Input_argument_list.
11168 * plugin.cc (Plugin_manager::add_input_file): Add error in
11169 incremental build.
11170 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11171 functions.
11172 * script.cc (read_input_script): Call
11173 Incremental_input::report_script.
11174 * script.h (Script_info): New class.
11175
11176 2009-04-27 Ian Lance Taylor <iant@google.com>
11177
11178 * x86_64.cc (do_adjust_output_section): Set entsize to
11179 plt_entry_size.
11180
11181 2009-04-23 Elliott Hughes <enh@google.com>
11182
11183 * output.cc (Output_file::close): After short writes, continue
11184 writing from the correct offset in the buffer being written.
11185
11186 2009-04-23 Chris Demetriou <cgd@google.com>
11187
11188 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11189 * configure: Regenerate.
11190 * config.in: Regenerate.
11191 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11192 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11193
11194 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11195
11196 * incremental.cc (Incremental_inputs_header_data): Renamed from
11197 Incremental_input_header_data.
11198 (Incremental_inputs_header_data::data_size): New field.
11199 (Incremental_inputs_header_data::put_input_file_count): Renamed
11200 from input_file_count.
11201 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11202 from command_line_offset.
11203 (Incremental_inputs_header_data::put_reserved): Renamed from
11204 put_reserved.
11205 (Incremental_inputs_entry_data): Renamed from
11206 Incremental_input_entry_data.
11207 (Incremental_inputs_entry_data::data_size): New field.
11208 (Incremental_inputs::report_command_line): New method.
11209 (Incremental_inputs::finalize): New method.
11210 (Incremental_inputs::create_incremental_inputs_data): New method.
11211 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11212 * incremental.h: New file.
11213 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11214 (Layout::finalize): Create incremental inputs section in
11215 incremental builds.
11216 (Layout::create_incremental_info_sections): New method.
11217 * layout.h (Layout::incremental_inputs): New method.
11218 (Layout::create_incremental_info_sections): New method.
11219 (Layout::incremental_inputs_): New field.
11220 * main.cc (main): Notify Incremental_input of the command line.
11221
11222 2009-04-01 Ian Lance Taylor <iant@google.com>
11223 Mikolaj Zalewski <mikolajz@google.com>
11224
11225 * gold.h (reserve_unordered_map): Define, three versions, one for
11226 each version of Unordered_map.
11227 * layout.cc (Layout::Layout): Remove options parameter. Add
11228 number_of_input_files parameter. Don't initialize options_.
11229 Initialize number_of_input_files_ and resized_signatures_. Move
11230 sections_are_attached_.
11231 (Layout::layout_group): Reserve space for group_signatures_.
11232 (Layout::find_or_add_kept_section): Change name parameter to be a
11233 reference. Resize signatures_ map when it gets large enough.
11234 (Layout::layout_eh_frame): Use parameters->options() instead of
11235 this->options_.
11236 (Layout::make_output_section): Likewise.
11237 (Layout::attach_allocated_section_to_segment): Likewise.
11238 (Layout::finalize, Layout::create_executable_stack): Likewise.
11239 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11240 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11241 * layout.h (class Layout): Update declarations. Remove options_
11242 field. Add number_of_input_files_ and resized_signatures_
11243 fields. Move sections_are_attached_ field.
11244 * main.cc (main): Pass number of input files to Layout
11245 constructor. Don't pass options.
11246
11247 2009-03-30 Ian Lance Taylor <iant@google.com>
11248
11249 * ffsll.c (ffsll): Correct implementation.
11250
11251 2009-03-27 Ian Lance Taylor <iant@google.com>
11252
11253 * ffsll.c: New file.
11254 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11255 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11256 * ftruncate.c (ftruncate): Declare before definition.
11257 * mremap.c (mremap): Likewise.
11258 * pread.c (pread): Likewise.
11259 * configure, Makefile.in, config.in: Rebuild.
11260
11261 * mremap.c: New file.
11262 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11263 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11264 (mremap): Declare if HAVE_MREMAP is not defined.
11265 * configure, Makefile.in, config.in: Rebuild.
11266
11267 2009-03-27 Cary Coutant <ccoutant@google.com>
11268
11269 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11270 position independent.
11271 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11272 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11273
11274 2009-03-24 Cary Coutant <ccoutant@google.com>
11275
11276 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11277 an executable.
11278 (needs_dynamic_reloc): Likewise.
11279
11280 2009-03-24 Ian Lance Taylor <iant@google.com>
11281
11282 * yyscript.y (file_cmd): Recognize EXTERN.
11283 (extern_name_list, extern_name_list_body): New nonterminals.
11284 * script.cc (script_add_extern): Define.
11285 * script-c.h (script_add_extern): Declare.
11286
11287 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11288
11289 * object.cc (is_elf_object): Define.
11290 * object.h (is_elf_object): Declare.
11291 * archive.cc (Archive::get_elf_object_for_member): Call
11292 is_elf_object.
11293 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11294
11295 2009-03-24 Elliott Hughes <enh@google.com>
11296
11297 * output.cc (Output_file::map_anonymous): Define.
11298 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11299 try an anonymous one. Report the size if the mmap fails.
11300 * output.h (class Output_file): Declare map_anonymous.
11301
11302 2009-03-24 Ian Lance Taylor <iant@google.com>
11303
11304 * target-select.cc (instantiate_target): Don't acquire the lock if
11305 the instantiated_target_ field has already been set.
11306
11307 2009-03-23 Ian Lance Taylor <iant@google.com>
11308
11309 * gold-threads.h (class Initialize_lock): Define.
11310 * gold-threads.cc (class Initialize_lock_once): Define.
11311 (initialize_lock_control): New static variable.
11312 (initialize_lock_pointer): New static variable.
11313 (initialize_lock_once): New static function.
11314 (Initialize_lock::Initialize_lock): Define.
11315 (Initialize_lock::initialize): Define.
11316 * target-select.h: Include "gold-threads.h".
11317 (class Target_selector): Add lock_ and initialize_lock_ fields.
11318 Don't define instantiate_target, just declare it.
11319 * target-select.cc (Target_selector::Target_selector): Initialize
11320 new fields.
11321 (Target_selector::instantiate_target): Define.
11322 * descriptors.h: Include "gold-threads.h".
11323 (class Descriptors): Add initialize_lock_ field.
11324 * descriptors.cc (Descriptors::Descriptors): Initialize new
11325 field.
11326 (Descriptors::open): Use initialize_lock_ field
11327 * errors.h (class Errors): Add initialize_lock_ field.
11328 * errors.cc (Errors::Errors): Initialize new field.
11329 (Errors::initialize_lock): Use initialize_lock_ field.
11330 * powerpc.cc (class Target_selector_powerpc): Remove
11331 instantiated_target_ field. In do_recognize call
11332 instantiate_target rather than do_instantiate_target. In
11333 do_instantiate_target just allocate a new target.
11334 * sparc.cc (class Target_selector_sparc): Likewise.
11335
11336 * freebsd.h: New file.
11337 * i386.cc: Include "freebsd.h".
11338 (Target_i386): Derive from Target_freebsd rather than
11339 Sized_target.
11340 (Target_selector_i386): Derive from Target_selector_freebsd rather
11341 than Target_selector.
11342 * x86_64.cc: Include "freebsd.h".
11343 (Target_x86_64): Derive from Target_freebsd rather than
11344 Sized_target.
11345 (Target_selector_x86_64): Derive from Target_selector_freebsd
11346 rather than Target_selector.
11347 * target.h (class Target): Add adjust_elf_header and
11348 do_adjust_elf_header.
11349 * output.cc (Output_file_header:: do_sized_write): Call target
11350 adjust_elf_header routine.
11351 * configure.tgt: Set targ_osabi.
11352 * configure.ac: Define GOLD_DEFAULT_OSABI.
11353 * parameters.cc (Parameters::default_target): Pass
11354 GOLD_DEFAULT_OSABI to select_target.
11355 * target-select.h (class Target_selector): Make instantiate_target
11356 protected rather than private.
11357 * Makefile.am (HFILES): Add freebsd.h.
11358 * configure, Makefile.in, config.in: Rebuild.
11359
11360 * merge.cc (do_add_input_section): Correct pend value. Change
11361 message about last entry not being null terminated from error to
11362 warning.
11363
11364 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11365
11366 * incremental.cc: New file.
11367 * Makefile.am (CCFILES): Add incremental.cc.
11368 * Makefile.in: Rebuild.
11369
11370 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11371
11372 * layout.cc (Layout::output_section_name): Preserve names
11373 of '.note.' sections.
11374
11375 2009-03-19 Ian Lance Taylor <iant@google.com>
11376
11377 * descriptors.cc (Descriptors::open): Check that the options are
11378 valid before using them.
11379
11380 2009-03-18 Ian Lance Taylor <iant@google.com>
11381
11382 * script-sections.h: Include <list>.
11383 (class Script_sections): Change Sections_elements from std::vector
11384 to std::list. Typedef public Elements_iterator. Add
11385 orphan_section_placement_, data_segment_align_start_, and
11386 saw_data_segment_align_ fields. Remove data_segment_align_index_
11387 field.
11388 * script-sections.cc (class Orphan_section_placement): New class.
11389 (class Sections_element): Add virtual functions is_relro and
11390 orphan_section_init. Remove virtual function place_orphan_here.
11391 (class Output_section_definition): Add is_relro and
11392 orphan_section_init. Remove place_orphan_here.
11393 (class Orphan_output_section): Likewise.
11394 (Script_sections::Script_sections): Update for field changes.
11395 (Script_sections::data_segment_align): Set saw_data_segment_align_
11396 and data_segment_align_start_, not data_segment_align_index.
11397 (Script_sections::data_segment_relro_end): Check
11398 saw_data_segment_align_. Use data_segment_align_start_ rather
11399 than data_segment_align_index_.
11400 (Script_sections::place_orphan): Rewrite to use
11401 Orphan_section_placement.
11402
11403 2009-03-17 Ian Lance Taylor <iant@google.com>
11404
11405 * archive.cc (Archive::add_symbols): Check for a version attached
11406 to the symbol name in the archive map.
11407 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11408 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11409 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11410 (ver_test_11.a): New target.
11411 * testsuite/Makefile.in: Rebuild.
11412
11413 * configure.ac: Check for chsize and posix_fallocate. Replace
11414 ftruncate.
11415 * ftruncate.c: New file, from gnulib.
11416 * output.cc (posix_fallocate): Define dummy version if not
11417 HAVE_POSIX_FALLOCATE.
11418 (Output_file::map): Call posix_fallocate rather than lseek and
11419 write.
11420 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11421 * configure, Makefile.in, config.in: Rebuild.
11422
11423 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11424
11425 * layout.h (Layout::create_note): Add section_name parameter.
11426 * layout.cc (Layout::create_note): Likewise.
11427 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11428
11429 2009-03-17 Ian Lance Taylor <iant@google.com>
11430
11431 * descriptors.cc: Include "options.h".
11432 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11433 (Descriptors::open): Always use O_CLOEXEC when opening a new
11434 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11435 then set FD_CLOEXEC.
11436
11437 * sparc.cc (class Target_sparc): Add has_got_section.
11438 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11439 make sure we have a GOT section.
11440
11441 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11442 (Target_sparc::Scan::local): Likewise.
11443 (Target_sparc::Scan::global): Likewise.
11444 (Target_sparc::Relocate::relocate): Likewise.
11445 (Target_sparc::Relocate::relocate_tls): Likewise.
11446
11447 * symtab.cc (Symbol_table::define_default_version): New function,
11448 broken out of add_from_object.
11449 (Symbol_table::add_from_object): Call define_default_version.
11450 (Symbol_table::define_special_symbol): Add resolve_oldsym
11451 parameter. Change all callers. If the version for a symbol comes
11452 from a version script, resolve it with the symbol with the same
11453 name with no version. Also add the symbol without a version if
11454 appropriate.
11455 (do_define_in_output_data): If resolving with oldsym, don't delete
11456 sym.
11457 (do_define_in_output_segment): Likewise.
11458 (do_define_as_constant): Likewise.
11459 * symtab.h (class Symbol_table): Update declarations.
11460
11461 2009-03-13 Ian Lance Taylor <iant@google.com>
11462
11463 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11464 (Read_symbols::requeue): New function.
11465 (Read_symbols::do_read_symbols): If make_elf_object fails because
11466 the target type is not configured, and the file was searched for,
11467 issue a warning and retry with the next directory.
11468 (Add_symbols::run): If the file has an incompatible format, and
11469 it was searched for, requeue the Read_symbols task. On error,
11470 release the object.
11471 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11472 dirindex parameter to constructor. Change all callers. Declare
11473 incompatible_warning and requeue.
11474 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11475 input_argument_ and input_group_ fields. Add them to
11476 constructor. Change all callers.
11477 (class Read_script): Add dirindex_ field. Add it to constructor.
11478 Change all callers.
11479 * archive.cc (Archive::setup): Remove input_objects parameter.
11480 Change all callers.
11481 (Archive::get_file_and_offset): Likewise.
11482 (Archive::read_all_symbols): Likewise.
11483 (Archive::read_symbols): Likewise.
11484 (Archive::get_elf_object_for_member): Remove input_objects
11485 parameter. Add punconfigured parameter. Change all callers.
11486 (Archive::add_symbols): Change return type to bool. Check return
11487 value of include_member.
11488 (Archive::include_all_members): Likewise.
11489 (Archive::include_member): Change return type to bool. Return
11490 false if first included object has incompatible target. Set
11491 included_member_ field.
11492 (Add_archive_symbols::run): If add_symbols returns false, requeue
11493 Read_symbols task.
11494 * archive.h (class Archive): Add included_member_ field.
11495 Initialize it in constructor. Add input_file and searched_for
11496 methods. Update declarations.
11497 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11498 input_argument_ fields. Add them to constructor. Change all
11499 callers.
11500 * script.cc: Include "target-select.h".
11501 (class Parser_closure): Add skip_on_incompatible_target_ and
11502 found_incompatible_target_ fields. Add
11503 skip_on_incompatible_target parameter to constructor. Change all
11504 callers. Add methods skip_on_incompatible_target,
11505 clear_skip_on_incompatible_target, found_incompatible_target, and
11506 set_found_incompatible_target.
11507 (read_input_script): Add dirindex parameter. Change all callers.
11508 If parser finds an incompatible target, requeue Read_symbols
11509 task.
11510 (script_set_symbol): Clear skip_on_incompatible_target in
11511 closure.
11512 (script_add_assertion, script_parse_option): Likewise.
11513 (script_start_sections, script_add_phdr): Likewise.
11514 (script_check_output_format): New function.
11515 * script.h (read_input_script): Update declaration.
11516 * script-c.h (script_check_output_format): Declare.
11517 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11518 (ignore_cmd): Remove OUTPUT_FORMAT.
11519 * fileread.cc (Input_file::Input_file): Add explicit this.
11520 (Input_file::will_search_for): New function.
11521 (Input_file::open): Add pindex parameter. Change all callers.
11522 * fileread.h (class Input_file): Add input_file_argument method.
11523 Declare will_search_for. Update declarations.
11524 * object.cc (make_elf_object): Add punconfigured parameter.
11525 Change all callers.
11526 * object.h (class Object): Make input_file public. Add
11527 searched_for method.
11528 (make_elf_object): Update declaration.
11529 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11530 restart search.
11531 * dirsearch.h (class Dirsearch): Update declaration.
11532 * options.h (class General_options): Add --warn-search-mismatch.
11533 * parameters.cc (Parameters::is_compatible_target): New function.
11534 * parameters.h (class Parameters): Declare is_compatible_target.
11535 * workqueue.cc (Workqueue::add_blocker): New function.
11536 * workqueue.h (class Workqueue): Declare add_blocker.
11537
11538 * fileread.cc (Input_file::open): Remove options parameter.
11539 Change all callers.
11540 (Input_file::open_binary): Likewise.
11541 * script.cc (read_input_script): Likewise.
11542 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11543 options parameter from constructor. Change all callers.
11544 (class Read_script): Likewise.
11545 * fileread.h (class Input_file): Update declarations.
11546 * script.h (read_input_script): Update declaration.
11547
11548 2009-03-10 Nick Clifton <nickc@redhat.com>
11549
11550 * po/es.po: New Spanish translation.
11551
11552 2009-03-06 Cary Coutant <ccoutant@google.com>
11553
11554 * options.cc (parse_short_option): Keep dash_z from registering itself.
11555
11556 2009-03-03 Ian Lance Taylor <iant@google.com>
11557
11558 PR 9918
11559 * target-reloc.h (relocate_section): Pass output_section to
11560 relocate.
11561 * i386.cc (Target_i386::should_apply_static_reloc): Add
11562 output_section parameter. Change all callers.
11563 (Target_i386::Relocate::relocate): Add output_section parameter.
11564 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11565 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11566 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11567 * testsuite/two_file_shared.sh: New script.
11568 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11569 (check_DATA): Add two_file_shared.dbg.
11570 (two_file_shared.dbg): New target.
11571 * testsuite/Makefile.in: Rebuild.
11572
11573 2009-03-01 Ian Lance Taylor <iant@google.com>
11574
11575 * configure.ac: Check for byteswap.h.
11576 * configure: Rebuild.
11577 * config.in: Rebuild.
11578
11579 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11580
11581 * layout.cc (Layout::find_or_add_kept_section): New function.
11582 (Layout::add_comdat): Removed.
11583 * layout.h (struct Kept_section): Move out of class Layout.
11584 Remove trailing underscores from field names. Add group_sections
11585 field. Rename group_ field to is_group. Change all uses.
11586 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11587 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11588 comdat_groups_ field.
11589 (Sized_relobj::include_section_group): Use
11590 find_or_add_kept_section and Kept_section::group_sections.
11591 (Sized_relobj::include_linkonce_section): Likewise.
11592 * object.cc (class Sized_relobj): Don't define Comdat_group or
11593 Comdat_group_table. Remove find_comdat_group and
11594 add_comdat_group. Remove comdat_groups_ field.
11595 * plugin.cc (include_comdat_group): Use
11596 Layout::find_or_add_kept_section.
11597
11598 2009-02-28 Ian Lance Taylor <iant@google.com>
11599
11600 * README: --gc-sections and map files are now supported. Document
11601 some build requirements.
11602
11603 PR 6992
11604 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11605 relocatable link set the value of the section symbol to zero.
11606 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11607 relocatable link don't include the section address in the local
11608 symbol value.
11609
11610 2009-02-27 Ian Lance Taylor <iant@google.com>
11611
11612 PR 6811
11613 * options.h (class Search_directory): Add is_system_directory.
11614 (class General_options): Declare is_in_system_directory.
11615 * options.cc (get_relative_sysroot): Make static.
11616 (get_default_sysroot): Make static.
11617 (General_optoins::is_in_system_directory): New function.
11618 * fileread.cc (Input_file::is_in_system_directory): New function.
11619 * fileread.h (class Input_file): Declare is_in_system_directory.
11620 * object.h (class Object): Add is_in_system_directory.
11621 (class Input_objects): Remove system_library_directory_ field.
11622 * object.cc (Input_objects::add_object): Don't set
11623 system_library_directory_.
11624 (input_objects::found_in_system_library_directory): Remove.
11625 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11626 parameter. Change all callers.
11627 (Symbol_table::sized_write_globals): Likewise.
11628 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11629 Call Object::is_in_system_directory.
11630 * symtab.h (class Symbol_table): Update declarations.
11631
11632 PR 5990
11633 * descriptors.h (Open_descriptor): Add is_on_stack field.
11634 * descriptors.cc (Descriptors::open): If the descriptor is on the
11635 top of the stack, remove it. Initialize is_on_stack field.
11636 (Descriptors::release): Only add pod to stack if it is not on the
11637 stack already.
11638 (Descriptors::close_some_descriptor): Clear stack_next and
11639 is_on_stack fields.
11640
11641 PR 7091
11642 * output.cc (Output_section::find_starting_output_address): Rename
11643 from starting_output_address; add PADDR parameter; change return
11644 type.
11645 * output.h (class Output_section): Declare
11646 find_starting_output_address instead of starting_output_address.
11647 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11648 section symbol for which we can't find a merge section.
11649
11650 PR 9836
11651 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11652 hidden or internal, force the symbol to be local.
11653 * resolve.cc (Symbol::override_visibility): Define.
11654 (Symbol::override_base): Use override_visibility.
11655 (Symbol_table::resolve): Likewise.
11656 (Symbol::override_base_with_special): Likewise.
11657 (Symbol_table::override_with_special): If the visibility is hidden
11658 or internal, force the symbol to be local.
11659 * symtab.h (class Symbol): Add set_visibility and
11660 override_visibility.
11661 * testsuite/ver_test_1.sh: New file.
11662 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11663 (check_DATA): Add ver_test_1.syms.
11664 (ver_test_1.syms): New target.
11665 * testsuite/Makefile.in: Rebuild.
11666
11667 2009-02-25 Cary Coutant <ccoutant@google.com>
11668
11669 * layout.cc (Layout::choose_output_section): Don't rename sections
11670 when using a linker script that has a SECTIONS clause.
11671 * Makefile.in: Regenerate.
11672
11673 * testsuite/Makefile.am (script_test_5.sh): New test case.
11674 * testsuite/Makefile.in: Regenerate.
11675 * testsuite/script_test_5.cc: New file.
11676 * testsuite/script_test_5.sh: New file.
11677 * testsuite/script_test_5.t: New file.
11678
11679 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11680
11681 * archive.cc (Archive::include_member): Update calls to add_symbols.
11682 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11683 the Layout argument.
11684 * dynobj.h (do_add_symbols): Add the Layout argument.
11685 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11686 Layout argument.
11687 * object.h (Object::add_symbols): Add the Layout argument.
11688 (Object::do_add_symbols): Add the Layout argument.
11689 (Sized_relobj::do_add_symbols): Add the Layout argument.
11690 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11691 Unify the two versions.
11692 (Add_plugin_symbols): Remove.
11693 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11694 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11695 (Add_plugin_symbols): Remove.
11696 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11697 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11698 (Add_symbols::run): Make it work with Pulginobj.
11699
11700 2009-02-06 Ian Lance Taylor <iant@google.com>
11701
11702 * object.cc (Sized_relobj::do_layout): Make info message start
11703 with lower case letter.
11704
11705 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11706
11707 * binary.cc: Fix file comment.
11708
11709 * options.h (enum Incremental_disposition): Define.
11710 (class General_options): Add new options: --incremental,
11711 --incremental_changed, --incremental_unchanged,
11712 --incremental_unknown. Add incremental_disposition_ and
11713 implicit_incremental_ fields.
11714 (General_options::incremental_disposition): New function.
11715 (class Position_dependent_options): Add incremental_disposition
11716 option.
11717 (Position_dependent_options::copy_from_options): Set incremental
11718 dispositions.
11719 * options.cc (General_options::parse_incremental_changed): New
11720 function.
11721 (General_options::parse_incremental_unchanged): New function.
11722 (General_options::parse_incremental_unknown): New function.
11723 (General_options::General_options): Initialize new fields
11724 incremental_disposition_ and implicit_incremental_.
11725 (General_options::finalize): Check for uasge of --incremental-*
11726 without --incremental.
11727
11728 2009-02-06 Chris Demetriou <cgd@google.com>
11729
11730 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11731 pointer and to report location as the file name associated with
11732 the symbol.
11733 (gold_undefined_symbol_at_location): New function to replace the
11734 old gold_undefined_symbol functionality.
11735 * target-reloc.h (relocate_section): Update to use
11736 gold_undefined_symbol_at_location.
11737 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11738 Call gold_undefined_symbol function rather than gold_error.
11739 * errors.h (Errors::undefined_symbol): Take location as a
11740 string, rather than calculating it from a relocation.
11741 * errors.cc (Errors::fatal): Print "fatal error:" before the
11742 formatted message.
11743 (Errors::error, Errors::error_at_location): Print "error: "
11744 before the formatted message.
11745 (Errors::undefined_symbol): Take location as a string, rather
11746 than calculating it from a relocation.
11747 (gold_undefined_symbol_at_location): New function akin to
11748 old gold_undefined_symbol, calculates location from relocation.
11749 (gold_undefined_symbol): Change to take only a Symbol pointer
11750 and to report location as the file name associated with the symbol.
11751 * testsuite/debug_msg.sh: Update for changed error messages.
11752 * testsuite/undef_symbol.sh: Likewise.
11753
11754 2009-02-04 Duncan Sands <baldrick@free.fr>
11755
11756 PR 9812
11757 * reduced_debug_output.h
11758 (Output_reduced_debug_abbrev_section::failed): Use format for
11759 gold_warning.
11760 (Output_reduced_debug_info_section::faild): Likewise.
11761
11762 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11763
11764 * script.cc (Lazy_demangler): New class.
11765 (Version_script_info::get_symbol_version_helper): Demangle a
11766 symbol only once.
11767
11768 2009-01-29 Cary Coutant <ccoutant@google.com>
11769
11770 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11771 to __tls_get_addr.
11772 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11773
11774 2009-01-28 Ian Lance Taylor <iant@google.com>
11775
11776 * version.cc (version_string): Bump to 1.9.
11777
11778 * gold.h: Include <cstring> and <stdint.h>.
11779 * version.cc: Include <cstdio>.
11780 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11781 warning.
11782 * reduced_debug_output.cc (insert_into_vector): Rename from
11783 Insert_into_vector; change all callers. Use Swap_unaligned to
11784 avoid aliasing issue; remove union since it is unnecessary.
11785
11786 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11787
11788 * Makefile.am (CCFILES): Add gc.cc.
11789 (HFILES): Add gc.h.
11790 * Makefile.in: Regenerate.
11791 * gold.cc (Gc_runner): New class.
11792 (queue_initial_tasks): Call garbage collection related tasks
11793 when corresponding options are invoked.
11794 (queue_middle_gc_tasks): New function.
11795 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11796 processed early before laying out sections during garbage collection.
11797 * gold.h (queue_middle_gc_tasks): New function.
11798 (is_prefix_of): Move from "layout.cc".
11799 * i386.cc (Target_i386::gc_process_relocs): New function.
11800 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11801 * main.cc (main): Create object of class "Garbage_collection".
11802 * object.cc (Relobj::copy_symbols_data): New function.
11803 (Relobj::is_section_name_included): New function.
11804 (Sized_relobj::do_layout): Allow this function to be called twice
11805 during garbage collection and defer layout of section during the
11806 first call.
11807 * object.h (Relobj::get_symbols_data): New function.
11808 (Relobj::is_section_name_included): New function.
11809 (Relobj::copy_symbols_data): New function.
11810 (Relobj::set_symbols_data): New function.
11811 (Relobj::get_relocs_data): New function.
11812 (Relobj::set_relocs_data): New function.
11813 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11814 (Relobj::gc_process_relocs): New function.
11815 (Relobj::do_gc_process_relocs): New pure virtual function.
11816 (Relobj::sd_): New data member.
11817 (Sized_relobj::is_output_section_offset_invalid): New function.
11818 (Sized_relobj::do_gc_process_relocs): New function.
11819 * options.h (General_options::gc_sections): Modify to not be a no-op.
11820 (General_options::print_gc_sections): New option.
11821 * plugin.cc (Plugin_finish::run): Remove function call to
11822 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11823 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11824 * reloc.cc (Read_relocs::run): Add task to process relocs and
11825 determine unreferenced sections when doing garbage collection.
11826 (Gc_process_relocs): New class.
11827 (Sized_relobj::do_gc_process_relocs): New function.
11828 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11829 sections that are garbage collected.
11830 * reloc.h (Gc_process_relocs): New class.
11831 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11832 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11833 symbols whose corresponding sections are garbage collected.
11834 (Symbol_table::Symbol_table): Add new parameter for the garbage
11835 collection object.
11836 (Symbol_table::gc_mark_undef_symbols): New function.
11837 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11838 (Symbol_table::gc_mark_dyn_syms): New function.
11839 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11840 as garbage.
11841 (Symbol_table::add_from_object): Likewise.
11842 (Symbol_table::add_from_relobj): When building shared objects, do not
11843 treat externally visible symbols as garbage.
11844 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11845 table information for static and relocatable links.
11846 * symtab.h (Symbol_table::set_gc): New function.
11847 (Symbol_table::gc): New function.
11848 (Symbol_table::gc_mark_undef_symbols): New function.
11849 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11850 (Symbol_table::gc_mark_dyn_syms): New function.
11851 (Symbol_table::gc_): New data member.
11852 * target.h (Sized_target::gc_process_relocs): New pure virtual
11853 function.
11854 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11855 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11856
11857 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11858
11859 * options.h (General_options::gc_sections): Define as a no-op for now.
11860 (General_options::no_keep_memory): Ditto.
11861 (General_options::Bshareable): Define.
11862 * options.cc (General_options::finalize): Honor -Bshareable.
11863
11864 2009-01-20 Andreas Schwab <schwab@suse.de>
11865
11866 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11867 read the value in the contents, since we don't use it. Use the
11868 template endianness when writing.
11869 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11870
11871 2009-01-19 Andreas Schwab <schwab@suse.de>
11872
11873 * configure.tgt (powerpc64-*): Fix targ_obj.
11874
11875 2009-01-15 Ian Lance Taylor <iant@google.com>
11876
11877 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11878 local symbols when stripping all symbols.
11879
11880 2009-01-14 Cary Coutant <ccoutant@google.com>
11881
11882 * output.cc (Output_reloc): Add explicit instantiations.
11883
11884 2009-01-14 Cary Coutant <ccoutant@google.com>
11885
11886 * archive.cc (Archive::get_elf_object_for_member): Remove call
11887 to File_read::claim_for_plugin.
11888 * descriptors.cc (Descriptors::open): Remove reference to
11889 is_claimed.
11890 (Descriptors::claim_for_plugin): Remove.
11891 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11892 (Descriptors::is_claimed): Remove.
11893 (claim_descriptor_for_plugin): Remove.
11894 * fileread.cc (File_read::claim_for_plugin): Remove.
11895 * fileread.h (File_read::claim_for_plugin): Remove.
11896 (File_read::descriptor): Reopen descriptor if necessary.
11897 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11898 (Plugin_manager::all_symbols_read): Add task parameter. Change
11899 all callers.
11900 (Plugin_manager::get_input_file): New function.
11901 (Plugin_manager::release_input_file): New function.
11902 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11903 corresponding data member.
11904 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11905 and pass to base constructor. Change all callers.
11906 (get_input_file, release_input_file): New functions.
11907 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11908 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11909 (Plugin_manager::all_symbols_read): Add task parameter.
11910 (Plugin_manager::get_input_file): New function.
11911 (Plugin_manager::release_input_file): New function.
11912 (Plugin_manager::task_): New data member.
11913 (Pluginobj::Pluginobj): Add filesize parameter.
11914 (Pluginobj::filename): New function.
11915 (Pluginobj::descriptor): New function.
11916 (Pluginobj::filesize): New function.
11917 (Pluginobj::filesize_): New data member.
11918 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11919 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11920 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11921
11922 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11923 with archive libraries.
11924 * testsuite/Makefile.in: Regenerate.
11925 * testsuite/plugin_test.c (struct sym_info): New type.
11926 (get_input_file, release_input_file): New static variables.
11927 (onload): Capture new transfer vector entries.
11928 (claim_file_hook): Stop reading at end of file according to filesize.
11929 Factor out parsing of readelf output into separate function.
11930 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11931 APIs and get the source file name from the symbol table. Convert
11932 source file name to corresponding object file name. Print info
11933 message when adding new input files.
11934 (parse_readelf_line): New function.
11935 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11936 * testsuite/plugin_test_2.sh: Likewise.
11937 * testsuite/plugin_test_3.sh: Likewise.
11938 * testsuite/plugin_test_4.sh: New test case.
11939
11940 2009-01-07 Ian Lance Taylor <iant@google.com>
11941
11942 * version.cc (version_string): Bump to 1.8.
11943
11944 2008-12-23 Cary Coutant <ccoutant@google.com>
11945
11946 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11947 * plugin.cc (Plugin_manager::finish): Rename as
11948 layout_deferred_objects. Move cleanup to separate function.
11949 (Plugin_manager::cleanup): New function.
11950 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11951 separately.
11952 * plugin.h (Plugin_manager::finish): Rename as
11953 layout_deferred_objects.
11954 (Plugin_manager::cleanup): New function.
11955 (Plugin_manager::cleanup_done): New field.
11956
11957 2008-12-23 Cary Coutant <ccoutant@google.com>
11958
11959 * plugin.cc (is_visible_from_outside): New function.
11960 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11961 so we don't return "IR only" status for exported symbols or -r links.
11962
11963 * testsuite/Makefile.am (plugin_test_3): New test case.
11964 * testsuite/Makefile.in: Regenerate.
11965 * testsuite/plugin_test_3.sh: New file.
11966
11967 2008-12-22 Cary Coutant <ccoutant@google.com>
11968
11969 * object.cc (Sized_relobj::layout_section): New function.
11970 (Sized_relobj::do_layout): Defer layout of input sections until after
11971 plugin has provided replacement files.
11972 (Sized_relobj::do_layout_deferred_sections): New function.
11973 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11974 (Relobj::layout_deferred_sections): New function.
11975 (Relobj::do_layout_deferred_sections): New function.
11976 (Sized_relobj::do_layout_deferred_sections): New function.
11977 (Sized_relobj::layout_section): New function.
11978 (Sized_relobj::Deferred_layout): New structure.
11979 (Sized_relobj::deferred_layout_): New field.
11980 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11981 Change all callers. Layout deferred sections.
11982 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11983 references.
11984 (Plugin_hook::run): Move code from do_plugin_hook inline.
11985 (Plugin_hook::do_plugin_hook): Remove.
11986 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11987 (Plugin_manager::finish): Renamed, was cleanup.
11988 (Plugin_manager::should_defer_layout): New function.
11989 (Plugin_manager::add_deferred_layout_object): New function.
11990 (Plugin_manager::Deferred_layout_list): New type.
11991 (Plugin_manager::deferred_layout_objects_): New field.
11992 (Plugin_hook::do_plugin_hook): Remove.
11993
11994 2008-12-17 Ian Lance Taylor <iant@google.com>
11995
11996 * options.h (class General_options): Add --no case for
11997 --export-dynamic.
11998
11999 2008-12-16 Cary Coutant <ccoutant@google.com>
12000
12001 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12002 vector.
12003 (Plugin_manager::claim_file): Create plugin object even if
12004 plugin did not call the add_symbols callback.
12005 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12006 asking for more symbols than were added.
12007 * testsuite/Makefile.am (plugin_test_1): Add test case with
12008 no global symbols.
12009 (empty.syms): New target.
12010 * testsuite/Makefile.in: Regenerate.
12011 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12012 message. Don't call add_symbols if no globals.
12013 (all_symbols_read_hook): Don't provide replacement for empty
12014 claimed file.
12015
12016 2008-12-12 Ian Lance Taylor <iant@google.com>
12017
12018 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12019 r_type == 0 for a local symbol with r_sym == 0.
12020 (scan_relocatable_relocs): Pass r_sym to
12021 local_non_section_strategy.
12022 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12023 r_sym parameter.
12024
12025 * configure.ac: Update test for TLS descriptors: they are
12026 supported as of glibc 2.9.
12027 * configure: Rebuild.
12028
12029 2008-12-11 Ian Lance Taylor <iant@google.com>
12030
12031 PR 7091
12032 * target-reloc.h (Default_scan_relocatable_relocs): For each
12033 function, map r_type == 0 to RELOC_DISCARD.
12034
12035 2008-12-10 Cary Coutant <ccoutant@google.com>
12036
12037 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12038 object to override a kept COMDAT group from a plugin object.
12039
12040 2008-12-09 Ian Lance Taylor <iant@google.com>
12041
12042 PR 7088
12043 * yyscript.y (file_cmd): Handle INPUT.
12044
12045 * testsuite/initpri1.c: Change all declarations to be full
12046 prototypes by adding void, to avoid compiler warnings.
12047
12048 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12049
12050 * options.cc (General_options::parse_plugin_opt): New.
12051 (General_options::add_plugin): The argument now is just the filename.
12052 (General_options::add_plugin_option): New.
12053 * options.h (plugin_opt): New.
12054 (add_plugin): Change argument name.
12055 (add_plugin_option): New.
12056 * plugin.cc (Plugin::load): Don't parse the plugin option.
12057 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12058 (Plugin::add_option): New.
12059 (Plugin::args_): Change type.
12060 (Plugin::filename_): New.
12061 (Plugin_manager::add_plugin_option): New.
12062 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12063 * testsuite/Makefile.in: Regenerate.
12064
12065 2008-12-05 Cary Coutant <ccoutant@google.com>
12066
12067 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12068 Handle --strip-lto-sections option.
12069 * options.h (strip_lto_sections): New option.
12070
12071 2008-12-01 Cary Coutant <ccoutant@google.com>
12072
12073 * plugin.cc (ld_plugin_message): Change format parameter to const.
12074 Fix mismatch between new[] and delete.
12075
12076 2008-11-14 Cary Coutant <ccoutant@google.com>
12077
12078 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12079 instead of -1U.
12080
12081 2008-11-05 Craig Silverstein <csilvers@google.com>
12082
12083 * options.cc (General_options::parse_dynamic_list): New function.
12084 * options.h (General_options): New flags dynamic_list,
12085 dynamic_list_data, dynamic_list_cpp_new, and
12086 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12087 (General_options::in_dynamic_list): New function.
12088 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12089 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12090 (Lex::can_continue_name): Likewise.
12091 (yylex): Likewise.
12092 (read_script_file): New parameter script_options.
12093 (read_dynamic_list): New function.
12094 (Script_options::define_dynamic_list): New function.
12095 (dynamic_list_keyword_parsecodes): New variable.
12096 (dynamic_list_keywords): New variable.
12097 * script.h (Script_options::define_dynamic_list): New function
12098 prototype.
12099 (read_dynamic_list): New function prototype.
12100 * symtab.cc (strprefix): New macro.
12101 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12102 dynamic_list_data, dynamic_list_cpp_new, and
12103 dynamic_list_cpp_typeinfo.
12104 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12105 (dynamic_list_expr): New rule.
12106 (dynamic_list_nodes): Likewise.
12107 (dynamic_list_node): Likewise.
12108 * testsuite/Makefile.am (dynamic_list): New test.
12109 * testsuite/Makefile.in: Regenerated.
12110 * testsuite/dynamic_list.t: New file.
12111 * testsuite/dynamic_list.sh: New file.
12112
12113 2008-11-05 Craig Silverstein <csilvers@google.com>
12114
12115 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12116 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12117 (t11_last): Likewise.
12118 * testsuite/ver_test_6.c (main): Likewise.
12119
12120 2008-10-07 Cary Coutant <ccoutant@google.com>
12121
12122 * options.c (General_options::finalize): Add check for -static and
12123 -shared.
12124 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12125 is not empty.
12126
12127 2008-10-02 Cary Coutant <ccoutant@google.com>
12128
12129 * plugin.cc (make_sized_plugin_object): Fix conditional
12130 compilation to work when not all targets are enabled.
12131
12132 2008-09-29 Cary Coutant <ccoutant@google.com>
12133
12134 * archive.cc (Archive::get_file_and_offset): Use filename instead
12135 of name to get library path.
12136 (Archive::include_member): Unlock external member of a thin archive.
12137
12138 * testsuite/Makefile.am (TEST_AR): New variable.
12139 (thin_archive_test_1): New test.
12140 (thin_archive_test_2): New test.
12141 * testsuite/Makefile.in: Regenerate.
12142 * testsuite/thin_archive_main.cc: New file.
12143 * testsuite/thin_archive_test_1.cc: New file.
12144 * testsuite/thin_archive_test_2.cc: New file.
12145 * testsuite/thin_archive_test_3.cc: New file.
12146 * testsuite/thin_archive_test_4.cc: New file.
12147
12148 2008-09-29 Cary Coutant <ccoutant@google.com>
12149
12150 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12151 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12152 instead of -1U.
12153 (Sized_relobj::do_finalize_local_symbols): Likewise.
12154 (Sized_relobj::map_to_kept_section): Likewise.
12155 * object.h (Sized_relobj::invalid_address): New constant.
12156 (Sized_relobj::do_output_section_offset): Check for invalid_address
12157 and return -1ULL.
12158 * output.cc (Output_reloc::local_section_offset): Use constant
12159 invalid_address instead of -1U.
12160 (Output_reloc::get_address): Likewise.
12161 (Output_section::output_address): Change -1U to -1ULL.
12162 * output.h (Output_reloc::invalid_address): New constant.
12163 * reloc.cc (Sized_relobj::write_sections): Use constant
12164 invalid_address instead of -1U.
12165 (Sized_relobj::relocate_sections): Likewise.
12166 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12167 values for merge sections.
12168 * target-reloc.h (relocate_for_relocatable): Use constant
12169 invalid_address instead of -1U.
12170
12171 2008-09-19 Cary Coutant <ccoutant@google.com>
12172
12173 Add plugin functionality for link-time optimization (LTO).
12174 * configure.ac (plugins): Add --enable-plugins option.
12175 * configure: Regenerate.
12176 * config.in: Regenerate.
12177 * Makefile.am (LIBDL): New variable.
12178 (CCFILES): Add plugin.cc.
12179 (HFILES): Add plugin.h.
12180 (ldadd_var): Add LIBDL.
12181 * Makefile.in: Regenerate.
12182
12183 * archive.cc: Include "plugin.h".
12184 (Archive::setup): Don't preread archive symbols when using a plugin.
12185 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12186 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12187 files.
12188 (Archive::include_member): Add symbols from plugin objects.
12189 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12190 * descriptors.cc (Descriptors::open): Check for file descriptors
12191 abandoned by plugins.
12192 (Descriptors::claim_for_plugin): New function.
12193 * descriptors.h (Descriptors::claim_for_plugin): New function.
12194 (Open_descriptor::is_claimed): New field.
12195 (claim_descriptor_for_plugin): New function.
12196 * fileread.cc (File_read::claim_for_plugin): New function.
12197 * fileread.h (File_read::claim_for_plugin): New function.
12198 (File_read::descriptor): New function.
12199 * gold.cc: Include "plugin.h".
12200 (queue_initial_tasks): Add task to call plugin hooks for generating
12201 new object files.
12202 * main.cc: Include "plugin.h".
12203 (main): Load plugin libraries.
12204 * object.h (Pluginobj): Declare.
12205 (Object::pluginobj): New function.
12206 (Object::do_pluginobj): New function.
12207 (Object::set_target): New function.
12208 * options.cc: Include "plugin.h".
12209 (General_options::parse_plugin): New function.
12210 (General_options::General_options): Initialize plugins_ field.
12211 (General_options::add_plugin): New function.
12212 * options.h (Plugin_manager): Declare.
12213 (General_options): Add --plugin option.
12214 (General_options::has_plugins): New function.
12215 (General_options::plugins): New function.
12216 (General_options::add_plugin): New function.
12217 (General_options::plugins_): New field.
12218 * plugin.cc: New file.
12219 * plugin.h: New file.
12220 * readsyms.cc: Include "plugin.h".
12221 (Read_symbols::do_read_symbols): Check for archive before checking
12222 for ELF file. Call plugin hooks to claim files.
12223 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12224 from a real object file; force override when processing replacement
12225 files.
12226 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12227 (Symbol::init_base_object): Likewise.
12228 (Symbol::init_base_output_data): Likewise.
12229 (Symbol::init_base_output_segment): Likewise.
12230 (Symbol::init_base_constant): Likewise.
12231 (Symbol::init_base_undefined): Likewise.
12232 (Symbol::output_section): Assert that object is not a plugin.
12233 (Symbol_table::add_from_pluginobj): New function.
12234 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12235 undefined.
12236 (Symbol_table::sized_write_globals): Likewise.
12237 (Symbol_table::add_from_pluginobj): Instantiate template.
12238 * symtab.h (Sized_pluginobj): Declare.
12239 (Symbol::in_real_elf): New function.
12240 (Symbol::set_in_real_elf): New function.
12241 (Symbol::in_real_elf_): New field.
12242 (Symbol_table::add_from_pluginobj): New function.
12243
12244 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12245 (LIBDL): New variable.
12246 (LDADD): Add LIBDL.
12247 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12248 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12249 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12250 (MOSTLYCLEANFILES): Likewise.
12251 * testsuite/Makefile.in: Regenerate.
12252 * testsuite/plugin_test.c: New file.
12253 * testsuite/plugin_test_1.sh: New file.
12254 * testsuite/plugin_test_2.sh: New file.
12255
12256 2008-09-16 Ian Lance Taylor <iant@google.com>
12257
12258 * target-reloc.h (relocate_section): Check whether a symbol is
12259 defined by the ABI before reporting an undefined symbol error.
12260 * target.h (Target::is_defined_by_abi): Make parameter const.
12261 (Target::do_is_defined_by_abi): Likewise.
12262 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12263 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12264 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12265 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12266 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12267 * testsuite/Makefile.in: Rebuild.
12268
12269 * fileread.cc (make_view): Add casts to avoid warning.
12270
12271 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12272
12273 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12274 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12275
12276 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12277
12278 * options.h (General_options::output_is_executable): New.
12279 (General_options::output_is_pie): New.
12280 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12281 for shared libraries.
12282 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12283
12284 2008-09-11 Chris Demetriou <cgd@google.com>
12285
12286 * options.h (origin): New -z option.
12287 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12288 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12289 in DT_FLAGS_1.
12290
12291 2008-09-05 Cary Coutant <ccoutant@google.com>
12292
12293 * fileread.cc (File_read::make_view): Add check for attempt to map
12294 beyond end of file.
12295
12296 2008-09-05 Cary Coutant <ccoutant@google.com>
12297
12298 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12299 explicit instantiations.
12300
12301 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12302
12303 PR gold/6858
12304 * options.cc (General_options::finalize): Allow undefined symbols
12305 in shlibs if linking -shared.
12306
12307 PR gold/6859
12308 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12309 symbols as not needing a dynsym entry.
12310
12311 2008-08-20 Craig Silverstein <csilvers@google.com>
12312
12313 * fileread.cc (File_read::open): Do not lock the file unless it
12314 was successfully opened.
12315
12316 2008-08-14 Cary Coutant <ccoutant@google.com>
12317
12318 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12319 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12320 * testsuite/tls_test.cc (struct int128): 128-bit struct
12321 for testing TLS relocs with non-zero addend.
12322 (v12): New TLS variable.
12323 (t12): New test.
12324 (t_last): Add check for v12.
12325 * testsuite/tls_test.h (t12): New function.
12326 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12327
12328 2008-08-13 Ian Lance Taylor <iant@google.com>
12329
12330 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12331 set tls_segment_ or relro_segment_.
12332 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12333 when appropriate.
12334 * output.h (Output_section::clear_is_relro): New function.
12335 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12336 sections specially even when output_data_ is empty.
12337 (Output_segment::maximum_alignment): When first section is relro,
12338 only force alignment for PT_LOAD segments.
12339 * script.cc (script_data_segment_align): New function.
12340 (script_data_segment_relro_end): New function.
12341 * script-c.h (script_data_segment_align): Declare.
12342 (script_data_segment_relro_end): Declare.
12343 * script-sections.h (class Script_sections): Declare
12344 data_segment_align and data_segment_relro_end. Add fields
12345 segment_align_index_ and saw_relro_end_.
12346 * script-sections.cc (class Sections_element): Add set_is_relro
12347 virtual function. Add new bool* parameter to place_orphan_here.
12348 Add get_output_section virtual function.
12349 (class Output_section_definition): Add set_is_relro. Add new
12350 bool* parameter to place_orphan_here. Add get_output_section.
12351 Add is_relro_ field.
12352 (Output_section_definition::Output_section_definition): Initialize
12353 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12354 and is_relro_ fields.
12355 (Output_section_definition::place_orphan_here): Add is_relro
12356 parameter.
12357 (Output_section_definition::set_section_addresses): Set relro for
12358 output section.
12359 (Output_section_definition::alternate_constraint): Likewise.
12360 (class Orphan_output_section): Add new bool* parameter to
12361 place_orphan_here. Add get_output_section.
12362 (Orphan_output_section::place_orphan_here): Add is_relro
12363 parameter.
12364 (Script_sections::Script_sections): Initialize
12365 data_segment_align_index_ and saw_relro_end_.
12366 (Script_sections::data_segment_align): New function.
12367 (Script_sections::data_segment_relro_end): New function.
12368 (Script_sections::place_orphan): Set or clear is_relro.
12369 (Script_sections::set_section_addresses): Force alignment of first
12370 TLS section.
12371 * yyscript.y (exp): Call script_data_segment_align and
12372 script_data_segment_relro_end.
12373 * testsuite/relro_script_test.t: New file.
12374 * testsuite/relro_test.cc (using_script): Declare.
12375 (t1, t2): Test using_script.
12376 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12377 (relro_script_test_SOURCES): Define.
12378 (relro_script_test_DEPENDENCIES): Define.
12379 (relro_script_test_LDFLAGS): Define.
12380 (relro_script_test_LDADD): Define.
12381 (relro_script_test.so): New target.
12382 * testsuite/Makefile.in: Rebuild.
12383
12384 2008-08-06 Cary Coutant <ccoutant@google.com>
12385
12386 * archive.cc (Archive::total_archives, Archive::total_members)
12387 (Archive::total_members_loaded): New variables.
12388 (Archive::setup): Add parameter. Add option to preread
12389 archive symbols.
12390 (Archive::read_armap): Add counter.
12391 (Archive::get_file_and_offset): New function.
12392 (Archive::get_elf_object_for_member): New function.
12393 (Archive::read_all_symbols): New function.
12394 (Archive::read_symbols): New function.
12395 (Archive::add_symbols): Add counters.
12396 (Archive::include_all_members): Use armap to find members if it's
12397 already built.
12398 (Archive::include_member): Skip reading symbols if already read.
12399 Factored code into Archive::get_file_and_offset and
12400 Archive::get_elf_object_for_member. Changed call to
12401 Mapfile::report_include_archive_member.
12402 (Archive::print_stats): New function.
12403 * archive.h: Declare Object and Read_symbols_data classes.
12404 (Archive::Archive): Add initializers for new members.
12405 (Archive::setup): Add parameter.
12406 (Archive::print_stats): New function.
12407 (Archive::total_archives, Archive::total_members)
12408 (Archive::total_members_loaded): New variables.
12409 (Archive::get_file_and_offset): New function.
12410 (Archive::get_elf_object_for_member): New function.
12411 (Archive::read_all_symbols): New function.
12412 (Archive::read_symbols): New function.
12413 (Archive::Archive_member): New class.
12414 (Archive::members_): New member.
12415 (Archive::num_members_): New member.
12416 * main.cc: Include archive.h.
12417 (main): Call Archive::print_stats.
12418 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12419 archive parameter; member_name is now the fully-decorated name.
12420 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12421 * options.h: (General_options): Add --preread-archive-symbols option.
12422 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12423 Archive::setup.
12424
12425 2008-08-04 Ian Lance Taylor <iant@google.com>
12426
12427 * symtab.h (Symbol::use_plt_offset): New function.
12428 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12429 * powerpc.cc (Relocate::relocate): Likewise.
12430 * sparc.cc (Relocate::relocate): Likewise.
12431 * x86_64.cc (Relocate::relocate): Likewise.
12432 * testsuite/weak_plt.sh: New test.
12433 * testsuite/weak_plt_main.cc: New test.
12434 * testsuite/weak_plt_shared.cc: New test.
12435 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12436 (check_PROGRAMS): Add weak_plt.
12437 (check_DATA): Add weak_plt_shared.so.
12438 (weak_plt_main_pic.o, weak_plt): New targets.
12439 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12440 * testsuite/Makefile.in: Rebuild.
12441
12442 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12443 gcctestdir/ld.
12444 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12445 * testsuite/Makefile.in: Rebuild.
12446
12447 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12448
12449 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12450 * Makefile.in: Regenerate.
12451 * po/POTFILES.in: Regenerate.
12452
12453 2008-07-29 Ian Lance Taylor <iant@google.com>
12454
12455 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12456 symbols before other symbols.
12457 * testsuite/script_test_2.cc (test_addr): Declare.
12458 (test_addr_alias): Declare.
12459 (main): Check that test_addr and test_addr_alias have the right
12460 values.
12461 * testsuite/script_test_2.t: Define test_addr_alias and
12462 test_addr.
12463
12464 2008-07-24 Ian Lance Taylor <iant@google.com>
12465
12466 PR 5990
12467 * descriptors.cc: New file.
12468 * descriptors.h: New file.
12469 * gold-threads.h (class Hold_optional_lock): New class.
12470 * fileread.cc: Include "descriptors.h".
12471 (File_read::~File_read): Release descriptor rather than closing
12472 it.
12473 (File_read::open) [file]: Call open_descriptor rather than open.
12474 Set is_descriptor_opened_.
12475 (File_read::open) [memory]: Assert that descriptor is not open.
12476 (File_read::reopen_descriptor): New function.
12477 (File_read::release): Release descriptor.
12478 (File_read::do_read): Make non-const. Reopen descriptor.
12479 (File_read::read): Make non-const.
12480 (File_read::make_view): Reopen descriptor.
12481 (File_read::do_readv): Likewise.
12482 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12483 Update declarations.
12484 * layout.cc: Include "descriptors.h".
12485 (Layout::create_build_id): Use open_descriptor rather than open.
12486 * output.cc: Include "descriptors.h".
12487 (Output_file::open): Use open_descriptor rather than open.
12488 * archive.cc (Archive::const_iterator): Change Archive to be
12489 non-const.
12490 (Archive::begin, Archive::end): Make non-const.
12491 (Archive::count_members): Likewise.
12492 * archive.h (class Archive): Update declarations.
12493 * object.h (Object::read): Make non-const.
12494 * Makefile.am (CCFILES): Add descriptors.cc.
12495 (HFILES): Add descriptors.h.
12496 * Makefile.in: Rebuild.
12497
12498 PR 6716
12499 * gold.h: Always include <clocale>. Add Solaris workarounds
12500 following code in binutils/sysdep.h.
12501
12502 PR 6048
12503 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12504 this->eh_frame_hdr_ is NULL before using it.
12505
12506 * dynobj.cc (Versions::Versions): Update comment.
12507
12508 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12509 the base version name.
12510
12511 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12512 array size plus one.
12513 (Stringpool_template::set_string_offsets): Subtract one from key
12514 before using it as an array index.
12515 (Stringpool_template::get_offset_with_length): Likewise.
12516 (Stringpool_template::write_to_buffer): Likewise.
12517 * stringpool.h (Stringpool_template::get_offset_from_key):
12518 Likewise.
12519
12520 2008-07-23 Ian Lance Taylor <iant@google.com>
12521
12522 PR 6658
12523 * object.h (Merged_symbol_value::value): Do our best to handle a
12524 negative addend.
12525
12526 PR 6647
12527 * script.cc (Version_script_info::get_versions): Don't add empty
12528 version tag to return value.
12529 (Version_script_info::get_symbol_version_helper): Change return
12530 type to bool. Add pversion parameter. Change all callers.
12531 (script_register_vers_node): Don't require a non-NULL tag.
12532 * script.h (class Version_script_info): Update declarations.
12533 (Version_script_info::get_symbol_version): Change return type to
12534 bool. Add version parameter. Change all callers.
12535 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12536 handling. Handle an empty version from a version script.
12537 (Symbol_table::define_special_symbol): Likewise.
12538 * testsuite/ver_test_10.script: New file.
12539 * testsuite/ver_test_10.sh: New file.
12540 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12541 (check_DATA): Add ver_test_10.syms.
12542 (ver_test_10.syms, ver_test_10.so): New target.
12543 * testsuite/Makefile.in: Rebuild.
12544
12545 2008-07-23 Simon Baldwin <simonb@google.com>
12546
12547 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12548 to zero for undefined symbols from dynamic libraries.
12549
12550 2008-07-23 Ian Lance Taylor <iant@google.com>
12551
12552 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12553 Change all callers.
12554 * symtab.h (class Symbol_table): Update declaration.
12555 * testsuite/ver_test_9.cc: New file.
12556 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12557 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12558 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12559 (ver_test_9.so, ver_test_9.o): New targets.
12560 * testsuite/Makefile.in: Rebuild.
12561
12562 2008-07-22 Ian Lance Taylor <iant@google.com>
12563
12564 * options.h (class General_options): Define --check-sections.
12565 * layout.cc (Layout::set_segment_offsets): Handle
12566 --check-sections.
12567
12568 * options.h (class General_options): Define -n/--nmagic and
12569 -N/--omagic.
12570 * options.cc (General_options::finalize): For -n/--nmagic or
12571 -N/--omagic, set -static.
12572 * layout.cc (Layout::attach_allocated_section_to_segment): If
12573 -N/--omagic, don't put read-only and read-write sections in
12574 different segments.
12575 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12576 finding a read-only segment.
12577 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12578 don't set the minimum segment alignment to the common page size,
12579 and don't set the file offset to the address modulo the page size.
12580 * script-sections.cc (Script_sections::create_segments): If
12581 -n/--omagic, don't put read-only and read-write sections in
12582 different segments.
12583
12584 * cref.cc: New file.
12585 * cref.h: New file.
12586 * options.h (class General_options): Add --print-symbol-counts.
12587 * main.cc (main): Issue defined symbol report if requested.
12588 * archive.cc (Archive::interpret_header): Make into a const member
12589 function.
12590 (Archive::add_symbols): Call Input_objects::archive_start and
12591 archive_stop.
12592 (Archive::const_iterator): Define new class.
12593 (Archive::begin, Archive::end): New functions.
12594 (Archive::include_all_members): Rewrite to use iterator.
12595 (Archive::count_members): New function.
12596 * archive.h (class Archive): Update declarations.
12597 (Archive::filename): New function.
12598 * object.cc: Include "cref.h".
12599 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12600 (Sized_relobj::do_get_global_symbol_counts): New function.
12601 (Input_objects::add_object): Add object to cross-referencer.
12602 (Input_objects::archive_start): New function.
12603 (Input_objects::archive_stop): New function.
12604 (Input_objects::print_symbol_counts): New function.
12605 * object.h: Declare Cref and Archive.
12606 (Object::get_global_symbol_counts): New function.
12607 (Object::do_get_global_symbol_counts): New pure virtual function.
12608 (class Sized_relobj): Add defined_count_ field. Update
12609 declarations.
12610 (class Input_objects): Add cref_ field. Update constructor.
12611 Update declarations.
12612 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12613 defined_count_.
12614 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12615 symbol counts.
12616 (Sized_dynobj::do_get_global_symbol_counts): New function.
12617 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12618 defined_count_. Update declarations. Define Symbols typedef.
12619 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12620 parameter. Change all callers.
12621 (Symbol_table::add_from_dynobj): Add sympointers and defined
12622 parameters. Change all callers.
12623 * symtab.h (class Symbol_table): Update declarations.
12624 * Makefile.am (CCFILES): Add cref.cc.
12625 (HFILES): Add cref.h.
12626 * Makefile.in: Rebuild.
12627
12628 2008-07-22 Simon Baldwin <simonb@google.com>
12629
12630 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12631 to zero when writing undefined symbols.
12632
12633 2008-07-22 Ian Lance Taylor <iant@google.com>
12634
12635 * output.cc (Output_section::add_input_section): Don't try to
12636 merge empty merge sections.
12637
12638 2008-07-21 Craig Silverstein <csilvers@google.com>
12639
12640 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12641 Include symbol version in error message.
12642
12643 2008-07-20 Chris Demetriou <cgd@google.com>
12644
12645 * configure.ac (gold_cv_c_random_seed): New configured variable.
12646 (RANDOM_SEED_CFLAGS): New substituted variable.
12647 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12648 * configure: Rebuild.
12649 * Makefile.in: Likewise.
12650 * testsuite/Makefile.in: Likewise.
12651
12652 2008-07-18 Ian Lance Taylor <iant@google.com>
12653
12654 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12655 where we see NAME/NULL and NAME/VERSION as separate symbols.
12656 * testsuite/ver_test_main.cc (main): Call t4.
12657 (t4, t4_2a): Define.
12658 * testsuite/ver_test_2.cc (t4_2): Define.
12659 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12660 * testsuite/ver_test_4.cc (t4_2a): Define.
12661 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12662 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12663
12664 2008-07-17 Ian Lance Taylor <iant@google.com>
12665
12666 * dynobj.cc (Versions::add_def): If we give an error about a
12667 missing version, go ahead and create the version anyhow.
12668
12669 2008-07-10 Ian Lance Taylor <iant@google.com>
12670
12671 Handle output sections with more than 0x7fffffff bytes.
12672 * object.h (class Relobj): Change map_to_output_ to
12673 output_sections_, and just keep a section pointer. Change all
12674 uses. Move comdat group support to Sized_relobj.
12675 (Relobj::is_section_specially_mapped): Remove.
12676 (Relobj::output_section): Remove poff parameter. Change all
12677 callers.
12678 (Relobj::output_section_offset): New function.
12679 (Relobj::set_section_offset): Rewrite.
12680 (Relobj::map_to_output): Remove.
12681 (Relobj::output_sections): New function.
12682 (Relobj::do_output_section_offset): New pure virtual function.
12683 (Relobj::do_set_section_offset): Likewise.
12684 (class Sized_relobj): Add section_offsets_ field. Add comdat
12685 group support from Relobj. Update declarations.
12686 (Sized_relobj::get_output_section_offset): New function.
12687 (Sized_relobj::do_output_section_offset): New function.
12688 (Sized_relobj::do_set_section_offset): New function.
12689 * object.cc (Relobj::output_section_address): Remove.
12690 (Sized_relobj::Sized_relobj): Initialize new fields.
12691 (Sized_relobj::include_section_group): Cast find_kept_object to
12692 Sized_relobj.
12693 (Sized_relobj::include_linkonce_section): Likewise.
12694 (Sized_relobj::do_layout): Use separate arrays for output section
12695 and output offset.
12696 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12697 output_sections.
12698 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12699 output_sections and section_offsets.
12700 (Sized_relobj::write_local_symbols): Likewise.
12701 (map_to_kept_section): Compute output address directly.
12702 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12703 output_sections and section_offsets.
12704 (Sized_relobj::write_sections): Likewise.
12705 (Sized_relobj::relocate_sections): Likewise.
12706 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12707 * output.h (class Output_reloc): Update declarations. Change
12708 u2_.relobj to Sized_relobj*.
12709 (class Output_data_reloc): Change add functions to use
12710 Sized_relobj*.
12711 * output.cc (Output_reloc::Output_reloc): Change relobj to
12712 Sized_relobj*.
12713 (Output_reloc::local_section_offset): Change return type to
12714 Elf_Addr. Use get_output_section_offset.
12715 (Output_reloc::get_address): Likewise.
12716 (Output_section::is_input_address_mapped): Don't call
12717 is_section_specially_mapped.
12718 (Output_section::output_offset): Likewise.
12719 (Output_section::output_address): Likewise.
12720 (Output_section::starting_output_address): Likewise.
12721 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12722 parameter to Sized_relobj*.
12723 (Copy_relocs::need_copy_reloc): Likewise.
12724 (Copy_relocs::save): Likewise.
12725 * copy-relocs.h (class Copy_relocs): Update declarations.
12726 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12727 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12728 * target-reloc.h (relocate_for_relocatable): Change
12729 offset_in_output_section type to Elf_Addr. Change code that uses
12730 it as well.
12731 * layout.cc (Layout::layout): Always set *off.
12732 * mapfile.cc (Mapfile::print_input_section): Use
12733 output_section_offset.
12734 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12735 Sized_relobj*.
12736 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12737 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12738 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12739
12740 2008-07-03 Ian Lance Taylor <iant@google.com>
12741
12742 * layout.cc (Layout::include_section): Do not discard unrecognized
12743 SHT_STRTAB sections.
12744
12745 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12746
12747 * script.cc (Lex::can_continue_name): Make '?' allowable in
12748 version-script names.
12749 * testsuite/version_script.map: Change glob pattern to use '?'
12750
12751 2008-06-30 Manish Singh <yosh@gimp.org>
12752
12753 PR 6585
12754 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12755 Correct typo.
12756
12757 2008-06-30 Ian Lance Taylor <iant@google.com>
12758
12759 PR 6660
12760 PR 6682
12761 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12762 versions]: Don't try to read the value in the contents, since we
12763 don't use it. Use the template endianness when writing.
12764
12765 2008-06-25 Cary Coutant <ccoutant@google.com>
12766
12767 * fileread.cc (File_read::make_view): Assert on zero-length view.
12768 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12769 symbol table when there are no symbols to read.
12770
12771 2008-06-23 Craig Silverstein <csilvers@google.com>
12772
12773 * version.cc (version_string): Bump to 1.7
12774
12775 2008-06-18 Craig Silverstein <csilvers@google.com>
12776
12777 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12778 constant 0xFFFF to type Valtype.
12779 (Powerpc_relocate_functions::rel16_ha): Likewise.
12780
12781 2008-06-17 Ian Lance Taylor <iant@google.com>
12782
12783 * output.h (Output_section::Input_section): Initialize p2align_ to
12784 zero for Output_section_data constructors.
12785 (Output_section::Input_section::addralign): If not an input
12786 section, return the alignment of the Output_section_data.
12787 * testsuite/copy_test.cc: New file.
12788 * testsuite/copy_test_1.cc: New file.
12789 * testsuite/copy_test_2.cc: New file.
12790 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12791 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12792 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12793 (copy_test_1_pic.o, copy_test_1.so): New targets.
12794 (copy_test_2_pic.o, copy_test_2.so): New targets.
12795 * testsuite/Makefile.in: Rebuild.
12796
12797 * script-sections.cc (Script_sections::place_orphan): Initialize
12798 local variable exact.
12799
12800 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12801
12802 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12803
12804 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12805 David S. Miller <davem@davemloft.net>
12806
12807 * powerpc.cc: New file.
12808 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12809 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12810 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12811 * Makefile.in: Rebuild.
12812
12813 2008-06-09 Ian Lance Taylor <iant@google.com>
12814
12815 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12816 <exception>.
12817 (throwing, orig_terminate): New static variables.
12818 (terminate_handler): New static function.
12819 (t2): Set terminate handler.
12820
12821 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12822
12823 PR 6584
12824 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12825 alignment.
12826
12827 2008-05-30 Cary Coutant <ccoutant@google.com>
12828
12829 * archive.cc (Archive::include_all_members) Correct to step
12830 over symbol table and extended name table in thin archives.
12831
12832 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12833
12834 PR 6407
12835 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12836 calculation.
12837
12838 2008-05-28 Caleb Howe <cshowe@google.com>
12839
12840 * reduced_debug_output.cc: New file.
12841 * reduced_debug_output.h: New file.
12842 * options.h (class General_options): Add --strip-debug-non-line.
12843 * options.cc (General_options::finalize): Add strip_debug_non_line
12844 to the strip heirarchy.
12845 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12846 fields.
12847 * layout.cc: Include "reduced_debug_output.h".
12848 (Layout::Layout): Initialize new fields.
12849 (line_only_debug_sections): New static array.
12850 (is_lines_only_debug_sections): New static inline function.
12851 (Layout::include_section): Handle --strip-debug-non-line.
12852 (Layout::make_output_section): If --strip-debug-non-line, build
12853 new output sections for .debug_abbrev and .debug_info.
12854 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12855 gold. Warn about possible overflow.
12856 (read_signed_LEB_128): Likewise.
12857 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12858 (read_signed_LEB_128): Declare.
12859 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12860 (HFILES): Add reduced_debug_output.h.
12861 * Makefile.in: Rebuild.
12862
12863 2008-05-21 Ian Lance Taylor <iant@google.com>
12864
12865 * mapfile.cc: New file.
12866 * mapfile.h: New file.
12867 * options.h (class General_options): Add -M/--print-map and -Map.
12868 * options.cc (General_options::finalize): Make -M equivalent to
12869 -Map -.
12870 * main.cc: Include <cstdio> and "mapfile.h".
12871 (main): Open mapfile if requested.
12872 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12873 constructor. Change caller.
12874 (queue_initial_tasks): Add mapfile parameter. Change caller.
12875 (queue_middle_tasks): Likewise.
12876 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12877 declarations.
12878 * archive.cc: Include "mapfile.h".
12879 (Archive::add_symbols): Add mapfile parameter. Change all
12880 callers. Pass mapfile, symbol, and reason to include_member.
12881 (Archive::include_all_members): Add mapfile parameter. Change all
12882 callers.
12883 (Archive::include_member): Add mapfile, sym, and why parameters.
12884 Change all callers. Report inclusion to map file.
12885 * archive.h: Include "fileread.h".
12886 (class Archive): Update declarations.
12887 (Archive::file): New const method.
12888 (class Add_archive_symbols): Add mapfile_ field. Update
12889 constructor. Change all callers.
12890 * readsyms.h (class Read_symbols): Likewise.
12891 (class Finish_group): Likewise.
12892 (class Read_script): Likewise.
12893 * common.cc: Include "mapfile.h".
12894 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12895 all callers.
12896 (Symbol_table::do_allocate_commons): Likewise.
12897 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12898 symbol allocation to mapfile.
12899 * common.h (class Allocate_commons_task): Add mapfile_ field.
12900 Update constructor. Change all callers.
12901 * symtab.h (class Symbol_table): Update declarations.
12902 * layout.cc: Include "mapfile.h".
12903 (Layout_task_runner::run): Print information to mapfile.
12904 (Layout::create_gold_note): Change Output_data_fixed_space to
12905 Output_data_zero_fill.
12906 (Layout::create_build_id): Likewise.
12907 (Layout::print_to_mapfile): New function.
12908 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12909 constructor. Change caller.
12910 (class Layout): Declare print_to_mapfile.
12911 * output.cc (Output_section::Input_section::print_to_mapfile): New
12912 function.
12913 (Output_section::add_input_section): If producing a map, always
12914 add to input_sections_ list.
12915 (Output_section::do_print_to_mapfile): New function.
12916 (Output_segment::print_sections_to_mapfile): New function.
12917 (Output_segment::print_section_list_to_mapfile): New function.
12918 * output.h: Include "mapfile.h".
12919 (Output_data::print_to_mapfile): New function.
12920 (Output_data::do_print_to_mapfile): New virtual function.
12921 (Output_segment_headers::do_print_to_mapfile): New function.
12922 (Output_file_header::do_print_to_mapfile): New function.
12923 (Output_data_const::do_print_to_mapfile): New function.
12924 (class Output_data_const_buffer): Add map_name_ field. Update
12925 constructor. Change all callers. Add do_print_to_mapfile
12926 function.
12927 (class Output_data_fixed_space): Likewise.
12928 (class Output_data_space): Likewise.
12929 (class Output_data_zero_fill): New class.
12930 (Output_data_strtab::do_print_to_mapfile): New function.
12931 (Output_data_reloc_base::do_print_to_mapfile): New function.
12932 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12933 (Output_data_group::do_print_to_mapfile): New function.
12934 (Output_data_got::do_print_to_mapfile): New function.
12935 (Output_data_dynamic::do_print_to_mapfile): New function.
12936 (Output_symtab_xindex::do_print_to_mapfile): New function.
12937 (class Output_section): Declare do_print_to_mapflie. Declare
12938 print_to_mapfile in Input_section.
12939 (class Output_segment): Declare new functions.
12940 * object.h (Sized_relobj::symbol_count): New function.
12941 * script-sections.cc
12942 (Output_section_element_dot_assignment::set_section_addresses):
12943 Change Output_data_fixed_space to Output_data_zero_fill.
12944 (Output_data_expression::do_print_to_mapfile): New function.
12945 * script.cc (read_input_script): Add mapfile parameter. Change
12946 all callers.
12947 * script.h (read_input_script): Update declaration.
12948 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12949 (Eh_frame::do_print_to_mapfile): New function.
12950 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12951 (Output_merge_string::do_print_to_mapfile): New function.
12952 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12953 function.
12954 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12955 function.
12956 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12957 function.
12958 * Makefile.am (CCFILES): Add mapfile.cc.
12959 (HFILES): Add mapfile.h.
12960 * Makefile.in: Rebuild.
12961
12962 2008-05-19 Ian Lance Taylor <iant@google.com>
12963
12964 * options.h (class General_options): Add -z relro.
12965 * layout.cc (Layout::Layout): Initialize relro_segment_.
12966 (Layout::add_output_section_data): Return the output section.
12967 (Layout::make_output_section): Rcognize relro sections and mark
12968 them appropriately.
12969 (Layout::attach_allocated_section_to_segment): Put relro sections
12970 in a PT_GNU_RELRO segment.
12971 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12972 section as relro.
12973 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12974 PT_TLS segments.
12975 (Layout::linkonce_mapping): Map d.rel.ro.local to
12976 .data.rel.ro.local.
12977 (Layout::output_section_name): Us .data.rel.ro.local for any
12978 section which begins with that.
12979 * layout.h (class Layout): Update add_output_section_data
12980 declaration. Add relro_segment_ field.
12981 * output.cc (Output_section::Output_section): Initialize is_relro_
12982 and is_relro_local_ fields.
12983 (Output_segment::add_output_section): Group relro sections.
12984 (Output_segment::is_first_section_relro): New function.
12985 (Output_segment::maximum_alignment): If there is a relro section,
12986 align the segment to the common page size.
12987 (Output_segment::set_section_addresses): Track whether we are
12988 looking at relro sections. If the last section is a relro
12989 section, align to the common page size.
12990 (Output_segment::set_section_list_addresses): Add in_relro
12991 parameter. Change all callers. Align to the page size when
12992 moving from relro to non-relro section.
12993 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12994 segment.
12995 * output.h (class Output_section): Add is_relro_ and
12996 is_relro_local_ fields.
12997 (Output_section::is_relro): New function.
12998 (Output_section::set_is_relro): New function.
12999 (Output_section::is_relro_local): New function.
13000 (Output_section::set_is_relro_local): New function.
13001 (class Output_segment): Update declarations.
13002 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13003 * sparc.cc (Target_sparc::got_section): Likewise.
13004 * x86_64.cc (Target_x86_64::got_section): Likewise.
13005 * testsuite/relro_test_main.cc: New file.
13006 * testsuite/relro_test.cc: New file.
13007 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13008 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13009 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13010 (relro_test.so, relro_test_pic.o): New targets.
13011 * testsuite/Makefile.in: Rebuild.
13012
13013 2008-05-16 Ian Lance Taylor <iant@google.com>
13014
13015 * output.cc (Output_segment::add_output_section): Remove front
13016 parameter.
13017 * output.h (class Output_segment): Remove
13018 add_initial_output_section and overloaded add_output_section.
13019 Update declaration of remaining add_output_section.
13020 * layout.cc (Layout::create_interp): Call add_output_section
13021 rather than add_initial_output_section.
13022 (Layout::finish_dynamic_section): Likewise.
13023
13024 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13025 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13026 know the dynamic type.
13027 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13028 field. Initialize it in constructor.
13029 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13030 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13031 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13032 reloc.
13033
13034 * output.cc (Output_reloc::get_address): Change return type to
13035 Elf_Addr.
13036 * output.h (class Output_reloc): Update get_address declaration.
13037 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13038 for section addresses.
13039
13040 2008-05-09 Ian Lance Taylor <iant@google.com>
13041
13042 PR 6493
13043 * gold.cc (gold_nomem): Use return value of write.
13044
13045 2008-05-08 Ian Lance Taylor <iant@google.com>
13046
13047 * symtab.c (Symbol::init_base_output_data): Add version
13048 parameter. Change all callers.
13049 (Symbol::init_base_output_segment): Likewise.
13050 (Symbol::init_base_constant): Likewise.
13051 (Symbol::init_base_undefined): Likewise.
13052 (Sized_symbol::init_output_data): Likewise.
13053 (Sized_symbol::init_output_segment): Likewise.
13054 (Sized_symbol::init_constant): Likewise.
13055 (Sized_symbol::init_undefined): Likewise.
13056 (Symbol_table::do_define_in_output_data): If the new symbol has a
13057 version, mark it as the default.
13058 (Symbol_table::do_define_in_output_segment): Likewise.
13059 (Symbol_table::do_define_as_constant): Likewise.
13060 * symtab.h (class Symbol): Update declarations.
13061 (class Sized_symbol): Likewise.
13062 * resolve.cc (Symbol::override_version): New function.
13063 (Symbol::override_base): Call override_version.
13064 (Symbol::override_base_with_special): Likewise.
13065 * testsuite/ver_script_8.script: New file.
13066 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13067 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13068 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13069 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13070
13071 2008-05-06 Ian Lance Taylor <iant@google.com>
13072
13073 PR 6049
13074 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13075 functions.
13076 (class General_options): Remove existing --undefined, and add
13077 --no-undefined instead. Add new --undefined as synonym for -u.
13078 * archive.cc (Archive::add_symbols): Check whether symbol was
13079 named with -u.
13080 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13081 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13082 all uses. Add IS_UNDEFINED. Update declarations to split
13083 different versions of init_base. Declare init_base_undefined.
13084 (Symbol::is_defined): Handle IS_UNDEFINED.
13085 (Symbol::is_undefined): Likewise.
13086 (Symbol::is_weak_undefined): Call is_undefined.
13087 (Symbol::is_absolute): Handle IS_CONSTANT.
13088 (class Sized_symbol): Update declarations to split different
13089 versions of init. Declare init_undefined.
13090 (class Symbol_table): Declare new functions.
13091 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13092 Change all callers.
13093 (Symbol::init_base_output_data): Likewise.
13094 (Symbol::init_base_output_segment): Likewise.
13095 (Symbol::init_base_constant): Likewise.
13096 (Symbol::init_base_undefined): New function.
13097 (Sized_symbol::init_object): Rename from init. Change all
13098 callers.
13099 (Sized_symbol::init_output_data): Likewise.
13100 (Sized_symbol::init_output_segment): Likewise.
13101 (Sized_symbol::init_constant): Likewise.
13102 (Sized_symbol::init_undefined): New function.
13103 (Symbol_table::add_undefined_symbols_from_command_line): New
13104 function.
13105 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13106 function.
13107 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13108 (Symbol::output_section): Likewise.
13109 (Symbol::set_output_section): Likewise.
13110 (Symbol_table::sized_finalize_symbol): Likewise.
13111 (Symbol_table::sized_write_globals): Likewise.
13112 * resolve.cc (Symbol_table::should_override): Likewise.
13113 (Symbol::override_base_with_special): Likewise.
13114
13115 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13116 symbol, change it to have default visibility.
13117 * testsuite/protected_1.cc: New file.
13118 * testsuite/protected_2.cc: New file.
13119 * testsuite/protected_3.cc: New file.
13120 * testsuite/protected_main_1.cc: New file.
13121 * testsuite/protected_main_2.cc: New file.
13122 * testsuite/protected_main_3.cc: New file.
13123 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13124 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13125 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13126 (protected_1.so): New target.
13127 (protected_1_pic.o, protected_2_pic.o): New targets.
13128 (protected_3_pic.o): New target.
13129 (check_PROGRAMS): Add protected_2.
13130 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13131 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13132 * testsuite/Makefile.in: Rebuild.
13133
13134 * options.h (DEFINE_var): Add set_user_set_##varname__.
13135 (DEFINE_bool_alias): New macro.
13136 (class General_options): Define -Bstatic using DEFINE_bool_alias
13137 rather than DEFINE_special. Add --undefined as an alias for -z
13138 defs.
13139 * options.cc (General_options::parse_Bstatic): Remove.
13140
13141 * options.h (class General_options): Add --fatal-warnings.
13142 * main.cc (main): Implement --fatal-warnings.
13143 * errors.h (Errors::warning_count): New function.
13144
13145 * options.h (class General_options): Add -Bsymbolic-functions.
13146 * symtab.h (Symbol::is_preemptible): Check for
13147 -Bsymbolic-functions.
13148
13149 2008-05-05 Ian Lance Taylor <iant@google.com>
13150
13151 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13152 as noVARNAME rather than no-VARNAME.
13153 (class General_options): Add option -z combreloc.
13154 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13155 get_address.
13156 (Output_reloc::sort_before) [SHT_REL]: New function.
13157 (Output_reloc::sort_before) [SHT_RELA]: New function.
13158 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13159 Sort_relocs_comparison.
13160 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13161 parameter. Change all callers.
13162 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13163 sort_relocs parameter. Change all callers.
13164 * output.cc (Output_reloc::get_address): New function, broken out
13165 of write_rel.
13166 (Output_reloc::write_rel): Call it.
13167 (Output_reloc::compare): New function.
13168 (Output_data_reloc_base::do_write): Optionally sort relocs.
13169
13170 * configure.ac: If targ_extra_obj is set, link it in.
13171 * configure.tgt: Initialize all variables.
13172 (x86_64*): Set targ_extra_obj and targ_extra_size.
13173 * configure: Rebuild.
13174
13175 * object.cc (Sized_relobj::include_section_group): Adjust section
13176 indexes read from group data. Build vector to pass to
13177 layout_group.
13178 * layout.cc (Layout::layout_group): Add flags and shndxes
13179 parameters. Remove contents parameter. Change caller. Update
13180 explicit instantiations.
13181 * layout.h (class Layout): Update layout_group declaration.
13182 * output.cc (Output_data_group::Output_data_group): Add flags and
13183 input_shndxes parameters. Remove contents parameter. Change
13184 caller.
13185 (Output_data_group::do_write): Change input_sections_ to
13186 input_shndxes_.
13187 * output.h (class Output_data_group): Update constructor
13188 declaration. Rename input_sections_ to input_shndxes_.
13189 * testsuite/many_sections_test.cc: Add template.
13190
13191 2008-04-30 Cary Coutant <ccoutant@google.com>
13192
13193 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13194
13195 * layout.cc (Layout::include_section): Refactored check for debug
13196 info section.
13197 (Layout::add_comdat): Add new parameters. Change type
13198 of signature parameter. Add object and shndx to signatures table.
13199 (Layout::find_kept_object): New function.
13200 * layout.h: Include <cstring>.
13201 (Layout::is_debug_info_section): New function.
13202 (Layout::add_comdat): Add new parameters.
13203 (Layout::find_kept_object): New function.
13204 (Layout::Kept_section): New struct.
13205 (Layout::Signatures): Change type of map range.
13206 * object.cc (Relobj::output_section_address): New function.
13207 (Sized_relobj::include_section_group): Add new parameters. Change
13208 calls to Layout::add_comdat. Change to build table of kept comdat
13209 groups and table mapping discarded sections to kept sections.
13210 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13211 (Sized_relobj::do_layout): Change calls to include_section_group and
13212 include_linkonce_section.
13213 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13214 value to zero when section is discarded.
13215 (Sized_relobj::map_to_kept_section): New function.
13216 * object.h (Relobj::output_section_address): New function.
13217 (Relobj::Comdat_group): New type.
13218 (Relobj::find_comdat_group): New function.
13219 (Relobj::Comdat_group_table): New type.
13220 (Relobj::Kept_comdat_section): New type.
13221 (Relobj::Kept_comdat_section_table): New type.
13222 (Relobj::add_comdat_group): New function.
13223 (Relobj::set_kept_comdat_section): New function.
13224 (Relobj::get_kept_comdat_section): New function.
13225 (Relobj::comdat_groups_): New field.
13226 (Relobj::kept_comdat_sections_): New field.
13227 (Symbol_value::input_value): Update comment.
13228 (Sized_relobj::map_to_kept_section) New function.
13229 (Sized_relobj::include_linkonce_section): Add new parameter.
13230 * target-reloc.h (Comdat_behavior): New type.
13231 (get_comdat_behavior): New function.
13232 (relocate_section): Add code to map a discarded section to the
13233 corresponding kept section when applying a relocation.
13234
13235 2008-04-30 Craig Silverstein <csilvers@google.com>
13236
13237 * dwarf_reader.cc (next_generation_count): New static var.
13238 (Addr2line_cache_entry): New struct.
13239 (addr2line_cache): New static var.
13240 (Dwarf_line_info::one_addr2line): Added caching.
13241 (Dwarf_line_info::clear_addr2line_cache): New function.
13242 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13243 cache-size parameter.
13244 (Dwarf_line_info::one_addr2line_cache): New function.
13245 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13246 new cache-size argument to one_addr2line(), and clear cache.
13247
13248 2008-04-28 Cary Coutant <ccoutant@google.com>
13249
13250 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13251 R_386_PC8 relocations.
13252
13253 2008-04-23 Ian Lance Taylor <iant@google.com>
13254
13255 * object.cc (Sized_relobj::include_section_group): Check for
13256 invalid section group.
13257
13258 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13259 header size.
13260
13261 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13262 than read for file header.
13263 * archive.cc (Archive::include_member): Likewise.
13264
13265 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13266
13267 * aclocal.m4: Regenerate.
13268 * configure: Regenerate.
13269
13270 2008-04-19 Ian Lance Taylor <iant@google.com>
13271
13272 * version.cc (version_string): Bump to 1.6.
13273
13274 * testsuite/Makefile.am (many_sections_r_test): New target.
13275 (many_sections_r_test_SOURCES): Remove.
13276 (many_sections_r_test_DEPENDENCIES): Remove.
13277 (many_sections_r_test_LDFLAGS): Remove.
13278 (many_sections_r_test_LDADD): Remove.
13279
13280 * object.cc (Sized_relobj::do_add_symbols): Always pass
13281 local_symbol_count_ to add_from_relobj.
13282
13283 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13284 every thousand variables.
13285 * testsuite/Makefile.in: Rebuild.
13286
13287 * object.cc (Xindex::initialize_symtab_xindex): New function.
13288 (Xindex::read_symtab_xindex): New function.
13289 (Xindex::sym_xindex_to_shndx): New function.
13290 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13291 available.
13292 (Sized_relobj::do_initialize_xindex): New function.
13293 (Sized_relobj::do_read_symbols): Adjust section links.
13294 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13295 parameter. Change all callers.
13296 (Sized_relobj::include_section_group): Adjust section links and
13297 symbol section indexes.
13298 (Sized_relobj::do_layout): Adjust section links.
13299 (Sized_relobj::do_count_local_symbols): Adjust section links and
13300 symbol section indexes.
13301 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13302 ordinary and special symbols.
13303 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13304 dynsym_xindex parameters. Change all callers. Adjust section
13305 links. Use SHN_XINDEX when needed.
13306 (Sized_relobj::get_symbol_location_info): Adjust section links.
13307 Don't get fooled by special symbols.
13308 * object.h (class Xindex): Define.
13309 (class Object): Add xindex_ parameter. Declare virtual functoin
13310 do_initialize_xindex.
13311 (Object::adjust_sym_shndx): New function.
13312 (Object::set_xindex): New protected function.
13313 (class Symbol_value): Add is_ordinary_shndx_ field.
13314 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13315 (Symbol_value::value): Assert ordinary section.
13316 (Symbol_value::initialize_input_to_output_map): Likewise.
13317 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13318 Change all callers.
13319 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13320 all callers.
13321 (class Sized_relobj): Update declarations.
13322 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13323 parameter. Change all callers.
13324 (Sized_relobj::adjust_shndx): New function.
13325 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13326 field.
13327 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13328 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13329 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13330 (Sized_dynobj::read_dynsym_section): Adjust section links.
13331 (Sized_dynobj::read_dynamic): Likewise.
13332 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13333 section links.
13334 (Sized_dynobj::do_initialize_xindex): New function.
13335 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13336 do_initialize_xindex.
13337 (Sized_dynobj::adjust_shndx): New function.
13338 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13339 dynsym_xindex_ fields.
13340 (Layout::finalize): Add a call to set_section_indexes before
13341 creating the symtab sections.
13342 (Layout::set_section_indexes): Don't do anything if the section
13343 already has a section index.
13344 (Layout::create_symtab_sections): Add shnum parameter. Change
13345 caller. Create .symtab_shndx section if needed.
13346 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13347 caller.
13348 (Layout::allocated_output_section_count): New function.
13349 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13350 needed.
13351 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13352 fields. Update declarations.
13353 (Layout::symtab_xindex): New function.
13354 (Layout::dynsym_xindex): New function.
13355 (class Write_symbols_task): Add layout_ field.
13356 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13357 Change caller.
13358 * output.cc (Output_section_headers::Output_section_headers): Add
13359 shstrtab_section parameter. Change all callers.
13360 (Output_section_headers::do_sized_write): Store overflow values
13361 for section count and section string table section index in
13362 section header zero.
13363 (Output_file_header::do_sized_write): Check for overflow of
13364 section count and section string table section index.
13365 (Output_symtab_xindex::do_write): New function.
13366 (Output_symtab_xindex::endian_do_write): New function.
13367 * output.h (class Output_section_headers): Add shstrtab_section_.
13368 Update declarations.
13369 (class Output_symtab_xindex): Define.
13370 (Output_section::has_out_shndx): New function.
13371 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13372 field.
13373 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13374 Change all callers.
13375 (Sized_symbol::init): Likewise.
13376 (Symbol::output_section): Check for ordinary symbol.
13377 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13378 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13379 callers.
13380 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13381 Change all callers. Simplify handling of symbols from sections
13382 not included in the link.
13383 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13384 distinction.
13385 (Weak_alias_sorter::operator()): Assert that symbols are
13386 ordinary.
13387 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13388 distinction.
13389 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13390 parameters. Change all callers.
13391 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13392 symbol distinction. Use SHN_XINDEX when needed.
13393 (Symbol_table::write_section_symbol): Add symtab_xindex
13394 parameter. Change all callers.
13395 (Symbol_table::sized_write_section_symbol): Likewise. Use
13396 SHN_XINDEX when needed.
13397 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13398 declarations.
13399 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13400 (Symbol::is_defined): Check is_ordinary.
13401 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13402 (Symbol::is_absolute, Symbol::is_common): Likewise.
13403 (class Sized_symbol): Update declarations.
13404 (class Symbol_table): Update declarations.
13405 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13406 parameters. Change all callers.
13407 (Sized_symbol::override): Likewise.
13408 (Symbol_table::override): Likewise.
13409 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13410 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13411 is_ordinary, and orig_st_shndx parameters. Change all callers.
13412 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13413 to be in an ordinary section.
13414 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13415 object and is_ordinary parameters. Change all callers.
13416 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13417 Change all callers. Don't add undefined or non-ordinary symbols
13418 to reloc_map_.
13419 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13420 Change all callers.
13421 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13422 declarations.
13423 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13424 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13425 (Sized_relobj::relocate_sections): Likewise.
13426 * target-reloc.h (scan_relocs): Adjust section symbol index.
13427 (scan_relocatable_relocs): Likewise.
13428 * i386.cc (Scan::local): Check for ordinary symbols.
13429 * sparc.cc (Scan::local): Likewise.
13430 * x86_64.cc (Scan::local): Likewise.
13431 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13432 to symbol_section_and_value.
13433 * testsuite/many_sections_test.cc: New file.
13434 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13435 (check_PROGRAMS): Add many_sections_test.
13436 (many_sections_test_SOURCES): Define.
13437 (many_sections_test_DEPENDENCIES): Define.
13438 (many_sections_test_LDFLAGS): Define.
13439 (BUILT_SOURCES): Add many_sections_define.h.
13440 (many_sections_define.h): New target.
13441 (BUILT_SOURCES): Add many_sections_check.h.
13442 (many_sections_check.h): New target.
13443 (check_PROGRAMS): Add many_sections_r_test.
13444 (many_sections_r_test_SOURCES): Define.
13445 (many_sections_r_test_DEPENDENCIES): Define.
13446 (many_sections_r_test_LDFLAGS): Define.
13447 (many_sections_r_test_LDADD): Define.
13448 (many_sections_r_test.o): New target.
13449 * testsuite/Makefile.in: Rebuild.
13450
13451 2008-04-17 Cary Coutant <ccoutant@google.com>
13452
13453 * errors.cc (Errors::info): New function.
13454 (gold_info): New function.
13455 * errors.h (Errors::info): New function.
13456 * gold.h (gold_info): New function.
13457 * object.cc (Input_objects::add_object): Print trace output.
13458 * options.cc (options::parse_set): New function.
13459 (General_options::parse_wrap): Deleted.
13460 (General_options::General_options): Deleted initializer.
13461 * options.h (options::String_set): New typedef.
13462 (options::parse_set): New function.
13463 (DEFINE_set): New macro.
13464 (General_options::wrap): Changed to use DEFINE_set. Changed
13465 callers of any_wrap_symbols and is_wrap_symbol.
13466 (General_options::trace, General_options::trace_symbol):
13467 New options.
13468 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13469 (General_options::wrap_symbols_): Deleted.
13470 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13471
13472 2008-04-17 David S. Miller <davem@davemloft.net>
13473
13474 * options.cc (General_options::parse_V): New function.
13475 * options.h: Add entries for -V and -Qy.
13476
13477 2008-04-17 Ian Lance Taylor <iant@google.com>
13478
13479 * common.cc (Symbol_table::allocate_commons): Remove options
13480 parameter. Change caller.
13481 (Symbol_table::do_allocate_commons): Remove options parameter.
13482 Change caller. Just call do_allocate_commons_list twice.
13483 (Symbol_table::do_allocate_commons_list): New function, broken out
13484 of do_allocate_commons.
13485 * common.h (class Allocate_commons_task): Remove options_ field.
13486 Update constructor.
13487 * symtab.cc (Symbol_table::Symbol_table): Initialize
13488 tls_commons_.
13489 (Symbol_table::add_from_object): Put TLS common symbols on
13490 tls_commons_ list.
13491 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13492 which are IN_OUTPUT_DATA.
13493 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13494 allocate_commons and do_allocate_commons declarations. Declare
13495 do_allocate_commons_list.
13496 * gold.cc (queue_middle_tasks): Update creation of
13497 Allocate_commons_task to not pass options.
13498 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13499 (TLS_TEST_C_FLAGS): New variable.
13500 (tls_test_c_pic.o): New target.
13501 (tls_test_shared.so): Link in tls_test_c_pic.o.
13502 (tls_test_c_pic_ie.o): New target.
13503 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13504 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13505 (tls_test_c.o): New target.
13506 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13507 (tls_pic_test_LDADD): Likewise.
13508 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13509 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13510 (tls_test_c_gnu2.o): New target.
13511 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13512 tls_test_c_gnu2.o.
13513 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13514 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13515 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13516 * testsuite/tls_test.cc: Include "config.h".
13517 (t_last): Call t11_last.
13518 * testsuite/tls_test.h (t11, t11_last): Declare.
13519 * testsuite/tls_test_c.c: New file.
13520 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13521 * configure.ac: Check for OpenMP support.
13522 * configure, config.in, Makefile.in: Rebuild.
13523 * testsuite/Makefile.in: Rebuild.
13524
13525 2008-04-16 Cary Coutant <ccoutant@google.com>
13526
13527 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13528 (Target_i386::tls_base_symbol_defined_): New field.
13529 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13530 (Target_i386::Scan::global): Likewise.
13531 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13532 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13533 (Target_x86_64::tls_base_symbol_defined_): New field.
13534 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13535 (Target_x86_64::Scan::global): Likewise.
13536
13537 2008-04-16 Cary Coutant <ccoutant@google.com>
13538
13539 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13540 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13541 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13542 building shared libraries.
13543 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13544 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13545 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13546 * testsuite/Makefile.in: Rebuild.
13547 * testsuite/weak_undef.h: New file.
13548 * testsuite/weak_undef_file1.cc: Add extra test cases.
13549 * testsuite/weak_undef_file2.cc: Likewise.
13550 * testsuite/weak_undef_test.cc: Likewise.
13551
13552 2008-04-16 David S. Miller <davem@davemloft.net>
13553
13554 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13555 Add issued_non_pic_error_ field. Declare check_non_pic.
13556 (Target_sparc::Scan::check_non_pic): New function.
13557 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13558 (Target_sparc::Scan::global): Likewise.
13559
13560 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13561 * configure: Rebuild.
13562
13563 * options.h (DEFINE_enable): New macro.
13564 (new_dtags): New enable option.
13565 (initfirst, interpose, loadfltr, nodefaultlib,
13566 nodelete, nodlopen, nodump): New -z options.
13567 * layout.cc (Layout:finish_dynamic_section): If new
13568 dtags enabled, emit DT_RUNPATH. Also, emit a
13569 DT_FLAGS_1 containing any specified -z flags.
13570
13571 2008-04-16 Ian Lance Taylor <iant@google.com>
13572
13573 * copy-relocs.cc: New file.
13574 * copy-relocs.h: New file.
13575 * reloc.cc: Remove Copy_relocs code.
13576 * reloc.h: Likewise.
13577 * reloc-types.h (struct Reloc_types) [both versions]: Add
13578 get_reloc_addend_noerror.
13579 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13580 variants of add_global which take an addend which must be zero.
13581 * i386.cc: Include "copy-relocs.h".
13582 (class Target_i386): Change type of copy_relocs_ to variable,
13583 update initializer.
13584 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13585 Change all callers.
13586 (Target_i386::do_finalize_sections): Change handling of
13587 copy_relocs_.
13588 * sparc.cc: Include "copy-relocs.h".
13589 (class Target_sparc): Change type of copy_relocs_ to variable,
13590 update initializer.
13591 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13592 Change all callers.
13593 (Target_sparc::do_finalize_sections): Change handling of
13594 copy_relocs_.
13595 * x86_64.cc: Include "copy-relocs.h".
13596 (class Target_x86_64): Change type of copy_relocs_ to variable,
13597 update initializer.
13598 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13599 class. Change all callers.
13600 (Target_x86_64::do_finalize_sections): Change handling of
13601 copy_relocs_.
13602 * Makefile.am (CCFILES): Add copy-relocs.cc.
13603 (HFILES): Add copy-relocs.h.
13604
13605 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13606
13607 * testsuite/script_test_4.sh: Permit leading zeroes.
13608
13609 2008-04-15 Ian Lance Taylor <iant@google.com>
13610
13611 * script-sections.cc (Script_sections::create_segments): Use
13612 header_size_adjustment even when there is enough room for the
13613 headers.
13614 * testsuite/script_test_4.sh: New file.
13615 * testsuite/script_test_4.t: New file.
13616 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13617 (check_DATA): Add script_test_4.stdout.
13618 (MOSTLYCLEANFILES): Likewise.
13619 (script_test_4): New target.
13620 (script_test_4.stdout): New target.
13621 * testsuite/Makefile.in: Rebuild.
13622
13623 * sparc.cc: Add definitions for Output_data_plt_sparc class
13624 constants.
13625
13626 2008-04-14 David S. Miller <davem@davemloft.net>
13627
13628 * sparc.cc: New file.
13629 * Makefile.am (TARGETSOURCES): Add sparc.cc
13630 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13631 * configure.tgt: Document targ_extra_size and
13632 targ_extra_big_endian. Add entries for sparc-* and
13633 sparc64-*.
13634 * configure.ac: Handle targ_extra_size and
13635 targ_extra_big_endian.
13636 * Makefile.in: Rebuild.
13637 * configure: Likewise.
13638 * po/POTFILES.in: Likewise.
13639 * po/gold.pot: Likewise.
13640
13641 2008-04-14 Ian Lance Taylor <iant@google.com>
13642
13643 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13644 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13645 in the name/type/flags to section mapping. Don't call
13646 allocate_output_section.
13647 (Layout::choose_output_section): Change parameter from adjust_name
13648 to is_input_section. Don't permit input sections after sections
13649 are attached to segments. Don't call allocate_output_section.
13650 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13651 not write_enable_output_section.
13652 (Layout::make_output_section): Don't push to
13653 unattached_section_list_ nor call attach_to_segment. Call
13654 attach_section_to_segment if sections are attached.
13655 (Layout::attach_sections_to_segments): New function.
13656 (Layout::attach_section_to_segment): New function.
13657 (Layout::attach_allocated_section_to_segment): Rename from
13658 attach_to_segment. Remove flags parameter.
13659 (Layout::allocate_output_section): Remove function.
13660 (Layout::write_enable_output_section): Remove function.
13661 * layout.h (class Layout): Update for above changes. Add new
13662 field sections_are_attached_.
13663 * output.h (Output_section::update_flags_for_input_section): New
13664 function.
13665 * output.cc (Output_section::add_input_section): Call
13666 update_flags_for_input_section.
13667 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13668
13669 2008-04-11 Cary Coutant <ccoutant@google.com>
13670
13671 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13672 thought unnecessary.
13673 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13674
13675 2008-04-11 Ian Lance Taylor <iant@google.com>
13676
13677 * output.h (class Output_section_data): Remove inline definition
13678 of set_addralign.
13679 * output.cc (Output_section_data::set_addralign): New function.
13680
13681 2008-04-11 Cary Coutant <ccoutant@google.com>
13682
13683 Add support for TLS descriptors for i386 and x86_64.
13684 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13685 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13686 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13687 GOT_TYPE_TLS_DESC.
13688 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13689 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13690 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13691 relocations.
13692 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13693 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13694 Fix problem with initial-exec relocations.
13695 (Target_i386::Relocate::relocate_tls): Likewise.
13696 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13697 relaxation.
13698 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13699 support for section-plus-offset dynamic table entries.
13700 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13701 (Output_data_dynamic::Dynamic_entry): Add support for
13702 section-plus-offset dynamic table entries.
13703 (Output_data_dynamic::Classification): Likewise.
13704 (Output_data_dynamic::classification_): Renamed offset_.
13705 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13706 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13707 (Target_x86_64::make_plt_section): New function.
13708 (Target_x86_64::reserve_tlsdesc_entries): New function.
13709 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13710 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13711 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13712 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13713 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13714 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13715 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13716 add extra PLT entry for TLS descriptors.
13717 (Output_data_plt_x86_64::got_): New field.
13718 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13719 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13720 fields.
13721 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13722 descriptors.
13723 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13724 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13725 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13726 R_386_TLS_DESC_CALL relocations.
13727 (Target_x86_64::Scan::global): Likewise.
13728 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13729 for TLS descriptors.
13730 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13731 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13732 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13733 GD-to-IE relaxation.
13734 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13735 and TLS_DESCRIPTORS.
13736 * Makefile.in: Rebuild.
13737 * configure: Rebuild.
13738 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13739 (tls_test_shared2.so): New target.
13740 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13741 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13742 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13743 (tls_shared_gd_to_ie_test_LDADD): New variable.
13744 (tls_shared_gnu2_gd_to_ie_test): New target.
13745 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13746 New targets.
13747 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13748 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13749 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13750 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13751 (tls_shared_gnu2_test): New target.
13752 (tls_test_gnu2_shared.so): New target.
13753 (tls_shared_gnu2_test_SOURCES): New variable.
13754 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13755 (tls_shared_gnu2_test_LDFLAGS): New variable.
13756 (tls_shared_gnu2_test_LDADD): New variable.
13757 * testsuite/Makefile.in: Rebuild.
13758 * testsuite/Makefile.
13759
13760 2008-04-11 Ian Lance Taylor <iant@google.com>
13761
13762 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13763 justsyms.t.
13764 * testsuite/Makefile.in: Rebuild.
13765
13766 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13767 long.
13768 * testsuite/script_test_2.cc (main): Adjust test.
13769
13770 2008-04-11 David S. Miller <davem@davemloft.net>
13771 Ian Lance Taylor <iant@google.com>
13772
13773 * options.h (General_options): Add entries for '-Y' and
13774 '-relax'.
13775 * options.cc (General_options:finalize): If -Y was used, add those
13776 entries to the library path instead of the default "/lib" and
13777 "/usr/lib".
13778
13779 2008-04-11 David S. Miller <davem@davemloft.net>
13780
13781 * testsuite/justsyms.t: Start at 0x100.
13782 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13783 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13784 long.
13785 * testsuite/script_test_2.cc: Adjust string and section length
13786 checks.
13787
13788 2008-04-09 Ian Lance Taylor <iant@google.com>
13789
13790 PR gold/5996
13791 * script-sections.cc (Sections_element::allocate_to_segment): Add
13792 orphan parameter.
13793 (Output_section_definition::allocate_to_segment): Likewise.
13794 (Orphan_output_section::allocate_to_segment): Likewise.
13795 (Script_sections::attach_sections_using_phdrs_clause): Don't
13796 propagate non-PT_LOAD segments to orphan sections.
13797 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13798 readelf rather than objdump.
13799 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13800 .interp section and PT_INTERP segment are the same size.
13801 * testsuite/Makefile.in: Rebuild.
13802
13803 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13804 aliases for symbols defined in the same object.
13805 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13806 (weak_alias_test_SOURCES): New variable.
13807 (weak_alias_test_DEPENDENCIES): New variable.
13808 (weak_alias_test_LDFLAGS): New variable.
13809 (weak_alias_test_LDADD): New variable.
13810 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13811 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13812 (weak_alias_test_3.o): New target.
13813 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13814 * testsuite/weak_alias_test_main.cc: New file.
13815 * testsuite/weak_alias_test_1.cc: New file.
13816 * testsuite/weak_alias_test_2.cc: New file.
13817 * testsuite/weak_alias_test_3.cc: New file.
13818
13819 2008-04-08 Ian Lance Taylor <iant@google.com>
13820
13821 * options.h (class General_options): Add --noinhibit-exec option.
13822 * main.cc (main): Check --noinhibit-exec.
13823
13824 * options.h (class General_options): Define --wrap as a special
13825 option. Add wrap_symbols_ field.
13826 (General_options::any_wrap_symbols): New function.
13827 (General_options::is_wrap_symbol): New function.
13828 * options.cc (General_options::parse_wrap): New function.
13829 (General_options::General_options): Initialize wrap_symbols_.
13830 * symtab.cc (Symbol_table::wrap_symbol): New function.
13831 (Symbol_table::add_from_object): Handle --wrap.
13832 * symtab.h (class Symbol_table): Declare wrap_symbol.
13833 * target.h (Target::wrap_char): New function.
13834 (Target::Target_info): Add wrap_char field.
13835 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13836 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13837 * testsuite/testfile.cc (Target_test::test_target_info):
13838 Likewise.
13839
13840 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13841 there is one.
13842
13843 * layout.h (class Layout): Add added_eh_frame_data_ field.
13844 * layout.cc (Layout::Layout): Initialize new field.
13845 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13846 output section until we find a section we merged successfully.
13847 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13848 that the size be non-zero.
13849
13850 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13851 qualifier.
13852
13853 2008-04-08 Craig Silverstein <csilvers@google.com>
13854
13855 * configure.ac: Export new conditional variable HAVE_ZLIB.
13856 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13857 on HAVE_ZLIB.
13858 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13859 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13860
13861 2008-04-07 Ian Lance Taylor <iant@google.com>
13862
13863 * version.cc (version_string): Set to "1.5".
13864
13865 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13866 Add issued_non_pic_error_ field. Declare check_non_pic.
13867 (Target_x86_64::Scan::check_non_pic): New function.
13868 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13869 (Target_x86_64::Scan::global): Likewise.
13870
13871 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13872 addend parameter. Change caller. Handle merge sections.
13873 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13874 Address to Addend. Don't add in the result of
13875 local_section_offset, pass down the addend and use the returned
13876 value.
13877 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13878 Update declarations of local_section_offset and symbol_value.
13879 * testsuite/two_file_test_1.cc (t18): New function.
13880 * testsuite/two_file_test_2.cc (f18): New function.
13881 * testsuite/two_file_test_main.cc (main): Call t18.
13882 * testsuite/two_file_test.h (t18, f18): Declare.
13883
13884 * configure.ac: Don't test for objdump, c++filt, or readelf.
13885 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13886 conditionals.
13887 (TEST_READELF): New variable.
13888 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13889 (check_PROGRAMS): Add two_file_strip_test.
13890 (two_file_strip_test): New target.
13891 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13892 (two_file_same_shared_strip_test_SOURCES): New variable.
13893 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13894 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13895 (two_file_same_shared_strip_test_LDADD): New variable.
13896 (two_file_shared_strip.so): New target.
13897 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13898 (ver_test_5.syms, ver_test_7.syms): Likewise.
13899 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13900 (strip_test_3.stdout): Use TEST_OBJDUMP.
13901 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13902
13903 2008-04-04 Cary Coutant <ccoutant@google.com>
13904
13905 * symtab.h (Symbol::is_weak_undefined): New function.
13906 (Symbol::is_strong_undefined): New function.
13907 (Symbol::is_absolute): New function.
13908 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13909 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13910 absolute symbols.
13911 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13912 (weak_undef_test): New target.
13913 * testsuite/Makefile.in: Rebuild.
13914 * testsuite/weak_undef_file1.cc: New file.
13915 * testsuite/weak_undef_file2.cc: New file.
13916 * testsuite/weak_undef_test.cc: New file.
13917
13918 2008-04-03 Craig Silverstein <csilvers@google.com>
13919
13920 * compressed_output.h (class Output_compressed_section): Use
13921 unsigned buffer.
13922 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13923 add zlib header.
13924 (zlib_compressed_suffix): Removed.
13925 (Output_compressed_section::set_final_data_size): Use unsigned
13926 buffers.
13927 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13928 Fix linker invocation.
13929 (flagstest_o_specialfile_and_compress_debug_sections):
13930 Likewise.
13931 * testsuite/Makefile.in: Regenerated.
13932
13933 2008-04-02 David S. Miller <davem@davemloft.net>
13934
13935 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13936 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13937
13938 2008-04-02 Craig Silverstein <csilvers@google.com>
13939
13940 * TODO: New file.
13941
13942 2008-04-02 Ian Lance Taylor <iant@google.com>
13943
13944 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13945 parameters. Update for new key type to views_. Change all
13946 callers.
13947 (File_read::read): Adjust for byteshift in returned view.
13948 (File_read::add_view): New function, broken out of
13949 find_and_make_view.
13950 (File_read::make_view): New function, broken out of
13951 find_and_make_view.
13952 (File_read::find_or_make_view): Add offset and aligned
13953 parameters. Rewrite accordingly. Change all callers.
13954 (File_read::get_view): Add offset and aligned parameters. Adjust
13955 for byteshift in return value.
13956 (File_read::get_lasting_view): Likewise.
13957 * fileread.h (class File_read): Update declarations.
13958 (class File_read::View): Add byteshift_ field. Add byteshift to
13959 constructor. Add byteshift method.
13960 * archive.h (Archive::clear_uncached_views): New function.
13961 (Archive::get_view): Add aligned parameter. Change all callers.
13962 * object.h (Object::get_view): Add aligned parameter. Change all
13963 callers.
13964 (Object::get_lasting_view): Likewise.
13965
13966 * fileread.cc (File_read::release): Don't call clear_views if
13967 there are multiple objects.
13968 * fileread.h (File_read::clear_uncached_views): New function.
13969 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13970 on the archive.
13971
13972 2008-03-31 Cary Coutant <ccoutant@google.com>
13973
13974 Add thin archive support.
13975 * archive.cc (Archive::armagt): New const.
13976 (Archive::setup): Remove task parameter and calls to unlock.
13977 (Archive::unlock_nested_archives): New function.
13978 (Archive::read_header): Add nested_off parameter. Change
13979 all callers.
13980 (Archive::interpret_header): Likewise.
13981 (Archive::include_all_members): Change to handle thin
13982 archives.
13983 (Archive::include_member): Likewise.
13984 * archive.h (Archive::Archive): Add new parameters and
13985 initializers.
13986 (Archive::armagt): New const.
13987 (Archive::setup): Remove task parameter.
13988 (Archive::unlock_nested_archives): New function.
13989 (Archive::read_header): Add nested_off parameter.
13990 (Archive::interpret_header): Likewise.
13991 (Archive::Nested_archive_table): New typedef.
13992 (Archive::is_thin_archive_): New field.
13993 (Archive::nested_archives_): New field.
13994 (Archive::options_): New field.
13995 (Archive::dirpath_): New field.
13996 (Archive::task_): New field.
13997 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13998 for thin archives. Pass additional parameters to
13999 Archive::Archive. Unlock the archive file after calling
14000 Archive::setup.
14001
14002 2008-03-29 Ian Lance Taylor <iant@google.com>
14003
14004 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14005 version symbol to be local.
14006 * testsuite/ver_test_4.sh: New file.
14007 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14008 (check_DATA): Add ver_test_4.syms.
14009 (ver_test_4.syms): New target.
14010 * testsuite/Makefile.in: Rebuild.
14011
14012 * output.cc
14013 (Output_section::Input_section_sort_entry::has_priority): New
14014 function.
14015 (Output_section::Input_section_sort_entry::match_file_name): New
14016 function.
14017 (Output_section::Input_section_sort_entry::match_section_name):
14018 Remove.
14019 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14020 Remove.
14021 (Output_section::Input_section_sort_entry::match_section_file):
14022 Remove.
14023 (Output_section::Input_section_sort_compare::operator()): Rewrite
14024 using new Input_section_sort_entry functions. Sort crtbegin and
14025 crtend first. Sort sections with no priority before sections with
14026 a priority.
14027 * testsuite/initpri1.c (d3): Check j != 4.
14028 (cd5): New constructor/destructor function.
14029 (main): Check j != 2.
14030
14031 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14032 new symbol when resolving, don't call set_is_default.
14033 * testsuite/ver_test_7.cc: New file.
14034 * testsuite/ver_test_7.sh: New file.
14035 * testsuite/Makefile.am (ver_test_7.so): New target.
14036 (ver_test_7.o): New target.
14037 (check_SCRIPTS): Add ver_test_7.sh.
14038 (check_DATA): Add ver_test_7.syms.
14039 (ver_test_7.syms): New target.
14040
14041 2008-03-28 Ian Lance Taylor <iant@google.com>
14042
14043 * layout.cc (Layout::layout): If we see an input section with a
14044 name that needs sorting, set the must_sort flag for the output
14045 section.
14046 (Layout::make_output_section): If the name of the output section
14047 indicates that it might require sorting, set the may_sort flag.
14048 * output.h (Output_section::may_sort_attached_input_sections): New
14049 function.
14050 (Output_section::set_may_sort_attached_input_sections): New
14051 function.
14052 (Output_section::must_sort_attached_input_sections): New
14053 function.
14054 (Output_section::set_must_sort_attached_input_sections): New
14055 function.
14056 (class Output_section): Declare Input_section_sort_entry. Define
14057 Input_section_sort_compare. Declare
14058 sort_attached_input_sections. Add new fields:
14059 may_sort_attached_input_sections_,
14060 must_sort_attached_input_sections_,
14061 attached_input_sections_are_sorted_.
14062 * output.cc (Output_section::Output_section): Initialize new
14063 fields.
14064 (Output_section::add_input_section): Add an entry to
14065 input_sections_ if may_sort or must_sort are true.
14066 (Output_section::set_final_data_size): Call
14067 sort_attached_input_sections if necessary.
14068 (Output_section::Input_section_sort_entry): Define new class.
14069 (Output_section::Input_section_sort_compare::operator()): New
14070 function.
14071 (Output_section::sort_attached_input_sections): New function.
14072 * configure.ac: Check whether the compiler supports constructor
14073 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14074 * testsuite/initpri1.c: New file.
14075 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14076 CONSTRUCTOR_PRIORITY.
14077 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14078 (initpri1_LDFLAGS): New variable.
14079 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14080
14081 2008-03-27 Ian Lance Taylor <iant@google.com>
14082
14083 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14084 * testsuite/common_test_1.c: New file.
14085 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14086 (common_test_1_SOURCES): New variable.
14087 (common_test_1_DEPENDENCIES): New variable.
14088 (common_test_1_LDFLAGS): New variable.
14089
14090 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14091 and commons_ correctly when NAME/VERSION does not override
14092 NAME/NULL.
14093 * testsuite/ver_test_6.c: New file.
14094 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14095 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14096 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14097
14098 2008-03-26 Ian Lance Taylor <iant@google.com>
14099
14100 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14101 of an undefined symbol from a version script.
14102 * testsuite/Makefile.am (ver_test_5.so): New target.
14103 (ver_test_5.o): New target.
14104 (check_SCRIPTS): Add ver_test_5.sh.
14105 (check_DATA): Add ver_test_5.syms.
14106 (ver_test_5.syms): New target.
14107 * testsuite/ver_test_5.cc: New file.
14108 * testsuite/ver_test_5.script: New file.
14109 * testsuite/ver_test_5.sh: New file.
14110 * Makefile.in, testsuite/Makefile.in: Rebuild.
14111
14112 PR gold/5986
14113 Fix problems building gold with gcc 4.3.0.
14114 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14115 (gold_error_at_location, gold_warning_at_location): Use it.
14116 * configure.ac: Check whether we can compile and use a template
14117 function with a printf attribute.
14118 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14119 when jumping over bytes.
14120 * object.cc: Instantiate Object::read_section_data.
14121 * debug.h: Include <cstring>
14122 * dwarf_reader.cc: Include <algorithm>
14123 * main.cc: Include <cstring>.
14124 * options.cc: Include <cstring>.
14125 * output.cc: Include <cstring>.
14126 * script.cc: Include <cstring>.
14127 * script.h: Include <string>.
14128 * symtab.cc: Include <cstring> and <algorithm>.
14129 * target-select.cc: Include <cstring>.
14130 * version.cc: Include <string>.
14131 * testsuite/testmain.cc: Include <cstdlib>.
14132 * configure, config.in: Rebuild.
14133
14134 2008-03-25 Ian Lance Taylor <iant@google.com>
14135
14136 * options.cc: Include "../bfd/bfdver.h".
14137 (options::help): Print bug reporting address.
14138
14139 * version.cc (print_version): Adjust output for current value of
14140 BFD_VERSION_STRING.
14141
14142 * NEWS: New file.
14143
14144 * options.cc (options::help): Print list of supported targets.
14145 * target-select.h: Include <vector>.
14146 (class Target_selector): Make machine_, size_, and is_big_endian_
14147 fields const. Add bfd_name_ and instantiated_target_ fields.
14148 (Target_selector::Target_selector): Add bfd_name parameter.
14149 (Target_selector::recognize): Make non-virtual, call
14150 do_recognize.
14151 (Target_selector::recognize_by_name): Make non-virtual, call
14152 do_recognize_by_name.
14153 (Target_selector::supported_names): New function.
14154 (Target_selector::bfd_name): New function.
14155 (Target_selector::do_instantiate_target): New pure virtual
14156 function.
14157 (Target_selector::do_recognize): New virtual function.
14158 (Target_selector::do_recognize_by_name): New virtual function.
14159 (Target_selector::instantiate_target): New private function.
14160 (supported_target_names): Declare.
14161 * target-select.cc (Target_selector::Target_selector): Update for
14162 new parameter and fields.
14163 (select_target_by_name): Check that the name matches before
14164 calling recognize_by_name.
14165 (supported_target_names): New function.
14166 * i386.cc (class Target_selector_i386): Update Target_selector
14167 constructor call. Remove recognize and recognize_by_name. Add
14168 do_instantiate_target.
14169 * x86_64.cc (class Target_selector_x86_64): Likewise.
14170 * testsuite/testfile.cc (class Target_selector_test): Update for
14171 changes to Target_selector.
14172
14173 * README: Rewrite, with some notes on unsupported features.
14174
14175 2008-03-24 Cary Coutant <ccoutant@google.com>
14176
14177 * i386.cc (Target_i386::Got_type): New enum declaration.
14178 (Target_i386::Scan::local): Updated callers of Output_data_got
14179 member functions.
14180 (Target_i386::Scan::global): Likewise.
14181 (Target_i386::Relocate::relocate): Likewise.
14182 (Target_i386::Relocate::relocate_tls): Likewise.
14183 * object.h (Got_offset_list): New class.
14184 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14185 (Sized_relobj::local_got_offset): Likewise.
14186 (Sized_relobj::set_local_got_offset): Likewise.
14187 (Sized_relobj::local_has_tls_got_offset): Removed.
14188 (Sized_relobj::local_tls_got_offset): Removed.
14189 (Sized_relobj::set_local_tls_got_offset): Removed.
14190 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14191 * output.cc (Output_data_got::add_global): Added got_type parameter.
14192 (Output_data_got::add_global_with_rel): Likewise.
14193 (Output_data_got::add_global_with_rela): Likewise.
14194 (Output_data_got::add_global_pair_with_rel): New function.
14195 (Output_data_got::add_global_pair_with_rela): New function.
14196 (Output_data_got::add_local): Added got_type parameter.
14197 (Output_data_got::add_local_with_rel): Likewise.
14198 (Output_data_got::add_local_with_rela): Likewise.
14199 (Output_data_got::add_local_pair_with_rel): New function.
14200 (Output_data_got::add_local_pair_with_rela): New function.
14201 (Output_data_got::add_global_tls): Removed.
14202 (Output_data_got::add_global_tls_with_rel): Removed.
14203 (Output_data_got::add_global_tls_with_rela): Removed.
14204 (Output_data_got::add_local_tls): Removed.
14205 (Output_data_got::add_local_tls_with_rel): Removed.
14206 (Output_data_got::add_local_tls_with_rela): Removed.
14207 * output.h (Output_data_got::add_global): Added got_type parameter.
14208 (Output_data_got::add_global_with_rel): Likewise.
14209 (Output_data_got::add_global_with_rela): Likewise.
14210 (Output_data_got::add_global_pair_with_rel): New function.
14211 (Output_data_got::add_global_pair_with_rela): New function.
14212 (Output_data_got::add_local): Added got_type parameter.
14213 (Output_data_got::add_local_with_rel): Likewise.
14214 (Output_data_got::add_local_with_rela): Likewise.
14215 (Output_data_got::add_local_pair_with_rel): New function.
14216 (Output_data_got::add_local_pair_with_rela): New function.
14217 (Output_data_got::add_global_tls): Removed.
14218 (Output_data_got::add_global_tls_with_rel): Removed.
14219 (Output_data_got::add_global_tls_with_rela): Removed.
14220 (Output_data_got::add_local_tls): Removed.
14221 (Output_data_got::add_local_tls_with_rel): Removed.
14222 (Output_data_got::add_local_tls_with_rela): Removed.
14223 * resolve.cc (Symbol::override_base_with_special): Removed
14224 reference to has_got_offset_ field.
14225 * symtab.cc (Symbol::init_fields): Replaced initialization
14226 of got_offset_ with got_offsets_. Removed initialization
14227 of has_got_offset_
14228 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14229 (Symbol::got_offset): Likewise.
14230 (Symbol::set_got_offset): Likewise.
14231 (Symbol::has_tls_got_offset): Removed.
14232 (Symbol::tls_got_offset): Removed.
14233 (Symbol::set_tls_got_offset): Removed.
14234 (Symbol::got_offset_): Removed.
14235 (Symbol::tls_mod_got_offset_): Removed.
14236 (Symbol::tls_pair_got_offset_): Removed.
14237 (Symbol::got_offsets_): New field.
14238 (Symbol::has_got_offset): Removed.
14239 (Symbol::has_tls_mod_got_offset): Removed.
14240 (Symbol::has_tls_pair_got_offset): Removed.
14241 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14242 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14243 member functions.
14244 (Target_x86_64::Scan::global): Likewise.
14245 (Target_x86_64::Relocate::relocate): Likewise.
14246 (Target_x86_64::Relocate::relocate_tls): Likewise.
14247
14248 2008-03-25 Ben Elliston <bje@au.ibm.com>
14249
14250 * yyscript.y: Fix spelling error in comment.
14251
14252 2008-03-24 Ian Lance Taylor <iant@google.com>
14253
14254 * options.h (class General_options): Define build_id option.
14255 * layout.h (class Layout): Declare write_build_id, create_note,
14256 create_build_id. Add build_id_note_ member.
14257 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14258 "libiberty.h", "md5.h", "sha1.h".
14259 (Layout::Layout): Initialize eh_frame_data_,
14260 eh_frame_hdr_section_, and build_id_note_.
14261 (Layout::finalize): Call create_build_id.
14262 (Layout::create_note): New function, broken out of
14263 Layout::create_gold_note.
14264 (Layout::create_gold_note): Call create_note.
14265 (Layout::create_build_id): New function.
14266 (Layout::write_build_id): New function.
14267 (Close_task_runner::run): Call write_build_id.
14268
14269 * x86_64.cc: Correct license to GPLv3.
14270
14271 2008-03-23 Ian Lance Taylor <iant@google.com>
14272
14273 * options.cc: Include "demangle.h".
14274 (parse_optional_string): New function.
14275 (parse_long_option): Handle takes_optional_argument.
14276 (parse_short_option): Update dash_z initializer. Handle
14277 takes_optional_argument.
14278 (General_options::General_options): Initialize do_demangle_.
14279 (General_options::finalize): Set do_demangle_. Handle demangling
14280 style.
14281 * options.h (parse_optional_string): Declare.
14282 (struct One_option): Add optional_arg field. Update constructor.
14283 Update call constructor calls. Add takes_optional_argument
14284 function.
14285 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14286 (DEFINE_optional_string): Define.
14287 (General_options::demangle): Change from DEFINE_bool to
14288 DEFINE_optional_string.
14289 (General_options::no_demangle): New function.
14290 (General_options::do_demangle): New function.
14291 (General_options::set_do_demangle): New function.
14292 (General_options::execstack_status_): Move definition to end of
14293 class definition.
14294 (General_options::static_): Likewise.
14295 (General_options::do_demangle_): New field.
14296 * object.cc (big_endian>::get_symbol_location_info): Call
14297 Options::do_demangle, not Options::demangle.
14298 * symtab.cc (demangle): Likewise.
14299
14300 2008-03-22 Ian Lance Taylor <iant@google.com>
14301
14302 * gold.h: Include <cstddef> and <sys/types.h>
14303 * options.h: Include <cstring>.
14304
14305 2008-03-21 Ian Lance Taylor <iant@google.com>
14306
14307 * Added source code to GNU binutils.
14308 \f
14309 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14310
14311 Copying and distribution of this file, with or without modification,
14312 are permitted in any medium without royalty provided the copyright
14313 notice and this notice are preserved.
14314
14315 Local Variables:
14316 mode: change-log
14317 left-margin: 8
14318 fill-column: 74
14319 version-control: never
14320 End: