daily update
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
0ec6429b
AM
12013-01-14 Alan Modra <amodra@gmail.com>
2
3 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
4 * testsuite/Makefile.in: Regenerate.
5
0bf402d5
ILT
62013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
7
8 Fix mingw gold build with plugins enabled
9 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
10 * configure.ac: Export DLOPEN_LIBS and add headers check.
11 * plugin.cc: Handle non-dlfcn case.
12 * Makefile.in: Regenerate.
13 * config.in: Regenerate.
14 * configure: Regenerate.
15 * testsuite/Makefile.in: Regenerate.
16
9e9143bc
ST
172013-01-09 Sriraman Tallam <tmsriram@google.com>
18
19 * output.h (sort_attached_input_sections): Change to be public.
20 * script-sections.cc
21 (Output_section_definition::set_section_addresses): Sort
22 attached input sections according to section order before linker
23 script assigns section addresses.
24 (Orphan_output_section::set_section_addresses): Sort
25 attached input sections according to section order before linker
26 script assigns section addresses.
27 * Makefile.am (final_layout.sh): Use a simple linker script to
28 check if section ordering still works.
29 * Makefile.in: Regenerate.
30
679af368
ILT
312013-01-09 Ben Cheng <bccheng@google.com>
32
33 * arm.cc (Target_arm::attributes_accept_div): New function.
34 (Target_arm::attributes_forbid_div): New function.
35 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
36 attribute using the same new functions as what bfd/elf32_arm.c
37 does.
38
3136a00e
CC
392013-01-07 Cary Coutant <ccoutant@google.com>
40
41 PR gold/14993
42 * output.cc (Output_section::add_input_section): For incremental
43 updates, don't track input sections that are allocated from patch
44 space.
45
f2a6224b
L
462013-01-07 H.J. Lu <hongjiu.lu@intel.com>
47 Ian Lance Taylor <iant@google.com>
48
49 PR gold/14897
50 * configure.ac (--enable-ld): Removed.
51 (install_as_default): Set to yes only for --enable-gold=default
52 or --disable-ld.
53 * configure: Regenerated.
54
4f46f626
L
552013-01-07 H.J. Lu <hongjiu.lu@intel.com>
56
57 * options.h (General_options): Add -fuse-ld= for GCC linker
58 option compatibility.
59
26e4ef59
CC
602013-01-04 Cary Coutant <ccoutant@google.com>
61
62 * configure.ac: Fix typo restoring CXXFLAGS.
63 * configure: Regenerate.
64
3d587466
CC
652013-01-04 Cary Coutant <ccoutant@google.com>
66
4f46f626
L
67 * testsuite/Makefile.am (CXXLINK_S): New macro.
68 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
69 * testsuite/Makefile.in: Regenerate.
3d587466 70
44db6695
L
712013-01-02 H.J. Lu <hongjiu.lu@intel.com>
72
73 * version.cc (print_version): Update copyright year to 2013.
74
edcac0c1
ILT
752012-12-20 Ian Lance Taylor <iant@google.com>
76
77 * layout.cc (Layout::special_ordering_of_input_section): New
78 function.
79 (Layout::layout): If input section requires special ordering, must
80 sort input sections.
81 (Layout::make_output_section): May sort .text input sections.
82 (Layout::is_section_name_prefix_grouped): Remove.
83 * layout.h (class Layout): Declare
84 special_ordering_of_input_section. Don't declare
85 is_section_name_prefix_grouped.
86 * output.cc (Output_section::add_input_section): Revert last
87 change.
88 (Output_section::Input_section_sort::match_file_name): Don't crash
89 if called on output section data.
90 (Output_section::Input_section_sort_compare): Sort based on
91 special ordering.
92 (Output_section::Input_section_sort_section_order_index_compare):
93 Revert last patch.
94 (Output_section::sort_attached_input_sections): Likewise.
95
28f2a4ac
ST
962012-12-18 Sriraman Tallam <tmsriram@google.com>
97
edcac0c1 98 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
28f2a4ac
ST
99 * layout.h (Layout::is_section_name_prefix_grouped): New function.
100 * output.cc (Output_section::add_input_section): Check if section
101 name contains special prefix. Keep input sections to sort such
102 sections.
103 (Output_section::Input_section_sort_section_order_index_compare
104 ::operator()): Group sections according to prefixes.
edcac0c1
ILT
105 (Output_section::sort_attached_input_sections): Add condition to
106 Input_section_entry constructor call.
28f2a4ac
ST
107 * testsuite/Makefile.am (text_section_grouping): New test.
108 * testsuite/Makefile.in: Regenerate.
109 * testsuite/text_section_grouping.cc: New file.
110 * testsuite/text_section_grouping.sh: New file.
111
5bf135a7
NC
1122012-12-17 Nick Clifton <nickc@redhat.com>
113
114 * Makefile.am: Add copyright notice.
115 * NEWS: Likewise.
116 * README: Likewise.
117 * configure.ac: Likewise.
118 * ftruncate.c: Likewise.
119 * Makefile.in: Regenerate.
120
59965708
CC
1212012-12-14 Cary Coutant <ccoutant@google.com>
122
123 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
124 --no-as-needed flag.
125 (exception_separate_shared_12_test): Likewise.
126 (incremental_copy_test): Likewise.
127 * testsuite/Makefile.in: Regenerate.
128
2a77e2ab
CC
1292012-12-14 Cary Coutant <ccoutant@google.com>
130
131 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
132 (Dwp_output_file::Dwp_index::enter_set): Add assert.
133
e3deeb9c
AM
1342012-12-12 Alan Modra <amodra@gmail.com>
135
136 * powerpc.cc (class Track_tls): New.
137 (class Relocate, class Scan): Inherit Track_tls.
138 (Target_powerpc::Scan::local, global): Track tls optimization
139 and avoid creating plt entry for __tls_get_addr if all uses
140 are optimized away.
141 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
142
d8f5a274
AM
1432012-12-12 Alan Modra <amodra@gmail.com>
144
145 * options.h (General_options): Add --toc-sort/--no-toc-sort.
146 Replace no_toc_optimize with toc_optimize.
147 * output.h (Output_section::input_sections): Provide non-const variant.
148 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
149 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
150 accessors.
151 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
152 (class Sort_toc_sections): New.
153 (Target_powerpc::do_finalize_sections): Sort toc sections.
154 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
155
4c8a1de1
RM
1562012-12-10 Roland McGrath <mcgrathr@google.com>
157
158 * testsuite/binary_unittest.cc (read_all): New function.
159 (Sized_binary_test): Use it instead of ::read.
160 * fileread.cc (do_read): Don't assume pread always reads the whole
161 amount in a single call.
162
edc27beb
AM
1632012-12-10 Alan Modra <amodra@gmail.com>
164
165 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
166 Set EM_PPC64 or EM_PPC here.
167 (Target_selector_powerpc::do_recognize): Delete.
168
906b9150
AM
1692012-12-10 Alan Modra <amodra@gmail.com>
170
171 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
172 stub_table_.
173 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
174
418c15ae
RM
1752012-12-07 Roland McGrath <mcgrathr@google.com>
176
177 * testsuite/binary_unittest.cc (Sized_binary_test):
178 Use open_descriptor rather than ::open.
179
decdd3bc
AM
1802012-12-07 Alan Modra <amodra@gmail.com>
181
182 * powerpc.cc (Stub_table::do_write): Delete redundant Address
183 typedef and invalid_address constant.
184 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
185 instantiate constants.
186
db399005
ILT
1872012-12-06 Roland McGrath <mcgrathr@google.com>
188
189 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
190 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
191 * aclocal.m4: Regenerate.
192 * configure: Regenerate.
193 * Makefile.in: Regenerate.
194 * testsuite/Makefile.in: Regenerate.
195
aba6bc71
AM
1962012-12-07 Alan Modra <amodra@gmail.com>
197
198 * options.h (General_options): Add no_toc_optimize.
199 * powerpc.cc (ok_lo_toc_insn): New function.
200 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
201
9e69ed50
AM
2022012-12-06 Alan Modra <amodra@gmail.com>
203
204 * options.h (General_options): Add plt_align, plt_static_chain,
205 plt_thread_safe. Update stub_group_size help text.
206 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
207 for new plt_thread_safe_ var.
208 (use_plt_offset): Correct comments.
209 (Target_powerpc::do_relax): Look for thread creation symbols to
210 determine default plt_thread_safe value. Clear plt call stubs
211 as well as branch stubs each iteration.
212 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
213 insn constants.
214 (l, hi, ha, write_insn): Move earlier.
215 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
216 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
217 plt stubs too.
218 (Stub_table::update_size): Adjust.
219 (Stub_table::prev_size, set_prev_size): Delete.
220 (Stub_table::stub_align): Let --plt-align affect result.
221 (Stub_table::plt_call_size): Calculate sizes for various stubs.
222 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
223 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
224 (Stub_table::do_write): Support more stub variants.
225
f43ba157
AM
2262012-12-04 Alan Modra <amodra@gmail.com>
227
228 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
229 (Target_powerpc::do_define_standard_symbols): New function.
230
34171bc5
AM
2312012-12-03 Alan Modra <amodra@gmail.com>
232
233 * output.h: Formatting, whitespace.
234
dc9589e9 2352012-12-03 Alan Modra <amodra@gmail.com>
ec661b9d
AM
236
237 * layout.h (Layout::get_executable_sections): Declare.
238 * layout.cc (Layout::get_executable_sections): New function.
239 * arm.cc (Target_arm::group_sections): Use it.
240 (Arm_output_section::group_sections): Delete now redundant test.
241 * output.cc (Output_reloc::Output_reloc): Add is_relative.
242 param to handle relative relocs.
243 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
244 (Output_data_reloc::add_absolute): Adjust.
245 (Output_data_reloc::add_relative): New function.
246 (Output_data::reset_data_size): New function.
247 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
248 (Output_section::set_addralign): New function.
249 (Output_section::checkpoint_set_addralign): New function.
250 (Output_section::clear_section_offsets_need_adjustment): New function.
251 (Output_section::input_sections): Make public.
252 * powerpc.cc (class Output_data_brlt_powerpc): New.
253 (class Stub_table, class Stub_control): New.
254 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
255 stub_table_, set_stub_table, stub_table): New vectors and accessor
256 functions.
257 (Target_powerpc::do_may_relax, do_relax, push_branch,
258 new_stub_table, stub_tables, brlt_section, group_sections,
259 add_branch_lookup_table, find_branch_lookup_table,
260 write_branch_lookup_table, make_brlt_section): New functions.
261 (Target_powerpc::struct Sort_sections, class Branch_info): New.
262 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
263 branch_info_): New vars.
264 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
265 make call stubs here.
266 (Output_data_glink): Remove all call stub handling from this class.
267 (Target_powerpc::Scan::local, global): Save interesting branch
268 relocs and relocs for ifunc. Adjust calls to plt entry functions.
269 (Target_powerpc::do_finalize_sections): Only make reg save/restore
270 functions on final link.
271 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
272 Handle long branch destinations too.
273 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
274 do_plt_address_for_local): Adjust lookup of plt call stubs.
275
627b30b7
AM
2762012-11-30 Alan Modra <amodra@gmail.com>
277
278 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
279 relocs against protected symbols when building 32-bit shared libs.
280
40b469d7
AM
2812012-11-30 Alan Modra <amodra@gmail.com>
282
283 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
284 param. Call got_section() to make .got. Update all callers
285 and their callers and so on.
286
bb66a627
AM
2872012-11-30 Alan Modra <amodra@gmail.com>
288
289 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
290 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
291 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
292 value if it already exists.
293
d2cf1c6c
L
2942012-11-19 H.J. Lu <hongjiu.lu@intel.com>
295
296 PR gold/14858
297 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
298
edccdf7c
RM
2992012-11-14 Roland McGrath <mcgrathr@google.com>
300
301 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
302 than bfc instruction for data sandboxing.
303
6febeb74
AM
3042012-11-08 Alan Modra <amodra@gmail.com>
305
306 * po/POTFILES.in: Regenerate.
307
0a6f1bf2
AM
3082012-11-05 Alan Modra <amodra@gmail.com>
309
310 * configure.ac: Apply 2012-09-10 change to config.in here.
311 * configure: Regenerate.
312
26a4e9cb
AM
3132012-11-05 Alan Modra <amodra@gmail.com>
314
315 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
316 (struct Opd_ent): Use "Address" rather than "Offset".
317 (Output_data_got_powerpc::got_base_offset): Return Valtype.
318 (Target_powerpc::got_section): Make public.
319 (Target_powerpc::scan_relocs): Move code setting symbols..
320 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
321 Create _SDA_BASE_ only when referenced.
322
cc928013
RM
3232012-11-02 Roland McGrath <mcgrathr@google.com>
324
325 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
326 from last change.
327
50ed5eb1
RM
3282012-11-01 Roland McGrath <mcgrathr@google.com>
329
62fe925a
RM
330 * target.h (Sized_target::relocate_relocs): Use Elf_Off
331 for offset_in_output_section parameter.
332 (Sized_target::relocate_special_relocatable): Likewise.
333 * arm.cc (Target_arm::relocate_relocs): Likewise.
334 (Target_arm::relocate_special_relocatable): Likewise.
335 * i386.cc (Target_i386::relocate_relocs): Likewise.
336 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
337 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
338 * target-reloc.h (relocate_relocs): Likewise.
339 * testsuite/testfile.cc (Target_test): Likewise.
340 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
341 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
342
343 * system.h: Move inclusion of <clocale> to after <libintl.h> in
344 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
345
346 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
347 parameter, which is unused in the [!F_SETFD] case.
348
50ed5eb1
RM
349 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
350 SYMNDX to off_t before comparing it to this->data_size().
351 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
352 * incremental.cc (Output_section_incremental_inputs::do_write):
353 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
354
2cadc0bf
RM
355 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
356
3bfcb652
NC
3572012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
358
359 * gold.cc (Target_arm::do_adjust_elf_header): Add the
360 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
361 in EABI_VER5.
362
c1a8d56e
CC
3632012-10-29 Cary Coutant <ccoutant@google.com>
364
365 * dwp.cc (usage): Add file and exit status parameters;
366 add --help and --version options.
367 (print_version): New function.
368 (main): Add --help and --version options.
369
b2490a7b
L
3702012-10-25 H.J. Lu <hongjiu.lu@intel.com>
371
372 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
373 final_layout_sequence.txt.
374 * testsuite/Makefile.in: Regenerated.
375
aa543512
L
3762012-10-25 H.J. Lu <hongjiu.lu@intel.com>
377
378 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
379 COMPILE generated by automake.
380 (LINK1): Likewise.
381 (CXXCOMPILE1): Likewise.
382 (CXXLINK1): Likewise.
383 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
384 (LINK): Likewise.
385 (CXXCOMPILE): Likewise.
386 (CXXLINK): Likewise.
387 * testsuite/Makefile.in: Regenerated.
388
d361fafb
L
3892012-10-25 H.J. Lu <hongjiu.lu@intel.com>
390
391 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
392 on bad fwrite return.
393
598c7410
L
3942012-10-25 H.J. Lu <hongjiu.lu@intel.com>
395
396 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
397 on val.
398
35c813e2
CC
3992012-10-23 Cary Coutant <ccoutant@google.com>
400
401 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
402 * testsuite/Makefile.in: Regenerate.
403 * testsuite/dwp_test.h: New source file.
404 * testsuite/dwp_test_1.cc: New source file.
405 * testsuite/dwp_test_1.s: New source file.
406 * testsuite/dwp_test_1.sh: New source file.
407 * testsuite/dwp_test_1b.cc: New source file.
408 * testsuite/dwp_test_1b.s: New source file.
409 * testsuite/dwp_test_2.cc: New source file.
410 * testsuite/dwp_test_2.s: New source file.
411 * testsuite/dwp_test_2.sh: New source file.
412 * testsuite/dwp_test_main.cc: New source file.
413 * testsuite/dwp_test_main.s: New source file.
414
77429909
CC
4152012-10-23 Cary Coutant <ccoutant@google.com>
416
417 * dwp.h: New header file.
418 * dwp.cc: New source file.
419 * gold.h: Move shared declarations to system.h.
420 * system.h: New header file.
421 * Makefile.am: Add dwp.
422 * Makefile.in: Regenerate.
423
ed5d6712
CC
4242012-10-23 Cary Coutant <ccoutant@google.com>
425
426 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
427 Dwarf_info_reader::read_from_pointer.
428 (Dwarf_pubnames_table::read_header): Likewise.
429 (Dwarf_pubnames_table::next_name): Likewise.
430 (Dwarf_die::read_attributes): Likewise.
431 (Dwarf_die::skip_attributes): Likewise.
432 (Dwarf_info_reader::read_from_pointer): New function template.
433 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
434 (Dwarf_pubnames_table): Likewise.
435 (Dwarf_info_reader::read_from_pointer): New function template.
436 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
437 Dwarf_pubnames_table ctor.
438
8787852d
CC
4392012-10-23 Cary Coutant <ccoutant@google.com>
440
441 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
442 abbrev_shndx.
443 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
444 abbrev_shndx_.
445 (Dwarf_info_reader::set_abbrev_shndx): New method.
446 (Dwarf_info_reader::abbrev_shndx_): New data member.
447
9fc236f3
CC
4482012-10-23 Cary Coutant <ccoutant@google.com>
449
450 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
451 from object, not parameters.
452 (Dwarf_info_reader::parse): Likewise.
453 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
454 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
455 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
456 methods.
457
effe8365
CC
4582012-10-23 Cary Coutant <ccoutant@google.com>
459
460 * fileread.cc (Input_file::Input_file): New constructor.
461 * fileread.h (class Input_file): Add new constructor.
462
1698990d
AM
4632012-10-18 Alan Modra <amodra@gmail.com>
464
465 PR gold/14727
466 * object.cc (Relobj::is_section_name_included): Also match
467 .sdata personality section.
468
168a4726
AM
4692012-10-18 Alan Modra <amodra@gmail.com>
470
471 * target-reloc.h (class Default_comdat_behavior): New, package up..
472 (get_comdat_behaviour): ..this.
473 (relocate_section): Add Relocate_comdat_behavior template arg,
474 adjust code to suit.
475 * arm.cc (Target_arm::relocate_section): Adjust to suit.
476 (Target_arm::scan_reloc_section): Likewise.
477 * i386.cc (Target_i386::relocate_section): Likewise.
478 * sparc.cc (Target_sparc::relocate_section): Likewise.
479 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
480 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
481 * powerpc.cc (class Relocate_comdat_behavior): New.
482 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
483 gold::relocate_section with new template arg.
484
acc276d8
AM
4852012-10-18 Alan Modra <amodra@gmail.com>
486
487 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
488 dynamic relocs for GOT_TPREL got entries, without symbol if
489 resolving locally.
490 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
491 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
492 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
493
e10f9870
AM
4942012-10-17 Alan Modra <amodra@gmail.com>
495
496 PR gold/14726
497 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
498
ae034989
ST
4992012-10-16 Sriraman Tallam <tmsriram@google.com>
500
501 * layout.cc (Layout::include_section): Keep sections marked
502 SHF_EXCLUDE when doing relocatable links.
503
f3a0ed29
AM
5042012-10-16 Alan Modra <amodra@gmail.com>
505
506 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
507 (Target_powerpc::do_finalize_sections): Call it.
508 (Output_data_save_res): New class and supporting functions.
509 (Target_powerpc::symval_for_branch): Only look up .opd entry for
510 normal symbols defined in object files.
511
c6de8ed4
AM
5122012-10-12 Alan Modra <amodra@gmail.com>
513
514 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
515 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
516 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
517 section if scan_opd_relocs not yet called.
518 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
519
03e25981
AM
5202012-10-12 Alan Modra <amodra@gmail.com>
521
522 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
523 add_local_ifunc_entry): Revert last change.
524 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
525
c9824451
AM
5262012-10-05 Alan Modra <amodra@gmail.com>
527
528 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
529 do_plt_address_for_global): New functions.
530 (Output_data_got_powerpc::do_write): Don't segfault when linking
531 statically.
532 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
533 add_local_ifunc_entry): Return true on adding entry..
534 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
535 glink->add_entry call. Remove unused symtab param. Adjust calls.
536 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
537 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
538 set up symbols here.
539 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
540 syms here. Do so even when no .iplt. Don't segfault when linking
541 statically.
542 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
543 new variants without reloc param.
544 (Glink_sym_ent::Glink_sym_ent): Likewise.
545 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
546 reloc when refs will resolve to plt call stub.
547 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
548 R_PPC_PLTREL24 to resolve locally.
549 (Target_powerpc::Scan::global): Correct ifunc handling.
550 (Target_powerpc::Relocate::relocate): Correct local sym glink
551 lookup. Don't destroy "value" when we have a plt call stub,
552 and when checking plt call validity.
553 (Target_powerpc::do_dynsym_value): Simplify.
554
19fec8c1
AM
5552012-10-05 Alan Modra <amodra@gmail.com>
556
557 * i386.cc (Output_data_plt_i386::address_for_global,
558 address_for_local): Add plt offset to returned value. Adjust uses.
559 * sparc.cc (Output_data_plt_sparc::address_for_global,
560 address_for_local): Likewise.
561 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
562 address_for_local): Likewise.
563 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
564 address_for_local): Likewise.
565 * target.h (Target::plt_address_for_global, plt_address_for_local):
566 Update comment.
567 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
568 (Output_data_got::Got_entry::write): Nor here.
569 * output.h: Comment fix.
570
e867b647
WL
5712012-10-02 Jiong Wang <jiwang@tilera.com>
572
573 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
574 global_offset_table_ value for larget got.
575 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
576
e5d5f5ed
AM
5772012-09-29 Alan Modra <amodra@gmail.com>
578
579 * powerpc.cc (Target_powerpc::iplt_): New output section.
580 (Target_powerpc::iplt_section, make_iplt_section,
581 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
582 (Target_powerpc::make_plt_entry): Handle ifunc syms.
583 Target_powerpc::plt_entry_count): Count iplt entries too.
584 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
585 reloc section in constructor. New params.
586 (Target_powerpc::make_plt_section): Create reloc section here instead.
587 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
588 functions.
589 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
590 (Output_data_glink::add_entry, find_entry): New functions to
591 deal with local syms.
592 (Glink_sym_ent): Add support for local syms.
593 (Output_data_glink::do_write): Handle ifunc plt entries.
594 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
595 (Target_powerpc::Scan::local, global): Handle ifunc syms.
596 (Target_powerpc::Relocate::relocate): Likewise.
597 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
598
ec4dbad3
AM
5992012-09-25 Alan Modra <amodra@gmail.com>
600
601 * object.h (Sized_relobj_file::adjust_local_symbol,
602 do_adjust_local_symbol): New functions.
603 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
604 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
605 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
606 and irregular opd entry spacing.
607 (Powerpc_relobj::do_read_relocs): Add opd size checks.
608 (Global_symbol_visitor_opd): New functor.
609 (Target_powerpc::do_finalize_sections): Omit global symbols defined
610 on deleted opd entries.
611
5c0b3823
WL
6122012-09-15 Jiong Wang <jiwang@tilera.com>
613
614 * tilegx.cc: New file.
615 * Makefile.am (TARGETSOURCES): Add tilegx.cc
616 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
617 * configure.tgt: Add entries for tilegx*.
618 * configure.ac: Likewise.
619 * Makefile.in: Rebuild.
620 * configure: Likewise.
621 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
622 tilegx.
623
bfdfa4cd
AM
6242012-09-13 Alan Modra <amodra@gmail.com>
625
626 * target-reloc.h (scan_relocs): Call scan.local for relocs
627 against symbols in discarded sections. Pass is_discarded
628 param.
629 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
630 Add is_discarded param.
631 * powerpc (Target_powerpc::Scan::local): Likewise. Use
632 is_discarded to flag opd entry as discarded. Don't emit dyn
633 relocs on such entries.
634 (Target_powerpc::Scan::global): Similarly detect and handle
635 such opd entries.
636 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
637 opd_ent_. Update all uses.
638 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
639 (Target_powerpc::relocate_section): Zero out discarded opd
640 entry relocs.
641
d77a0555
ILT
6422012-09-12 Ian Lance Taylor <iant@google.com>
643
644 PR gold/14570
645 * output.cc: Rename Output_data_got template parameter from size
646 to got_size for all functions. Compile all variants of
647 Output_data_got.
648 (Output_data_got::Got_entry::write): Correct use of size for
649 symbol value. Use local_is_tls rather than casting to
650 Sized_relobj_file.
651 * object.h (class Object): Add local_is_tls and do_local_is_tls.
652 (class Sized_relobj_file): Add do_local_is_tls.
653 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
654
815a1205
AM
6552012-09-11 Alan Modra <amodra@gmail.com>
656
657 PR gold/14566
658 * layout.cc (Layout::set_segment_offsets): When using
659 common-page-size alignment, ensure we are on a new max-page-size
660 page.
661 * output.cc (Output_segment::set_section_addresses): Use
662 abi_pagesize, not common_pagesize for relro boundary.
663 (Output_segment::set_offset): Likewise.
664
bd73a62d
AM
6652012-09-11 Alan Modra <amodra@gmail.com>
666
667 * output.h (Output_data_got::add_global_tls, add_local_tls,
668 add_local_tls_pair): New functions.
669 (Output_data_got::add_local_pair_with_rel): Remove second
670 reloc param. Expand comment.
671 (Output_data_got::Got_entry): Rename use_plt_offset_ to
672 use_plt_or_tls_offset_, similarly for constructor param.
673 (Output_data_got::Got_entry::write): Add got_index param.
674 * output.cc (Output_data_got::add_global_tls, add_local_tls,
675 add_local_tls_pair): New functions.
676 (Output_data_got::Got_entry::write): Handle tls symbols
677 with use_plt_or_tls_offset_ set specially.
678 (Output_data_got::add_local_pair_with_rel): Only one reloc.
679 (Output_data_got::do_write): Replace iterator with index, pass
680 index to entry write function.
681 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
682 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
683 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
684 call.
685 * i386.cc (Target_i386::Scan::local): Likewise.
686 * sparc.cc (Target_sparc::Scan::local): Likewise.
687 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
688 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
689 do_tls_offset_for_global): New functions.
690 (Target_powerpc::Scan::local): Correct TLS relocations and got
691 entry values.
692 (Target_powerpc::Scan::global): Don't emit unnecessary
693 dynamic relocations on TLS GOT entries.
694
00716ab1
AM
6952012-09-10 Matthias Klose <doko@ubuntu.com>
696
697 * config.in: Disable sanity check for kfreebsd.
698
c891b3f9
SA
6992012-09-10 Sterling Augustine <saugustine@google.com>
700
701 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
702 (Gdb_index::pubtypes_read): New parameter.
703 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
704 to calls.
705 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
706 pubtypes_object_.
707
e81fea4d
AM
7082012-09-09 Alan Modra <amodra@gmail.com>
709
710 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
711 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
712 * gc.h (gc_process_relocs): Call target gc_add_reference.
713 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
714 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
715 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
716 unnecessary cast.
717 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
718 to cater for when we don't need code offset. Update use.
719 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
720 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
721 set_opd_valid): New functions.
722 (Target_powerpc::do_gc_add_reference): New function.
723 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
724 stashed refs.
725 (Target_powerpc::do_gc_mark_symbol): New function.
726
d2d60eef
CC
7272012-09-06 Cary Coutant <ccoutant@google.com>
728
729 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
730 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
731 (Dwarf_die::skip_attributes): Likewise.
732 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
733 * testsuite/gdb_index_test.cc (inline_func_1): New function.
734 (main): Call it.
735 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
736
32ed4573
L
7372012-09-05 H.J. Lu <hongjiu.lu@intel.com>
738
739 * testsuite/script_test_3.t: Add .got.plt output section
740 statement.
741 * testsuite/script_test_4.t: Likewise.
742
f4baf0d4
AM
7432012-09-05 Alan Modra <amodra@gmail.com>
744
745 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
746 update all uses and lose "enum" when using type.
747
864a1b56
AM
7482012-09-05 Alan Modra <amodra@gmail.com>
749
750 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
751 * configure: Regenerate.
752 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
753 (plugin_final_layout.stdout): Likewise.
754 (memory_test): Set page sizes to 0x1000.
755 * testsuite/Makefile.in: Regenerate.
756 * testsuite/discard_locals_test.sh: Add FIXME comment.
757 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
758 * testsuite/pr14265.t: Add .got output section statement.
759 * testsuite/script_test_2.t: Likewise.
760 * testsuite/script_test_3.t: Likewise.
761 * testsuite/script_test_4.t: Likewise.
762 * testsuite/script_test_5.t: Likewise.
763 * testsuite/script_test_6.t: Likewise.
764 * testsuite/script_test_7.t: Likewise.
765 * testsuite/script_test_9.t: Likewise.
766
3ea0a085
AM
7672012-09-05 Alan Modra <amodra@gmail.com>
768
769 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
770 (Powerpc_relocate_functions::Status): New typedef.
771 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
772 (Target_powerpc::Scan::local): Handle REL64.
773 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
774 for REL32 and REL64.
775 (Target_powerpc::symval_for_branch): New function, extracted from..
776 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
777 checks. Report overflow errors.
778
7404fe1b
AM
7792012-09-05 Alan Modra <amodra@gmail.com>
780
781 * object.h (Sized_relobj_file::emit_relocs): Delete.
782 (Sized_relobj_file::emit_relocs_reltype): Delete.
783 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
784 relocate_relocs for --emit-relocs.
785 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
786 * output.h: Update comment.
787 (Output_segment::first_section): New function.
788 (Output_segment::first_section_load_address): Use first_section.
789 * output.cc (Output_segment::first_section): New function extracted..
790 (Output_segment::first_section_load_address): ..from here. Delete.
791 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
792 * target.h (Sized_target::relocate_for_relocatable): Likewise.
793 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
794 adjust call to target.h function.
795 * i386.cc (Target_i386): Likewise.
796 * sparc.cc (Target_sparc): Likewise.
797 * x86_64.cc (Target_x86_64): Likewise.
798 * powerpc.cc (Target_powerpc): Likewise.
799 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
800 first tls section has section symbol for optimised local dynamic
801 output relocs.
802 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
803 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
804 optimised tls code.
805 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
806 Rename to relocate_relocs. Update error message.
807
957564c9
AS
8082012-09-04 Andreas Schwab <schwab@linux-m68k.org>
809
810 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
811 --just-symbols.
812
dd93cd0a
AM
8132012-08-31 Alan Modra <amodra@gmail.com>
814
815 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
816 (Powerpc_relobj::toc_base_offset): New stub function.
817 (Target_powerpc): Add tp_offset, dtp_offset. Rename
818 got_mod_index_offset to tlsld_got_offset. Update all refs.
819 (Target_powerpc::Relocate::enum skip_tls): New.
820 (Target_powerpc::call_tls_get_addr_): New var.
821 (Target_powerpc::is_branch_reloc): Move to file scope.
822 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
823 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
824 New functions.
825 (Target_powerpc::enum Got_type): Delete old values, add new ones.
826 (powerpc_info): Correct common_pagesize for ppc64.
827 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
828 (Powerpc_relocate_functions): Add overflow check enums and functions.
829 Add non-shift version of rela, rela_ua. Delete all rel public
830 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
831 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
832 addr16_ha3, addr14 functions.
833 (Output_data_got_powerpc::add_constant_pair): New function.
834 (Output_data_got_powerpc::got_base_offset): Likewise.
835 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
836 (instruction constants): Sort, add some more.
837 (Output_data_glink::do_write): Add and use Address typedef. Use
838 object->toc_base_offset() stub for 64-bit.
839 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
840 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
841 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
842 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
843 Always treat .opd relocs as against locally defined symbol.
844 Correct condition for RELATIVE relocs.
845 (Target_powerpc::do_finalize_sections): Test for NULL sections.
846 (Target_powerpc::Relocate::relocate): Use plt call stub as value
847 for 32-bit syms with a plt entry. Correct ppc64 toc base
848 calculations. Handle TLS relocs, and more. Add overflow
849 checking and adjust for Powerpc_relocate_functions changes.
850 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
851 Reinstate --emit-relocs code with FIXME.
852
a1373b60
AM
8532012-08-30 Alan Modra <amodra@gmail.com>
854
855 * layout.cc (Layout::set_segment_offsets): Set p_align to
856 abi_pagesize, not common_pagesize.
857 (Layout::relaxation_loop_body): Similarly use abi_pagesize
858 to determine whether file header can go in segment.
859
703d02da
AM
8602012-08-30 Alan Modra <amodra@gmail.com>
861
862 * output.h (Output_reloc::Output_reloc <output section>): Add
863 is_relative param. Adjust calls.
864 (Output_reloc::add_output_section_relative): New functions.
865 * output.cc (Output_reloc::Output_reloc <output section>): Handle
866 is_relative.
867 (Output_reloc::symbol_value): Handle SECTION_CODE.
868
16164a6b
ST
8692012-08-24 Sriraman Tallam <tmsriram@google.com>
870
871 * gold.cc (queue_middle_tasks): Call layout again when unique
872 segments for sections is desired.
873 * layout.cc (Layout::Layout): Initialize new members.
874 (Layout::get_output_section_flags): New function.
875 (Layout::choose_output_section): Call get_output_section_flags.
876 (Layout::layout): Make output section for mapping to a unique segment.
877 (Layout::insert_section_segment_map): New function.
878 (Layout::attach_allocated_section_to_segment): Make unique segment for
703d02da 879 output sections marked so.
16164a6b
ST
880 (Layout::segment_precedes): Check for unique segments when sorting.
881 * layout.h (Layout::Unique_segment_info): New struct.
882 (Layout::Section_segment_map): New typedef.
883 (Layout::insert_section_segment_map): New function.
884 (Layout::get_output_section_flags): New function.
885 (Layout::is_unique_segment_for_sections_specified): New function.
886 (Layout::set_unique_segment_for_sections_specified): New function.
887 (Layout::unique_segment_for_sections_specified_): New member.
888 (Layout::section_segment_map_): New member.
889 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
890 Rename is_gc_pass_one to is_pass_one.
891 Rename is_gc_pass_two to is_pass_two.
892 Rename is_gc_or_icf to is_two_pass.
893 Check for which pass based on whether symbols data is present.
894 Make it two pass when unique segments for sections is desired.
895 * output.cc (Output_section::Output_section): Initialize new
896 members.
897 * output.h (Output_section::is_unique_segment): New function.
898 (Output_section::set_is_unique_segment): New function.
899 (Output_section::is_unique_segment_): New member.
900 (Output_section::extra_segment_flags): New function.
901 (Output_section::set_extra_segment_flags): New function.
902 (Output_section::extra_segment_flags_): New member.
903 (Output_section::segment_alignment): New function.
904 (Output_section::set_segment_alignment): New function.
905 (Output_section::segment_alignment_): New member.
906 (Output_segment::Output_segment): Initialize is_unique_segment_.
907 (Output_segment::is_unique_segment): New function.
908 (Output_segment::set_is_unique_segment): New function.
909 (Output_segment::is_unique_segment_): New member.
910 * plugin.cc (allow_unique_segment_for_sections): New function.
911 (unique_segment_for_sections): New function.
912 (Plugin::load): Add new functions to transfer vector.
913 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
914 * Makefile.in: Regenerate.
915 * testsuite/plugin_final_layout.sh: Check if unique segment
916 functionality works.
917 * testsuite/plugin_section_order.c (onload): Check if new interfaces
918 are available.
919 (allow_unique_segment_for_sections): New global.
920 (unique_segment_for_sections): New global.
921 (claim_file_hook): Call allow_unique_segment_for_sections.
922 (all_symbols_read_hook): Call unique_segment_for_sections.
16164a6b 923
1e2bee4f
CC
9242012-08-22 Cary Coutant <ccoutant@google.com>
925
926 * layout.cc (Layout::include_section): Don't assert on GROUP
927 sections with --emit-relocs.
928
1d5dfe78
CC
9292012-08-21 Cary Coutant <ccoutant@google.com>
930
931 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
932 if --export-dynamic-symbol names an undef symbol.
933
c9269dff
AM
9342012-08-18 Alan Modra <amodra@gmail.com>
935
936 * powerpc.cc: Formatting and white space.
937 (Powerpc_relobj): Rename got2_section_ to special_.
938 Add opd_ent_shndx_ and opd_ent_off_ vectors.
939 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
940 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
941 (Target_powerpc): Add Address typedef and invalid_address. Use
942 throughout.
943 (Target_powerpc::is_branch_reloc): New function.
944 (Powerpc_relocate_functions): Add Address typedef, use throughout.
945 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
946 for dst_mask, value and addend.
947 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
948 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
949 (Output_data_glink::do_write): Correct toc base. Don't try to use
950 uint16_t for 24-bit offset. Use get_output_section_offset and
951 check return.
952 (Target_powerpc::Scan::local): Handle more relocs.
953 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
954 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
955 Plug in toc restoring insn after plt calls. Translate branches
956 to function descriptor symbols to corresponding entry point.
957 (Target_powerpc::relocate_for_relocatable): Check return from
958 get_output_section_offset.
959 * symtab.h: Comment typo.
960
b1759dce
ILT
9612012-08-14 Ian Lance Taylor <iant@google.com>
962
963 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
964 unsupported_relocal_local to call unsupported_reloc_global.
965
b9b2ae8b
NC
9662012-08-14 Nick Clifton <nickc@redhat.com>
967
968 PR ld/14265
969 * script-sections.cc (Sections_element::output_section_name): Add
970 keep return parameter.
971 (Output_section_element::match_name): Add keep return parameter.
972 Return the value of the keep_ member.
973 * script-sections.h (class Output_section): Update
974 output_section_name prototype.
975 * layout.cc (Layout::keep_input_section): New public member
976 function.
977 (Layout::choose_output_section): Pass keep parameter to
978 output_section_name.
979 * layout.h (class Layout): Add keep_input_section.
980 * object.cc (Sized_relobj_file::do_layout): Check for kept input
981 sections.
982 * testsuite/Makefile.am: Add a test.
983 * testsuite/Makefile.in: Regenerate.
984 * testsuite/pr14265.c: Source file for the test.
985 * testsuite/pr14265.t: Linker script for the test.
986 * testsuite/pr14265.sh: Shell script for the test.
987
921b5322
AM
9882012-08-14 Alan Modra <amodra@gmail.com>
989
990 * target.h (Target::output_section_name): New function.
991 (Target::do_output_section_name): New function.
992 * layout.cc (Layout::choose_output_section): Call the above.
993 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
994
6ce78956
AM
9952012-08-14 Alan Modra <amodra@gmail.com>
996
997 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
998 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
999 for replace_constant call.
1000 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1001 (Output_data_glink::do_print_to_mapfile): New function.
1002 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1003 (Target_powerpc::Relocate::relocate): Likewise.
1004
d1a8cabd
AM
10052012-08-14 Alan Modra <amodra@gmail.com>
1006
1007 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1008 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1009 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1010 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1011 all references to shndx_. Handle special case for R_PPC_PLTREL24
1012 here.
1013 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1014 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1015 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1016 here.
1017 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1018 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1019
d83ce4e3
AM
10202012-08-12 Alan Modra <amodra@gmail.com>
1021
1022 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1023 (glink insn constants): Use uint32_t.
1024 (Output_data_glink::add_entry): Use insert, not [] operator.
1025
cf43a2fe
AM
10262012-08-11 Alan Modra <amodra@gmail.com>
1027
1028 * object.h (Sized_relobj_file::find_shdr): New function.
1029 (Sized_relobj_file::find_special_sections): New function.
1030 * object.cc (Sized_relobj_file::find_shdr): New function.
1031 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1032 (Sized_relobj_file::find_special_sections): New function, split out..
1033 (Sized_relobj_file::do_read_symbols): ..from here.
1034 * output.h (Output_data_got::replace_constant): New function.
1035 (Output_data_got::num_entries): New function.
1036 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1037 (Output_data_got::got_offset): Protected rather than private.
1038 (Output_data_got::replace_got_entry): New function.
1039 * output.cc (Output_data_got::replace_got_entry): New function.
1040 * powerpc.cc (class Powerpc_relobj): New.
1041 (class Powerpc_relocate_functions): Delete all psymval variants or
1042 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1043 Implement _ha functions using corresponding _hi function.
1044 (Powerpc_relobj::find_special_sections): New function.
1045 (Target_powerpc::do_make_elf_object): New function.
1046 (class Output_data_got_powerpc): New.
1047 (class Output_data_glink): New.
1048 (class Powerpc_scan_relocatable_reloc): New.
1049 Many more changes througout file.
1050
3c892704
NC
10512012-08-09 Nick Clifton <nickc@redhat.com>
1052
1053 * po/vi.po: Updated Vietnamese translation.
1054
82435b3b
ILT
10552012-08-07 Ian Lance Taylor <iant@google.com>
1056
1057 * layout.cc (Layout::add_target_dynamic_tags): If
1058 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1059 plt_rel.
1060
a6dc81d2
NC
10612012-07-30 Nick Clifton <nickc@redhat.com>
1062
1063 * po/gold.pot: Updated template.
1064 * po/es.po: Updated Spanish translation.
1065
f1415016
CC
10662012-07-18 Cary Coutant <ccoutant@google.com>
1067
1068 PR gold/14344
1069 * configure.ac: Add check for -gpubnames support.
1070 * configure: Regenerate.
1071 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1072 support; force -gno-pubnames.
1073 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1074 support.
1075 (gdb_index_test_4): New test.
1076 * testsuite/Makefile.in: Regenerate.
1077 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1078 * testsuite/gdb_index_test_2.sh: Likewise.
1079 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1080 * testsuite/gdb_index_test_4.sh: New script.
1081 * testsuite/gdb_index_test_comm.sh: New script with common code;
1082 don't look for space after colon.
1083
b7fd7c37
ST
10842012-07-16 Sriraman Tallam <tmsriram@google.com>
1085
1086 * gold.cc (queue_middle_tasks): Update function order only after
1087 deferred objects due to plugins are processed.
1088
1f3212db
ILT
10892012-07-11 Ian Lance Taylor <iant@google.com>
1090
1091 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1092 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1093 (Target_arm::scan_reloc_for_stub): Likewise.
1094 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1095 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1096 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1097 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1098 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1099
81c82a68
ILT
11002012-07-10 Dodji Seketeli <dodji@redhat.com>
1101 Ian Lance Taylor <iant@google.com>
1102
1103 PR gold/14309
1104 * configure.ac: Test whether std::tr1::hash<off_t> works.
1105 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1106 needed.
1107 * output.h (class Output_fill): Add virtual destructor.
1108 * configure, config.in: Rebuild.
1109
eabc84f4
RM
11102012-06-22 Roland McGrath <mcgrathr@google.com>
1111
1112 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1113
370e30b6
RÁE
11142012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1115
1116 * plugin.cc (Plugin::load): Handle position independent executables.
1117
fb1b895d
CC
11182012-06-06 Cary Coutant <ccoutant@google.com>
1119
1120 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1121 add .debug_macro.
1122 (lines_only_debug_sections): Likewise.
1123 (gdb_fast_lookup_sections): New static array.
1124 (is_gdb_debug_section): Rename formal parameter.
1125 (is_lines_only_debug_section): Likewise.
1126 (is_gdb_fast_lookup_section): New function.
1127 (Layout::include_section): Check for ".zdebug_" prefix; pass
1128 section name suffix to is_gdb_debug_section, et al.; check for
1129 fast-lookup sections when building .gdb_index.
1130 * options.h (--strip-debug-gdb): Update GDB version number.
1131
7c0640fa
CC
11322012-06-06 Cary Coutant <ccoutant@google.com>
1133
1134 * configure.ac: Add check for fallocate.
1135 * configure: Regenerate.
1136 * config.in: Regenerate.
1137
1138 * options.h (class General_options): Add --mmap-output-file and
1139 --posix-fallocate options.
1140 * output.cc: (posix_fallocate): Remove; replace with...
1141 (gold_fallocate): New function.
1142 (Output_file::map_no_anonymous): Call gold_fallocate.
1143 (Output_file::map): Check --mmap-output-file option.
1144
2a49eb69
DK
11452012-06-05 Jing Yu <jingyu@google.com>
1146
1147 * gold.h (textdomain): Add do {} to empty while(0).
1148 (bindtextdomain): Likewise.
1149
fad072ac
CC
11502012-06-04 Cary Coutant <ccoutant@google.com>
1151
1152 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1153 has_dynsym_index.
1154
8cc69fb6
ST
11552012-05-25 Sriraman Tallam <tmsriram@google.com>
1156
1157 * symtab.cc (Symbol_table::define_special_symbol):
1158 Initialize *poldsym to prevent uninitialized variable errors.
1159
1be75daa
CC
11602012-05-23 Cary Coutant <ccoutant@google.com>
1161
1162 * layout.cc (Layout::section_name_mapping): Add rules to handle
1163 exact match on .data.rel.ro.local or .data.rel.ro.
1164 (Layout::output_section_name): Check for exact matches.
1165
9b689de0
CC
11662012-05-23 Cary Coutant <ccoutant@google.com>
1167
1168 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1169 more carefully.
1170
b24fdbf5
CC
11712012-05-22 Cary Coutant <ccoutant@google.com>
1172
1173 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1174 object before exporting symbol.
1175
e550e1a2
L
11762012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1177
1178 * testsuite/tls_test.cc: Include "config.h" first.
1179 * testsuite/tls_test_c.c: Likewise.
1180
df7b86aa
NC
11812012-05-17 Daniel Richard G. <skunk@iskunk.org>
1182 Nick Clifton <nickc@redhat.com>
1183
1184 PR 14072
1185 * configure.in: Add check that sysdep.h has been included before
1186 any system header files.
1187 * configure: Regenerate.
1188 * config.in: Regenerate.
1189
1007b503
CC
11902012-05-14 Cary Coutant <ccoutant@google.com>
1191
1192 * layout.cc (Layout::make_output_section): Mark .tdata section
1193 as RELRO.
1194 * testsuite/relro_test.cc: Add a TLS variable.
1195
fd885f3a
L
11962012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1197
1198 PR gold/14091
1199 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1200 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1201 R_X86_64_64.
1202
80f5885c
CC
12032012-05-08 Cary Coutant <ccoutant@google.com>
1204
1205 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1206 (lines_only_debug_sections): Likewise.
1207
2e702c99
RM
12082012-05-02 Roland McGrath <mcgrathr@google.com>
1209
1210 * nacl.cc: New file.
1211 * nacl.h: New file.
1212 * Makefile.am (CCFILES, HFILES): Add them.
1213 * Makefile.in: Regenerate.
1214 * i386.cc (Output_data_plt_i386_nacl): New class.
1215 (Output_data_plt_i386_nacl_exec): New class.
1216 (Output_data_plt_i386_nacl_dyn): New class.
1217 (Target_i386_nacl): New class.
1218 (Target_selector_i386_nacl): New class.
1219 (target_selector_i386): Use it instead of Target_selector_i386.
1220 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1221 (Target_x86_64_nacl): New class.
1222 (Target_selector_x86_64_nacl): New class.
1223 (target_selector_x86_64, target_selector_x32): Use it instead of
1224 Target_selector_x86_64.
1225 * arm.cc (Output_data_plt_arm_nacl): New class.
1226 (Target_arm_nacl): New class.
1227 (Target_selector_arm_nacl): New class.
1228 (target_selector_arm, target_selector_armbe): Use it instead of
1229 Target_selector_arm.
1230
1231 * target-select.cc (select_target): Take new Input_file* and off_t
1232 arguments, pass them on to recognize method of selector.
1233 * object.cc (make_elf_sized_object): Update caller.
1234 * parameters.cc (parameters_force_valid_target): Likewise.
1235 * incremental.cc (make_sized_incremental_binary): Likewise.
1236 * target-select.h: Update decl.
1237 (Target_selector::recognize): Take new Input_file* argument,
1238 pass it on to do_recognize.
1239 (Target_selector::do_recognize): Take new Input_file* argument.
1240 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1241 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1242 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1243 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1244
1245 * target.h (Target::Target_info): New members isolate_execinstr
1246 and rosegment_gap.
1247 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1248 * arm.cc (Target_arm::arm_info): Update initializer.
1249 * i386.cc (Target_i386::i386_info): Likewise.
1250 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1251 * sparc.cc (Target_sparc::sparc_info): Likewise.
1252 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1253 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1254 * layout.cc (Layout::attach_allocated_section_to_segment):
1255 Take new const Target* argument. If target->isolate_execinstr(), act
1256 like --rosegment.
1257 (Layout::find_first_load_seg): Take new const Target* argument;
1258 if target->isolate_execinstr(), reject PF_X segments.
1259 (Layout::relaxation_loop_body): Update caller.
1260 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1261 reset file offset to zero when we hit LOAD_SEG, and then do a second
1262 loop over the segments before LOAD_SEG to reassign offsets after
1263 addresses have been determined. Handle target->rosegment_gap().
1264 (Layout::attach_section_to_segment): Take new const Target* argument;
1265 pass it to attach_allocated_section_to_segment.
1266 (Layout::make_output_section): Update caller.
1267 (Layout::attach_sections_to_segments): Take new const Target* argument;
1268 pass it to attach_section_to_segment.
1269 * gold.cc (queue_middle_tasks): Update caller.
1270 * layout.h (Layout): Update method decls with new arguments.
1271
1272 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1273 Target_info pointer to use.
1274 (Target_arm::do_make_data_plt): New virtual method.
1275 (Target_arm::make_data_plt): New method that calls it.
1276 (Target_arm::make_plt_entry): Use it.
1277 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1278 for the section alignment.
1279 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1280 method.
1281 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1282 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1283 method.
1284 (Output_data_plt_arm::get_plt_entry_size): Call it.
1285 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1286 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1287 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1288 method.
1289 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1290 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1291 method instead of sizeof(plt_entry).
1292 (Output_data_plt_arm::add_entry): Likewise.
1293 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1294 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1295 than static method.
1296 (Target_arm::plt_entry_size): Likewise.
1297 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1298 Move to ...
1299 (Output_data_plt_arm_standard): ... here, new class.
1300 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1301 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1302 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1303
1304 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1305 Take additional argument for the PLT entry size.
1306 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1307 Use get_plt_entry_size method rather than plt_entry_size variable.
1308 (Output_data_plt_x86_64::reserve_slot): Likewise.
1309 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1310 (Output_data_plt_x86_64::add_entry): Likewise.
1311 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1312 (Output_data_plt_x86_64::address_for_global): Likewise.
1313 (Output_data_plt_x86_64::address_for_local): Likewise.
1314 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1315 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1316 Make method non-static.
1317 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1318 method.
1319 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1320 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1321 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1322 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1323 virtual method.
1324 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1325 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1326 virtual method.
1327 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1328 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1329 virtual method.
1330 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1331 (Output_data_plt_x86_64::plt_entry_size)
1332 (Output_data_plt_x86_64::first_plt_entry)
1333 (Output_data_plt_x86_64::plt_entry)
1334 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1335 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1336 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1337 (Output_data_plt_x86_64_standard): ... here, new class.
1338 (Target_x86_64::Target_x86_64): Take optional argument for the
1339 Target_info pointer to use.
1340 (Target_x86_64::do_make_data_plt): New virtual method.
1341 (Target_x86_64::make_data_plt): New method to call it.
1342 (Target_x86_64::init_got_plt_for_update): Use that.
1343 Call this->plt_->add_eh_frame method here.
1344 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1345 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1346 rather than static method.
1347 (Target_x86_64::plt_entry_size): Likewise.
1348 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1349 rather than plt_entry_size variable. Move guts of PLT filling to...
1350 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1351 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1352 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1353
1354 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1355 additional argument for the section alignment.
1356 Don't do add_eh_frame_for_plt here.
1357 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1358 non-static. Use get_plt_entry_size method rather than plt_entry_size
1359 variable.
1360 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1361 method.
1362 (Output_data_plt_i386::get_plt_entry_size): Call it.
1363 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1364 (Output_data_plt_i386::add_eh_frame): New method to call it.
1365 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1366 method.
1367 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1368 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1369 method.
1370 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1371 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1372 method instead of plt_entry_size.
1373 (Output_data_plt_i386::plt_entry_size)
1374 (Output_data_plt_i386::plt_eh_frame_fde_size)
1375 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1376 (Output_data_plt_i386_standard): ... here, new class.
1377 (Output_data_plt_i386_exec): New class.
1378 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1379 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1380 (Output_data_plt_i386::exec_plt_entry): Move to ...
1381 (Output_data_plt_i386_exec::plt_entry): ... here.
1382 (Output_data_plt_i386_dyn): New class.
1383 (Output_data_plt_i386::first_plt_entry): Move to ...
1384 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1385 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1386 (Output_data_plt_i386_dyn::plt_entry): ... here.
1387 (Target_i386::Target_i386): Take optional argument for the Target_info
1388 pointer to use.
1389 (Target_i386::do_make_data_plt): New virtual method.
1390 (Target_i386::make_data_plt): New method to call it.
1391 (Target_i386::make_plt_section): Use that.
1392 Call this->plt_->add_eh_frame method here.
1393 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1394 rather than plt_entry_size variable.
1395 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1396 (Output_data_plt_i386::address_for_local): Likewise.
1397 (Output_data_plt_i386::do_write): Likewise.
1398 Move guts of PLT filling to...
1399 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1400 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1401 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1402 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1403
b9b9f2ee
CC
14042012-05-01 Cary Coutant <ccoutant@google.com>
1405
1406 * dwarf_reader.cc (Dwarf_die::read_attributes)
1407 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1408 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1409 * reduced_debug_output.cc
1410 (Output_reduced_debug_info_section::get_die_end): Remove
1411 DW_FORM_GNU_ref_index. Add default case.
1412
57923f48
MW
14132012-04-26 Mark Wielaard <mjw@redhat.com>
1414
1415 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1416 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1417 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1418 DW_AT_high_pc as offset from DW_AT_low_pc.
1419
1420 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1421 * testsuite/Makefile.in: Regenerate.
1422 * testsuite/gdb_index_test_3.c: New test source file.
1423 * testsuite/gdb_index_test_3.sh: New test source file.
1424
2c54b4f4
ILT
14252012-04-25 Ian Lance Taylor <iant@google.com>
1426
1427 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1428 pointer.
1429 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1430 as a class, not a struct.
1431 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1432 (Target_arm::apply_cortex_a8_workaround): Likewise.
1433 * gc.h: Declare Reloc_types as a struct, not a class.
1434 * object.h: Declare Symbols_data as a struct.
1435 * reloc.h: Declare Read_relocs_data as a struct.
1436 * target.h: Declare Relocate_info as a struct.
1437
a5a5f7a3
DM
14382012-04-24 David S. Miller <davem@davemloft.net>
1439
1440 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1441 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1442 and R_SPARC_WPLT30.
1443
f038d496
CC
14442012-04-24 Cary Coutant <ccoutant@google.com>
1445
1446 * incremental-dump.cc (find_input_containing_global): Replace
1447 magic number with symbolic constant.
1448 (dump_incremental_inputs): Update version number.
1449 * incremental.cc (Output_section_incremental_inputs): Update version
1450 number; import symbolic constants from Incremental_inputs_reader.
1451 (Incremental_inputs::create_data_sections): Align relocations
1452 section correctly for 64-bit targets.
1453 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1454 constants; add padding.
1455 (Output_section_incremental_inputs::write_header): Add assert for
1456 header_size.
1457 (Output_section_incremental_inputs::write_input_files): Add assert
1458 for input_entry_size.
1459 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1460 add assert for object_info_size, input_section_entry_size,
1461 global_sym_entry_size.
1462 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1463 for data structure sizes; use them.
1464 (Incremental_input_entry_reader): Import symbolic constants from
1465 Incremental_inputs_reader; use them.
1466
a4d85145
DM
14672012-04-23 David S. Miller <davem@davemloft.net>
1468
1469 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1470 and elf_flags_set_.
1471 (Target_sparc::Target_sparc): Initialize new fields.
1472 (Target_sparc::do_make_elf_object): New function.
1473 (Target_sparc::do_adjust_elf_header): New function.
1474
1d509098
CC
14752012-04-23 Cary Coutant <ccoutant@google.com>
1476
1477 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1478 CU range table of gdb index.
1479
7ebeff7f
DM
14802012-04-20 David S. Miller <davem@davemloft.net>
1481
1482 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1483 instead of false.
1484
13cf9988
DM
14852012-04-16 David S. Miller <davem@davemloft.net>
1486
2a1079e8
DM
1487 * sparc.cc (Target_sparc::got_address): New function.
1488 (Sparc_relocate_functions::gdop_hix22): New function.
1489 (Sparc_relocate_functions::gdop_lox10): New function.
1490 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1491 relocs.
1492 (Target_sparc::Scan::local): Likewise if the global symbol is not
1493 preemptible and is not IFUNC.
1494 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1495 transformations for local and non-preemptible non-IFUNC global
1496 symbols.
1497
0bc964fc
DM
1498 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1499 writing out 64-bit part of ranges.
1500
661d7a80
DM
1501 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1502 -fpic and -fpie respectively.
1503 * Makefile.in: Regenerate.
1504
8c2bf391
DM
1505 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1506 (Target_sparc::Target_sparc): Initialize new field.
1507 (Target_sparc::do_plt_section_for_global): New function.
1508 (Target_sparc::do_plt_section_for_local): New function.
1509 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1510 (Target_sparc::make_plt_section): New function, broken out of
1511 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1512 (Target_sparc::make_plt_entry): Call make_plt_section.
1513 (Target_sparc::make_local_ifunc_plt_entry): New function.
1514 (Target_sparc::rela_ifunc_section): New function.
1515 (Target_sparc::plt_section): Remove const.
1516 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1517 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1518 and ifunc_count_ fields.
1519 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1520 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1521 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1522 (Output_data_plt_sparc::rela_ifunc): New function.
1523 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1524 (Output_data_plt_sparc::has_ifunc_section): New function.
1525 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1526 (Output_data_plt_sparc::address_for_global): New function.
1527 (Output_data_plt_sparc::address_for_local): New function.
1528 (Output_data_plt_sparc::plt_index_to_offset): New function.
1529 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1530 and entry_count.
1531 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1532 entry_count.
1533 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1534 R_SPARC_JMP_IREL to switch.
1535 (Target_sparc::Scan::check_non_pic): Likewise.
1536 (Target_sparc::Scan::local): Handle IFUNC symbols.
1537 (Target_sparc::Scan::local): Likewise.
1538 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1539 and plt_address_for_local.
1540 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1541 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1542
13cf9988
DM
1543 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1544 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1545 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1546 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1547 global relocs too.
1548 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1549 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1550 calls.
1551 * sparc.cc (Target_sparc::Scan::global): Likewise.
1552 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1553
31821be0
CC
15542012-04-16 Cary Coutant <ccoutant@google.com>
1555
1556 * archive.cc (Library_base::should_include_member): Check for
1557 --export-dynamic-symbol.
1558 * options.h (class General_options): Add --export-dynamic-symbol.
1559 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1560 --export-dynamic-symbol.
1561 (Symbol_table::gc_mark_undef_symbols): Likewise.
1562 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1563
2615994e
DM
15642012-04-12 David S. Miller <davem@davemloft.net>
1565
1566 * sparc.cc (Reloc::wdisp10): New relocation method.
1567 (Reloc::h34): Likewise.
1568 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1569 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1570 R_SPARC_WDISP10.
1571 (Target_sparc::Scan::local): Likewise.
1572 (Target_sparc::Scan::global): Likewise.
1573 (Target_sparc::Relocate::relocate): Likewise.
1574
6782735d
CC
15752012-04-09 Cary Coutant <ccoutant@google.com>
1576
1577 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1578 low_pc == 0.
1579
8c7a0b00
ILT
15802012-04-06 Ian Lance Taylor <iant@google.com>
1581
1582 * timer.cc: #include <unistd.h>.
1583
58797674
RM
15842012-04-06 Roland McGrath <mcgrathr@google.com>
1585
1586 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1587 * config.in: Regenerate.
1588 * configure: Regenerate.
1589
44350750
NC
15902012-04-05 Nick Clifton <nickc@redhat.com>
1591
1592 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1593 (AM_LC_MESSAGES): Add.
1594 * aclocal.m4: Regenerate.
1595 * config.in: Regenerate.
1596 * configure: Regenerate.
1597
c1027032
CC
15982012-03-21 Cary Coutant <ccoutant@google.com>
1599
1600 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1601 * Makefile.in: Regenerate.
1602 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1603 (Sized_elf_reloc_mapper::symbol_section): New function.
1604 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1605 (make_elf_reloc_mapper): New function.
1606 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1607 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1608 (Dwarf_abbrev_table::do_get_abbrev): New function.
1609 (Dwarf_ranges_table::read_ranges_table): New function.
1610 (Dwarf_ranges_table::read_range_list): New function.
1611 (Dwarf_pubnames_table::read_section): New function.
1612 (Dwarf_pubnames_table::read_header): New function.
1613 (Dwarf_pubnames_table::next_name): New function.
1614 (Dwarf_die::Dwarf_die): New function.
1615 (Dwarf_die::read_attributes): New function.
1616 (Dwarf_die::skip_attributes): New function.
1617 (Dwarf_die::set_name): New function.
1618 (Dwarf_die::set_linkage_name): New function.
1619 (Dwarf_die::attribute): New function.
1620 (Dwarf_die::string_attribute): New function.
1621 (Dwarf_die::int_attribute): New function.
1622 (Dwarf_die::uint_attribute): New function.
1623 (Dwarf_die::ref_attribute): New function.
1624 (Dwarf_die::child_offset): New function.
1625 (Dwarf_die::sibling_offset): New function.
1626 (Dwarf_info_reader::check_buffer): New function.
1627 (Dwarf_info_reader::parse): New function.
1628 (Dwarf_info_reader::do_parse): New function.
1629 (Dwarf_info_reader::do_read_string_table): New function.
1630 (Dwarf_info_reader::lookup_reloc): New function.
1631 (Dwarf_info_reader::get_string): New function.
1632 (Dwarf_info_reader::visit_compilation_unit): New function.
1633 (Dwarf_info_reader::visit_type_unit): New function.
1634 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1635 Sized_elf_reloc_mapper.
1636 (Sized_dwarf_line_info::symbol_section): Remove function.
1637 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1638 (Sized_dwarf_line_info::read_line_mappings): Remove object
1639 parameter, adjust callers.
1640 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1641 * dwarf_reader.h: Include <sys/types.h>.
1642 (class Track_relocs): Remove forward declaration.
1643 (class Elf_reloc_mapper): New class.
1644 (class Sized_elf_reloc_mapper): New class.
1645 (class Dwarf_abbrev_table): New class.
1646 (class Dwarf_range_list): New class.
1647 (class Dwarf_ranges_table): New class.
1648 (class Dwarf_pubnames_table): New class.
1649 (class Dwarf_die): New class.
1650 (class Dwarf_info_reader): New class.
1651 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1652 (Sized_dwarf_line_info::symbol_section): Remove member function.
1653 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1654 base class.
1655 * gdb-index.cc: New source file.
1656 * gdb-index.h: New source file.
1657 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1658 and .debug_types sections, call Layout::add_to_gdb_index.
1659 (Sized_relobj_incr::do_section_name): Implement.
1660 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1661 return type; Implement.
1662 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1663 return type.
1664 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1665 parameter list and return type.
1666 (Sized_incr_dynobj::do_section_contents): Likewise.
1667 * layout.cc: Include gdb-index.h.
1668 (Layout::Layout): Initialize gdb_index_data_.
1669 (Layout::init_fixed_output_section): Check for .gdb_index section.
1670 (Layout::add_to_gdb_index): New function. Instantiate.
1671 * layout.h: Add forward declaration for class Gdb_index.
1672 (Layout::add_to_gdb_index): New member function.
1673 (Layout::gdb_index_data_): New data member.
1674 * main.cc: Include gdb-index.h.
1675 (main): Print statistics for gdb index.
1676 * object.cc (Object::section_contents): Move code into
1677 do_section_contents.
1678 (need_decompressed_section): Check for sections needed when building
1679 gdb index.
1680 (build_compressed_section_map): Likewise.
1681 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1682 gdb index.
1683 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1684 sections; call Layout::add_to_gdb_index.
1685 (Sized_relobj_file::do_decompressed_section_contents): Call
1686 do_section_contents directly.
1687 * object.h (Object::do_section_contents): Adjust parameter list and
1688 return type.
1689 (Object::do_decompressed_section_contents): Call do_section_contents
1690 directly.
1691 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1692 return type.
1693 * options.h (class General_options): Add --gdb-index option.
1694 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1695 list and return type.
1696 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1697 * reloc.h (Track_relocs::checkpoint): New function.
1698 (Track_relocs::reset): New function.
1699
1700 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1701 New test cases.
1702 * testsuite/Makefile.in: Regenerate.
1703 * testsuite/gdb_index_test.cc: New test source file.
1704 * testsuite/gdb_index_test_1.sh: New test source file.
1705 * testsuite/gdb_index_test_2.sh: New test source file.
1706
647f1574
DK
17072012-03-19 Doug Kwan <dougkwan@google.com>
1708
1709 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2e702c99 1710 (Target_arm::do_finalize_sections): Remove code which defines
647f1574
DK
1711 __exidx_start and __exidx_end. Make symbol table parameter
1712 anonymous as it is not used.
1713 * gold.cc (queue_middle_tasks): Call target hook to define any
1714 target-specific symbols.
1715 * target.h (Target::define_standard_symbols): New method.
1716 (Target::do_define_standard_symbols): Same.
1717 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1718 * testsuite/Makefile.in: Regenerate.
1719 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1720 and __exidx_end.
1721 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1722 relocations are generated for __exidx_start and __exidx_end.
1723
7c6109da
DK
17242012-03-16 Doug Kwan <dougkwan@google.com>
1725
1726 * testsuite/Makefile.am: Disable test initpri3b.
1727 * testsuite/Makefile.in: Regenerate.
1728
7b8957f8
DK
17292012-03-15 Doug Kwan <dougkwan@google.com>
1730
1731 * arm.cc (Target_arm::got_section): Make .got section read-only
1732 if -z now is given.
1733
14dc9ef7
ILT
17342012-03-15 Ian Lance Taylor <iant@google.com>
1735
1736 PR gold/13850
1737 * layout.cc (Layout::make_output_section): Correctly mark
1738 SHT_INIT_ARRAY, et. al., as relro.
1739
fa40b62a
DK
17402012-03-14 Doug Kwan <dougkwan@google.com>
1741
1742 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1743 dynamic relocations for protected symbols in shared objects.
1744
fd325007
ILT
17452012-03-13 Ian Lance Taylor <iant@google.com>
1746
1747 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1748 keep the larger alignment.
1749
e8dd54e1
CC
17502012-03-12 Cary Coutant <ccoutant@google.com>
1751
1752 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1753 handling of DW_LNE_define_file.
1754
feb5f3b0
CC
17552012-03-12 Cary Coutant <ccoutant@google.com>
1756
1757 * reduced_debug_output.cc
1758 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1759 codes to switch.
1760
a1fb4256
CC
17612012-02-29 Cary Coutant <ccoutant@google.com>
1762
1763 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1764
5dd8762a
CC
17652012-02-29 Cary Coutant <ccoutant@google.com>
1766
1767 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1768 Call Object::decompressed_section_contents.
1769 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1770 New dtor.
1771 (Sized_dwarf_line_info::buffer_start_): New data member.
1772 * merge.cc (Output_merge_data::do_add_input_section): Call
1773 Object::decompressed_section_contents.
1774 (Output_merge_string::do_add_input_section): Likewise.
1775 * object.cc (need_decompressed_section): New function.
1776 (build_compressed_section_map): Decompress sections needed later.
1777 (Sized_relobj_file::do_decompressed_section_contents): New function.
1778 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1779 * object.h (Object::decompressed_section_contents): New function.
1780 (Object::discard_decompressed_sections): New function.
1781 (Object::do_decompressed_section_contents): New function.
1782 (Object::do_discard_decompressed_sections): New function.
1783 (Compressed_section_info): New type.
1784 (Compressed_section_map): Include decompressed section contents.
1785 (Sized_relobj_file::do_decompressed_section_contents): New function.
1786 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1787
7b5de7ee
CC
17882012-02-16 Cary Coutant <ccoutant@google.com>
1789
1790 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1791 * testsuite/Makefile.in: Regenerate.
1792
f9fa4a63
CC
17932012-02-14 Cary Coutant <ccoutant@google.com>
1794
1795 * options.cc (General_options::finalize): Disallow -pie and -static.
1796
2c175ebc
DK
17972012-02-03 Doug Kwan <dougkwan@google.com>
1798
1799 * arm.cc (Arm_relocate_functions::abs8,
1800 Arm_relocate_functions::abs16): Use
1801 Bits::has_signed_unsigned_overflow32.
1802 (Arm_relocate_functions::thm_abs8): Correct range of
1803 overflow check.
1804 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1805 in assertions.
1806
90cff06f
DK
18072012-02-02 Doug Kwan <dougkwan@google.com>
1808
1809 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1810 position independent outputs, not just shared objects.
1811
63887f3d
L
18122012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1813
1814 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1815 * configure: Regenerated.
1816
bef2b434
ILT
18172012-01-27 Ian Lance Taylor <iant@google.com>
1818
1819 * reloc.h (Bits): New class with static functions, copied from
1820 namespace utils in arm.cc.
1821 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1822 instead.
1823
c335b55d
L
18242012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1825
1826 * incremental.cc (write_info_blocks): Correct relocation offset.
1827
41194d9f
L
18282012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1829
1830 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1831 (Relocate::tls_gd_to_le): Likewise.
1832
1bae613c
L
18332012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1834
1835 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1836
24482ca0
L
18372012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1838
1839 * configure.ac: Check if -mcmodel=medium works.
1840 * configure: Regenerated.
1841
c2c7840a
CC
18422012-01-24 Cary Coutant <ccoutant@google.com>
1843
1844 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1845 definition and ...
1846 (read_unsigned_LEB_128_x): ... this new function.
1847 (read_signed_LEB_128): Replaced with inline definition and ...
1848 (read_signed_LEB_128_x): ... this new function.
1849 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1850 (read_unsigned_LEB_128): Add inline definition.
1851 (read_signed_LEB_128_x): New function.
1852 (read_signed_LEB_128): Add inline definition.
1853 * testsuite/Makefile.am (leb128_unittest): New unit test.
1854 * testsuite/Makefile.in: Regenerate.
1855 * testsuite/leb128_unittest.cc: New unit test.
1856
833de760 18572012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
1858
1859 PR gold/13617
1860 * i386.cc (Target_i386::do_code_fill): When using a jmp
1861 instruction, pad with nop instructions.
1862 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1863
618d6666
L
18642012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1865
1866 * x86_64.cc (gc_process_relocs): Add typename on types used in
1867 template.
1868 (scan_relocs): Likewise.
1869 (relocate_section): Likewise.
1870 (apply_relocation): Likewise.
1871
3660ff06
L
18722012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1873
1874 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1875 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1876 under x32.
1877
fc51264f
L
18782012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1879
1880 * x86_64.cc: Initial support for x32.
1881
dd74ae06
CC
18822012-01-03 Cary Coutant <ccoutant@google.com>
1883
1884 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1885 Use abstract base class for GOT.
1886 * gold/output.h (class Output_data_got_base): New abstract base class.
1887 (class Output_data_got): Derive from new base class, adjust ctors.
1888 (Output_data_got::reserve_slot): Make virtual; rename to
1889 do_reserve_slot; Adjust callers.
1890 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1891 pointer to abstract base class.
1892 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1893
83896202
ILT
18942011-12-18 Ian Lance Taylor <iant@google.com>
1895
1896 * object.h (Relobj::local_symbol_value): New function.
1897 (Relobj::local_plt_offset): New function.
1898 (Relobj::local_has_got_offset): New function.
1899 (Relobj::local_got_offset): New function.
1900 (Relobj::set_local_got_offset): New function.
1901 (Relobj::do_local_symbol_value): New pure virtual function.
1902 (Relobj::do_local_plt_offset): Likewise.
1903 (Relobj::do_local_has_got_offset): Likewise.
1904 (Relobj::do_local_got_offset): Likewise.
1905 (Relobj::do_set_local_got_offset): Likewise.
1906 (Sized_relobj::do_local_has_got_offset): Rename from
1907 local_has_got_offset.
1908 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1909 (Sized_relobj::do_set_local_got_offset): Rename from
1910 set_local_got_offset.
1911 (Sized_relobj_file::do_local_plt_offset): Rename from
1912 local_plt_offset.
1913 (Sized_relobj_file::do_local_symbol_value): New function.
1914 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1915 local_plt_offset.
1916 * output.cc (Output_data_got::Got_entry::write): Change object to
1917 Relobj. Use local_symbol_value.
1918 (Output_data_got::add_global_with_rel): Change rel_dyn to
1919 Output_data_reloc_generic*. Use add_global_generic.
1920 (Output_data_got::add_global_with_rela): Remove. Change all
1921 callers to use add_global_with_rel.
1922 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1923 Output_data_reloc_generic*. Use add_global_generic.
1924 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1925 callers to use add_global_pair_with_rel.
1926 (Output_data_got::add_local): Change object to Relobj*.
1927 (Output_data_got::add_local_plt): Likewise.
1928 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1929 change rel_dyn to Output_data_reloc_generic*. Use
1930 add_local_generic.
1931 (Output_data_got::add_local_with_rela): Remove. Change all
1932 callers to use all_local_with_rel.
1933 (Output_data_got::add_local_pair_with_rel): Change object to
1934 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1935 add_output_section_generic.
1936 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1937 callers to use add_local_pair_with_rel.
1938 (Output_data_got::reserve_local): Change object to Relobj*.
1939 * output.h: (class Output_data_reloc_generic): Add pure virtual
1940 declarations for add_global_generic, add_local_generic,
1941 add_output_section_generic.
1942 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1943 functions for Output_data_reloc_generic. Update declarations for
1944 changes listed in output.cc.
1945 (class Output_data_got): Change template parameter to got_size.
1946 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1947 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1948 function.
1949 (Sized_relobj_incr::do_local_plt_offset): New function.
1950 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1951 add_global_generic.
1952
76677ad0
CC
19532011-12-17 Cary Coutant <ccoutant@google.com>
1954
1955 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1956 * resolve.cc (Symbol_table::resolve): Likewise.
1957 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1958 arrays.
1959 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1960
8b8dd8d5
ILT
19612011-12-16 Ian Lance Taylor <iant@google.com>
1962
1963 * output.h (Output_data_reloc_generic::add): Only call
1964 add_dynamic_reloc if this is a dynamic reloc section.
1965
d55525b9
L
19662011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1967
1968 PR gold/13505
1969 * target-reloc.h (apply_relocation): Replace <64, false> with
1970 <size, big_endian>.
1971
ff81c7c1
NC
19722011-11-25 Nick Clifton <nickc@redhat.com>
1973
1974 * po/it.po: New Italian translation.
1975
628f39be
SA
19762011-11-17 Sterling Augustine <saugustine@google.com>
1977
1978 * script.cc (script_include_directive): Implement.
1979 (read_script_file): New local variables name and search_path. Update
1980 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1981 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1982 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1983
98ef3ea4
SA
19842011-11-11 Sterling Augustine <saugustine@google.com>
1985
1986 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1987 (file_or_sections_cmd): Likewise.
1988
f4a8b6d7
DK
19892011-11-11 Doug Kwan <dougkwan@google.com>
1990
1991 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1992 if --just-symbols is given.
1993
29ab395d
DK
19942011-11-10 Doug Kwan <dougkwan@google.com>
1995
1996 PR gold/13362
1997 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1998 when processing data relocs.
1999 * reloc.h (Relocate_functions::rel_unaligned): New method.
2000 (Relocate_functions::pcrel_unaligned): Ditto.
2001 (Relocate_functions::rel32_unaligned): Ditto.
2002 (Relocate_functions::pcrel32_unaligned): Ditto.
2003
2c339f71
DK
20042011-11-09 Doug Kwan <dougkwan@google.com>
2005
2006 PR gold/13362
2007 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2008 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2009 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2010 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2011 (Relocate_functions::rel_unaligned): New.
2012 (Relocate_functions::rel32_unaligned): New.
2013 * target-reloc.h (relocate_for_relocatable): Add code to handle
2014 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2015 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2016 arm_unaligned_reloc_r): New targets.
2017 * testsuite/Makefile.in: Regenerate.
2018 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2019 linking.
2020
3f3cddf1
ILT
20212011-11-02 Ian Lance Taylor <iant@google.com>
2022
2023 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2024 NATIVE_LINKER.
2025 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2026 * options.cc (General_options::finalize): Use library search path
2027 from configure script if specified. If not native and no sysroot,
2028 only search TOOLLIBDIR.
2029 * options.h (Search_directory::Search_directory): Change name to
2030 const std::string&.
2031 (General_options::add_to_library_path_with_sysroot): Change arg to
2032 const std::string&.
2033 * configure, Makefile.in, config.in: Rebuild.
2034
a8e2273b
ILT
20352011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2036
2037 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2038 we are working around the ARM1176 Erratum.
2039 * options.h (General_options::fix_arm1176): Add option.
2040 * testsuite/Makefile.am: Add testcases, and keep current ones
2041 working.
2042 * testsuite/Makefile.in: Regenerate.
2043 * testsuite/arm_fix_1176.s: New file.
2044 * testsuite/arm_fix_1176.sh: Likewise.
2045
cd6eab1c
ILT
20462011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2047
2048 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2049 may_use_blx_.
2050 (Target_arm::may_use_blx): Remove method.
2051 (Target_arm::set_may_use_blx): Likewise.
2052 (Target_arm::may_use_v4t_interworking): New method.
2053 (Target_arm::may_use_v5t_interworking): Likewise.
2054 (Target_arm::may_use_blx_): Remove member variable.
2055 (Arm_relocate_functions::arm_branch_common): Check for v5T
2056 interworking.
2057 (Arm_relocate_functions::thumb_branch_common): Likewise.
2058 (Reloc_stub::stub_type_for_reloc): Likewise.
2059 (Target_arm::do_finalize_sections): Correct interworking checks.
2060 * testsuite/Makefile.am: Add new tests.
2061 * testsuite/Makefile.in: Regenerate.
2062 * testsuite/arm_farcall_arm_arm.s: New test.
2063 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2064 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2065 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2066 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2067 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2068 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2069 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2070
286adcf4
CC
20712011-10-31 Cary Coutant <ccoutant@google.com>
2072
2073 PR gold/13023
2074 * expression.cc (Expression::eval_with_dot): Add
2075 is_section_dot_assignment parameter.
2076 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2077 absolute and assigning to dot within a section.
2078 * script-sections.cc
2079 (Output_section_element_assignment::set_section_addresses): Pass
2080 dot_section to set_if_absolute.
2081 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2082 as is_section_dot_assignment flag to eval_with_dot.
2083 (Output_section_element_dot_assignment::set_section_addresses):
2084 Likewise.
2085 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2086 parameter. Also set value if relative to dot_section; set the
2087 symbol's output_section.
2088 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2089 parameter. Adjust all callers.
2090 (Expression::eval_maybe_dot): Likewise.
2091 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2092 Adjust all callers.
2093 * testsuite/script_test_2.t: Test assignment of an absolute value
2094 to dot within an output section element.
2095
9634ed06
CC
20962011-10-31 Cary Coutant <ccoutant@google.com>
2097
2098 * options.h (class General_options): Add --[no-]gnu-unique options.
2099 * symtab.cc (Symbol_table::sized_write_globals): Convert
2100 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2101
de4101c7
CC
21022011-10-31 Cary Coutant <ccoutant@google.com>
2103
2104 PR gold/13359
2105 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2106 unnecessary assertion.
2107 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2108
7257cc92
ST
21092011-10-31 Sriraman Tallam <tmsriram@google.com>
2110
2111 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2112 gc_mark_symbol.
2113 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2114 gc_mark_symbol.
2115 Change to just keep the section associated with symbol.
2116 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2117 they are externally visible and --export-dynamic is turned on.
2118 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2119
bfc34b3f
ILT
21202011-10-19 Ian Lance Taylor <iant@google.com>
2121
2122 PR gold/13163
2123 * script-sections.cc
2124 (Output_section_element_dot_assignment::needs_output_section): New
2125 function.
2126
ea0d8c47
ILT
21272011-10-19 Ian Lance Taylor <iant@google.com>
2128
2129 PR gold/13204
2130 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2131 --section-start option was seen.
2132 * options.h (General_options::any_section_start): New function.
2133
abd242a9
DM
21342011-10-18 David S. Miller <davem@davemloft.net>
2135
2136 PR binutils/13301
2137 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2138 member to track relocation locations that have moved during TLS
2139 reloc optimizations.
2140 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2141 (Target_sparc::Relocate::relocate): Adjust view down by 4
2142 bytes if it matches reloc_adjust_addr_.
2143 (Target_sparc::Relocate::relocate_tls): Always move the
2144 __tls_get_addr call delay slot instruction forward 4 bytes when
2145 performing relaxation.
2146
bab9090f
CC
21472011-10-18 Cary Coutant <ccoutant@google.com>
2148
2149 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2150 (Output_file::map_no_anonymous): Check for non-zero
2151 return code from posix_fallocate.
2152
f7c5b166
CC
21532011-10-17 Cary Coutant <ccoutant@google.com>
2154
2155 PR gold/13245
2156 * plugin.cc (is_visible_from_outside): Check for symbols
2157 referenced from dynamic objects.
2158 * resolve.cc (Symbol_table::resolve): Don't count references
2159 from dynamic objects as references from real ELF files.
2160 * testsuite/plugin_test_2.sh: Adjust expected result.
2161
b490c0bb
CC
21622011-10-17 Cary Coutant <ccoutant@google.com>
2163
2164 * gold.cc: Include timer.h.
2165 (queue_middle_tasks): Stamp time.
2166 (queue_final_tasks): Likewise.
2167 * main.cc (main): Store timer in parameters. Print timers
2168 for each pass.
2169 * parameters.cc (Parameters::Parameters): Initialize timer_.
2170 (Parameters::set_timer): New function.
2171 (set_parameters_timer): New function.
2172 * parameters.h (Parameters::set_timer): New function.
2173 (Parameters::timer): New function.
2174 (Parameters::timer_): New data member.
2175 (set_parameters_timer): New function.
2176 * timer.cc (Timer::stamp): New function.
2177 (Timer::get_pass_time): New function.
2178 * timer.h (Timer::stamp): New function.
2179 (Timer::get_pass_time): New function.
2180 (Timer::pass_times_): New data member.
2181
f475cf7b
CC
21822011-10-17 Cary Coutant <ccoutant@google.com>
2183
2184 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2185 task for members of lib groups.
2186
cdd7e244
CC
21872011-10-17 Cary Coutant <ccoutant@google.com>
2188
2189 PR gold/13288
4f95c8b4 2190 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
2191 (File_read::make_view): Move bounds check (replace with assert)...
2192 (File_read::find_or_make_view): ... to here.
2193
dfb45471
CC
21942011-10-12 Cary Coutant <ccoutant@google.com>
2195
4f95c8b4 2196 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
2197 ::read returns less than requested size.
2198
53bbcc1b
CC
21992011-10-10 Cary Coutant <ccoutant@google.com>
2200
4f95c8b4 2201 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
2202 Initialize defined_count_.
2203 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2204 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2205 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2206 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2207 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 2208 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
2209 member.
2210 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 2211 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
2212 Return zeroes instead of internal error.
2213
397b129b
CC
22142011-10-10 Cary Coutant <ccoutant@google.com>
2215
2216 PR gold/13249
4f95c8b4 2217 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 2218 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 2219 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
2220 (Output_reloc::type_): Adjust size of bit field.
2221 (Output_reloc::use_plt_offset_): New bit field.
2222 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2223 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2224 flag. Adjust all callers.
4f95c8b4 2225 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
2226 creating RELATIVE relocations.
2227
d5698657
NC
22282011-10-10 Nick Clifton <nickc@redhat.com>
2229
2230 * po/es.po: Updated Spanish translation.
2231 * po/fi.po: Updated Finnish translation.
2232
6a59a5c2
DN
22332011-10-03 Diego Novillo <dnovillo@google.com>
2234
2235 * options.cc (parse_uint): Fix dereference of RETVAL.
2236
f0558624
ST
22372011-09-29 Sriraman Tallam <tmsriram@google.com>
2238
2239 * layout.h (section_order_map_): New member.
2240 (get_section_order_map): New member function.
2241 * output.cc (Output_section::add_input_section): Check for patterns
2242 only when --section-ordering-file is specified.
2243 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2244 output_sections have been formed.
2245 * layout.cc (Layout_Layout): Initialize section_order_map_.
2246 * plugin.cc (update_section_order): Store order in order_map. Do not
2247 update the order.
2248 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2249 * testsuite/Makefile.in: Regenerate.
2250 * testsuite/plugin_section_order.c: New file.
2251 * testsuite/plugin_final_layout.cc: New file.
2252 * testsuite/plugin_final_layout.sh: New file.
2253
a7dac153
CC
22542011-09-29 Cary Coutant <ccoutant@google.com>
2255
4f95c8b4 2256 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 2257 Check for NULL.
4f95c8b4 2258 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
2259 symbols during incremental update.
2260 (Symbol_table::add_from_dynobj): Likewise.
2261
eebd87a5
ILT
22622011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2263 Ian Lance Taylor <iant@google.com>
2264
2265 * symtab.cc (Symbol_table::define_special_symbol): Always
2266 canonicalize version string.
2267
403a3331
CC
22682011-09-26 Cary Coutant <ccoutant@google.com>
2269
4f95c8b4
CC
2270 * gold.cc (queue_initial_tasks): Move option checks ...
2271 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
2272 some options; make others fatal.
2273
235061c2
CC
22742011-09-26 Cary Coutant <ccoutant@google.com>
2275
2276 gcc PR lto/47247
2277 * plugin.cc (get_symbols_v2): New function.
2278 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2279 (is_referenced_from_outside): New function.
2280 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2281 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2282 (get_symbols): Pass version parameter.
2283 (get_symbols_v2): New function.
2284 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2285 parameter.
2286 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2287 (onload): Add LDPT_GET_SYMBOLS_V2.
2288 (all_symbols_read_hook): Use get_symbols_v2; check for
2289 LDPR_PREVAILING_DEF_IRONLY_EXP.
2290 * testsuite/plugin_test_3.sh: Update expected results.
2291
dc87f620
ILT
22922011-09-23 Simon Baldwin <simonb@google.com>
2293
2294 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2295 configuration options.
2296 * configure: Regenerate.
2297 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2298 * Makefile.in: Regenerate.
2299 * testsuite/Makefile.in: Regenerate.
2300
a8279f82
ST
23012011-09-19 Sriraman Tallam <tmsriram@google.com>
2302
2303 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2304
0c9350c8
CC
23052011-09-19 Cary Coutant <ccoutant@google.com>
2306
2307 * incremental.cc (can_incremental_update): Fix typo in comment.
2308 * incremental.h (can_incremental_update): Likewise.
2309
aa06ae28
CC
23102011-09-18 Cary Coutant <ccoutant@google.com>
2311
2312 * incremental.cc (can_incremental_update): New function.
2313 * incremental.h (can_incremental_update): New function.
2314 * layout.cc (Layout::init_fixed_output_section): Call it.
2315 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2316 * object.cc (Sized_relobj_file::do_layout): Call
2317 can_incremental_update.
2318
ebb300b2
CC
23192011-09-13 Cary Coutant <ccoutant@google.com>
2320
2321 * configure.ac: Check for glibc support for gnu_indirect_function
2322 support with static linking, setting automake conditional
2323 IFUNC_STATIC.
2324 * Makefile.in: Regenerate.
2325 * configure: Regenerate.
2326
2327 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2328 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2329 for IFUNC_STATIC.
2330 * testsuite/Makefile.in: Regenerate.
2331
1206d0d5
CC
23322011-09-13 Cary Coutant <ccoutant@google.com>
2333
2334 * incremental.cc (Sized_relobj_incr::do_layout): Call
2335 report_comdat_group for kept comdat sections.
2336 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2337 * testsuite/Makefile.in: Regenerate.
2338 * testsuite/incr_comdat_test_1.cc: New source file.
2339 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2340 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2341 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2342
40b29874
ILT
23432011-09-13 Ian Lance Taylor <iant@google.com>
2344
2345 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2346 variable external_symbols_offset.
2347
1b045aac
ILT
23482011-09-12 Ian Lance Taylor <iant@google.com>
2349
2350 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2351 triggered if object has no symbols.
2352
24c6c55a
DM
23532011-09-09 David S. Miller <davem@davemloft.net>
2354
2355 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2356 (Output_fill_debug_line::do_write): Likewise.
2357
66570254
CC
23582011-08-29 Cary Coutant <ccoutant@google.com>
2359
2360 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2361 casts to match formatting specs.
2362 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2363
8ea8cd50
CC
23642011-08-26 Cary Coutant <ccoutant@google.com>
2365
2366 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2367 remaining hole size when allocating.
2368 (Layout::make_output_section): Set fill methods for debug sections.
2369 * layout.h (Free_list::Free_list_node): Move from private to
2370 public.
2371 (Free_list::set_min_hole_size): New function.
2372 (Free_list::begin, Free_list::end): New functions.
2373 (Free_list::min_hole_): New data member.
2374 * output.cc: Include dwarf.h.
2375 (Output_fill_debug_info::do_minimum_hole_size): New function.
2376 (Output_fill_debug_info::do_write): New function.
2377 (Output_fill_debug_line::do_minimum_hole_size): New function.
2378 (Output_fill_debug_line::do_write): New function.
2379 (Output_section::Output_section): Initialize new data member.
2380 (Output_section::set_final_data_size): Ensure patch space is larger
2381 than minimum hole size.
2382 (Output_section::do_write): Fill holes in debug sections.
2383 * output.h (Output_fill): New class.
2384 (Output_fill_debug_info): New class.
2385 (Output_fill_debug_line): New class.
2386 (Output_section::set_free_space_fill): New function.
2387 (Output_section::free_space_fill_): New data member.
2388 * testsuite/Makefile.am (incremental_test_3): Add
2389 --incremental-patch option.
2390 (incremental_test_4): Likewise.
2391 (incremental_test_5): Likewise.
2392 (incremental_test_6): Likewise.
2393 (incremental_copy_test): Likewise.
2394 (incremental_common_test_1): Likewise.
2395 * testsuite/Makefile.in: Regenerate.
2396
7cf80422
NC
23972011-08-26 Nick Clifton <nickc@redhat.com>
2398
2399 * po/es.po: Updated Spanish translation.
2400
c3f7b0e5
CC
24012011-08-01 Cary Coutant <ccoutant@google.com>
2402
2403 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2404 * gold/testsuite/Makefile.in: Regenerate.
2405 * gold/testsuite/justsyms_exec.c: New source file.
2406 * gold/testsuite/justsyms_lib.c: New source file.
2407
9590bf25
CC
24082011-08-01 Cary Coutant <ccoutant@google.com>
2409
2410 * layout.cc (Layout::set_segment_offsets): Don't realign text
2411 segment if -Ttext was specified.
2412 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2413 file type.
2414 * object.h (Sized_relobj_file::e_type): New function.
2415 (Sized_relobj_file::e_type_): New data member.
2416 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2417 base address for ET_EXEC files.
2418 * target.cc (Target::do_make_elf_object_implementation): Allow
2419 ET_EXEC files with --just-symbols option.
2420
dcd8d12e
CC
24212011-07-28 Cary Coutant <ccoutant@google.com>
2422
2423 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2424 Add thread_number parameter.
2425 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2426 * workqueue-threads.cc
2427 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2428 current thread if its thread number is greater than desired thread
2429 count.
2430 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2431 Add thread_number parameter.
2432 (Workqueue::should_cancel_thread): Likewise.
2433 (Workqueue::find_runnable_or_wait): Pass thread_number to
2434 should_cancel_thread.
2435 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2436 parameter.
2437
804eb480
ST
24382011-07-22 Sriraman Tallam <tmsriram@google.com>
2439
2440 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2441 only after checking if it cannot be forced local.
2442 * symtab.h (is_externally_visible): Check if the symbol is not forced
2443 local.
2444
f1ddb600
ILT
24452011-07-15 Ian Lance Taylor <iant@google.com>
2446
2447 * options.h (class General_options): Add --print-output-format.
2448 Move -EL next to -EB, for better --help output.
2449 * target-select.cc: Include <cstdio>, "options.h", and
2450 "parameters.h".
2451 (Target_selector::do_target_bfd_name): New function.
2452 (print_output_format): New function.
2453 * target-select.h (class Target_selector): Update declarations.
2454 (Target_selector::target_bfd_name): New function.
2455 (print_output_format): Declare.
2456 * main.cc: Include "target-select.h".
2457 (main): Handle --print-output-format.
2458 * gold.cc: Include "target-select.h".
2459 (queue_initial_tasks): Handle --print-output-format when there are
2460 no input files.
2461 * parameters.cc (parameters_force_valid_target): Give a better
2462 error message if -EB/-EL does not match target.
2463 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2464 function.
2465
7d172687
ILT
24662011-07-15 Ian Lance Taylor <iant@google.com>
2467
2468 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2469 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2470 (Output_data_plt_i386::do_write): Write address of .dynamic
2471 section to first entry in .got.plt section.
2472 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2473 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2474 Initialize layout_.
2475 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2476 section to first entry in .got.plt section.
2477 * layout.h (Layout::dynamic_section): New function.
2478
e9552f7e
ST
24792011-07-13 Sriraman Tallam <tmsriram@google.com>
2480
2481 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2482 to claim_file call.
2483 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2484 input_section_position_, and input_section_glob_.
2485 (read_layout_from_file): Call function section_ordering_specified.
2486 * layout.h (is_section_ordering_specified): New function.
2487 (section_ordering_specified): New function.
2488 (section_ordering_specified_): New boolean member.
2489 * main.cc(main): Call load_plugins after layout object is defined.
2490 * output.cc (Output_section::add_input_section): Use
2491 function section_ordering_specified to check if section ordering is
2492 needed.
2493 * output.cc (Output_section::add_relaxed_input_section): Use
2494 function section_ordering_specified to check if section ordering is
2495 needed.
2496 (Output_section::update_section_layout): New function.
2497 (Output_section::sort_attached_input_sections): Check if input section
2498 must be reordered.
2499 * output.h (Output_section::update_section_layout): New function.
2500 * plugin.cc (get_section_count): New function.
2501 (get_section_type): New function.
2502 (get_section_name): New function.
2503 (get_section_contents): New function.
2504 (update_section_order): New function.
58797674 2505 (allow_section_ordering): New function.
e9552f7e
ST
2506 (Plugin::load): Add the new interfaces to the transfer vector.
2507 (Plugin_manager::load_plugins): New parameter.
2508 (Plugin_manager::all_symbols_read): New parameter.
2509 (Plugin_manager::claim_file): New parameter. Save the elf object for
2510 unclaimed objects.
2511 (Plugin_manager::get_elf_object): New function.
2512 (Plugin_manager::get_view): Change to directly use the bool to check
2513 if get_view is called from claim_file_hook.
2514 * plugin.h (input_objects): New function
2515 (Plugin__manager::load_plugins): New parameter.
2516 (Plugin_manager::claim_file): New parameter.
2517 (Plugin_manager::get_elf_object): New function.
2518 (Plugin_manager::in_claim_file_handler): New function.
2519 (Plugin_manager::in_claim_file_handler_): New member.
2520 (layout): New function.
2521 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2522 handler with an extra parameter. Make the elf object before calling
2523 claim_file handler.
2524 * testsuite/plugin_test.c (get_section_count): New function pointer.
2525 (get_section_type): New function pointer.
2526 (get_section_name): New function pointer.
2527 (get_section_contents): New function pointer.
2528 (update_section_order): New function pointer.
2529 (allow_section_ordering): New function pointer.
2530 (onload): Check if the new interfaces exist.
2531
9446efde
ILT
25322011-07-13 Ian Lance Taylor <iant@google.com>
2533
2534 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2535 relro section.
2536 * x86_64.cc (Target_x86_64::got_section): Likewise.
2537 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2538 (relro_now_test_SOURCES): New variable.
2539 (relro_now_test_DEPENDENCIES): New variable.
2540 (relro_now_test_LDFLAGS): New variable.
2541 (relro_now_test_LDADD): New variable.
2542 (relro_now_test.so): New target.
2543 * testsuite/Makefile.in: Rebuild.
2544
07aa62f2
ILT
25452011-07-12 Ian Lance Taylor <iant@google.com>
2546
2547 PR gold/12980
2548 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2549 GLOB_DAT relocation rather than a RELATIVE relocation for a
2550 protected symbol when creating a shared library.
2551 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2552 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2553 * testsuite/protected_main_1.cc (main): Test that protected
2554 function has same address.
2555
e2153196
ILT
25562011-07-11 Ian Lance Taylor <iant@google.com>
2557
2558 PR gold/12979
2559 * options.h (class General_options): Add -Bgroup.
2560 * options.cc (General_options::finalize): If -Bgroup is set,
2561 default to --unresolved-symbols=report-all.
2562 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2563 * target-reloc.h (issue_undefined_symbol_error): Handle
2564 --unresolved-symbols=report-all.
2565
6daf5215
ILT
25662011-07-08 Ian Lance Taylor <iant@google.com>
2567
2568 PR gold/11985
2569 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2570 if linker script discards key sections.
2571 (Layout::create_dynamic_symtab): Likewise.
2572 (Layout::assign_local_dynsym_offsets): Likewise.
2573 (Layout::sized_create_version_sections): Likewise.
2574 (Layout::create_interp): Likewise.
2575 (Layout::finish_dynamic_section): Likewise.
2576 (Layout::set_dynamic_symbol_size): Likewise.
2577
beabb2c6
ILT
25782011-07-08 Ian Lance Taylor <iant@google.com>
2579
2580 PR gold/12386
2581 * options.h (class General_options): Add --unresolved-symbols.
2582 * target-reloc.h (issue_undefined_symbol_error): Check
2583 --unresolved-symbols. Add comments.
2584
9c16daf1
ILT
25852011-07-08 Ian Lance Taylor <iant@google.com>
2586
2587 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2588 expression more complex.
2589
191f1a2d
ILT
25902011-07-08 Ian Lance Taylor <iant@google.com>
2591
2592 PR gold/11317
2593 * target-reloc.h (issue_undefined_symbol_error): New inline
2594 function, broken out of relocate_section.
2595 (relocate_section): Call issue_undefined_symbol_error.
2596 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2597 there is no TLS segment if we are about to issue an undefined
2598 symbol error.
2599 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2600
62855347
ILT
26012011-07-08 Ian Lance Taylor <iant@google.com>
2602
2603 PR gold/12279
2604 * resolve.cc (Symbol_table::should_override): Add fromtype
2605 parameter. Change all callers. Give error when linking together
2606 TLS and non-TLS symbol.
2607 (Symbol_table::should_override_with_special): Add fromtype
2608 parameter. Change all callers.
2609 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2610 there is no TLS segment if we have reported some errors.
2611 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2612
67181c72
ILT
26132011-07-08 Ian Lance Taylor <iant@google.com>
2614
2615 PR gold/12372
2616 * target.h (Target::plt_address_for_global): New function.
2617 (Target::plt_address_for_local): New function.
2618 (Target::plt_section_for_global): Remove.
2619 (Target::plt_section_for_local): Remove.
2620 (Target::do_plt_address_for_global): New virtual function.
2621 (Target::do_plt_address_for_local): New virtual function.
2622 (Target::do_plt_section_for_global): Remove.
2623 (Target::do_plt_section_for_local): Remove.
2624 (Target::register_global_plt_entry): Add Symbol_table and Layout
2625 parameters.
2626 * output.cc (Output_data_got::Got_entry::write): Use
2627 plt_address_for_global and plt_address_for_local.
2628 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2629 address of output section.
2630 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2631 got_irelative_, and irelative_count_ fields. Update
2632 declarations.
2633 (Output_data_plt_i386::has_irelative_section): New function.
2634 (Output_data_plt_i386::entry_count): Add irelative_count_.
2635 (Output_data_plt_i386::set_final_data_size): Likewise.
2636 (class Target_i386): Add got_irelative_ and rel_irelative_
2637 fields. Update declarations.
2638 (Target_i386::Target_i386): Initialize new fields.
2639 (Target_i386::do_plt_address_for_global): New function replacing
2640 do_plt_section_for_global.
2641 (Target_i386::do_plt_address_for_local): New function replacing
2642 do_plt_section_for_local.
2643 (Target_i386::got_section): Create got_irelative_.
2644 (Target_i386::rel_irelative_section): New function.
2645 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2646 fields. Don't define __rel_iplt_{start,end}.
2647 (Output_data_plt_i386::add_entry): Add symtab and layout
2648 parameters. Change all callers. Use different PLT and GOT for
2649 IFUNC symbols.
2650 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2651 layout parameters. Change all callers. Use different PLT and
2652 GOT.
2653 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2654 (Output_data_plt_i386::rel_irelative): New function.
2655 (Output_data_plt_i386::address_for_global): New function.
2656 (Output_data_plt_i386::address_for_local): New function.
2657 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2658 IRELATIVE GOT when changing IFUNC GOT entries.
2659 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2660 reloc.
2661 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2662 if we didn't create an IRELATIVE GOT.
2663 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2664 plt_address_for_local.
2665 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2666 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2667 got_irelative_, and irelative_count_ fields. Update
2668 declarations.
2669 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2670 Initialize new fields. Remove symtab parameter. Change all
2671 callers.
2672 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2673 irelative_count_.
2674 (Output_data_plt_x86_64::has_irelative_section): New function.
2675 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2676 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2677 fields. Update declarations.
2678 (Target_x86_64::Target_x86_64): Initialize new fields.
2679 (Target_x86_64::do_plt_address_for_global): New function replacing
2680 do_plt_section_for_global.
2681 (Target_x86_64::do_plt_address_for_local): New function replacing
2682 do_plt_section_for_local.
2683 (Target_x86_64::got_section): Create got_irelative_.
2684 (Target_x86_64::rela_irelative_section): New function.
2685 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2686 all callers. Don't create __rel_iplt_{start,end}.
2687 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2688 parameters. Change all callers. Use different PLT and GOT for
2689 IFUNC symbols.
2690 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2691 layout parameters. Change all callers. Use different PLT and
2692 GOT.
2693 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2694 parameters. Change all callers. Use different PLT and GOT for
2695 IFUNC symbols.
2696 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2697 (Output_data_plt_x86_64::rela_irelative): New function.
2698 (Output_data_plt_x86_64::address_for_global): New function.
2699 (Output_data_plt_x86_64::address_for_local): New function.
2700 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2701 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2702 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2703 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2704 parameters.
2705 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2706 reloc.
2707 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2708 symbols if we didn't create an IRELATIVE GOT.
2709 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2710 plt_address_for_local.
2711 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2712 * testsuite/ifuncvar1.c: New test file.
2713 * testsuite/ifuncvar2.c: New test file.
2714 * testsuite/ifuncvar3.c: New test file.
2715 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2716 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2717 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2718 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2719 * testsuite/Makefile.in: Rebuild.
2720
33c15b45
CC
27212011-07-07 Cary Coutant <ccoutant@google.com>
2722
2723 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2724 (two_file_test_1_ndebug.o): Likewise.
2725 (two_file_test_1b_ndebug.o): Likewise.
2726 (two_file_test_2_ndebug.o): Likewise.
2727 (two_file_test_main_ndebug.o): Likewise.
2728 (incremental_test_2): Link with no-debug versions.
2729
f48b5fb7
CC
27302011-07-06 Cary Coutant <ccoutant@google.com>
2731
2732 * gold/incremental.cc
2733 (Output_section_incremental_inputs::write_info_blocks): Check for
2734 hidden and internal symbols.
2735
221597a5
CC
27362011-07-06 Cary Coutant <ccoutant@google.com>
2737
2738 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2739 Check disposition for startup file.
2740 (Incremental_inputs::report_command_line): Ignore
2741 --incremental-startup-unchanged option.
2742 * options.cc (General_options::parse_incremental_startup_unchanged):
2743 New function.
2744 (General_options::General_options): Initialize new data member.
2745 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2746 (General_options): Add --incremental-startup-unchanged option.
2747 (General_options::incremental_startup_disposition): New function.
2748 (General_options::incremental_startup_disposition_): New data member.
2749
e24719f6
CC
27502011-07-06 Cary Coutant <ccoutant@google.com>
2751
2752 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2753 input file index to Script_info ctor.
2754 (Sized_incremental_binary::do_file_has_changed): Find the
2755 command-line argument for files named in scripts.
2756 * incremental.h (Script_info::Script_info): New ctor
2757 with input file index.
2758 (Script_info::input_file_index): New function.
2759 (Script_info::input_file_index_): New data member.
2760 (Incremental_binary::get_library): Add const.
2761 (Incremental_binary::get_script_info): Add const.
2762 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2763 * testsuite/Makefile.am (incremental_test_5): New test case.
2764 (incremental_test_6): New test case.
2765 * testsuite/Makefile.in: Regenerate.
2766
8f7c81e8
CC
27672011-07-06 Cary Coutant <ccoutant@google.com>
2768
2769 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2770 debug output when command lines differ.
2771
9fbd3822
CC
27722011-07-06 Cary Coutant <ccoutant@google.com>
2773
2774 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2775 --incremental-patch option.
2776 * layout.cc (Free_list::allocate): Extend allocation beyond original
2777 end if enabled.
2778 (Layout::make_output_section): Mark sections that should get
2779 patch space.
2780 * options.cc (parse_percent): New function.
2781 * options.h (parse_percent): New function.
2782 (DEFINE_percent): New macro.
2783 (General_options): Add --incremental-patch option.
2784 * output.cc (Output_section::Output_section): Initialize new data
2785 members.
2786 (Output_section::add_input_section): Print section name when out
2787 of patch space.
2788 (Output_section::add_output_section_data): Likewise.
2789 (Output_section::set_final_data_size): Add patch space when
2790 doing --incremental-full.
2791 (Output_section::do_reset_address_and_file_offset): Remove patch
2792 space.
2793 (Output_segment::set_section_list_addresses): Print debug output
2794 only if --incremental-update.
2795 * output.h (Output_section::set_is_patch_space_allowed): New function.
2796 (Output_section::is_patch_space_allowed_): New data member.
2797 (Output_section::patch_space_): New data member.
2798 * parameters.cc (Parameters::incremental_full): New function.
2799 * parameters.h (Parameters::incremental_full): New function
2800 * testsuite/Makefile.am (incremental_test_2): Add test for
2801 --incremental-patch option.
2802 * testsuite/Makefile.in: Regenerate.
2803 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2804 (t18): Remove function body.
2805
f6cccc2c
DK
28062011-07-05 Doug Kwan <dougkwan@google.com>
2807
2808 PR gold/12771
2809 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2810 Arm_Address type for relocation result.
2811 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2812 overflow check.
2813 (Arm_relocate_functions::abs32): Use unaligned access.
2814 (Arm_relocate_functions::rel32): Ditto.
2815 (Arm_relocate_functions::prel31): Ditto.
2816 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2817 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2818 static data relocations.
2819 * testsuite/Makefile.in: Regnerate.
2820 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2821
28a13fec
ILT
28222011-07-05 Ian Lance Taylor <iant@google.com>
2823
2824 PR gold/12392
2825 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2826 symbols if necessary.
2827 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2828
24d47b34
ILT
28292011-07-05 Ian Lance Taylor <iant@google.com>
2830
2831 PR gold/12952
2832 * resolve.cc (Symbol::override_base_with_special): Simply override
2833 version with special symbol version, ignoring previous version.
2834
41f9cbbe
ILT
28352011-07-05 Ian Lance Taylor <iant@google.com>
2836
2837 * object.cc (Sized_relobj_file::include_section_group): Add
2838 information to comment about signature location.
2839
886288f1
ILT
28402011-07-02 Ian Lance Taylor <iant@google.com>
2841
2842 PR gold/12957
2843 * options.h (class General_options): Add -f and -F.
2844 * options.cc (General_options::finalize): Fatal error if -f/-F
2845 are used without -shared.
2846 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2847
ae3a6d4f
ILT
28482011-07-02 Ian Lance Taylor <iant@google.com>
2849
2850 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2851
21131061
ILT
28522011-07-01 Ian Lance Taylor <iant@google.com>
2853
2854 PR gold/12525
2855 PR gold/12952
2856 * resolve.cc (Symbol::override_base_with_special): Don't override
2857 the version if the overriding symbol has a different name.
2858 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2859 all callers. If we give an error about an undefined version,
2860 define the base version if necessary.
2861 * dynobj.h (class Versions): Update declaration.
2862 * testsuite/weak_alias_test_5.cc: New file.
2863 * testsuite/weak_alias_test.script: New file.
2864 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2865 and versioned_alias have the right value, and call t2.
2866 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2867 weak_alias_test_5.so.
2868 (weak_alias_test_LDADD): Likewise.
2869 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2870 * testsuite/Makefile.in: Rebuild.
2871
611062c0
ILT
28722011-07-01 Ian Lance Taylor <iant@google.com>
2873
2874 PR gold/12525
2875 * options.h (class General_options): Support -z notext.
2876 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2877 -Wl,-z,notext.
2878 (two_file_shared_nonpic.so): Likewise.
2879 (two_file_shared_mixed.so): Likewise.
2880 (two_file_shared_mixed_1.so): Likewise.
2881 (weak_undef_lib_nonpic.so): Likewise.
2882 (alt/weak_undef_lib_nonpic.so): Likewise.
2883 (tls_test_shared_nonpic.so): Likewise.
2884 * testsuite/Makefile.in: Rebuild.
2885
328c7c2f
ILT
28862011-07-01 Ian Lance Taylor <iant@google.com>
2887
2888 PR gold/12525
2889 * configure.ac: Test whether static linking works, setting
2890 the automake conditional HAVE_STATIC.
2891 * testsuite/Makefile.am: Disable tests using -static if
2892 HAVE_STATIC is not true.
2893 * configure, testsuite/Makefile.in: Rebuild.
2894
02d7cd44
ILT
28952011-07-01 Ian Lance Taylor <iant@google.com>
2896
2897 PR gold/12525
2898 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2899 Assert if we see DW_EH_PE_indirect.
2900 * target.h (Target::ehframe_datarel_base): New function.
2901 (Target::do_ehframe_datarel_base): New target function.
2902 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2903 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2904 function.
2905
07a60597
ILT
29062011-07-01 Ian Lance Taylor <iant@google.com>
2907
2908 PR gold/12571
2909 * options.h (class General_options): Add
2910 --ld-generated-unwind-info.
2911 * ehframe.cc (Fde::write): Add address parameter. Change all
2912 callers. If associated with PLT, fill in address and size.
2913 (Cie::set_output_offset): Only add merge mapping if there is an
2914 object.
2915 (Cie::write): Add address parameter. Change all callers.
2916 (Eh_frame::add_ehframe_for_plt): New function.
2917 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2918 input_offset_ fields into union u_, with new plt field.
2919 (Fde::Fde): Adjust for new union field.
2920 (Fde::Fde) [Output_data version]: New constructor.
2921 (Fde::add_mapping): Only add merge mapping if there is an object.
2922 (class Cie): Update declarations.
2923 (class Eh_frame): Declare add_ehframe_for_plt.
2924 * layout.cc (Layout::layout_eh_frame): Break out code into
2925 make_eh_frame_section, and call it.
2926 (Layout::make_eh_frame_section): New function.
2927 (Layout::add_eh_frame_for_plt): New function.
2928 * layout.h (class Layout): Update declarations.
2929 * merge.cc (Merge_map::add_mapping): Add assertion.
2930 * i386.cc: Include "dwarf.h".
2931 (class Output_data_plt_i386): Make first_plt_entry,
2932 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2933 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2934 and plt_eh_frame_fde.
2935 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2936 boundary. Call add_eh_frame_for_plt if appropriate.
2937 * x86_64.cc: Include "dwarf.h".
2938 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2939 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2940 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2941 and plt_eh_frame_fde.
2942 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2943 appropriate.
2944
14788a3f
ILT
29452011-06-29 Ian Lance Taylor <iant@google.com>
2946
2947 PR gold/12629
2948 * object.cc (Sized_relobj_file::layout_section): Change shdr
2949 parameter to be const.
2950 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2951 out of do_layout.
2952 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2953 appropriate. Call layout_eh_frame_section.
2954 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2955 sections.
2956 * object.h (class Sized_relobj_file): Update declarations.
2957
6c21fce1
ILT
29582011-06-29 Ian Lance Taylor <iant@google.com>
2959
37e41b03 2960 PR gold/12652
6c21fce1
ILT
2961 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2962 modifier.
2963 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2964
4d5e4e62
ILT
29652011-06-29 Ian Lance Taylor <iant@google.com>
2966
2967 PR gold/12675
2968 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2969 SHT_X86_64_UNWIND.
2970 * layout.cc (Layout::layout_eh_frame): Likewise.
2971
886f533a
ILT
29722011-06-29 Ian Lance Taylor <iant@google.com>
2973
2974 PR gold/12695
2975 * layout.cc (Layout::symtab_section_shndx): New function.
2976 * layout.h (class Layout): Declare symtab_section_shndx.
2977 * output.cc (Output_section::write_header): Call it.
2978
f3ae1b28
ILT
29792011-06-29 Ian Lance Taylor <iant@google.com>
2980
2981 PR gold/12818
2982 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2983 symbols which are not used in a relocation.
2984
aecf301f
ILT
29852011-06-28 Ian Lance Taylor <iant@google.com>
2986
2987 PR gold/12898
2988 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2989 script create indistinguishable segments.
2990 (Layout::set_segment_offsets): Use stable_sort when sorting
2991 segments. Pass this to Compare_segments constructor.
2992 * layout.h (class Layout): Make segment_precedes non-static.
2993 (class Compare_segments): Change from struct to class. Add
2994 layout_ field. Add constructor.
2995 * script-sections.cc
2996 (Script_sections::attach_sections_using_phdrs_clause): Rename
2997 local orphan to is_orphan. Don't report failure to put empty
2998 section in segment. On attachment failure, report name of
2999 section, and attach to first PT_LOAD segment.
3000
03ef7571
ILT
30012011-06-28 Ian Lance Taylor <iant@google.com>
3002
3003 PR gold/12934
3004 * target-select.cc (Target_selector::Target_selector): Add
3005 emulation parameter. Change all callers.
3006 (select_target_by_bfd_name): Rename from select_target_by_name.
3007 Change all callers.
3008 (select_target_by_emulation): New function.
3009 (supported_emulation_names): New function.
3010 * target-select.h (class Target_selector): Add emulation_ field.
3011 Update declarations.
3012 (Target_selector::recognize_by_bfd_name): Rename from
3013 recognize_by_name. Change all callers.
3014 (Target_selector::supported_bfd_names): Rename from
3015 supported_names. Change all callers.
3016 (Target_selector::recognize_by_emulation): New function.
3017 (Target_selector::supported_emulations): New function.
3018 (Target_selector::emulation): New function.
3019 (Target_selector::do_recognize_by_bfd_name): Rename from
3020 do_recognize_by_name. Change all callers.
3021 (Target_selector::do_supported_bfd_names): Rename from
3022 do_supported_names. Change all callers.
3023 (Target_selector::do_recognize_by_emulation): New function.
3024 (Target_selector::do_supported_emulations): New function.
3025 (select_target_by_bfd_name): Change name in declaration.
3026 (select_target_by_emulation): Declare.
3027 (supported_emulation_names): Declare.
3028 * parameters.cc (parameters_force_valid_target): Try to find
3029 target based on emulation from -m option.
3030 * options.h (class General_options): Change doc string for -m.
3031 * options.cc (help): Print emulations.
3032 (General_options::parse_V): Likewise.
3033 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3034 Add emulation parameter. Change all callers.
3035
200b2bb9
ILT
30362011-06-28 Ian Lance Taylor <iant@google.com>
3037
3038 * target.h (class Target): Add osabi_ field.
3039 (Target::osabi): New function.
3040 (Target::set_osabi): New function.
3041 (Target::Target): Initialize osabi_.
3042 (Target::do_adjust_elf_header): Make pure virtual.
3043 (Sized_target::do_adjust_elf_header): Declare.
3044 * target.cc (Sized_target::do_adjust_elf_header): New function.
3045 (class Sized_target): Instantiate all versions.
3046 * freebsd.h (class Target_freebsd): Remove.
3047 (Target_selector_freebsd::do_recognize): Call set_osabi on
3048 Target.
3049 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3050 (Target_selector_freebsd::set_osabi): Remove.
3051 * i386.cc (class Target_i386): Inherit from Sized_target rather
3052 than Target_freebsd.
3053 * x86_64.cc (class Target_x86_64): Likewise.
3054
b3ce541e
ILT
30552011-06-28 Ian Lance Taylor <iant@google.com>
3056
3057 * target.h (Target::can_check_for_function_pointers): Rewrite.
3058 Make non-virtual.
3059 (Target::can_icf_inline_merge_sections): Likewise.
3060 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3061 (Target::Target_info): Add can_icf_inline_merge_sections field.
3062 (Target::do_can_check_for_function_pointers): New virtual
3063 function.
3064 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3065 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3066 from can_check_for_function_pointers, move in file.
3067 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3068 section_may_have_icf_unsafe_poineters, move in file.
3069 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3070 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3071 Rename from can_check_for_function_pointers, move in file.
3072 (Target_i386::can_icf_inline_merge_sections): Remove.
3073 (Target_i386::i386_info): Initialize
3074 can_icf_inline_merge_sections.
3075 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3076 Initialize can_icf_inline_merge_sections.
3077 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3078 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3079 Rename from can_check_for_function_pointers, move in file.
3080 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3081 (Target_x86_64::x86_64_info): Initialize
3082 can_icf_inline_merge_sections.
3083 * testsuite/testfile.cc (Target_test::test_target_info):
3084 Likewise.
3085 * icf.cc (get_section_contents): Correct formatting.
3086
6d1c4efb
ILT
30872011-06-27 Ian Lance Taylor <iant@google.com>
3088
3089 * symtab.cc (Symbol::versioned_name): New function.
3090 (Symbol_table::add_to_final_symtab): Use versioned_name when
3091 appropriate.
3092 (Symbol_table::sized_write_symbol): Likewise.
3093 * symtab.h (class Symbol): Declare versioned_name.
3094 * stringpool.h (class Stringpool_template): Add variant of add
3095 which takes a std::basic_string.
3096 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3097 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3098 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3099 (ver_test_12.o): New target.
3100 * testsuite/Makefile.in: Rebuild.
3101
57eb9b50
DK
31022011-06-27 Doug Kwan <dougkwan@google.com>
3103
3104 * arm.cc (Arm_relocate_functions::thm_jump8,
3105 Arm_relocate_functions::thm_jump11): Use a wider signed
3106 type to compute offset.
3107 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3108 arm_thm_jump8.
3109 * testsuite/Makefile.in: Regenerate.
3110 * testsuite/arm_branch_in_range.sh: Check test results of
3111 arm_thm_jump11 and arm_thm_jump8.
3112 * testsuite/arm_thm_jump11.s: New test source file.
3113 * testsuite/arm_thm_jump11.t: New linker script.
3114 * testsuite/arm_thm_jump8.s: New test source file.
3115 * testsuite/arm_thm_jump8.t: New linker script.
3116
487b39df
ILT
31172011-06-24 Ian Lance Taylor <iant@google.com>
3118
3119 * layout.cc: Include "object.h".
3120 (ctors_sections_in_init_array): New static variable.
3121 (Layout::is_ctors_in_init_array): New function.
3122 (Layout::layout): Add entry to ctors_sections_in_init_array if
3123 appropriate.
3124 * layout.h (class Layout): Declare is_ctors_in_init_array.
3125 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3126 is_ctors_reverse_view is set.
3127 (Sized_relobj_file::write_sections): Add layout parameter. Change
3128 all callers. Set is_ctors_reverse_view field of View_size.
3129 (Sized_relobj_file::reverse_words): New function.
3130 * object.h (Sized_relobj_file::View_size): Add
3131 is_ctors_reverse_view field.
3132 (class Sized_relobj_file): Update declarations.
3133 * testsuite/initpri3.c: New test.
3134 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3135 initpri3b.
3136 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3137 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3138 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3139 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3140 * testsuite/Makefile.in: Rebuild.
3141
472076e4
CC
31422011-06-24 Cary Coutant <ccoutant@google.com>
3143
3144 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3145 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3146 (debug_msg_cdebug.err): New targets.
3147 * testsuite/Makefile.in: Regenerate.
3148 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3149 Fix checks for link with shared library.
3150
a60af0db
DK
31512011-06-24 Doug Kwan <dougkwan@google.com>
3152
3153 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3154 skip empty text sections.
3155 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3156
5393d741
ILT
31572011-06-22 Ian Lance Taylor <iant@google.com>
3158
3159 PR gold/12910
3160 * options.h (class General_options): Add --ctors-in-init-array.
3161 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3162 friends as SHT_PROGBITS for merging sections.
3163 (Layout::layout): Remove special handling of .init_array and
3164 friends. Don't sort if doing relocatable link. Sort for .ctors
3165 and .dtors if ctors_in_init_array.
3166 (Layout::make_output_section): Force correct section types for
3167 .init_array and friends. Don't sort if doing relocatable link,
3168 Don't sort .ctors and .dtors if ctors_in_init_array.
3169 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3170 (Layout::output_section_name): Add relobj parameter. Change all
3171 callers. Handle .ctors. and .dtors. in code rather than table.
3172 Handle .ctors and .dtors if ctors_in_init_array.
3173 (Layout::match_file_name): New function, moved from output.cc.
3174 * layout.h (class Layout): Update declarations.
3175 * output.cc: Include "layout.h".
3176 (Input_section_sort_entry::get_priority): New function.
3177 (Input_section_sort_entry::match_file_name): Just call
3178 Layout::match_file_name.
3179 (Output_section::Input_section_sort_init_fini_compare::operator()):
3180 Handle .ctors and .dtors. Sort by explicit priority rather than
3181 by name.
3182 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3183 * testsuite/initpri2.c: New test.
3184 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3185 (check_PROGRAMS): Add initpri2.
3186 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3187 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3188 * configure, testsuite/Makefile.in: Rebuild.
3189
e1f74f98
ILT
31902011-06-19 Ian Lance Taylor <iant@google.com>
3191
3192 PR gold/12880
3193 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3194 .interp section to a PT_INTERP segment even if we have seen a
3195 --dynamic-linker option. Don't do it if we have seen a PHDRS
3196 clause in a linker script.
3197 (Layout::finalize): Don't create a .interp section if we've
3198 already create a PT_INTERP segment.
3199 (Layout::create_interp): Always call choose_output_section (revert
3200 patch of 2011-06-17). Don't create PT_INTERP segment.
3201 * script-sections.cc
3202 (Script_sections::create_note_and_tls_segments): Add a .interp
3203 section to a PT_INTERP segment even if we have seen a
3204 --dynamic-linker option.
3205
766f91bb
ILT
32062011-06-18 Ian Lance Taylor <iant@google.com>
3207
3208 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3209 merely because a non-PT_LOAD segment has a dynamic reloc.
3210
0d212c3a
ILT
32112011-06-18 Ian Lance Taylor <iant@google.com>
3212
3213 * layout.cc (Layout::finish_dynamic_section): Don't create
3214 DT_FLAGS entry if not needed.
3215
911a5072
ILT
32162011-06-18 Ian Lance Taylor <iant@google.com>
3217
3218 PR gold/12745
3219 * layout.cc (Layout::layout_eh_frame): Correct handling of
3220 writable .eh_frame section.
3221
534b4e5f
ILT
32222011-06-17 Ian Lance Taylor <iant@google.com>
3223
3224 PR gold/12893
3225 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3226 symbol is redefined with the exact same object and value.
3227
10b4f102
ILT
32282011-06-17 Ian Lance Taylor <iant@google.com>
3229
3230 PR gold/12880
3231 * layout.h (class Layout): Add interp_segment_ field.
3232 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3233 (Layout::attach_allocated_section_to_segment): If making shared
3234 library, put .interp section in PT_INTERP segment.
3235 (Layout::finalize): Also call create_interp if -dynamic-linker
3236 option was used.
3237 (Layout::create_interp): Assert that there is no PT_INTERP
3238 segment. If not using a SECTIONS clause, use make_output_section.
3239 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3240 * script-sections.cc
3241 (Script_sections::create_note_and_tls_segments): If making shared
3242 library, put .interp section in PT_INTERP segment.
3243
a29b0dad
ILT
32442011-06-17 Ian Lance Taylor <iant@google.com>
3245
e588ea8d
ILT
3246 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3247 when making a shared library.
3248
32492011-06-17 Ian Lance Taylor <iant@google.com>
3250
3251 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3252 parameter. Change all callers. Don't issue warning about PC32
3253 against locally defined symbol.
a29b0dad 3254
9d3b0698
ILT
32552011-06-16 Ian Lance Taylor <iant@google.com>
3256
3257 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3258 occurs in same object.
3259
85b0f90c
AM
32602011-06-14 Alan Modra <amodra@gmail.com>
3261
3262 * po/POTFILES.in: Regenerate.
3263
a94907d9
ILT
32642011-06-09 Ian Lance Taylor <iant@google.com>
3265
3266 * script-sections.cc
3267 (Orphan_output_section::set_section_addresses): For a relocatable
3268 link set address to 0.
3269
4fb3a1c3
CC
32702011-06-09 Cary Coutant <ccoutant@google.com>
3271
3272 PR gold/12804
3273 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3274 used with --compress-debug-sections.
3275 * gold/object.cc (Sized_relobj_file::do_layout): Report
3276 uncompressed size of compressed input sections.
3277
61220854
CC
32782011-06-08 Cary Coutant <ccoutant@google.com>
3279
3280 PR gold/12804
3281 * testsuite/two_file_test_2_v1.cc: Change initialization of
3282 v2 to keep it in .data.
3283
e6455dfb
CC
32842011-06-07 Cary Coutant <ccoutant@google.com>
3285
3286 * common.cc (Symbol_table::do_allocate_commons_list): Call
3287 gold_fallback.
3288 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3289 (Errors::fallback): New function.
3290 (gold_fallback): New function.
3291 * errors.h (Errors::fallback): New function.
3292 * gold.cc (gold_exit): Change status parameter to enum; adjust
3293 all callers.
3294 (queue_initial_tasks): Call gold_fallback.
3295 * gold.h: Include cstdlib.
3296 (Exit_status): New enum type.
3297 (gold_exit): Change status parameter to enum.
3298 (gold_fallback): New function.
3299 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3300 (Layout::create_symtab_sections): Likewise.
3301 (Layout::create_shdrs): Likewise.
3302 * main.cc (main): Adjust call to gold_exit.
3303 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3304 (Output_data_got::add_got_entry_pair): Likewise.
3305 (Output_section::add_input_section): Likewise.
3306 (Output_section::add_output_section_data): Likewise.
3307 (Output_segment::set_section_list_addresses): Likewise.
3308 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3309
fb0e076f
CC
33102011-06-07 Cary Coutant <ccoutant@google.com>
3311
3312 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3313 for incremental links.
3314 * output.cc (Output_segment::set_section_list_addresses): Remove
3315 FIXME and test for TLS or BSS.
3316
a5ee4d5d
CC
33172011-06-07 Cary Coutant <ccoutant@google.com>
3318
3319 * testsuite/Makefile.am: Add incremental_copy_test,
3320 incremental_common_test_1.
3321 * testsuite/Makefile.in: Regenerate.
3322 * testsuite/common_test_1_v1.c: New source file.
3323 * testsuite/common_test_1_v2.c: New source file.
3324 * testsuite/copy_test_v1.cc: New source file.
3325
5146f448
CC
33262011-06-07 Cary Coutant <ccoutant@google.com>
3327
3328 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3329 update, allocate common from bss section's free list.
3330 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3331 linker-defined symbols.
3332 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3333 Skip GOT and PLT entries that are no longer referenced.
3334 (Output_section_incremental_inputs::write_info_blocks): Mark
3335 linker-defined symbols.
3336 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3337 * output.cc (Output_section::allocate): New function.
3338 * output.h (Output_section::allocate): New function.
3339 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3340 linker-defined symbols.
3341 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3342 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3343 (Symbol::init_base_output_data): Likewise.
3344 (Symbol::init_base_output_segment): Likewise.
3345 (Symbol::init_base_constant): Likewise.
3346 (Sized_symbol::init_output_data): Likewise.
3347 (Sized_symbol::init_output_segment): Likewise.
3348 (Sized_symbol::init_constant): Likewise.
3349 (Symbol_table::do_define_in_output_data): Likewise.
3350 (Symbol_table::do_define_in_output_segment): Likewise.
3351 (Symbol_table::do_define_as_constant): Likewise.
3352 * symtab.h (Symbol::is_predefined): New function.
3353 (Symbol::init_base_output_data): Add is_predefined parameter.
3354 (Symbol::init_base_output_segment): Likewise.
3355 (Symbol::init_base_constant): Likewise.
3356 (Symbol::is_predefined_): New data member.
3357 (Sized_symbol::init_output_data): Add is_predefined parameter.
3358 (Sized_symbol::init_output_segment): Likewise.
3359 (Sized_symbol::init_constant): Likewise.
3360 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3361
26d3c67d
CC
33622011-06-07 Cary Coutant <ccoutant@google.com>
3363
3364 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3365 instead of emit_copy_reloc.
3366 (Copy_relocs::emit_copy_reloc): Refactor.
3367 (Copy_relocs::make_copy_reloc): New function.
3368 (Copy_relocs::add_copy_reloc): Remove.
3369 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3370 section.
3371 (Copy_relocs::make_copy_reloc): New function.
3372 (Copy_relocs::add_copy_reloc): Remove.
3373 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3374 unchanged input files.
3375 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3376 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3377 Reserve BSS space for COPY relocations.
3378 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3379 (Output_section_incremental_inputs::write_info_blocks): Record
3380 whether a symbol is copied from a shared object.
3381 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3382 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3383 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3384 (Incremental_input_entry_reader::get_output_symbol_index): Add
3385 is_copy parameter.
3386 (Incremental_binary::emit_copy_relocs): New function.
3387 (Incremental_binary::do_emit_copy_relocs): New function.
3388 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3389 new data member.
3390 (Sized_incremental_binary::add_copy_reloc): New function.
3391 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3392 (Sized_incremental_binary::Copy_reloc): New struct.
3393 (Sized_incremental_binary::Copy_relocs): New typedef.
3394 (Sized_incremental_binary::copy_relocs_): New data member.
3395 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3396 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3397 * target.h (Sized_target::emit_copy_reloc): New function.
3398 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3399
7cdb37d9
CC
34002011-06-02 Cary Coutant <ccoutant@google.com>
3401
3402 PR gold/12163
3403 * gold/archive.cc (Archive::Archive): Initialize new data member.
3404 (Archive::include_all_members): Return if archive has already been
3405 included.
3406 * gold/archive.h (Archive::include_all_members_): New data member.
3407
cc643b88
NC
34082011-06-02 Nick Clifton <nickc@redhat.com>
3409
3410 * dynobj.h: Fix spelling mistake in comment.
3411 * output.cc: Likewise.
3412
f62a3ca7 34132011-05-31 Doug Kwan <dougkwan@google.com>
2e702c99 3414 Asier Llano
f62a3ca7
DK
3415
3416 PR gold/12826
cc643b88 3417 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
3418 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3419 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3420 redundant arm_exidx_test.so.
3421 * testsuite/Makefile.in: Regenerate.
3422 (check_SCRIPTS): Add pr12826.sh
3423 (check_DATA): Add pr12826.stdout
3424 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3425 * testsuite/pr12826.sh: New file.
3426 * testsuite/pr12826_1.s: Ditto.
3427 * testsuite/pr12826_1.s: Ditto.
3428
8dbe1edc
ILT
34292011-05-30 Ian Lance Taylor <iant@google.com>
3430
3431 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3432 sections.
3433
c49875be
ILT
34342011-05-29 Ian Lance Taylor <iant@google.com>
3435
3436 PR gold/12804
3437 * testsuite/Makefile.am: Use different file name for two_file_test
3438 temporary file for each incremental test.
3439 * testsuite/Makefile.in: Rebuild.
3440
69d53f7a
ILT
34412011-05-29 Ian Lance Taylor <iant@google.com>
3442
3443 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3444 binary input file is empty.
3445
41d0ab5f
ILT
34462011-05-27 Ian Lance Taylor <iant@google.com>
3447
3448 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3449 (ver_test_9.so): Likewise.
3450 * testsuite/Makefile.in: Rebuild.
3451
89d8a36b
CC
34522011-05-26 Cary Coutant <ccoutant@google.com>
3453
3454 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3455 * incremental.cc (Incremental_inputs::report_input_section): Fix
3456 comment, indentation.
3457 (Incremental_inputs::report_comdat_group): New function.
3458 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3459 of data for incremental input file entry.
3460 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3461 group count, COMDAT group signatures.
3462 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3463 an unchanged input file.
3464 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3465 Initialize new data member.
3466 (Incremental_object_entry::add_comdat_group): New function.
3467 (Incremental_object_entry::get_comdat_group_count): New function.
3468 (Incremental_object_entry::get_comdat_signature_key): New function.
3469 (Incremental_object_entry::groups_): New data member.
3470 (Incremental_inputs::report_comdat_group): New function.
3471 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3472 data for incremental input file entry.
3473 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3474 (Incremental_input_entry_reader::get_input_section): Adjust size of
3475 data for incremental input file entry.
3476 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3477 (Incremental_input_entry_reader::get_comdat_group_signature): New
3478 function.
3479 * object.cc (Sized_relobj::include_section_group): Report kept
3480 COMDAT groups for incremental links.
3481
1706a06f
ILT
34822011-05-24 David Meyer <pdox@google.com>
3483
3484 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3485 with name parameter. Add found_name parameter.
3486 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3487 * dirsearch.h (class Dirsearch): Update declaration.
3488
a10ae760
ILT
34892011-05-24 Ian Lance Taylor <iant@google.com>
3490
3491 * archive.cc (Library_base::should_include_member): Pull in object
3492 from archive if it defines the entry symbol.
3493 * parameters.cc (Parameters::entry): New function.
3494 * parameters.h (class Parameters): Declare entry.
3495 * output.h (class Output_file_header): Remove entry_ field.
3496 * output.cc (Output_file_header::Output_file_header): Remove entry
3497 parameter. Change all callers.
3498 (Output_file_header::entry): Use parameters->entry.
3499 * gold.cc (queue_middle_tasks): Likewise.
3500 * plugin.cc (Plugin_hook::run): Likewise.
3501
aa92d6ed
CC
35022011-05-24 Cary Coutant <ccoutant@google.com>
3503
3504 * gold.cc (queue_initial_tasks): Pass incremental base filename
3505 to Output_file::open_base_file; don't print error message.
3506 * incremental-dump.cc (main): Adjust call to
3507 Output_file::open_for_modification.
3508 * incremental-dump.cc (main): Likewise.
3509 * incremental.cc (Incremental_inputs::report_command_line):
3510 Ignore --incremental-base option when comparing command lines.
3511 Ignore parameter when given as separate argument.
3512 * options.h (class General_options): Add --incremental-base.
3513 * output.cc (Output_file::Output_file):
3514 (Output_file::open_base_file): Add base_name and writable parameters;
3515 read base file into new file; print error message here.
3516 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3517 callers.
3518 * output.h (Output_file::open_for_modification): Rename to...
3519 (Output_file::open_base_file): ...this; add base_name and
3520 writable parameters; adjust all callers.
3521 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3522 callers.
3523 * testsuite/Makefile.am (incremental_test_4): Test
3524 --incremental-base.
3525 * testsuite/Makefile.in: Regenerate.
3526
2eedd706
CC
35272011-05-24 Cary Coutant <ccoutant@google.com>
3528
3529 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3530 incremental_test_4.
3531 * testsuite/Makefile.in: Regenerate.
3532 * testsuite/two_file_test_1_v1.cc: New test source file.
3533 * testsuite/two_file_test_1b_v1.cc: New test source file.
3534 * testsuite/two_file_test_2_v1.cc: New test source file.
3535
0f1c85a6
CC
35362011-05-24 Cary Coutant <ccoutant@google.com>
3537
3538 * dynobj.h (Dynobj::do_dynobj): New function.
3539 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3540 flag and soname for shared objects.
3541 * incremental.cc (Incremental_inputs::report_object): Make
3542 either Incremental_object_entry or Incremental_dynobj_entry; add
3543 soname to string table.
3544 (Incremental_inputs::report_input_section): Add assertion.
3545 (Output_section_incremental_inputs::set_final_data_size): Adjust
3546 type of input file entry for shared libraries; adjust size of
3547 shared library info entry.
3548 (Output_section_incremental_inputs::write_input_files): Write
3549 as_needed flag for shared libraries.
3550 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3551 of input file entry for shared libraries; write soname.
3552 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3553 soname from incremental info.
3554 * incremental.h (enum Incremental_input_flags): Add
3555 INCREMENTAL_INPUT_AS_NEEDED.
3556 (Incremental_input_entry::Incremental_input_entry): Initialize new
3557 data member.
3558 (Incremental_input_entry::set_as_needed): New function.
3559 (Incremental_input_entry::as_needed): New function.
3560 (Incremental_input_entry::do_dynobj_entry): New function.
3561 (Incremental_input_entry::as_needed_): New data member.
3562 (Incremental_object_entry::Incremental_object_entry): Don't check
3563 for shared library.
3564 (Incremental_object_entry::do_type): Likewise.
3565 (class Incremental_dynobj_entry): New class.
3566 (Incremental_input_entry_reader::as_needed): New function.
3567 (Incremental_input_entry_reader::get_soname): New function.
3568 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3569 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3570 size of shared library info entry.
58797674 3571 * layout.cc (Layout::finish_dynamic_section): Don't test for
0f1c85a6
CC
3572 incremental link when adding DT_NEEDED entries.
3573 * object.h (Object::Object): Initialize new data member.
3574 (Object::dynobj): New function.
3575 (Object::set_as_needed): New function.
3576 (Object::as_needed): New function.
3577 (Object::do_dynobj): New function.
3578 (Object::as_needed_): New data member.
3579
6fa2a40b
CC
35802011-05-24 Cary Coutant <ccoutant@google.com>
3581
3582 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3583 info; adjust display of GOT entries.
3584 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3585 vector of input objects; remove file_status_.
3586 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3587 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3588 got_plt reader; call target hooks to reserve GOT entries.
3589 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3590 of input file info header and GOT info entry.
3591 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3592 relocation info.
3593 (Got_plt_view_info::got_descriptor): Remove.
3594 (Got_plt_view_info::sym_index): New data member.
3595 (Got_plt_view_info::input_index): New data member.
3596 (Local_got_offset_visitor::visit): Write input file index.
3597 (Global_got_offset_visitor::visit): Write 0 for input file index.
3598 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3599 with sym_index and input_index.
3600 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3601 incremental info GOT entry; replace got_descriptor with input_index.
3602 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3603 map from input file index to object.
3604 (Sized_relobj_incr::do_layout): Replace direct data member reference
3605 with accessor function.
3606 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3607 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3608 Adjust size of input file info header.
3609 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3610 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3611 (Incremental_input_entry_reader::get_input_section): Adjust size of
3612 input file info header.
3613 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3614 of incremental info GOT entry.
3615 (Incremental_got_plt_reader::get_got_desc): Remove.
3616 (Incremental_got_plt_reader::get_got_symndx): New function.
3617 (Incremental_got_plt_reader::get_got_input_index): New function.
3618 (Sized_incremental_binary::Sized_incremental_binary): Remove
3619 file_status_; add input_objects_.
3620 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3621 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3622 (Sized_incremental_binary::file_is_unchanged): Remove.
3623 (Sized_incremental_binary::set_input_object): New function.
3624 (Sized_incremental_binary::input_object): New function.
3625 (Sized_incremental_binary::file_status_): Remove.
3626 (Sized_incremental_binary::input_objects_): New data member.
3627 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3628 references.
3629 (Sized_relobj_incr::invalid_address): Move to base class.
3630 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3631 class.
3632 (Sized_relobj_incr::do_output_section_offset): Likewise.
3633 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3634 (Sized_relobj_incr::section_offsets_): Likewise.
3635 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3636 function.
3637 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3638 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3639 with accessor function.
3640 (Sized_relobj_file::do_layout): Likewise.
3641 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3642 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3643 (Sized_relobj_file::compute_final_local_value): Replace refs to
3644 section_offsets_ with accessor function.
3645 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3646 * object.h (Relobj::Relobj): Initialize new data members.
3647 (Relobj::add_dyn_reloc): New function.
3648 (Relobj::first_dyn_reloc): New function.
3649 (Relobj::dyn_reloc_count): New function.
3650 (Relobj::first_dyn_reloc_): New data member.
3651 (Relobj::dyn_reloc_count_): New data member.
3652 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3653 references.
3654 (Sized_relobj::Address): New typedef.
3655 (Sized_relobj::invalid_address): Move here from child class.
3656 (Sized_relobj::Sized_relobj): Initialize new data members.
3657 (Sized_relobj::sized_relobj): New function.
3658 (Sized_relobj::is_output_section_offset_invalid): Move here from
3659 child class.
3660 (Sized_relobj::get_output_section_offset): Likewise.
3661 (Sized_relobj::local_has_got_offset): Likewise.
3662 (Sized_relobj::local_got_offset): Likewise.
3663 (Sized_relobj::set_local_got_offset): Likewise.
3664 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3665 (Sized_relobj::clear_got_offsets): New function.
3666 (Sized_relobj::section_offsets): Move here from child class.
3667 (Sized_relobj::do_output_section_offset): Likewise.
3668 (Sized_relobj::do_set_section_offset): Likewise.
3669 (Sized_relobj::Local_got_offsets): Likewise.
3670 (Sized_relobj::local_got_offsets_): Likewise.
3671 (Sized_relobj::section_offsets_): Likewise.
3672 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3673 references.
3674 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3675 class.
3676 (Sized_relobj_file::sized_relobj): New function
3677 (Sized_relobj_file::local_has_got_offset): Move to base class.
3678 (Sized_relobj_file::local_got_offset): Likewise.
3679 (Sized_relobj_file::set_local_got_offset): Likewise.
3680 (Sized_relobj_file::get_output_section_offset): Likewise.
3681 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3682 (Sized_relobj_file::do_output_section_offset): Likewise.
3683 (Sized_relobj_file::do_set_section_offset): Likewise.
3684 (Sized_relobj_file::Local_got_offsets): Likewise.
3685 (Sized_relobj_file::local_got_offsets_): Likewise.
3686 (Sized_relobj_file::section_offsets_): Likewise.
3687 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3688 (all constructors).
3689 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3690 (Output_reloc::get_symbol_index): Likewise.
3691 (Output_reloc::local_section_offset): Likewise.
3692 (Output_reloc::get_address): Likewise.
3693 (Output_reloc::symbol_value): Likewise.
3694 (Output_data_got::reserve_slot): Move to class definition.
3695 (Output_data_got::reserve_local): New function.
3696 (Output_data_got::reserve_slot_for_global): Remove.
3697 (Output_data_got::reserve_global): New function.
3698 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3699 (all constructors, two instantiations).
3700 (Output_reloc::get_relobj): New function (two instantiations).
3701 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3702 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3703 (Output_data_reloc::add_global): Adjust type of relobj.
3704 (Output_data_reloc::add_global_relative): Likewise.
3705 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3706 (Output_data_reloc::add_local): Likewise.
3707 (Output_data_reloc::add_local_relative): Likewise.
3708 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3709 (Output_data_reloc::add_local_section): Likewise.
3710 (Output_data_reloc::add_output_section): Likewise.
3711 (Output_data_reloc::add_absolute): Likewise.
3712 (Output_data_reloc::add_target_specific): Likewise.
3713 (Output_data_got::reserve_slot): Move definition here.
3714 (Output_data_got::reserve_local): New function.
3715 (Output_data_got::reserve_global): New function.
3716 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3717 section_offsets_ with accessor function.
3718 (Sized_relobj_file::write_sections): Likewise.
3719 (Sized_relobj_file::do_relocate_sections): Likewise.
3720 * target.h (Sized_target::reserve_local_got_entry): New function.
3721 (Sized_target::reserve_global_got_entry): New function.
3722 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3723 (Target_x86_64::reserve_global_got_entry): New function.
3724 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3725
4829d394
CC
37262011-05-23 Cary Coutant <ccoutant@google.com>
3727
3728 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3729 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3730 bit when checking got_type.
3731 * incremental.cc (Sized_incremental_binary::setup_readers):
3732 Store symbol table and string table locations; initialize bit vector
3733 of file status flags.
3734 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3735 unchanged files.
3736 (Sized_incremental_binary::do_process_got_plt): New function.
3737 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3738 (Output_section_incremental_inputs::set_final_data_size): Record
3739 file index for each input file.
3740 (Output_section_incremental_inputs::write_got_plt): Store file index
3741 instead of input entry offset for each GOT entry.
3742 * incremental.h
3743 (Incremental_input_entry::Incremental_input_entry): Initialize new
3744 data member.
3745 (Incremental_input_entry::set_offset): Store file index.
3746 (Incremental_input_entry::get_file_index): New function.
3747 (Incremental_input_entry::file_index_): New data member.
3748 (Incremental_binary::process_got_plt): New function.
3749 (Incremental_binary::do_process_got_plt): New function.
3750 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3751 data members.
3752 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3753 (Sized_incremental_binary::set_file_is_unchanged): New function.
3754 (Sized_incremental_binary::file_is_unchanged): New function.
3755 (Sized_incremental_binary::do_process_got_plt): New function.
3756 (Sized_incremental_binary::file_status_): New data member.
3757 (Sized_incremental_binary::main_symtab_loc_): New data member.
3758 (Sized_incremental_binary::main_strtab_loc_): New data member.
3759 * output.cc (Output_data_got::Got_entry::write): Add case
3760 RESERVED_CODE.
3761 (Output_data_got::add_global): Call add_got_entry.
3762 (Output_data_got::add_global_plt): Likewise.
3763 (Output_data_got::add_global_with_rel): Likewise.
3764 (Output_data_got::add_global_with_rela): Likewise.
3765 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3766 (Output_data_got::add_global_pair_with_rela): Likewise.
3767 (Output_data_got::add_local): Call add_got_entry.
3768 (Output_data_got::add_local_plt): Likewise.
3769 (Output_data_got::add_local_with_rel): Likewise.
3770 (Output_data_got::add_local_with_rela): Likewise.
3771 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3772 (Output_data_got::add_local_pair_with_rela): Likewise.
3773 (Output_data_got::reserve_slot): New function.
3774 (Output_data_got::reserve_slot_for_global): New function.
3775 (Output_data_got::add_got_entry): New function.
3776 (Output_data_got::add_got_entry_pair): New function.
3777 (Output_section::add_output_section_data): Edit FIXME.
3778 * output.h
3779 (Output_section_data_build::Output_section_data_build): New
3780 constructor with size parameter.
3781 (Output_data_space::Output_data_space): Likewise.
3782 (Output_data_got::Output_data_got): Initialize new data member; new
3783 constructor with size parameter.
3784 (Output_data_got::add_constant): Call add_got_entry.
3785 (Output_data_got::reserve_slot): New function.
3786 (Output_data_got::reserve_slot_for_global): New function.
3787 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3788 (Output_data_got::add_got_entry): New function.
3789 (Output_data_got::add_got_entry_pair): New function.
3790 (Output_data_got::free_list_): New data member.
3791 * target.h (Sized_target::init_got_plt_for_update): New function.
3792 (Sized_target::register_global_plt_entry): New function.
3793 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3794 Initialize new data member; call init; add constructor with PLT count.
3795 (Output_data_plt_x86_64::init): New function.
3796 (Output_data_plt_x86_64::add_relocation): New function.
3797 (Output_data_plt_x86_64::reserve_slot): New function.
3798 (Output_data_plt_x86_64::free_list_): New data member.
3799 (Target_x86_64::init_got_plt_for_update): New function.
3800 (Target_x86_64::register_global_plt_entry): New function.
3801 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3802 incremental updates.
3803 (Output_data_plt_x86_64::add_relocation): New function.
3804 * testsuite/object_unittest.cc (Object_test): Set default options.
3805
ec69d6da
ILT
38062011-05-16 Ian Lance Taylor <iant@google.com>
3807
3808 * options.h (class General_options): Make -i a synonym for -r.
3809
732e31de
ILT
38102011-05-16 Ian Lance Taylor <iant@google.com>
3811
3812 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3813
403676b5
CC
38142011-05-10 Cary Coutant <ccoutant@google.com>
3815
3816 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3817 strip_all (-s).
3818
5b7b7d6e
ILT
38192011-05-06 Ian Lance Taylor <iant@google.com>
3820
3821 * layout.cc (Layout::layout): If the output section flags change,
3822 update the ordering.
3823
f0f9babf
CC
38242011-04-25 Cary Coutant <ccoutant@google.com>
3825
3826 * incremental-dump.cc (dump_incremental_inputs): Print local
3827 symbol info for each input file.
3828 * incremental.cc
3829 (Output_section_incremental_inputs::set_final_data_size): Add local
3830 symbol info to input file entries in incremental info.
3831 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3832 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3833 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3834 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3835 implementation.
3836 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3837 (Sized_incr_relobj::do_relocate): Write the local symbols.
3838 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3839 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3840 Adjust size of input file header.
3841 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3842 (Incremental_inputs_reader::get_local_symbol_count): New function.
3843 (Incremental_inputs_reader::get_input_section): Adjust size of input
3844 file header.
3845 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3846 (Sized_incr_relobj::This): New typedef.
3847 (Sized_incr_relobj::sym_size): New const data member.
3848 (Sized_incr_relobj::Local_symbol): New struct.
3849 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3850 (Sized_incr_relobj::do_local_symbol_offset): New function.
3851 (Sized_incr_relobj::local_symbol_count_): New data member.
3852 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3853 (Sized_incr_relobj::local_symbol_index_): New data member.
3854 (Sized_incr_relobj::local_symbol_offset_): New data member.
3855 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3856 (Sized_incr_relobj::local_symbols_): New data member.
3857 * object.h (Relobj::output_local_symbol_count): New function.
3858 (Relobj::local_symbol_offset): New function.
3859 (Relobj::do_output_local_symbol_count): New function.
3860 (Relobj::do_local_symbol_offset): New function.
3861 (Sized_relobj::do_output_local_symbol_count): New function.
3862 (Sized_relobj::do_local_symbol_offset): New function.
3863
d0a9ace3
ILT
38642011-04-22 Vladimir Simonov <sv@sw.ru>
3865
3866 * descriptors.cc (set_close_on_exec): New function.
3867 (Descriptors::open): Use set_close_on_exec.
3868 * output.cc (S_ISLNK): Define if not defined.
3869
94a3fc8b
CC
38702011-04-22 Cary Coutant <ccoutant@google.com>
3871
3872 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3873 global symbol map.
3874 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3875 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3876 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3877 relocations.
3878 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3879 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3880 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3881 * incremental.h
3882 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3883 function.
3884 (Incremental_binary::apply_incremental_relocs): New function.
3885 (Incremental_binary::do_apply_incremental_relocs): New function.
3886 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3887 data member.
3888 (Sized_incremental_binary::add_global_symbol): New function.
3889 (Sized_incremental_binary::global_symbol): New function.
3890 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3891 (Sized_incremental_binary::symbol_map_): New data member.
3892 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3893 * target.h (Sized_target::apply_relocation): New function.
3894 * target-reloc.h (apply_relocation): New function.
3895 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3896
c87e4302
DK
38972011-04-22 Doug Kwan <dougkwan@google.com>
3898
3899 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3900 flag of a SHT_ARM_EXIDX section.
2e702c99 3901 * testsuite/Makefile.am (arm_exidx_test): New test rules.
c87e4302
DK
3902 * testsuite/Makefile.in: Regenerate.
3903 * testsuite/arm_exidx_test.s: New file.
3904 * testsuite/arm_exidx_test.sh: Same.
3905
e7782cf6
CC
39062011-04-20 Cary Coutant <ccoutant@google.com>
3907
3908 PR gold/12689
3909 * archive.h (Incremental_archive_entry::Archive_member):
3910 Initialize arg_serial_ (second constructor).
3911
308ecdc7
ILT
39122011-04-17 Ian Lance Taylor <iant@google.com>
3913
3914 * object.cc (Relocate_info::location): Simplify location string.
3915 * errors.cc (Errors::error_at_location): Don't print program
3916 name.
3917 (Errors::warning_at_location): Likewise.
3918 (Errors::undefined_symbol): Likewise.
3919 * testsuite/debug_msg.sh: Update accordingly.
3920
bec5b579
CC
39212011-04-14 Cary Coutant <ccoutant@google.com>
3922
3923 * gold/layout.cc (Layout::symtab_section_offset): New function.
3924 * gold/layout.h (Layout::symtab_section_offset): New function.
3925 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3926
88597d34
ILT
39272011-04-12 Ian Lance Taylor <iant@google.com>
3928
3929 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3930 with MREMAP_MAYMOVE.
3931 * output.h (class Output_file): Add map_is_allocated_ field.
3932 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3933 not available, provide stubs. If mremap is not available, #define
3934 it to gold_mremap.
3935 (MREMAP_MAYMOVE): Define if not defined.
3936 (Output_file::Output_file): Initialize map_is_allocated_.
3937 (Output_file::resize): Check map_is_allocated_.
3938 (Output_file::map_anonymous): If mmap fails, use malloc.
3939 (Output_file::unmap): Don't do anything for an anonymous map.
3940 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3941 is not available, provide stubs.
3942 (File_read::View::~View): Use free rather than delete[].
3943 (File_read::make_view): Use malloc rather than new[]. If mmap
3944 fails, use malloc.
3945 (File_read::find_or_make_view): Use malloc rather than new[].
3946 * gold.h: Remove HAVE_REMAP code.
3947 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3948 exists. Rename mremap to gold_mremap. If mmap is not available
3949 don't do anything.
3950 * configure, config.in: Rebuild.
3951
11e361bc
ILT
39522011-04-11 Ian Lance Taylor <iant@google.com>
3953
3954 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3955 initialize local variable v.
3956
cdc29364
CC
39572011-04-11 Cary Coutant <ccoutant@google.com>
3958
3959 * archive.cc (Archive::include_member): Adjust call to
3960 report_object.
3961 (Add_archive_symbols::run): Track argument serial numbers.
3962 (Lib_group::include_member): Likewise.
3963 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3964 * archive.h (Incremental_archive_entry::Archive_member):
3965 Initialize arg_serial_.
3966 (Archive_member::arg_serial_): New data member.
3967 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3968 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3969 incremental link.
3970 (Sized_dynobj::do_for_all_local_got_entries): New function.
3971 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3972 function.
3973 * fileread.cc (get_mtime): New function.
3974 * fileread.h (get_mtime): New function.
3975 * gold.cc (queue_initial_tasks): Check for incremental update.
3976 (process_incremental_input): New function.
3977 (queue_middle_tasks): Don't force valid target for incremental
3978 update.
3979 * incremental-dump.cc (find_input_containing_global): Adjust
3980 size of symbol info entry.
3981 (dump_incremental_inputs): Dump argument serial number and
3982 in_system_directory flag; bias shndx by 1; print symbol names
3983 when dumping per-file symbol lists; use new symbol info readers.
3984 * incremental.cc
3985 (Output_section_incremental_inputs:update_data_size): New function.
3986 (Sized_incremental_binary::setup_readers): Setup input readers
3987 for each input file; build maps for files added from libraries
3988 and scripts.
3989 (Sized_incremental_binary::check_input_args): New function.
3990 (Sized_incremental_binary::do_check_inputs): Build map of argument
3991 serial numbers to input arguments.
3992 (Sized_incremental_binary::do_file_has_changed): Rename
3993 do_file_is_unchanged to this; compare file modification times.
3994 (Sized_incremental_binary::do_init_layout): New function.
3995 (Sized_incremental_binary::do_reserve_layout): New function.
3996 (Sized_incremental_binary::do_get_input_reader): Remove.
3997 (Sized_incremental_binary::get_symtab_view): New function.
3998 (Incremental_checker::can_incrementally_link_output_file): Remove.
3999 (Incremental_inputs::report_command_line): Exclude --debug options.
4000 (Incremental_inputs::report_archive_begin): Add parameter; track
4001 argument serial numbers; don't put input file entry for archive
4002 before archive members.
4003 (Incremental_inputs::report_archive_end): Put input file entry
4004 for archive after archive members.
4005 (Incremental_inputs::report_object): Add parameter; track argument
4006 serial numbers and in_system_directory flag.
4007 (Incremental_inputs::report_script): Add parameter; track argument
4008 serial numbers.
4009 (Output_section_incremental_inputs::set_final_data_size): Adjust
4010 size of symbol info entry; check for forwarding symbols.
4011 (Output_section_incremental_inputs::write_input_files): Write
4012 in_system_directory flag and argument serial number.
4013 (Output_section_incremental_inputs::write_info_blocks): Map section
4014 indices between incremental info and original input file; store
4015 input section index for each symbol.
4016 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4017 change operator() to visit().
4018 (class Global_got_offset_visitor): Likewise.
4019 (class Global_symbol_visitor_got_plt):
4020 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4021 classes.
4022 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4023 (Sized_incr_relobj::do_read_symbols): New function.
4024 (Sized_incr_relobj::do_layout): New function.
4025 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4026 (Sized_incr_relobj::do_add_symbols): New function.
4027 (Sized_incr_relobj::do_should_include_member): New function.
4028 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4029 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4030 (Sized_incr_relobj::do_section_size): New function.
4031 (Sized_incr_relobj::do_section_name): New function.
4032 (Sized_incr_relobj::do_section_contents): New function.
4033 (Sized_incr_relobj::do_section_flags): New function.
4034 (Sized_incr_relobj::do_section_entsize): New function.
4035 (Sized_incr_relobj::do_section_address): New function.
4036 (Sized_incr_relobj::do_section_type): New function.
4037 (Sized_incr_relobj::do_section_link): New function.
4038 (Sized_incr_relobj::do_section_info): New function.
4039 (Sized_incr_relobj::do_section_addralign): New function.
4040 (Sized_incr_relobj::do_initialize_xindex): New function.
4041 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4042 (Sized_incr_relobj::do_read_relocs): New function.
4043 (Sized_incr_relobj::do_gc_process_relocs): New function.
4044 (Sized_incr_relobj::do_scan_relocs): New function.
4045 (Sized_incr_relobj::do_count_local_symbols): New function.
4046 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4047 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4048 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4049 (Sized_incr_relobj::do_relocate): New function.
4050 (Sized_incr_relobj::do_set_section_offset): New function.
4051 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4052 (Sized_incr_dynobj::do_read_symbols): New function.
4053 (Sized_incr_dynobj::do_layout): New function.
4054 (Sized_incr_dynobj::do_add_symbols): New function.
4055 (Sized_incr_dynobj::do_should_include_member): New function.
4056 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4057 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4058 (Sized_incr_dynobj::do_section_size): New function.
4059 (Sized_incr_dynobj::do_section_name): New function.
4060 (Sized_incr_dynobj::do_section_contents): New function.
4061 (Sized_incr_dynobj::do_section_flags): New function.
4062 (Sized_incr_dynobj::do_section_entsize): New function.
4063 (Sized_incr_dynobj::do_section_address): New function.
4064 (Sized_incr_dynobj::do_section_type): New function.
4065 (Sized_incr_dynobj::do_section_link): New function.
4066 (Sized_incr_dynobj::do_section_info): New function.
4067 (Sized_incr_dynobj::do_section_addralign): New function.
4068 (Sized_incr_dynobj::do_initialize_xindex): New function.
4069 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4070 (make_sized_incremental_object): New function.
4071 (Incremental_library::copy_unused_symbols): New function.
4072 (Incremental_library::do_for_all_unused_symbols): New function.
4073 * incremental.h (enum Incremental_input_flags): New type.
4074 (class Incremental_checker): Remove.
4075 (Incremental_input_entry::Incremental_input_entry): Add argument
4076 serial number.
4077 (Incremental_input_entry::arg_serial): New function.
4078 (Incremental_input_entry::set_is_in_system_directory): New function.
4079 (Incremental_input_entry::is_in_system_directory): New function.
4080 (Incremental_input_entry::arg_serial_): New data member.
4081 (Incremental_input_entry::is_in_system_directory_): New data member.
4082 (class Script_info): Move here from script.h.
4083 (Script_info::Script_info): Add filename parameter.
4084 (Script_info::filename): New function.
4085 (Script_info::filename_): New data member.
4086 (Incremental_script_entry::Incremental_script_entry): Add argument
4087 serial number.
4088 (Incremental_object_entry::Incremental_object_entry): Likewise.
4089 (Incremental_object_entry::add_input_section): Build list of input
4090 sections with map to original shndx.
4091 (Incremental_object_entry::get_input_section_index): New function.
4092 (Incremental_object_entry::shndx_): New data member.
4093 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4094 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4095 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4096 serial number.
4097 (Incremental_inputs::report_archive_begin): Likewise.
4098 (Incremental_inputs::report_object): Likewise.
4099 (Incremental_inputs::report_script): Likewise.
4100 (class Incremental_global_symbol_reader): New class.
4101 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4102 and store flags and input file type.
4103 (Incremental_input_entry_reader::arg_serial): New function.
4104 (Incremental_input_entry_reader::type): Extract type from flags.
4105 (Incremental_input_entry_reader::is_in_system_directory): New function.
4106 (Incremental_input_entry_reader::get_input_section_count): Call
4107 accessor function for type.
4108 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4109 function for type; adjust size of global symbol entry.
4110 (Incremental_input_entry_reader::get_global_symbol_count): Call
4111 accessor function for type.
4112 (Incremental_input_entry_reader::get_object_count): Likewise.
4113 (Incremental_input_entry_reader::get_object_offset): Likewise.
4114 (Incremental_input_entry_reader::get_member_count): Likewise.
4115 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4116 (Incremental_input_entry_reader::get_member_offset): Likewise.
4117 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4118 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4119 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4120 (Incremental_input_entry_reader::get_global_symbol_reader): New
4121 function.
4122 (Incremental_input_entry_reader::get_output_symbol_index): New
4123 function.
4124 (Incremental_input_entry_reader::type_): Remove.
4125 (Incremental_input_entry_reader::flags_): New data member.
4126 (Incremental_inputs_reader::input_file_offset): New function.
4127 (Incremental_inputs_reader::input_file_index): New function.
4128 (Incremental_inputs_reader::input_file): Call input_file_offset.
4129 (Incremental_inputs_reader::input_file_at_offset): New function.
4130 (Incremental_relocs_reader::get_r_type): Reformat.
4131 (Incremental_relocs_reader::get_r_shndx): Reformat.
4132 (Incremental_relocs_reader::get_r_offset): Reformat.
4133 (Incremental_relocs_reader::data): New function.
4134 (Incremental_binary::Incremental_binary): Initialize new data members.
4135 (Incremental_binary::check_inputs): Add cmdline parameter.
4136 (Incremental_binary::file_is_unchanged): Remove.
4137 (Input_reader::arg_serial): New function.
4138 (Input_reader::get_unused_symbol_count): New function.
4139 (Input_reader::get_unused_symbol): New function.
4140 (Input_reader::do_arg_serial): New function.
4141 (Input_reader::do_get_unused_symbol_count): New function.
4142 (Input_reader::do_get_unused_symbol): New function.
4143 (Incremental_binary::input_file_count): New function.
4144 (Incremental_binary::get_input_reader): Change signature to use
4145 index instead of filename.
4146 (Incremental_binary::file_has_changed): New function.
4147 (Incremental_binary::get_input_argument): New function.
4148 (Incremental_binary::get_library): New function.
4149 (Incremental_binary::get_script_info): New function.
4150 (Incremental_binary::init_layout): New function.
4151 (Incremental_binary::reserve_layout): New function.
4152 (Incremental_binary::output_file): New function.
4153 (Incremental_binary::do_check_inputs): New function.
4154 (Incremental_binary::do_file_is_unchanged): Remove.
4155 (Incremental_binary::do_file_has_changed): New function.
4156 (Incremental_binary::do_init_layout): New function.
4157 (Incremental_binary::do_reserve_layout): New function.
4158 (Incremental_binary::do_input_file_count): New function.
4159 (Incremental_binary::do_get_input_reader): Change signature.
4160 (Incremental_binary::input_args_map_): New data member.
4161 (Incremental_binary::library_map_): New data member.
4162 (Incremental_binary::script_map_): New data member.
4163 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4164 new data members.
4165 (Sized_incremental_binary::output_section): New function.
4166 (Sized_incremental_binary::inputs_reader): Add const.
4167 (Sized_incremental_binary::symtab_reader): Add const.
4168 (Sized_incremental_binary::relocs_reader): Add const.
4169 (Sized_incremental_binary::got_plt_reader): Add const.
4170 (Sized_incremental_binary::get_symtab_view): New function.
4171 (Sized_incremental_binary::Inputs_reader): New typedef.
4172 (Sized_incremental_binary::Input_entry_reader): New typedef.
4173 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4174 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4175 (Sized_incremental_binary::do_file_has_changed): New function.
4176 (Sized_incremental_binary::do_init_layout): New function.
4177 (Sized_incremental_binary::do_reserve_layout): New function.
4178 (Sized_input_reader::Inputs_reader): Remove.
4179 (Sized_input_reader::Input_entry_reader): Remove.
4180 (Sized_input_reader::do_arg_serial): New function.
4181 (Sized_input_reader::do_get_unused_symbol_count): New function.
4182 (Sized_input_reader::do_get_unused_symbol): New function.
4183 (Sized_incremental_binary::do_input_file_count): New function.
4184 (Sized_incremental_binary::do_get_input_reader): Change signature;
4185 use index instead of filename.
4186 (Sized_incremental_binary::section_map_): New data member.
4187 (Sized_incremental_binary::input_entry_readers_): New data member.
4188 (class Sized_incr_relobj): New class.
4189 (class Sized_incr_dynobj): New class.
4190 (make_sized_incremental_object): New function.
4191 (class Incremental_library): New class.
4192 * layout.cc (Free_list::num_lists): New static data member.
4193 (Free_list::num_nodes): New static data member.
4194 (Free_list::num_removes): New static data member.
4195 (Free_list::num_remove_visits): New static data member.
4196 (Free_list::num_allocates): New static data member.
4197 (Free_list::num_allocate_visits): New static data member.
4198 (Free_list::init): New function.
4199 (Free_list::remove): New function.
4200 (Free_list::allocate): New function.
4201 (Free_list::dump): New function.
4202 (Free_list::print_stats): New function.
4203 (Layout_task_runner::run): Resize output file for incremental updates.
4204 (Layout::Layout): Initialize new data members.
4205 (Layout::set_incremental_base): New function.
4206 (Layout::init_fixed_output_section): New function.
4207 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4208 incremental updates.
4209 (Layout::create_gold_note): Do not create gold note section for
4210 incremental updates.
4211 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4212 for incremental updates.
4213 (Layout::set_section_offsets): For incremental updates, allocate space
4214 from free list.
4215 (Layout::create_symtab_sections): Layout with offsets relative to
4216 start of section; for incremental updates, allocate space from free
4217 list.
4218 (Layout::create_shdrs): For incremental updates, allocate space from
4219 free list.
4220 (Layout::finish_dynamic_section): For incremental updates, do not
4221 check --as-needed (fixed in subsequent patch).
4222 * layout.h (class Free_list): New class.
4223 (Layout::set_incremental_base): New function.
4224 (Layout::incremental_base): New function.
4225 (Layout::init_fixed_output_section): New function.
4226 (Layout::allocate): New function.
4227 (Layout::incremental_base_): New data member.
4228 (Layout::free_list_): New data member.
4229 * main.cc (main): Print Free_list statistics.
4230 * object.cc (Relobj::finalize_incremental_relocs): Add
4231 clear_counts parameter; clear counts only when clear_counts is set.
4232 (Sized_relobj::Sized_relobj): Initialize new base class.
4233 (Sized_relobj::do_layout): Don't report special sections.
4234 (Sized_relobj::do_for_all_local_got_entries): New function.
4235 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4236 symtab_off to all symbol table offsets.
4237 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4238 * object.h (class Got_offset_list): Move to top of file.
4239 (Object::Object): Allow case where input_file == NULL.
4240 (Object::~Object): Likewise.
4241 (Object::input_file): Assert that input_file != NULL.
4242 (Object::lock): Allow case where input_file == NULL.
4243 (Object::unlock): Likewise.
4244 (Object::is_locked): Likewise.
4245 (Object::token): Likewise.
4246 (Object::release): Likewise.
4247 (Object::is_incremental): New function.
4248 (Object::get_mtime): New function.
4249 (Object::for_all_local_got_entries): New function.
4250 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4251 (Object::set_is_in_system_directory): New function.
4252 (Object::is_in_system_directory): New function.
4253 (Object::do_is_incremental): New function.
4254 (Object::do_get_mtime): New function.
4255 (Object::do_for_all_local_got_entries): New function.
4256 (Object::is_in_system_directory_): New data member.
4257 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4258 (class Sized_relobj_base): New class.
4259 (class Sized_relobj): Derive from Sized_relobj_base.
4260 (class Sized_relobj::Symbols): Redeclare from base class.
4261 (class Sized_relobj::local_got_offset_list): Remove.
4262 (class Sized_relobj::Output_sections): Redeclare from base class.
4263 (class Sized_relobj::do_for_all_local_got_entries): New function.
4264 (class Sized_relobj::write_local_symbols): Add offset parameter.
4265 (class Sized_relobj::local_symbol_offset_): Update comment.
4266 (class Sized_relobj::local_dynsym_offset_): Update comment.
4267 * options.cc (Input_arguments::add_file): Remove const.
4268 * options.h (Input_file_argument::Input_file_argument):
4269 Initialize arg_serial_ (all constructors).
4270 (Input_file_argument::set_arg_serial): New function.
4271 (Input_file_argument::arg_serial): New function.
4272 (Input_file_argument::arg_serial_): New data member.
4273 (Input_arguments::Input_arguments): Initialize file_count_.
4274 (Input_arguments::add_file): Remove const.
4275 (Input_arguments::number_of_input_files): New function.
4276 (Input_arguments::file_count_): New data member.
4277 (Command_line::number_of_input_files): Call
4278 Input_arguments::number_of_input_files.
4279 * output.cc (Output_segment_headers::Output_segment_headers):
4280 Set current size.
4281 (Output_section::Input_section::current_data_size): New function.
4282 (Output_section::Output_section): Initialize new data members.
4283 (Output_section::add_input_section): Don't do merge sections for
4284 an incremental link; allocate space from free list for an
4285 incremental update.
4286 (Output_section::add_output_section_data): Allocate space from
4287 free list for an incremental update.
4288 (Output_section::update_data_size): New function.
4289 (Output_section::set_fixed_layout): New function.
4290 (Output_section::reserve): New function.
4291 (Output_segment::set_section_addresses): Remove const.
4292 (Output_segment::set_section_list_addresses): Remove const; allocate
4293 space from free list for an incremental update.
4294 (Output_segment::set_offset): Adjust size of RELRO segment for an
4295 incremental update.
4296 * output.h (Output_data::current_data_size): Move here from
4297 child classes.
4298 (Output_data::pre_finalize_data_size): New function.
4299 (Output_data::update_data_size): New function.
4300 (Output_section_headers::update_data_size): new function.
4301 (Output_section_data_build::current_data_size): Move to Output_data.
4302 (Output_data_strtab::update_data_size): New function.
4303 (Output_section::current_data_size): Move to Output_data.
4304 (Output_section::set_fixed_layout): New function.
4305 (Output_section::has_fixed_layout): New function.
4306 (Output_section::reserve): New function.
4307 (Output_section::update_data_size): New function.
4308 (Output_section::has_fixed_layout_): New data member.
4309 (Output_section::free_list_): New data member.
4310 (Output_segment::set_section_addresses): Remove const.
4311 (Output_segment::set_section_list_addresses): Remove const.
4312 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4313 New function.
4314 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4315 New function.
4316 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4317 parameter when calling Add_symbols constructor; store argument
4318 serial number for members of a lib group.
4319 (Add_symbols::locks): Allow case where token == NULL.
4320 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4321 (Read_member::~Read_member): New function.
4322 (Read_member::is_runnable): New function.
4323 (Read_member::locks): New function.
4324 (Read_member::run): New function.
4325 (Check_script::~Check_script): New function.
4326 (Check_script::is_runnable): New function.
4327 (Check_script::locks): New function.
4328 (Check_script::run): New function.
4329 (Check_library::~Check_library): New function.
4330 (Check_library::is_runnable): New function.
4331 (Check_library::locks): New function.
4332 (Check_library::run): New function.
4333 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4334 (Add_symbols::library_): New data member.
4335 (class Read_member): New class.
4336 (class Check_script): New class.
4337 (class Check_library): New class.
4338 * reloc.cc (Read_relocs::is_runnable): Allow case where
4339 token == NULL.
4340 (Read_relocs::locks): Likewise.
4341 (Scan_relocs::locks): Likewise.
4342 (Relocate_task::locks): Likewise.
4343 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4344 to clear counters.
4345 (Sized_relobj::incremental_relocs_scan): Fix comment.
4346 (Sized_relobj::do_relocate): Pass output file offset to
4347 write_local_symbols.
4348 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4349 from class declaration.
4350 * script.cc (read_input_script): Allocate Script_info; pass
4351 argument serial number to report_script.
4352 * script.h (class Script_info): Move to incremental.h.
4353 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4354 * symtab.h (Symbol_table::add_from_incrobj): New function.
4355 (Symbol_table::set_file_offset): New function.
4356
b961d0d7
CC
43572011-04-05 Cary Coutant <ccoutant@google.com>
4358
4359 * incremental-dump.cc (dump_incremental_inputs): Change signature
4360 to take a Sized_incremental_binary; change caller. Use readers
4361 in Sized_incremental_binary.
4362 * incremental.cc
4363 (Sized_incremental_binary::find_incremental_inputs_sections):
4364 Rename do_find_incremental_inputs_sections to this.
4365 (Sized_incremental_binary::setup_readers): New function.
4366 (Sized_incremental_binary::do_check_inputs): Check
4367 has_incremental_info_ flag; move setup code to setup_readers;
4368 use input readers.
4369 (Sized_incremental_binary::do_file_is_unchanged): New function.
4370 (Sized_incremental_binary::do_get_input_reader): New function.
4371 * incremental.h (class Incremental_binary): Move to end of file.
4372 (Incremental_binary::file_is_unchanged): New function.
4373 (Incremental_binary::do_file_is_unchanged): New function.
4374 (Incremental_binary::Input_reader): New class.
4375 (Incremental_binary::get_input_reader): New function.
4376 (class Sized_incremental_binary): Move to end of file.
4377 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4378 input section reader classes.
4379 (Sized_incremental_binary::has_incremental_info): New function.
4380 (Sized_incremental_binary::inputs_reader): New function.
4381 (Sized_incremental_binary::symtab_reader): New function.
4382 (Sized_incremental_binary::relocs_reader): New function.
4383 (Sized_incremental_binary::got_plt_reader): New function.
4384 (Sized_incremental_binary::do_file_is_unchanged): New function.
4385 (Sized_incremental_binary::Sized_input_reader): New class.
4386 (Sized_incremental_binary::get_input_reader): New function.
4387 (Sized_incremental_binary::find_incremental_inputs_sections):
4388 Rename do_find_incremental_inputs_sections to this.
4389 (Sized_incremental_binary::setup_readers): New function.
4390 (Sized_incremental_binary::has_incremental_info_): New data member.
4391 (Sized_incremental_binary::inputs_reader_): New data member.
4392 (Sized_incremental_binary::symtab_reader_): New data member.
4393 (Sized_incremental_binary::relocs_reader_): New data member.
4394 (Sized_incremental_binary::got_plt_reader_): New data member.
4395 (Sized_incremental_binary::current_input_file_): New data member.
4396
a869183f
PP
43972011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4398
4399 PR gold/12640
4400 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4401 violation.
4402
44032011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
4404
4405 * archive.cc (Archive::include_member): Adjust call to report_object.
4406 (Add_archive_symbols::run): Add script_info to call to
4407 report_archive_begin.
4408 (Lib_group::include_member): Adjust call to report_object.
4409 (Add_lib_group_symbols::run): Adjust call to report_object.
4410 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4411 blocks. Add object count for script input files.
4412 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4413 script_info parameter; change all callers.
4414 (Incremental_inputs::report_object): Add script_info parameter;
4415 change all callers.
4416 (Incremental_inputs::report_script): Store backpointer to
4417 incremental info entry.
4418 (Output_section_incremental_inputs::set_final_data_size): Record
4419 additional information for scripts.
4420 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4421 * incremental.h (Incremental_script_entry::add_object): New function.
4422 (Incremental_script_entry::get_object_count): New function.
4423 (Incremental_script_entry::get_object): New function.
4424 (Incremental_script_entry::objects_): New data member; adjust
4425 constructor.
4426 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4427 (Incremental_inputs::report_object): Add script_info parameter.
4428 (Incremental_inputs_reader::get_object_count): New function.
4429 (Incremental_inputs_reader::get_object_offset): New function.
4430 * options.cc (Input_arguments::add_file): Return reference to
4431 new input argument.
4432 * options.h (Input_argument::set_script_info): New function.
4433 (Input_argument::script_info): New function.
4434 (Input_argument::script_info_): New data member; adjust all
4435 constructors.
4436 (Input_file_group::add_file): Return reference to new input argument.
4437 (Input_file_lib::add_file): Likewise.
4438 (Input_arguments::add_file): Likewise.
4439 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4440 * script.cc (Parser_closure::Parser_closure): Add script_info
4441 parameter; adjust all callers.
4442 (Parser_closure::script_info): New function.
4443 (Parser_closure::script_info_): New data member.
4444 (read_input_script): Report scripts earlier to incremental info.
4445 (script_add_file): Set script_info in Input_argument.
4446 (script_add_library): Likewise.
4447 * script.h (Script_options::Script_info): Rewrite class.
4448
a869183f 44492011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
4450
4451 * archive.cc (Library_base::should_include_member): Move
4452 method here from class Archive.
4453 (Archive::Archive): Initialize base class.
4454 (Archive::should_include_member): Move to base class.
4455 (Archive::do_for_all_unused_symbols): New function.
4456 (Add_archive_symbols::run): Remove redundant access to
4457 incremental_inputs.
4458 (Lib_group::Lib_group): Initialize base class.
4459 (Lib_group::do_filename): New function.
4460 (Lib_group::include_member): Pass pointer to Lib_group to
4461 report_object.
4462 (Lib_group::do_for_all_unused_symbols): New function.
4463 (Add_lib_group_symbols::run): Report archive information for
4464 incremental links.
4465 * archive.h (class Library_base): New base class.
4466 (class Archive): Derive from Library_base.
4467 (Archive::filename): Move to base class.
4468 (Archive::set_incremental_info): Likewise.
4469 (Archive::incremental_info): Likewise.
4470 (Archive::Should_include): Likewise.
4471 (Archive::should_include_member): Likewise.
4472 (Archive::Armap_entry): Remove.
4473 (Archive::Unused_symbol_iterator): Remove.
4474 (Archive::unused_symbols_begin): Remove.
4475 (Archive::unused_symbols_end): Remove.
4476 (Archive::do_filename): New function.
4477 (Archive::do_get_mtime): New function.
4478 (Archive::do_for_all_unused_symbols): New function.
4479 (Archive::task_): Move to base class.
4480 (Archive::incremental_info_): Likewise.
4481 (class Lib_group): Derive from Library_base.
4482 (Lib_group::do_filename): New function.
4483 (Lib_group::do_get_mtime): New function.
4484 (Lib_group::do_for_all_unused_symbols): New function.
4485 (Lib_group::task_): Move to base class.
4486 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4487 function.
4488 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4489 function.
4490 * incremental.cc (Incremental_inputs::report_archive_begin):
4491 Use Library_base; call library's get_mtime; add incremental inputs
4492 entry before members.
4493 (class Unused_symbol_visitor): New class.
4494 (Incremental_inputs::report_archive_end): Use Library_base; use
4495 visitor class to record unused symbols; don't add incremental inputs
4496 entry after members.
4497 (Incremental_inputs::report_object): Use Library_base.
4498 * incremental.h
4499 (Incremental_archive_entry::Incremental_archive_entry): Remove
4500 unused Archive parameter.
4501 (Incremental_inputs::report_archive_begin): Use Library_base.
4502 (Incremental_inputs::report_archive_end): Likewise.
4503 (Incremental_inputs::report_object): Likewise.
4504 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4505 function.
4506 * object.h (Object::for_all_global_symbols): New function.
4507 (Object::do_for_all_global_symbols): New function.
4508 (Sized_relobj::do_for_all_global_symbols): New function.
4509 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4510 function.
4511 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4512 function.
4513
61ab3e40
ILT
45142011-03-27 Ian Lance Taylor <iant@google.com>
4515
4516 * archive.cc (Archive::interpret_header): Return -1 if something
4517 goes wrong. Change callers accordingly.
4518
30e1f9e6
CC
45192011-03-25 Cary Coutant <ccoutant@google.com>
4520
4521 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4522 * testsuite/Makefile.in: Regenerate.
4523
9370ce59 45242011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
4525
4526 * plugin.cc (get_view): New.
4527 (Plugin::load): Pass get_view to the plugin.
4528 (Plugin_manager::get_view): New.
4529
9312bb0a
ILT
45302011-03-21 Ian Lance Taylor <iant@google.com>
4531
4532 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 4533 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 4534
7e12ba9e
ST
45352011-03-21 Sriraman Tallam <tmsriram@google.com>
4536
4537 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4538 Change == to -eq.
4539 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4540 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4541 Change == to -eq.
4542 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4543 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4544
fd7a005d
ILT
45452011-03-14 Ian Lance Taylor <iant@google.com>
4546
4547 * script-sections.cc (Sort_output_sections::script_compare):
4548 Rename from is_before, change return type.
4549 (Sort_output_sections::operator()): Adjust accordingly.
4550
ed16fd1b
ILT
45512011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4552
4553 PR gold/12572
4554 * testsuite/odr_violation2.cc: Add comment to make all error line
4555 numbers double digits.
4556 * testsuite/debug_msg.sh: Adjust expected errors.
4557
71ff8986
ILT
45582011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4559
4560 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4561 but mark earlier ones as non-canonical
4562 (offset_to_iterator): Update search target and example
4563 (do_addr2line): Return extra lines in a vector*
4564 (format_file_lineno): Extract from do_addr2line
4565 (one_addr2line): Add vector* out-param
4566 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4567 when a lineno entry appeared last for its instruction
4568 (Dwarf_line_info): Add vector* out-param
4569 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4570 * symtab.cc (Odr_violation_compare): Include the lineno in the
4571 comparison again.
4572 (linenos_from_loc): New. Combine the canonical line for an
4573 address with its other lines.
4574 (True_if_intersect): New. Helper functor to make
4575 std::set_intersection a query.
4576 (detect_odr_violations): Compare sets of lines instead of just
4577 one line for each function. This became less deterministic, but
4578 has fewer false positives.
4579 * symtab.h: Declarations.
4580 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4581 mix an optimized and non-optimized object in the same binary
4582 (odr_violation2.so): Same.
4583 * testsuite/Makefile.in: Regenerate from Makefile.am.
4584 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4585 * testsuite/debug_msg.sh: Update line numbers and add
4586 assertions.
4587 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4588 non-optimized context.
4589 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4590 isn't inlined, and use OdrDerived in an optimized context.
4591 * testsuite/odr_header1.h: Defines OdrDerived, where
4592 optimization will change the
4593 first-instruction-in-the-destructor's file and line number.
4594 * testsuite/odr_header2.h: Defines OdrBase.
4595
a19fefdc
ILT
45962011-03-09 Ian Lance Taylor <iant@google.com>
4597
4598 * fileread.cc (File_read::clear_views): Don't delete the whole
4599 file view.
4600
ecb351e9
ILT
46012011-03-08 Ian Lance Taylor <iant@google.com>
4602
4603 PR gold/12525
4604 * fileread.cc: #include <climits>.
4605 (GOLD_IOV_MAX): Define.
4606 (File_read::read_multiple): Limit number of entries by iov_max.
4607 * fileread.h (class File_read): Always set max_readv_entries to
4608 128.
4609
b821d13c
ILT
46102011-03-07 Ian Lance Taylor <iant@google.com>
4611
4612 PR gold/12525
4613 * options.h (class General_options): Add -dy and -dn.
4614
89243142
CC
46152011-03-02 Cary Coutant <ccoutant@google.com>
4616
4617 * testsuite/script_test_9.t: Add TLS segment.
4618
d0773f31
ILT
46192011-03-02 Simon Baldwin <simonb@google.com>
4620
4621 * configure.ac: Add check for gnu_indirect_function support in
4622 the toolchain building binutils.
4623 * configure: Rebuild.
4624
9370ce59 46252011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
4626
4627 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4628 plugin only symbols.
4629 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4630 in plugin files as not needed in the symbol table.
4631
4cf7a849
ST
46322011-02-11 Sriraman Tallam <tmsriram@google.com>
4633
4634 * output.cc (Output_section::add_input_section): Delay fill
4635 generation for section ordering.
4636
b578bd7d
ILT
46372011-02-09 Ian Lance Taylor <iant@google.com>
4638
4639 PR gold/12316
4640 * object.h (class Sized_relobj): Remove clear_local_symbols.
4641 * reloc.cc (Sized_relobj::do_relocate): Don't call
4642 clear_local_symbols.
4643
9370ce59 46442011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
4645
4646 * plugin.cc (is_visible_from_outside): Return true for symbols
4647 in the -u option.
4648
55382fb7
ILT
46492011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4650
4651 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4652 filename.
4653
4e271fff
ST
46542011-02-02 Sriraman Tallam <tmsriram@google.com>
4655
4656 * icf.h (is_section_foldable_candidate): Change type of parameter
2e702c99 4657 to std::string.
4e271fff 4658 * icf.cc (Icf::find_identical_sections): Change type of local variable
2e702c99 4659 section_name to be std::string.
4e271fff
ST
4660 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4661
d433c3ac
ILT
46622011-01-25 Ian Lance Taylor <iant@google.com>
4663
4664 * script.cc (script_add_extern): Rewrite to use
4665 add_symbol_reference.
4666
880473a6
DK
46672011-01-25 Doug Kwan <dougkwan@google.com>
4668
d433c3ac 4669 * icf.cc (get_section_contents): Always lock section's object.
880473a6 4670
f30f86fa
ILT
46712011-01-24 Ian Lance Taylor <iant@google.com>
4672
4673 * options.h (class General_options): Accept
4674 --no-detect-odr-violations.
4675
8e51a0b9
ILT
46762011-01-24 Ian Lance Taylor <iant@google.com>
4677
4678 * version.cc (version_string): Bump to 1.11.
4679
0f3b89d8
ILT
46802011-01-24 Ian Lance Taylor <iant@google.com>
4681
4682 * plugin.cc (class Plugin_rescan): Define new class.
4683 (Plugin_manager::claim_file): Set any_claimed_.
4684 (Plugin_manager::save_archive): New function.
4685 (Plugin_manager::save_input_group): New function.
4686 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4687 necessary.
4688 (Plugin_manager::new_undefined_symbol): New function.
4689 (Plugin_manager::rescan): New function.
4690 (Plugin_manager::rescannable_defines): New function.
4691 (Plugin_manager::add_input_file): Set any_added_.
4692 * plugin.h (class Plugin_manager): define new fields rescannable_,
4693 undefined_symbols_, any_claimed_, and any_added_. Declare
4694 Plugin_rescan as friend. Declare new functions.
4695 (Plugin_manager::Rescannable): Define type.
4696 (Plugin_manager::Rescannable_list): Define type.
4697 (Plugin_manager::Undefined_symbol_list): Define type.
4698 (Plugin_manager::Plugin_manager): Initialize new fields.
4699 * archive.cc (Archive::defines_symbol): New function.
4700 (Add_archive_symbols::run): Pass archive to plugins if any.
4701 * archive.h (class Archive): Declare defines_symbol.
4702 * readsyms.cc (Input_group::~Input_group): New function.
4703 (Finish_group::run): Pass input_group to plugins if any.
4704 * readsyms.h (class Input_group): Declare destructor.
4705 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4706 any.
4707
3bb951e5
ILT
47082011-01-10 Ian Lance Taylor <iant@google.com>
4709
4710 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4711 section as relro.
4712 (Layout::set_segment_offsets): Reset increase_relro before calling
4713 set_section_addresses a second time.
4714
0aa45fac
CC
47152011-01-04 Cary Coutant <ccoutant@google.com>
4716
4717 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4718 sections before NOBITS sections.
4719
0db46eb4
L
47202011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4721
4722 * version.cc (print_version): Update copyright to 2011.
4723
829c9745
CC
47242010-12-23 Cary Coutant <ccoutant@google.com>
4725
4726 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4727 of OS to this->add. Add OD parameter to second form of the function.
4728
7500420b
ILT
47292010-12-20 Ian Lance Taylor <iant@google.com>
4730
4731 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4732 second of two consecutive entries with same offset.
4733
f8e9a930
RW
47342010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4735
4736 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4737 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4738 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4739 to avoid unneeded links against $(LDADD).
4740 * testsuite/Makefile.in: Regenerate.
4741
2fbb4320
ILT
47422010-12-15 Ian Lance Taylor <iant@google.com>
4743
4744 PR gold/12324
4745 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4746 for R_X86_64_32 and R_X86_64_PC32.
4747 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4748 ver_matching_def_pic.o.
4749 (ver_matching_def_pic.o): New target.
4750
fedb228d
RW
47512010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4752
4753 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4754 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4755 Move definition before File_read::View member definitions.
4756 (File_read::View::~View): Initialize and hold lock before
4757 updating current_mapped_bytes.
4758
9b547ce6
RW
47592010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4760
4761 * dwarf_reader.cc: Remove outdated comment.
4762 * gold-threads.cc: Fix typo in error message.
4763 * archive.cc: Fix typos in comments.
4764 * archive.h: Likewise.
4765 * arm-reloc-property.cc: Likewise.
4766 * arm-reloc-property.h: Likewise.
4767 * arm-reloc.def: Likewise.
4768 * arm.cc: Likewise.
4769 * attributes.h: Likewise.
4770 * cref.cc: Likewise.
4771 * ehframe.cc: Likewise.
4772 * fileread.h: Likewise.
4773 * gold.h: Likewise.
4774 * i386.cc: Likewise.
4775 * icf.cc: Likewise.
4776 * incremental.h: Likewise.
4777 * int_encoding.cc: Likewise.
4778 * layout.h: Likewise.
4779 * main.cc: Likewise.
4780 * merge.h: Likewise.
4781 * object.cc: Likewise.
4782 * object.h: Likewise.
4783 * options.cc: Likewise.
4784 * readsyms.cc: Likewise.
4785 * reduced_debug_output.cc: Likewise.
4786 * reloc.cc: Likewise.
4787 * script-sections.cc: Likewise.
4788 * sparc.cc: Likewise.
4789 * symtab.h: Likewise.
4790 * target-reloc.h: Likewise.
4791 * target.cc: Likewise.
4792 * target.h: Likewise.
4793 * timer.cc: Likewise.
4794 * timer.h: Likewise.
4795 * x86_64.cc: Likewise.
4796
83e17bd5
CC
47972010-12-09 Cary Coutant <ccoutant@google.com>
4798
4799 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4800 stack.
4801 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4802 parameter; change all callers.
4803 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4804 * options.h (warn_execstack): New option.
4805
017257f8
DK
48062010-12-07 Doug Kwan <dougkwan@google.com>
4807
4808 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4809 like function call relocations.
4810
c20cbc06
ILT
48112010-12-07 Ian Lance Taylor <iant@google.com>
4812
4813 * archive.cc (Archive::get_elf_object_for_member): Permit
4814 punconfigured to be NULL.
4815 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4816 (Archive::include_member): Pass NULL to get_elf_object_for_member
4817 if we searched for the archive and this is the first included
4818 object.
4819
4dbfafcc
ILT
48202010-12-01 Ian Lance Taylor <iant@google.com>
4821
4822 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4823 track_relocs_type_ field.
4824 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4825 Set track_relocs_type_.
4826 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4827 contents when using RELA relocs.
4828 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4829 reloc_map_.
4830 * reloc.cc (Track_relocs::next_addend): New function.
4831 * reloc.h (class Track_relocs): Declare next_addend.
4832
e5e19edd
ILT
48332010-12-01 Ian Lance Taylor <iant@google.com>
4834
4835 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4836 virtual destructor.
4837
9a5ce24c
ILT
48382010-12-01 Ian Lance Taylor <iant@google.com>
4839
4840 * README: Update compilers known to work and fail.
4841
c7791212
NC
48422010-11-23 Matthias Klose <doko@ubuntu.com>
4843
4844 * configure.in: For --enable-gold, handle value `default' instead of
4845 `both*'. Always install ld as ld.bfd, install as ld if gold is
4846 not the default.
4847 * configure: Regenerate.
4848
0ad220c9
DK
48492010-11-18 Doug Kwan <dougkwan@google.com>
4850
4851 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4852 and right_alignment to be zero. Store result alignment only if it is
4853 greater than existing alignment.
4854
ab8056e0
CC
48552010-11-16 Cary Coutant <ccoutant@google.com>
4856
4857 PR gold/12220
4858 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4859 Check for ".zdebug_line".
4860
fd064a5b
CC
48612010-11-16 Doug Kwan <dougkwan@google.com>
4862 Cary Coutant <ccoutant@google.com>
4863
4864 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4865 by reference; adjust all callers.
4866 * output.cc (Output_segment::set_section_addresses): Adjust references
4867 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4868 list is empty.
4869 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4870 end at page boundary.
4871
6fc6ea19
CC
48722010-11-16 Cary Coutant <ccoutant@google.com>
4873
4874 PR gold/12220
4875 * layout.cc (Layout::choose_output_section): Transform names of
4876 compressed sections even when using a script with a SECTIONS clause.
4877 (Layout::output_section_name): Remove code to transform
4878 compressed debug section names.
4879 * output.cc (Output_section::add_input_section): Use uncompressed
4880 section size when tracking input sections.
4881
95a2c8d6
RS
48822010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4883
4884 * symtab.h (Symbol::NON_PIC_REF): Remove.
4885 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4886 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4887 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4888 (Symbol::use_plt_offset): Take a flags argument and pass it
4889 directly to needs_dynamic_reloc. Restrict check for undefined
4890 weak symbols to function calls.
4891 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4892 (Target_arm::Scan::global): Use it.
4893 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4894 (Target_arm::Relocate::relocate): Likewise.
4895 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4896 parameter with an r_type parameter. Use get_reference_flags
4897 to get the flags.
4898 (Target_arm::Relocate::relocate): Update accordingly.
4899 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4900 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4901 (Target_i386::Scan::global): Likewise.
4902 (Target_i386::Relocate::relocate): Likewise.
4903 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4904 parameter with an r_type parameter. Use get_reference_flags
4905 to get the flags.
4906 (Target_i386::Relocate::relocate): Update accordingly.
4907 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4908 (Target_powerpc::Scan::global): Use it.
4909 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4910 (Target_powerpc::Relocate::relocate): Likewise.
4911 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4912 (Target_sparc::Scan::global): Use it.
4913 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4914 (Target_sparc::Relocate::relocate): Likewise.
4915 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4916 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4917 (Target_x86_64::Scan::global): Likewise.
4918 (Target_x86_64::Relocate::relocate): Likewise.
4919
f625ae50
DK
49202010-11-08 Doug Kwan <dougkwan@google.com>
4921 Cary Coutant <ccoutant@google.com>
4922
4923 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4924 (Arm_exidx_merge_section::section_contents_): New data member.
4925 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4926 (Arm_input_section::~Arm_input_section): De-allocate memory.
58797674 4927 (Arm_input_section::original_contents_): New data member.
f625ae50
DK
4928 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4929 in parameters instead of calling Object::section_contents without
4930 locking.
4931 (Arm_output_section::group_section): New parameter TASK. Pass it
4932 to callees that need locking objects.
4933 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4934 to lock EXIDX input sections. Fix a formatting issue. Call
4935 Arm_exidx_merged_section::build_contents to create merged section
4936 contents.
4937 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4938 to lock object of stub table owner.
4939 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4940 TEXT_SIZE to initialize data member TEXT_SIZE_.
4941 (Arm_exidx_input_section::addralign): Fix typo in comment.
4942 (Arm_exidx_input_section::text_size): New method.
4943 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4944 that require locking objects. Lock objects before scanning for stubs
4945 and updating local symbols.
4946 (Arm_input_section<big_endian>::init): Copy contents of original
4947 input section.
2e702c99 4948 (Arm_input_section<big_endian>::do_write): Use saved contents of
f625ae50
DK
4949 original input section instead of calling Object::section_contents
4950 without locking.
4951 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4952 size without calling Object::section_size().
4953 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4954 for size. Allocate a buffer for merged EXIDX entries.
4955 (Arm_exidx_merged_section::build_contents): New method.
2e702c99 4956 (Arm_exidx_merged_section::do_write): Move merge section contents
f625ae50
DK
4957 building code to Arm_exidx_merged_section::build_contetns. Write
4958 out contetns in buffer instead of building it on the fly.
4959 (Arm_relobj::make_exidx_input_section): Also pass text section size
4960 to Arm_exidx_input_section constructor.
4961 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4962 (Arm_dynobj::do_read_symbols): Fix memory leak.
4963 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4964 * target.h: (class Task): Add forward declaration.
4965 (Target::relax): Add new parameter TASK and pass it to
4966 Target::do_relax().
4967 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4968
5f9bcf58
CC
49692010-11-05 Cary Coutant <ccoutant@google.com>
4970
4971 PR gold/10708
4972 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4973 object when reading from the file.
4974 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4975 second layout pass.
4976 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4977 when reading section contents.
4978 (get_section_contents): Likewise.
4979 (icf::find_identical_sections): Likewise.
4980 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4981 object when reading from the file.
4982 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4983 the object when doing deferred section layout.
4984
e597fa08
NC
49852010-11-03 Nick Clifton <nickc@redhat.com>
4986
4987 PR gold/12001
4988 * script.h (class Symbol_assignment: name): New member. Returns
4989 the name of the symbol.
4990 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4991 Returns true if the given symbol name is on the list of
4992 assignments wating to be processed.
4993 * archive.cc (should_incldue_member): If the symbol is undefined,
4994 check to see if it is on the list of symbols pending assignment.
4995
3f9a3278
ILT
49962010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4997
4998 * script-sections.cc (Script_sections::find_memory_region): Check
4999 for a NULL output section pointer.
5000
d06fb4d1
DK
50012010-10-29 Doug Kwan <dougkwan@google.com>
5002
5003 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5004 Output_section::add_relaxed_input_section.
5005 * output.cc (Output_section::add_relaxed_input_section): Add new
5006 arguments LAYOUT and NAME. Set section order index.
5007 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5008 Copy section order index.
5009 * output.h (Output_section::add_relaxed_input_section): Add new
5010 arguments LAYOUT and NAME.
5011
90e24de5
ILT
50122010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5013
5014 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2e702c99 5015 NATIVE_OR_CROSS_LINKER.
90e24de5
ILT
5016 * testsuite/Makefile.in: Regenerate.
5017
c9484ea5
DK
50182010-10-20 Doug Kwan <dougkwan@google.com>
5019
5020 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5021 without SHF_LINK_ORDER flags.
5022 * layout.cc (Layout::choose_output_section): Do not filter
5023 SHF_LINK_ORDER flag in a relocatable link.
5024
5bc2f5be
CC
50252010-10-17 Cary Coutant <ccoutant@google.com>
5026
5027 * output.h (Output_segment::set_section_addresses): Change function
5028 signature. Update all callers.
5029 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5030 sections.
5031 (Output_segment::set_section_addresses): Align after last TLS
5032 section. Add padding before last relro section instead of after.
5033
0c91cf04
DK
50342010-10-17 Doug Kwan <dougkwan@google.com>
5035
5036 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5037 GOT output section to be writable.
5038
8c21d9d3
CC
50392010-10-14 Cary Coutant <ccoutant@google.com>
5040
5041 * debug.h (DEBUG_INCREMENTAL): New flag.
2e702c99
RM
5042 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5043 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5044 mode.
5045 * incremental.cc (report_command_line): Ignore all forms of
5046 --incremental.
5047 * layout.cc (Layout::Layout): Check parameters for incremental link
5048 mode.
5049 * options.cc (General_options::parse_incremental): New function.
5050 (General_options::parse_no_incremental): New function.
5051 (General_options::parse_incremental_full): New function.
5052 (General_options::parse_incremental_update): New function.
5053 (General_options::incremental_mode_): New data member.
5054 (General_options::finalize): Check incremental_mode_.
5055 * options.h (General_options): Update help text for --incremental.
5056 Add --no-incremental, --incremental-full, --incremental-update.
5057 (General_options::Incremental_mode): New enum type.
5058 (General_options::incremental_mode): New function.
5059 (General_options::incremental_mode_): New data member.
5060 * parameters.cc (Parameters::incremental_mode_): New data member.
5061 (Parameters::set_options): Set incremental_mode_.
5062 (Parameters::set_incremental_full): New function.
5063 (Parameters::incremental): New function.
5064 (Parameters::incremental_update): New function.
5065 (set_parameters_incremental_full): New function.
5066 * parameters.h (Parameters::set_incremental_full): New function.
5067 (Parameters::incremental): New function.
5068 (Parameters::incremental_update): New function.
5069 (Parameters::incremental_mode_): New data member.
5070 (set_parameters_incremental_full): New function.
5071 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5072 incremental link mode.
5073 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5074 (Sized_relobj::do_relocate_sections): Likewise.
5075 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5076 option.
5077 * testsuite/Makefile.in: Regenerate.
5078 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8c21d9d3 5079
bb32aa18 50802010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
5081
5082 * script-sections.h (class Script_sections): Make
5083 Sections_elements typedef public.
5084 * script-sections.cc (class Sort_output_sections): Add elements_
5085 field. Add constructor which sets it; change all callers.
5086 (Sort_output_sections::is_before): New function.
5087 (Sort_output_sections::operator()): Call is_before.
5088 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5089 conditional.
5090 * testsuite/script_test_10.sh: New test. Test script section
5091 order.
5092 * testsuite/script_test_10.t: Likewise.
5093 * testsuite/script_test_10.s: Likewise.
5094 * testsuite/Makefile.am: Wrap the cross linker tests and the
5095 common tests into NATIVE_OR_CROSS_LINKER.
5096 (check_SCRIPTS): Add script_test_10.sh.
5097 (check_DATA): Add script_test_10.stdout.
5098 (script_test_10.o, script_test_10): New targets.
5099 (script_test_10.stdout): New target.
5100 * configure, testsuite/Makefile.in: Regenerate.
5101
3cef7179
ILT
51022010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5103
5104 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5105 error for the deprecated relocations.
5106 (Target_arm::Scan::global): Likewise.
5107 (Target_arm::Relocate::relocate): Likewise.
5108
7411e9a8
RS
51092010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5110
5111 * fileread.cc (Input_file::find_file): Initialize *found_name
5112 and *namep when using the fallback search for case 4.
5113
6a9da32a
CC
51142010-10-11 Cary Coutant <ccoutant@google.com>
5115
5116 * options.h (class General_options): Redefine -z lazy as an alias for
5117 the negation of -z now.
5118
ac897c20
ILT
51192010-10-11 Ian Lance Taylor <iant@google.com>
5120
5121 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5122 binding.
5123
ea5cae92
NC
51242010-10-06 Nick Clifton <nickc@redhat.com>
5125
5126 * script-sections.cc(class Memory_region): Remove
5127 current_lma_offset_ field. Rename current_vma_offset_ to
5128 current_offset_. Add last_section_ field.
5129 (Memory_region::get_current_vma_address): Rename to
5130 get_current_address.
5131 (Memory_region::get_current_lma_address): Delete.
5132 (Memory_region::increment_vma_offset): Rename to
5133 increment_offset.
5134 (Memory_region::increment_lma_offset): Delete.
5135 (Memory_region::attributes_compatible): New method. Returns
5136 true if the provided section is compatible with the region.
5137 (Memory_region::get_last_section): New method. Returns the last
5138 section to use the region.
5139 (Memory_region::set_last_section): New method. Stores the last
5140 section to use the region.
5141 (Script_sections::block_in_region): New method. Returns true if
5142 a block of memory is contained within a region.
5143 (Script_sections::find_memory_region): New method. Locates a
5144 memory region to be used to set a VMA or LMA address.
5145 (Output_section_definition::set_section_addresses): Add code to
5146 check for addresses set by memory regions.
5147 (Output_segment::set_section_addresses): Remove memory region
5148 walking code.
5149 (Script_sections::create_segment): Add a warning if a header
5150 segment is created outside of any region.
5151 * script-sections.h (class Script_sections): Add prototypes for
5152 find_memory_region and block_in_region methods.
5153 * testsuite/memory_test.s: Use .long instead of .word.
5154 * testsuite/memory_test.t: Add some more output sections.
5155 * testsuite/memory_test.sh: Update expected output.
5156
a9bfd952
DK
51572010-10-02 Doug Kwan <dougkwan@google.com>
5158
5159 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5160 defintion to symtab.h
5161 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5162 declaration to defintion.
5163
bacff3ab
NC
51642010-10-01 Nick Clifton <nickc@redhat.com>
5165
5166 * expression.cc (eval): Replace dummy argument with NULL.
5167 (eval_maybe_dot): Check for a NULL result section pointer.
5168 (Symbol_expression::value): Likewise.
5169 (Dot_expression::value): Likewise.
5170 (BINARY_EXPRESSION): Likewise.
5171 (Max_expression::value): Likewise.
5172 (Min_expression::value): Likewise.
5173 (Absolute_expression::value): Likewise.
5174 (Addr_expression::value_from_output_section): Likewise.
5175 (Loaddddr_expression::value_from_output_section): Likewise.
5176 (Segment_start_expression::value): Likewise.
5177 * script-sections.cc
5178 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5179 argument with NULL.
5180 (Sections_elememt_dot_assignment::set_section_addresses):
5181 Likewise.
5182 (Output_data_expression::do_write_to_buffer): Likewise.
5183 (Output_section_definition::finalize_symbols): Likewise.
5184 (Output_section_definition::set_section_addresses): Likewise.
5185
f81bc8b5
DK
51862010-09-30 Doug Kwan <dougkwan@google.com>
5187
5188 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5189
c95e9f27
ST
51902010-09-28 Sriraman Tallam <tmsriram@google.com>
5191
5192 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 5193 function.
c95e9f27
ST
5194 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5195 virtual function.
5196 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5197 virtual function.
5198 * icf.cc (get_section_contents): Inline merge sections only when
5199 target allows it.
5200
3cac54d2
RW
52012010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5202
5203 * configure: Regenerate.
5204
2904037a
ILT
52052010-09-17 Ian Lance Taylor <iant@google.com>
5206
5207 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
5208 * testsuite/Makefile.am (memory_test.o): New target.
5209 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5210 memory_test.t.
5211 * testsuite/Makefile.in: Rebuild.
2904037a 5212
bca7fb63
DK
52132010-09-17 Doug Kwan <dougkwan@google.com>
5214
5215 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5216 defintion if relocation uses GOT entries of the symbol.
5217 * testsuite/icf_safe_test.sh: Fix test.
5218 * testsuite/icf_safe_so_test.sh: Fix test.
5219
4ef28648
CC
52202010-09-16 Cary Coutant <ccoutant@google.com>
5221
5222 * script_sections.cc (class Memory_region): Remove "NULL" from
5223 vector initializations.
5224
793990de
CC
52252010-09-15 Cary Coutant <ccoutant@google.com>
5226
5227 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5228 Resolve forwarding symbols.
5229
81e015e2
DK
52302010-09-15 Doug Kwan <dougkwan@google.com>
5231
5232 * gold/testsuite/script_test_3.t: Add ARM special sections.
5233 * gold/testsuite/script_test_4.t: Same.
5234 * gold/testsuite/script_test_5.t: Same.
5235 * gold/testsuite/script_test_6.t: Same.
5236 * gold/testsuite/script_test_7.t: Same.
5237 * gold/testsuite/script_test_7.t: Same.
5238 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5239
36171d64
CC
52402010-09-14 Cary Coutant <ccoutant@google.com>
5241
5242 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5243 (Target_x86_64::Relocate::relocate_tls): Replace check for
5244 saw_tls_block_reloc_ with test for executable section.
5245
d89051bd
CC
52462010-09-12 Cary Coutant <ccoutant@google.com>
5247
5248 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5249 position-independent executables to shared libraries need dynamic
5250 relocations.
5251 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5252 position-independent executables.
5253 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5254 * testsuite/Makefile.in: Regenerate.
5255
fca41f0f
NC
52562010-09-10 Nick Clifton <nickc@redhat.com>
5257
5258 PR gold/11997
5259 * testsuite/memory_test.t: Discard any sections that are not
5260 needed.
5261
6695e4b3
L
52622010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5263
5264 PR gold/11996
5265 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5266 "This::" to work around a bug in gcc 4.2.
5267
5268 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5269
0f72bf6f
RÁE
52702010-09-09 Rafael Espindola <espindola@google.com>
5271
5272 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5273 sections with different PF_X flags in the same segment.
5274 (Layout::find_first_load_seg): Search all segments to find the first
5275 one.
5276 * options.h (rosegment): New.
5277
52782010-09-08 Rafael Espindola <espindola@google.com>
a6577478 5279
05a79166 5280 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 5281
aa98ff75
DK
52822010-09-08 Doug Kwan <dougkwan@google.com>
5283
5284 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5285 (Arm_relobj::do_relocate_sections): Add new parameter for output
5286 file to match the parent.
5287 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5288 of local symbols instead of input values. Update code to track
5289 changes in gold::relocate_section.
5290 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5291 (Sized_relobj::compute_final_local_value_internal): New methods.
5292 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5293 body into private version of Sized_relobj::compute_final_local_value.
5294 Call the inline method.
5295 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5296 merged symbol value if there is one.
5297 (Symbol_value::has_output_value): New method defintiion.
5298 (Sized_relobj::Compute_final_local_value_status): New enum type.
5299 (Sized_relobj::compute_final_local_value): New methods.
5300 (Sized_relobj::compute_final_local_value_internal): New methods.
5301 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5302 and arm_cortex_a8.sh.
5303 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5304 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5305 New tests.
5306 * Makefile.in: Regenerate.
5307 * testsuite/arm_bl_out_of_range.s: Update test.
5308 * testsuite/thumb_bl_out_of_range.s: Ditto.
5309 * testsuite/thumb_blx_out_of_range.s: Ditto.
5310 * testsuite/arm_branch_out_of_range.sh: New file.
5311 * testsuite/arm_cortex_a8.sh: Ditto.
5312 * testsuite/arm_cortex_a8_b.s: Ditto.
5313 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5314 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5315 * testsuite/arm_cortex_a8_bl.s: Ditto.
5316 * testsuite/arm_cortex_a8_blx.s: Ditto.
5317 * testsuite/arm_cortex_a8_local.s: Ditto.
5318 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5319 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5320
05a79166
L
53212010-09-08 Rafael Espindola <espindola@google.com>
5322
5323 * Makefile.am (memory_test.stdout): Run readelf with -W.
5324 * Makefile.in: Regenerate.
5325 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5326 64 bit output.
5327
33dbc701
RÁE
53282010-09-08 Rafael Espindola <espindola@google.com>
5329
5330 * script-sections.cc (Script_sections::add_memory_region): Convert
5331 field precision to int.
5332 * script.cc (script_set_section_region, script_set_section_region):
5333 Convert field precision to int.
5334
731ca54a
RÁE
53352010-09-08 Rafael Espindola <espindola@google.com>
5336
5337 * arm.cc (do_finalize_sections): Create the __exidx_start and
5338 __exdix_end symbols even when the section is missing.
5339
7f8cd844
NC
53402010-09-08 Nick Clifton <nickc@redhat.com>
5341
5342 * README: Remove claim that MEMORY is not supported.
5343 * expression.cc (script_exp_function_origin)
5344 (script_exp_function_length): Move from here to ...
5345 * script.cc: ... here.
5346 (script_set_section_region, script_add_memory)
5347 (script_parse_memory_attr, script_include_directive): New
5348 functions.
5349 * script-sections.cc
5350 (class Memory_region): New class.
5351 (class Output_section_definition): Add set_memory_region,
5352 set_section_vma, set_section_lma and get_section_name methods.
5353 (class Script_Sections): Add add_memory_region,
5354 find_memory_region, find_memory_region_origin,
5355 find_memory_region_length and set_memory_region methods.
5356 Have set_section_addresses method walk the list of set memory
5357 regions.
5358 Extend the print methos to display memory regions.
5359 * script-sections.h: Add prototypes for new methods.
5360 Add enum for MEMORY region attributes.
5361 * yyscript.y: Add support for parsing MEMORY regions.
5362 * script-c.h: Add prototypes for new functions.
5363 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5364 * testsuite/Makefile.in: Regenerate.
5365 * testsuite/memory_test.sh: New script.
5366 * testsuite/memory_test.s: New assembler source file.
5367 * testsuite/memory_test.t: New linker script.
5368
a4649286
DK
53692010-08-27 Doug Kwan <dougkwan@google.com>
5370
5371 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5372 reference override an existing dynamic weak reference.
5373 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5374 * testsuite/Makefile.in: Regenerate.
5375 * testsuite/dyn_weak_ref.sh: New file.
5376 * testsuite/dyn_weak_ref_1.c: Ditto.
5377 * testsuite/dyn_weak_ref_2.c: Ditto.
5378
b56648ad
ILT
53792010-08-27 Ian Lance Taylor <iant@google.com>
5380
5381 * incremental.h (class Incremental_input_entry): Add virtual
5382 destructor.
5383
809313cb
ILT
53842010-08-27 Ian Lance Taylor <iant@google.com>
5385
5386 * testsuite/start_lib_test_3.c: Mark t3 as used.
5387
11e32464
NC
53882010-08-27 Nick Clifton <nickc@redhat.com>
5389
5390 * options.cc (version_script): Fix small typo in previous
5391 whitespace tidyup.
5392
ca09d69a
NC
53932010-08-25 Nick Clifton <nickc@redhat.com>
5394
5395 * archive.cc: Formatting fixes: Remove whitespace between
5396 typename and following asterisk. Remove whitespace between
5397 function name and opening parenthesis.
5398 * archive.h: Likewise.
5399 * arm.cc: Likewise.
5400 * attributes.cc: Likewise.
5401 * attributes.h: Likewise.
5402 * common.cc: Likewise.
5403 * copy-relocs.cc: Likewise.
5404 * dirsearch.h: Likewise.
5405 * dynobj.cc: Likewise.
5406 * ehframe.cc: Likewise.
5407 * ehframe.h: Likewise.
5408 * expression.cc: Likewise.
5409 * fileread.cc: Likewise.
5410 * fileread.h: Likewise.
5411 * gc.h: Likewise.
5412 * gold-threads.cc: Likewise.
5413 * gold.cc: Likewise.
5414 * i386.cc: Likewise.
5415 * icf.h: Likewise.
5416 * incremental-dump.cc: Likewise.
5417 * incremental.cc: Likewise.
5418 * layout.cc: Likewise.
5419 * layout.h: Likewise.
5420 * main.cc: Likewise.
5421 * merge.cc: Likewise.
5422 * merge.h: Likewise.
5423 * object.cc: Likewise.
5424 * object.h: Likewise.
5425 * options.cc: Likewise.
5426 * options.h: Likewise.
5427 * output.cc: Likewise.
5428 * output.h: Likewise.
5429 * plugin.cc: Likewise.
5430 * plugin.h: Likewise.
5431 * powerpc.cc: Likewise.
5432 * reloc.cc: Likewise.
5433 * script-c.h: Likewise.
5434 * script-sections.cc: Likewise.
5435 * script.cc: Likewise.
5436 * stringpool.cc: Likewise.
5437 * symtab.cc: Likewise.
5438 * symtab.h: Likewise.
5439 * target.cc: Likewise.
5440 * timer.cc: Likewise.
5441 * timer.h: Likewise.
5442 * version.cc: Likewise.
5443 * x86_64.cc: Likewise.
5444
b8fa8750
NC
54452010-08-24 Nick Clifton <nickc@redhat.com>
5446
5447 PR 11899
5448 * layout.cc (segment_precedes): Sort segments by their physical
5449 addresses, if they have been set.
5450
9919d93b
CC
54512010-08-23 Cary Coutant <ccoutant@google.com>
5452
5453 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5454 symbols data.
5455 (Lib_group::include_member): Unlock object after deleting its
5456 symbols data.
5457 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5458 the bug fixed here.
5459
97b4be1c
CC
54602010-08-19 Neil Vachharajani <nvachhar@google.com>
5461 Cary Coutant <ccoutant@google.com>
5462
5463 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5464 constructor, and set_blocker.
5465 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5466 readsyms_blocker_.
5467 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5468 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5469 * testsuite/Makefile.am (start_lib_test): New test case.
5470 * testsuite/Makefile.in: Regenerate.
5471 * testsuite/start_lib_test_main.c: New file.
5472 * testsuite/start_lib_test_1.c: New file.
5473 * testsuite/start_lib_test_2.c: New file.
5474 * testsuite/start_lib_test_3.c: New file.
5475
dd0b1884
ILT
54762010-08-19 Ian Lance Taylor <iant@google.com>
5477
5478 * Makefile.in: Rebuild with automake 1.11.1.
5479 * aclocal.m4: Likewise.
5480 * testsuite/Makefile.in: Likewise.
5481
7223e9ca
ILT
54822010-08-19 Ian Lance Taylor <iant@google.com>
5483
5484 PR 10893
5485 * i386.cc (class Output_data_plt_i386): Update declarations.
5486 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5487 local_ifuncs_ fields.
5488 (Target_i386::do_plt_section_for_global): New function.
5489 (Target_i386::do_plt_section_for_local): New function.
5490 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5491 parameter; change all callers. Initialize global_ifuncs_ and
5492 local_ifuncs_. If doing a static link define __rel_iplt_start and
5493 __rel_iplt_end.
5494 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5495 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5496 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5497 symbols.
5498 (Target_i386::make_plt_section): New function, broken out of
5499 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5500 (Target_i386::make_plt_entry): Call make_plt_section.
5501 (Target_i386::make_local_ifunc_plt_entry): New function.
5502 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5503 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5504 R_386_IRELATIVE to switch.
5505 (Target_i386::Scan::global): Likewise.
5506 (Target_i386::Relocate::relocate): Likewise.
5507 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5508 switch.
5509 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5510 (Target_x86_64::do_plt_section_for_global): New function.
5511 (Target_x86_64::do_plt_section_for_local): New function.
5512 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5513 parameter; change all callers. If doing a static link define
5514 __rela_iplt_start and __rela_iplt_end.
5515 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5516 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5517 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5518 to point to .plt.
5519 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5520 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5521 switch.
5522 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5523 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5524 R_X86_64_IRELATIVE to switch.
5525 (Target_x86_64::Scan::global): Likewise.
5526 (Target_x86_64::Relocate::relocate): Likewise.
5527 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5528 switch.
5529 * target.h (class Target): Add plt_section_for_global and
5530 plt_section_for_local functions. Add do_plt_section_for_global
5531 and do_plt_section_for_local virtual functions.
5532 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5533 clarifying comments.
5534 (Symbol::use_plt_offset): Handle IFUNC symbol.
5535 * object.cc (Sized_relobj::Sized_relobj): Initialize
5536 local_plt_offsets_.
5537 (Sized_relobj::local_has_plt_offset): New function.
5538 (Sized_relobj::local_plt_offset): New function.
5539 (Sized_relobj::set_local_plt_offset): New function.
5540 (Sized_relobj::do_count): Handle IFUNC symbol.
5541 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5542 a bit away from input_shndx_ field. Add set_is_func_symbol and
5543 is_ifunc_symbol functions.
5544 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5545 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5546 local_plt_offsets_ field.
5547 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5548 * output.h (class Output_section_data): Add non-const
5549 output_section function.
5550 (class Output_data_got): Update declarations.
5551 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5552 Add use_plt_offset parameter to global and local constructors.
5553 Change all callers. Change local_sym_index_ field to 31 bits.
5554 Change GSYM_CODE and CONSTANT_CODE accordingly.
5555 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5556 doing a static link don't set sh_link field.
5557 (Output_data_got::Got_entry::write): Use PLT offset if
5558 appropriate.
5559 (Output_data_got::add_global_plt): New function.
5560 (Output_data_got::add_local_plt): New function.
5561 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5562 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5563 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5564 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5565 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5566 IFUNC conditional.
5567 * testsuite/ifunc-sel.h: New file.
5568 * testsuite/ifuncmain1.c: New file.
5569 * testsuite/ifuncmain1vis.c: New file.
5570 * testsuite/ifuncmod1.c: New file.
5571 * testsuite/ifuncdep2.c: New file.
5572 * testsuite/ifuncmain2.c: New file.
5573 * testsuite/ifuncmain3.c: New file.
5574 * testsuite/ifuncmod3.c: New file.
5575 * testsuite/ifuncmain4.c: New file.
5576 * testsuite/ifuncmain5.c: New file.
5577 * testsuite/ifuncmod5.c: New file.
5578 * testsuite/ifuncmain6pie.c: New file.
5579 * testsuite/ifuncmod6.c: New file.
5580 * testsuite/ifuncmain7.c: New file.
5581 * configure, testsuite/Makefile.in: Rebuild.
5582
56f75c03
ILT
55832010-08-18 Ian Lance Taylor <iant@google.com>
5584
5585 * incremental.cc
5586 (Output_section_incremental_inputs::write_input_files): Add cast
5587 to avoid signed/unsigned comparison warning.
5588 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5589
55455f89
CC
55902010-08-12 Cary Coutant <ccoutant@google.com>
5591
5592 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5593
e2054bcb
ILT
55942010-08-13 Ian Lance Taylor <iant@google.com>
5595
5596 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5597
74f67560
DK
55982010-08-12 Cary Coutant <ccoutant@google.com>
5599 Doug Kwan <dougkwan@google.com>
5600
5601 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5602 defintion overrides non-weak undef, remember that the original undef
5603 is not weak.
5604 * symtab.cc (Symbol_table::sized_write_global): For undef without
5605 an original weak binding, set binding to global in output.
5606 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5607 * testsuite/Makefile.in: Regenerate.
5608 * testsuite/strong_ref_weak_def.sh: New file.
5609 * testsuite/strong_ref_weak_def_1.c: Ditto.
5610 * testsuite/strong_ref_weak_def_2.c: Ditto.
5611
d1238d12
CC
56122010-08-12 Cary Coutant <ccoutant@google.com>
5613
5614 * testsuite/incremental_test.sh: Rewrite.
5615 * testsuite/incremental_test_1.c: Rewrite.
5616 * testsuite/incremental_test_2.c: Rewrite.
5617
0e70b911
CC
56182010-08-12 Cary Coutant <ccoutant@google.com>
5619
5620 * arm.cc (Target_arm::got_size): Add const.
5621 (Target_arm::got_entry_count): New function.
5622 (Target_arm::plt_entry_count): New function.
5623 (Target_arm::first_plt_entry_offset): New function.
5624 (Target_arm::plt_entry_size): New function.
5625 (Output_data_plt_arm::entry_count): New function.
5626 (Output_data_plt_arm::first_plt_entry_offset): New function.
5627 (Output_data_plt_arm::get_plt_entry_size): New function.
5628 * i386.cc (Target_i386::got_size): Add const.
5629 (Target_i386::got_entry_count): New function.
5630 (Target_i386::plt_entry_count): New function.
5631 (Target_i386::first_plt_entry_offset): New function.
5632 (Target_i386::plt_entry_size): New function.
5633 (Output_data_plt_i386::entry_count): New function.
5634 (Output_data_plt_i386::first_plt_entry_offset): New function.
5635 (Output_data_plt_i386::get_plt_entry_size): New function.
5636 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5637 find_incremental_inputs_sections. Dump incremental_got_plt section.
5638 * incremental.cc: Include target.h.
5639 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5640 parameter. Adjust all callers. Find incremental_got_plt section.
5641 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5642 section.
5643 (Output_section_incremental_inputs::set_final_data_size): Calculate
5644 size of incremental_got_plt section.
5645 (Output_section_incremental_inputs::do_write): Write the
5646 incremental_got_plt section.
5647 (Got_plt_view_info): New struct.
5648 (Local_got_offset_visitor): New class.
5649 (Global_got_offset_visitor): New class.
5650 (Global_symbol_visitor_got_plt): New class.
5651 (Output_section_incremental_inputs::write_got_plt): New function.
5652 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5653 Add parameter. Adjust all callers.
5654 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5655 (Incremental_inputs::got_plt_section): New function.
5656 (Incremental_inputs::got_plt_section_): New data member.
5657 (Incremental_got_plt_reader): New class.
5658 * layout.cc (Layout::create_incremental_info_sections): Add the
5659 incremental_got_plt section.
5660 * object.h (Got_offset_list::get_list): New function.
5661 (Got offset_list::for_all_got_offsets): New function.
5662 (Sized_relobj::local_got_offset_list): New function.
5663 * powerpc.cc (Target_powerpc::got_size): Add const.
5664 (Target_powerpc::got_entry_count): New function.
5665 (Target_powerpc::plt_entry_count): New function.
5666 (Target_powerpc::first_plt_entry_offset): New function.
5667 (Target_powerpc::plt_entry_size): New function.
5668 (Output_data_plt_powerpc::entry_count): New function.
5669 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5670 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5671 * sparc.cc (Target_sparc::got_size): Add const.
5672 (Target_sparc::got_entry_count): New function.
5673 (Target_sparc::plt_entry_count): New function.
5674 (Target_sparc::first_plt_entry_offset): New function.
5675 (Target_sparc::plt_entry_size): New function.
5676 (Output_data_plt_sparc::entry_count): New function.
5677 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5678 (Output_data_plt_sparc::get_plt_entry_size): New function.
5679 * symtab.h (Symbol::got_offset_list): New function.
5680 (Symbol_table::for_all_symbols): New function.
5681 * target.h (Sized_target::got_entry_count): New function.
5682 (Sized_target::plt_entry_count): New function.
5683 (Sized_target::plt_entry_size): New function.
5684 * x86_64.cc (Target_x86_64::got_size): Add const.
5685 (Target_x86_64::got_entry_count): New function.
5686 (Target_x86_64::plt_entry_count): New function.
5687 (Target_x86_64::first_plt_entry_offset): New function.
5688 (Target_x86_64::plt_entry_size): New function.
5689 (Output_data_plt_x86_64::entry_count): New function.
5690 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5691 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5692
09ec0418
CC
56932010-08-12 Cary Coutant <ccoutant@google.com>
5694
5695 * archive.cc: Include incremental.h.
5696 (Archive::Archive): Initialize incremental_info_.
5697 (Archive::include_member): Record archive members in incremental info.
5698 (Add_archive_symbols::run): Record begin and end of an archive in
5699 incremental info.
5700 (Lib_group::include_member): Record objects in incremental info.
5701 * archive.h (Incremental_archive_entry): Forward declaration.
5702 (Archive::set_incremental_info): New member function.
5703 (Archive::incremental_info): New member function.
5704 (Archive::Unused_symbol_iterator): New class.
5705 (Archive::unused_symbols_begin): New member function.
5706 (Archive::unused_symbols_end): New member function.
5707 (Archive::incremental_info_): New data member.
5708 * incremental-dump.cc (find_input_containing_global): New function.
5709 (dump_incremental_inputs): Dump new incremental info sections.
5710 * incremental.cc: Include symtab.h.
5711 (Output_section_incremental_inputs): New class.
5712 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5713 new incremental info sections.
5714 (Sized_incremental_binary::do_check_inputs): Likewise.
5715 (Incremental_inputs::report_archive): Remove.
5716 (Incremental_inputs::report_archive_begin): New function.
5717 (Incremental_inputs::report_archive_end): New function.
5718 (Incremental_inputs::report_object): New function.
5719 (Incremental_inputs::finalize_inputs): Remove.
5720 (Incremental_inputs::report_input_section): New function.
5721 (Incremental_inputs::report_script): Rewrite.
5722 (Incremental_inputs::finalize): Do nothing but finalize string table.
5723 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5724 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5725 (Incremental_inputs::create_data_sections): New function.
5726 (Incremental_inputs::relocs_entsize): New function.
5727 (Output_section_incremental_inputs::set_final_data_size): New function.
5728 (Output_section_incremental_inputs::do_write): New function.
5729 (Output_section_incremental_inputs::write_header): New function.
5730 (Output_section_incremental_inputs::write_input_files): New function.
5731 (Output_section_incremental_inputs::write_info_blocks): New function.
5732 (Output_section_incremental_inputs::write_symtab): New function.
5733 * incremental.h (Incremental_script_entry): Forward declaration.
5734 (Incremental_object_entry): Forward declaration.
5735 (Incremental_archive_entry): Forward declaration.
5736 (Incremental_inputs): Forward declaration.
5737 (Incremental_inputs_header_data): Remove.
5738 (Incremental_inputs_header): Remove.
5739 (Incremental_inputs_header_write): Remove.
5740 (Incremental_inputs_entry_data): Remove.
5741 (Incremental_inputs_entry): Remove.
5742 (Incremental_inputs_entry_write): Remove.
5743 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5744 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5745 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5746 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5747 Likewise.
5748 (Incremental_input_entry): New class.
5749 (Incremental_script_entry): New class.
5750 (Incremental_object_entry): New class.
5751 (Incremental_archive_entry): New class.
5752 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5753 (Incremental_inputs::report_inputs): Remove.
5754 (Incremental_inputs::report_archive): Remove.
5755 (Incremental_inputs::report_archive_begin): New function.
5756 (Incremental_inputs::report_archive_end): New function.
5757 (Incremental_inputs::report_object): Change prototype.
5758 (Incremental_inputs::report_input_section): New function.
5759 (Incremental_inputs::report_script): Change prototype.
5760 (Incremental_inputs::get_reloc_count): New function.
5761 (Incremental_inputs::set_reloc_count): New function.
5762 (Incremental_inputs::create_data_sections): New function.
5763 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5764 (Incremental_inputs::inputs_section): New function.
5765 (Incremental_inputs::symtab_section): New function.
5766 (Incremental_inputs::relocs_section): New function.
5767 (Incremental_inputs::get_stringpool): Add const.
5768 (Incremental_inputs::command_line): Add const.
5769 (Incremental_inputs::inputs): Remove.
5770 (Incremental_inputs::command_line_key): New function.
5771 (Incremental_inputs::input_file_count): New function.
5772 (Incremental_inputs::input_files): New function.
5773 (Incremental_inputs::relocs_entsize): New function.
5774 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5775 (Incremental_inputs::finalize_inputs): Remove.
5776 (Incremental_inputs::Input_info): Remove.
5777 (Incremental_inputs::lock_): Remove.
5778 (Incremental_inputs::inputs_): Change type.
5779 (Incremental_inputs::inputs_map_): Remove.
5780 (Incremental_inputs::current_object_entry_): New data member.
5781 (Incremental_inputs::inputs_section_): New data member.
5782 (Incremental_inputs::symtab_section_): New data member.
5783 (Incremental_inputs::relocs_section_): New data member.
5784 (Incremental_inputs::reloc_count_): New data member.
5785 (Incremental_inputs_reader): New class.
5786 (Incremental_symtab_reader): New class.
5787 (Incremental_relocs_reader): New class.
5788 * layout.cc (Layout::finalize): Move finalization of incremental info
5789 and creation of incremental info sections to follow finalization of
5790 symbol table. Set offsets for postprocessing sections.
5791 (Layout::create_incremental_info_sections): Call
5792 Incremental_inputs::create_data_sections. Add incremental symtab
5793 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5794 sections to layout after input sections.
5795 * layout.h (struct Timespec): Forward declaration.
5796 (Layout::incremental_inputs): Add const.
5797 (Layout::create_incremental_info_sections): Add parameter.
5798 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5799 * object.cc: Include incremental.h.
5800 (Relobj::finalize_incremental_relocs): New function.
5801 (Sized_relobj::do_layout): Record input sections in incremental info.
5802 * object.h (Object::output_section): New function.
5803 (Object::output_section_offset): Moved from Relobj.
5804 (Object::get_incremental_reloc_base): New function.
5805 (Object::get_incremental_reloc_count): New function.
5806 (Object::do_output_section): New function.
5807 (Object::do_output_section_offset): Moved from Relobj.
5808 (Object::do_get_incremental_reloc_base): New function.
5809 (Object::do_get_incremental_reloc_count): New function.
5810 (Object::Object): Initialize new data members.
5811 (Relobj::output_section): Renamed do_output_section and moved to
5812 protected.
5813 (Relobj::output_section_offset): Moved to Object.
5814 (Relobj::do_get_incremental_reloc_base): New function.
5815 (Relobj::do_get_incremental_reloc_count): New function.
5816 (Relobj::allocate_incremental_reloc_counts): New function.
5817 (Relobj::count_incremental_reloc): New function.
5818 (Relobj::finalize_incremental_relocs): New function.
5819 (Relobj::next_incremental_reloc_index): New function.
5820 (Relobj::reloc_counts_): New data member.
5821 (Relobj::reloc_bases_): New data member.
5822 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5823 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5824 (Sized_relobj::incremental_relocs_scan): New function.
5825 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5826 (Sized_relobj::incremental_relocs_write): New function.
5827 (Sized_relobj::incremental_relocs_write_reltype): New function.
5828 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5829 incremental link.
5830 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5831 archives and object files elsewhere.
5832 (Add_symbols::run): Report object files here.
5833 (Finish_group::run): Report end of archive at end of group.
5834 * reloc.cc: Include layout.h, incremental.h.
5835 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5836 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5837 (Sized_relobj::incremental_relocs_scan): New function.
5838 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5839 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5840 (Sized_relobj::incremental_relocs_write): New function.
5841 (Sized_relobj::incremental_relocs_write_reltype): New function.
5842 * script.cc (read_input_script): Rewrite test for incremental link.
5843 Change call to Incremental_inputs::report_script.
5844 * symtab.h (Symbol_table::first_global_index): New function.
5845 (Symbol_table::output_count): New function.
5846
ce0d1972
DK
58472010-08-12 Doug Kwan <dougkwan@google.com>
5848
5849 * arm.cc (Target_arm::merge_object_attributes): Check command line
5850 options --no-wchar-size-warning and --no-enum-size-warning.
5851 * options.h (General_options): Add ld-compatible options
5852 --no-enum-size-warning and --no-wchar-size-warning.
5853
6e5710ce
ILT
58542010-08-04 Ian Lance Taylor <iant@google.com>
5855
5856 * x86_64.cc (Target_x86_64::Scan::local): Use
5857 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5858 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5859 (Target_x86_64::Scan::global): Likewise.
5860 (Target_x86_64::Relocate::relocate): Likewise.
5861 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5862 Likewise.
5863
fef830db
CC
58642010-08-03 Cary Coutant <ccoutant@google.com>
5865
5866 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5867 to reserve space in merged_strings vector. Keep total input size
5868 for stats.
5869 (Output_merge_string::do_print_merge_stats): Print total input size.
5870 * merge.h (Output_merge_string): Add input_size_ field.
5871 * stringpool.cc (Stringpool_template::string_length): Move
5872 implementations out of Stringpool_template class and place in
5873 stringpool.h.
5874 * stringpool.h (string_length): Move out of Stringpool_template.
5875
1e3811b0
ILT
58762010-08-03 Ian Lance Taylor <iant@google.com>
5877
5878 PR 11712
5879 * layout.cc (relaxation_loop_body): If address of load segment is
5880 set, adjust address to include headers if possible.
5881
7af0c620
ILT
58822010-08-03 Ian Lance Taylor <iant@google.com>
5883
5884 * version.cc (version_string): Bump to 1.10.
5885
22f0da72
ILT
58862010-08-03 Ian Lance Taylor <iant@google.com>
5887
5888 PR 11805
5889 * layout.h (enum Output_section_order): Define.
5890 (class Layout): Update declarations.
5891 * layout.cc (Layout::get_output_section): Add order parameter.
5892 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5893 is_first_non_relro parameters. Change all callers.
5894 (Layout::choose_output_section): Likewise.
5895 (Layout::add_output_section_data): Likewise.
5896 (Layout::make_output_section): Likewise. Set order.
5897 (Layout::default_section_order): New function.
5898 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5899 * output.cc (Output_section::Output_section): Initialize order_.
5900 Don't initialize deleted fields.
5901 (Output_segment::Output_segment): Don't initialize deleted
5902 fields.
5903 (Output_segment::add_output_section_to_load): New function
5904 replacing add_output_section. Change all callers to call this or
5905 add_output_section_to_nonload.
5906 (Output_segment::add_output_section_to_nonload): New function.
5907 (Output_segment::remove_output_section): Rewrite.
5908 (Output_segment::add_initial_output_data): Likewise.
5909 (Output_segment::has_any_data_sections): Likewise.
5910 (Output_segment::is_first_section_relro): Likewise.
5911 (Output_segment::maximum_alignment): Likewise.
5912 (Output_segment::has_dynamic_reloc): New function replacing
5913 dynamic_reloc_count. Change all callers.
5914 (Output_segment::has_dynamic_reloc_list): New function replacing
5915 dynamic_reloc_count_list. Change all callers.
5916 (Output_segment::set_section_addresses): Rewrite.
5917 (Output_segment::set_offset): Rewrite.
5918 (Output_segment::find_first_and_last_list): Remove.
5919 (Output_segment::set_tls_offsets): Rewrite.
5920 (Output_segment::first_section_load_address): Likewise.
5921 (Output_segment::output_section_count): Likewise.
5922 (Output_segment::section_with_lowest_load_address): Likewise.
5923 (Output_segment::write_section_headers): Likewise.
5924 (Output_segment::print_sections_to_map): Likewise.
5925 * output.h (class Output_data): Remove dynamic_reloc_count_
5926 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5927 (Output_data::add_dynamic_reloc): Rewrite.
5928 (Output_data::has_dynamic_reloc): New function.
5929 (Output_data::dynamic_reloc_count): Remove.
5930 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5931 is_last_relro_, is_first_non_relro_, is_interp_,
5932 is_dynamic_linker_section_ fields. Add order and set_order
5933 functions. Remove is_relro_local, set_is_relro_local,
5934 is_last_relro, set_is_last_relro, is_first_non_relro,
5935 set_is_first_non_relro functions, is_interp, set_is_interp,
5936 is_dynamic_linker_section, and set_is_dynamic_linker_section
5937 functions.
5938 (class Output_segment): Change Output_data_list from std::list to
5939 std:;vector. Add output_lists_ field. Remove output_data_ and
5940 output_bss_ fields. Update declarations.
5941
3ff2ccb0
ILT
59422010-08-02 Ian Lance Taylor <iant@google.com>
5943
5944 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5945 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5946 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5947
88a4108b
ILT
59482010-08-02 Ian Lance Taylor <iant@google.com>
5949
5950 PR 11855
5951 * script.cc (Script_options::Script_options): Initialize
5952 symbol_definitions_ and symbol_references_.
5953 (Script_options::add_symbol_assignment): Update
5954 symbol_definitions_ and symbol_references_.
5955 (Script_options::add_symbol_reference): New function.
5956 (script_symbol): New function.
5957 * script.h (class Script_options): Add symbol_definitions_ and
5958 symbol_references_ fields.
5959 (Script_options::referenced_const_iterator): New type.
5960 (Script_options::referenced_begin): New function.
5961 (Script_options::referenced_end): New function.
5962 (Script_options::is_referenced): New function.
5963 (Script_options::any_unreferenced): New function.
5964 * script-c.h (script_symbol): Declare.
5965 * yyscript.y (exp): Call script_symbol.
5966 * symtab.cc: Include "script.h".
5967 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5968 Change all callers. Check symbols referenced by scripts.
5969 (Symbol_table::add_undefined_symbols_from_command_line): Add
5970 layout parameter. Change all callers.
5971 (Symbol_table::do_add_undefined_symbols_from_command_line):
5972 Likewise. Break out loop body. Check symbols referenced by
5973 scripts.
5974 (Symbol_table::add_undefined_symbol_from_command_line): New
5975 function broken out of
5976 do_add_undefined_symbols_from_command_line.
5977 * symtab.h (class Symbol_table): Update declarations.
5978 * archive.cc: Include "layout.h".
5979 (Archive::should_include_member): Add layout parameter. Change
5980 all callers. Check for symbol mentioned in expression.
5981 * archive.h (class Archive): Update declaration.
5982 * object.cc (Sized_relobj::do_should_include_member): Add layout
5983 parameter.
5984 * object.h (Object::should_include_member): Add layout parameter.
5985 Change all callers.
5986 (Object::do_should_include_member): Add layout parameter.
5987 (class Sized_relobj): Update declaration.
5988 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5989 parameter.
5990 * dynobj.h (class Sized_dynobj): Update declaration.
5991 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5992 layout parameter.
5993 * plugin.h (class Sized_pluginobj): Update declaration.
5994
5f1ab67a
ILT
59952010-08-02 Ian Lance Taylor <iant@google.com>
5996
5997 PR 11866
5998 * output.cc (Output_segment::set_offset): Search for the first and
5999 last sections rather than assuming that the list is in order.
6000 (Output_segment::find_first_and_last_list): New function.
6001 * output.h (class Output_segment): Update declarations.
6002 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6003 (relro_strip_test_SOURCES): New variable.
6004 (relro_strip_test_DEPENDENCIES): New variable.
6005 (relro_strip_test_LDFLAGS): New variable.
6006 (relro_strip_test_LDADD): New variable.
6007 (relro_strip_test.so): New target.
6008
a8df5856
ILT
60092010-08-02 Ian Lance Taylor <iant@google.com>
6010
6011 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6012 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6013 (Target_i386::got_tlsdesc_section): New function.
6014 (Target_i386::got_section): Create space for GOT entries for
6015 TLSDESC relocations.
6016 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6017 R_386_TLS_GOTDESC.
6018 (Target_i386::Scan::global): Likewise.
6019 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6020 using TLSDESC GOT.
6021 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6022 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6023 (Target_x86_64::got_tlsdesc_section): New function.
6024 (Target_x86_64::got_section): Create space for GOT entries for
6025 TLSDESC relocations.
6026 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6027 R_386_TLS_GOTDESC.
6028 (Target_x86_64::Scan::global): Likewise.
6029 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6030 using TLSDESC GOT.
6031
0c10a0a6
ILT
60322010-08-02 Ian Lance Taylor <iant@google.com>
6033
6034 * testsuite/final_layout.sh: Use dc to convert from hex to
6035 decimal.
6036
41cbeecc
ST
60372010-07-29 Sriraman Tallam <tmsriram@google.com>
6038
6039 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6040 paramter to the call to gold::gc_process_relocs.
6041 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6042 paramter to the call to gold::gc_process_relocs.
6043 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6044 parameter to the call to gold::gc_process_relocs.
6045 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6046 template parameter to the call to gold::gc_process_relocs.
6047 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6048 paramter to the call to gold::gc_process_relocs.
6049 * gc.h (get_embedded_addend_size): New function.
6050 (gc_process_relocs): Save the size of the reloc for use by ICF.
6051 * icf.cc (get_section_contents): Get the addend from the text section
6052 for SHT_REL relocation sections.
6053 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6054 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6055 * int_encoding.h (read_from_pointer): New overloaded function.
6056 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6057 * testsuite/icf_sht_rel_addend_test.sh: New file.
6058 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6059 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6060
6ea55b82
RW
60612010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6062
6063 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6064 * Makefile.in: Regenerate.
6065 * testsuite/Makefile.in: Regenerate.
6066
9691462b
ILT
60672010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6068
6069 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6070 * gold/testsuite/debug_msg.cc: Likewise.
6071 * gold/testsuite/odr_violation1.cc
6072 * gold/testsuite/odr_violation2.cc
6073
76897331
CC
60742010-07-21 Cary Coutant <ccoutant@google.com>
6075
6076 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6077 string, and length fields.
6078 (Output_merge_string::Merged_strings_list): New type.
6079 (Output_merge_string::Merged_strings_lists): New typedef.
6080 (Output_merge_string): Replace merged_strings_ with
6081 merged_strings_lists_.
6082 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6083 Merged_strings_list per input object and section. Don't store pointer
6084 to the string. Don't store length with each merged string entry.
6085 (Output_merge_string::finalize_merged_data): Loop over list of merged
6086 strings lists. Recompute length of each merged string.
6087
78384e8f
CC
60882010-07-15 Cary Coutant <ccoutant@google.com>
6089
6090 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6091 here.
6092
783659f9
ILT
60932010-07-14 Ian Lance Taylor <iant@google.com>
6094
6095 * descriptors.cc (Descriptors::open): Report correct name in error
6096 message.
6097
131687b4
DK
60982010-07-13 Doug Kwan <dougkwan@google.com>
6099
6100 * arm.cc (Arm_input_section::Arm_input_section): For a
6101 SHT_ARM_EXIDX section, always keeps the input sections.
6102 (Arm_input_section::set_exidx_section_link): New method.
6103 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6104 has_errors_ to false.
6105 (Arm_exidx_input_section::has_errors,
6106 Arm_exidx_input_section::set_has_errors): New methods.
6107 (Arm_exidx_input_section::has_errors_): New data member.
6108 (Arm_relobj::get_exidx_shndx_list): New method.
6109 (Arm_output_section::append_text_sections_to_list): Do not skip
6110 section without SHF_EXECINSTR.
6111 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6112 errors.
2e702c99 6113 (Arm_relobj::make_exidx_input_section): Add new parameter for text
131687b4
DK
6114 section header. Make error messages more verbose. Check for
6115 a non-executable section linked to an EXIDX section.
6116 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6117 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6118 check that there is no deferred EXIDX section if we exit early.
6119 Instead of not making an EXIDX section in case of an error, make one
6120 and set the has_errors flag of it.
6121 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6122 in a relocatable link.
6123 (Target_arm::do_relax): Look for the EXIDX output section instead of
6124 assuming that it is called .ARM.exidx.
2e702c99 6125 (Target_arm::fix_exidx_coverage): Add a new parameter for input
131687b4
DK
6126 section list. Do not check for SHF_EXECINSTR section flags but
6127 skip any input section with errors.
6128 * output.cc (Output_section::Output_section): Initialize
6129 always_keeps_input_sections_ to false.
6130 (Output_section::add_input_section): Check for
6131 always_keeps_input_sections_.
6132 * output.h (Output_section::always_keeps_input_sections,
6133 Output_section::set_always_keeps_input_sections): New methods.
6134 (Output_section::always_keeps_input_sections): New data member.
6135
69517287
RÁE
61362010-07-13 Rafael Espindola <espindola@google.com>
6137
6138 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6139 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6140
82742395
ILT
61412010-07-13 Philip Herron <herron.philip@googlemail.com>
6142 Ian Lance Taylor <iant@google.com>
6143
6144 * output.h (Output_section_lookup_maps::add_merge_section):
6145 Correct check of whether value was inserted.
6146 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6147 (Output_section_lookup_maps::add_relaxed_input_section):
6148 Likewise.
6149 * arm.cc (Target_arm::got_section): Remove used local os.
6150 * i386.cc (Target_i386::got_section): Likewise.
6151 * x86_64.cc (Target_x86_64::got_section): Likewise.
6152 * sparc.cc (Target_sparc::got_section): Likewise.
6153 (Target_sparc::relocate): Remove unused local have_got_offset.
6154 * powerpc.cc (Target_powerpc::relocate): Likewise.
6155
f2d707b5
ILT
61562010-07-13 Ian Lance Taylor <iant@google.com>
6157
241531d6
ILT
6158 * compressed_output.cc (zlib_decompress): Fix signature in
6159 !HAVE_ZLIB_H case.
6160
f2d707b5
ILT
6161 * archive.cc (Archive::include_member): Unlock an external member
6162 of a thin archive. Don't bother to delete an object we know is
6163 NULL.
6164
a2e47362
CC
61652010-07-12 Cary Coutant <ccoutant@google.com>
6166
6167 * compressed_output.cc (zlib_decompress): New function.
6168 (get_uncompressed_size): New function.
6169 (decompress_input_section): New function.
6170 * compressed_output.h (get_uncompressed_size): New function.
6171 (decompress_input_section): New function.
6172 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6173 Handle compressed debug sections.
6174 * layout.cc (is_compressed_debug_section): New function.
6175 (Layout::output_section_name): Map compressed section names to
6176 canonical names.
6177 * layout.h (is_compressed_debug_section): New function.
6178 (is_debug_info_section): Recognize compressed debug sections.
6179 * merge.cc: Include compressed_output.h.
6180 (Output_merge_data::do_add_input_section): Handle compressed
6181 debug sections.
6182 (Output_merge_string::do_add_input_section): Handle compressed
6183 debug sections.
6184 * object.cc: Include compressed_output.h.
6185 (Sized_relobj::Sized_relobj): Initialize new data members.
6186 (build_compressed_section_map): New function.
6187 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6188 * object.h (Object::section_is_compressed): New method.
6189 (Object::do_section_is_compressed): New method.
6190 (Sized_relobj::Compressed_section_map): New type.
6191 (Sized_relobj::do_section_is_compressed): New method.
6192 (Sized_relobj::compressed_sections_): New data member.
6193 * output.cc (Output_section::add_input_section): Handle compressed
6194 debug sections.
6195 * reloc.cc: Include compressed_output.h.
6196 (Sized_relobj::write_sections): Handle compressed debug sections.
6197
ce279a62
CC
61982010-07-08 Cary Coutant <ccoutant@google.com>
6199
6200 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6201 weak when resolving to a dynamic def.
6202 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6203 for weak undef/dynamic def cases. Adjust callers.
6204 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6205 undef_binding_weak_.
6206 (Symbol_table::sized_write_globals): Adjust symbol binding.
6207 (Symbol_table::sized_write_symbol): Add binding parameter.
6208 * symtab.h (Symbol::set_undef_binding): New method.
6209 (Symbol::is_undef_binding_weak): New method.
6210 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6211 (Symbol_table::should_override): Add new parameter.
6212 (Symbol_table::sized_write_symbol): Add new parameter.
6213
6214 * testsuite/weak_undef_file1.cc: Add new test case.
6215 * testsuite/weak_undef_file2.cc: Fix header comment.
6216 * testsuite/weak_undef_test.cc: Add new test case.
6217
b2286c10
DK
62182010-06-29 Doug Kwan <dougkwan@google.com>
6219
6220 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6221 Initialize USE_SYMBOL_.
6222 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6223 definition.
6224 (Arm_reloc_property::uses_symbol_): New data member declaration.
6225 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6226 uses symbol value and symbol is undefined but not weakly undefined.
6227
4802450a
RÁE
62282010-06-28 Rafael Espindola <espindola@google.com>
6229
6230 * plugin.cc (Plugin::load): Use dlerror.
6231
e5ca47ba
ILT
62322010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6233
6234 * symtab.cc (detect_odr_violations): When reporting an ODR
6235 violation, report an object where the symbol is defined.
6236
8a75a161
DK
62372010-06-25 Doug Kwan <dougkwan@google.com>
6238
6239 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6240 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6241 definition.
6242 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6243 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6244 target hook to detect function points.
6245 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6246 * icf.h (Icf::check_section_for_function_pointers): Change type of
6247 parameter SECTION_NAME to const reference to std::string. Use
6248 target hook to determine if section may have unsafe pointers.
6249 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6250 method definition.
6251
42218b9f
RÁE
62522010-06-21 Rafael Espindola <espindola@google.com>
6253
6254 * fileread.cc (Input_file::find_fie): New
6255 (Input_file::open): Use Input_file::find_fie.
6256 * fileread.h (Input_file::find_fie): New
6257 * plugin.cc (set_extra_library_path): New.
6258 (Plugin::load): Add set_extra_library_path to the transfer vector.
6259 (Plugin_manager::set_extra_library_path): New.
6260 (Plugin_manager::add_input_file): Use the extra search path if set.
6261 (set_extra_library_path(): New.
6262 * plugin.h (Plugin_manager): Add set_extra_library_path and
6263 extra_search_path_.
6264
a0506cca
CC
62652010-06-19 Cary Coutant <ccoutant@google.com>
6266
6267 * layout.cc (gdb_sections): Add .debug_types.
6268 (lines_only_debug_sections): Likewise.
6269
6508b958
RÁE
62702010-06-18 Rafael Espindola <espindola@google.com>
6271
6272 * plugin.cc (add_input_file,add_input_library)
6273 (Plugin_manager::add_input_file): Make filename arguments const.
6274 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6275 const.
6276
3e235302
DK
62772010-06-16 Doug Kwan <dougkwan@google.com>
6278
6279 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6280 .ARM.attributes section if we have not merged any input
6281 attributes sections.
6282
106e8a6c
DK
62832010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6284
6285 * arm.cc: Allow combining objects with no EABI version
6286 information.
6287
91ff43fe
RÁE
62882010-06-15 Rafael Espindola <espindola@google.com>
6289
6290 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6291
68ed838c
ILT
62922010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6293
6294 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6295 (struct iovec): Correct !HAVE_READV definition.
6296
f3a2388f
CC
62972010-06-10 Cary Coutant <ccoutant@google.com>
6298
6299 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6300 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6301 reloc sections.
6302 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6303
6304 PR 11683
6305 * symtab.h (Symbol::is_placeholder): New member function.
6306 * target-reloc.h (relocate_section): Check for placeholder symbols.
6307
6308 * testsuite/Makefile.am (plugin_test_8): New test.
6309 (plugin_test_9): New test.
6310 * testsuite/Makefile.in: Regenerate.
6311
e1df38aa
NC
63122010-06-09 Nick Clifton <nickc@redhat.com>
6313
6314 * yyscript.y (input_list_element): Allow strings prefixed with
6315 the '-' character. Treat these as libraries.
6316 * script.cc (script_add_library): New function. Adds a library
6317 specified by "-l<name>" found in an input script.
6318 * script-c.h: Add prototype for script_add_library.
6319
25bbe950
DK
63202010-06-07 Doug Kwan <dougkwan@google.com>
6321
6322 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6323 Restrict stub-group size to be within long conditional branch
6324 range when working around cortex-A8 erratum.
6325
0f32ea4c
ILT
63262010-06-07 Damien Diederen <dd@crosstwine.com>
6327
6328 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6329 #ifdef typo.
6330
8fe2a369
ST
63312010-06-03 Sriraman Tallam <tmsriram@google.com>
6332
6333 PR gold/11658
6334 * output.cc
6335 (Output_section::Input_section_sort_entry::compare_section_ordering):
6336 Change to return non-zero correctly.
6337 (Output_section::Input_section_sort_section_order_index_compare
6338 ::operator()): Change to fix ambiguity in comparisons.
6339
6e9ba2ca
ST
63402010-06-01 Sriraman Tallam <tmsriram@google.com>
6341
6342 * gold.h (is_wildcard_string): New function.
6343 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6344 (Layout::layout_eh_frame): Ditto.
6345 (Layout::find_section_order_index): New method.
6346 (Layout::read_layout_from_file): New method.
6347 * layout.h (Layout::find_section_order_index): New method.
6348 (Layout::read_layout_from_file): New method.
6349 (Layout::input_section_position_): New private member.
6350 (Layout::input_section_glob_): New private member.
6351 * main.cc (main): Call read_layout_from_file here.
6352 * options.h (--section-ordering-file): New option.
6353 * output.cc (Output_section::input_section_order_specified_): New
6354 member.
6355 (Output_section::Output_section): Initialize new member.
6356 (Output_section::add_input_section): Add new parameter.
6357 Keep input sections when --section-ordering-file is used.
6358 (Output_section::set_final_data_size): Sort input sections when
6359 section ordering file is specified.
6360 (Output_section::Input_section_sort_entry): Add new parameter.
6361 Check sorting type.
6362 (Output_section::Input_section_sort_entry::compare_section_ordering):
6363 New method.
6364 (Output_section::Input_section_sort_compare::operator()): Change to
6365 consider section_order_index.
6366 (Output_section::Input_section_sort_init_fini_compare::operator()):
6367 Change to consider section_order_index.
6368 (Output_section::Input_section_sort_section_order_index_compare
6369 ::operator()): New method.
6370 (Output_section::sort_attached_input_sections): Change to sort
6371 according to section order when specified.
e1df38aa
NC
6372 (Output_section::add_input_section<32, true>): Add new parameter.
6373 (Output_section::add_input_section<64, true>): Add new parameter.
6374 (Output_section::add_input_section<32, false>): Add new parameter.
6375 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
6376 * output.h (Output_section::add_input_section): Add new parameter.
6377 (Output_section::input_section_order_specified): New
6378 method.
6379 (Output_section::set_input_section_order_specified): New method.
6380 (Input_section::Input_section): Initialize section_order_index_.
6381 (Input_section::section_order_index): New method.
6382 (Input_section::set_section_order_index): New method.
6383 (Input_section::section_order_index_): New member.
6384 (Input_section::Input_section_sort_section_order_index_compare): New
6385 struct.
6386 (Output_section::input_section_order_specified_): New member.
6387 * script-sections.cc (is_wildcard_string): Delete and move modified
6388 method to gold.h.
6389 (Output_section_element_input::Output_section_element_input): Modify
6390 call to is_wildcard_string.
6391 (Output_section_element_input::Input_section_pattern
6392 ::Input_section_pattern): Ditto.
6393 (Output_section_element_input::Output_section_element_input): Ditto.
6394 * testsuite/Makefile.am (final_layout): New test case.
6395 * testsuite/Makefile.in: Regenerate.
6396 * testsuite/final_layout.cc: New file.
6397 * testsuite/final_layout.sh: New file.
6398
3537c84b
RÁE
63992010-06-01 Rafael Espindola <espindola@google.com>
6400
6401 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6402
105b6afd
RÁE
64032010-06-01 Rafael Espindola <espindola@google.com>
6404
6405 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6406 visibility of symbols.
6407
29e11421
DK
64082010-05-27 Doug Kwan <dougkwan@google.com>
6409
6410 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6411 from start of output section instead of address for a local symbol
6412 in a merged or relaxed section when doing a relocatable link.
6413
5e0f337e
RÁE
64142010-05-26 Rafael Espindola <espindola@google.com>
6415
703d02da 6416 PR 11604
5e0f337e
RÁE
6417 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6418 adding sections the garbage collector removed.
6419 * gold/testsuite/Makefile.am: Add test.
6420 * gold/testsuite/Makefile.in: Regenerate.
6421 * gold/testsuite/plugin_test_7.sh: New.
6422 * gold/testsuite/plugin_test_7_1.c: New.
6423 * gold/testsuite/plugin_test_7_2.c: New.
6424
f4187277
RÁE
64252010-05-26 Rafael Espindola <espindola@google.com>
6426
6427 * script-sections.cc (Output_section_definition::set_section_addresses):
6428 Check for --section-start.
6429
5c388529
DK
64302010-05-26 Doug Kwan <dougkwan@google.com>
6431
6432 * arm.cc (Arm_scan_relocatable_relocs): New class.
6433 (Target_arm::relocate_special_relocatable): New method.
6434 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6435 (Arm_relocate_functions::thumb_branch_common): Same.
6436 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6437 instead of Default_scan_relocatable_relocs.
6438 * target-reloc.h (relocate_for_relocatable): Let target handle
6439 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6440 * target.h (Sized_target::relocate_special_relocatable): New method.
6441
bca1c3ae
ILT
64422010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6443
6444 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6445
0439c796
DK
64462010-05-23 Doug Kwan <dougkwan@google.com>
6447
6448 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6449 instead of a cast.
6450 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6451 with a direct branch, not a conditional branch, to a stub.
6452 * merge.cc (Output_merge_base::record_input_section): New method
6453 defintion.
6454 (Output_merge_data::do_add_input_section): Record input section if
6455 keeps-input-sections flag is set.
6456 (Output_merge_string::do_add_input_section): Ditto.
6457 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6458 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6459 INPUT_SECTIONS_.
6460 (Output_merge_base::keeps_input_sections,
6461 Output_merge_base::set_keeps_input_sections,
6462 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6463 method definitions.
6464 (Output_merge_base::Input_sections): New type declaration.
6465 (Output_merge_base::input_sections_begin,
6466 Output_merge_base::input_sections_end,
6467 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6468 (Output_merge_base::bool keeps_input_sections_,
6469 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6470 Output_merge_base::input_sections_): New data members.
6471 (Output_merge_data::do_set_keeps_input_sections): New method
6472 defintion.
6473 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6474 * output.cc (Output_section::Input_section::relobj): Move method
6475 defintion from class declaration to here and handle merge sections.
6476 (Output_section::Input_section::shndx): Ditto.
6477 (Output_section::Output_section): Remove initializations of removed
6478 data members and initialize new data member LOOKUP_MAPS_.
6479 (Output_section::add_input_section): Set keeps-input-sections flag
6480 for a newly created merge output section as appropriate. Adjust code
6481 to use Output_section_lookup_maps class.
6482 (Output_section::add_relaxed_input_section): Adjst code for lookup
6483 maps code refactoring.
2e702c99 6484 (Output_section::add_merge_input_section): Add a new parameter
0439c796
DK
6485 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6486 class. If adding input section to a newly created merge output
6487 section fails, remove the new merge section.
6488 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 6489 Adjust code for use of the Output_section_lookup_maps class.
2e702c99 6490 (Output_section::find_merge_section): Ditto.
0439c796 6491 (Output_section::build_lookup_maps): New method defintion.
2e702c99 6492 (Output_section::find_relaxed_input_section): Adjust code to use
0439c796
DK
6493 Output_section_lookup_maps class.
6494 (Output_section::get_input_sections): Export merge sections. Adjust
6495 code to use Output_section_lookup_maps class.
6496 (Output_section:::add_script_input_section): Adjust code to use
6497 Output_section_lookup_maps class. Update lookup maps for merge
6498 sections also.
6499 (Output_section::discard_states): Use Output_section_lookup_maps.
6500 (Output_section::restore_states): Same.
6501 * output.h (Merge_section_properties): Move class defintion out of
6502 Output_section.
6503 (Output_section_lookup_maps): New class.
6504 (Output_section::Input_section::is_merge_section): New method
6505 defintion.
6506 (Output_section::Input_section::relobj): Move defintion out of class
6507 defintion. Declare method only.
6508 (Output_section::Input_section::shndx): Ditto.
6509 (Output_section::Input_section::output_merge_base): New method defintion.
2e702c99 6510 (Output_section::Input_section::u2_.pomb): New union field.
0439c796
DK
6511 (Output_section::Merge_section_by_properties_map,
6512 Output_section::Output_section_data_by_input_section_map,
6513 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6514 Remove types.
2e702c99 6515 (Output_section::add_merge_input_section): Add new parameter
0439c796
DK
6516 KEEPS_INPUT_SECTIONS.
6517 (Output_section::build_lookup_maps): New method declaration.
6518 (Output_section::merge_section_map_,
6519 Output_section::merge_section_by_properties_map_,
6520 Output_section::relaxed_input_section_map_,
6521 Output_section::is_relaxed_input_section_map_valid_): Remove data
6522 members.
6523 (Output_section::lookup_maps_): New data member.
6524
76295588
L
65252010-05-21 Doug Kwan <dougkwan@google.com>
6526
6527 PR gold/11619
6528 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6529 avoid a compilation error.
6530
d103a984
RÁE
65312010-05-19 Rafael Espindola <espindola@google.com>
6532
6533 * script-sections.cc (Output_section_definition::allocate_to_segment):
6534 Update the phdrs_list even when the output section is NULL.
6535 * testsuite/Makefile.am: Add test.
6536 * testsuite/Makefile.in: Regenerate.
6537 * testsuite/script_test_9.cc: New.
6538 * testsuite/script_test_9.sh: New.
6539 * testsuite/script_test_9.t: New.
6540
6625d24e
DK
65412010-05-19 Doug Kwan <dougkwan@google.com>
6542
6543 * arm.cc (Arm_input_section::original_size): New method.
6544 (Arm_input_section::do_addralign): Add a cast.
6545 (Arm_input_section::do_output_offset): Remove static cast.
6546 (Arm_input_section::original_addralign,
6547 Arm_input_section::original_size_): Change type to uint32_t.
6548 (Arm_input_section::init): Add safe casts for section alignment
6549 and size.
6550 (Arm_input_section::set_final_data_size): Do not set address and
6551 offset of stub table.
6552 (Arm_output_section::fix_exidx_coverage): Change use of of
6553 Output_section::Simple_input_section to that of
6554 Output_section::Input_section.
6555 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6556 except for the first pass.
6557 * output.cc (Output_section::get_input_sections): Change type of
6558 input_sections to std::list<Input_section>.
6559 (Output_section::add_script_input_section): Rename from
6560 Output_section::add_simple_input_section. Change type of SIS
6561 parameter from Simple_input_section to Input_section.
6562 * output.h (Output_section::Simple_input_section): Remove class.
6563 (Output_section::Input_section): Change class visibility to public.
6564 (Output_section::Input_section::addralign): Use stored alignments
6565 for special input sections if set.
6566 (Output_section::Input_section::set_addralign): New method.
6567 (Output_section::get_input_sections): Change parameter type from
6568 list of Simple_input_section to list of Input_section.
6569 (Output_section::add_script_input_section): Rename from
6570 Output_section::add_simple_input_section. Change first parameter's
6571 type from Simple_input_section to Input_section and remove the
6572 second and third parameters.
6573 * script-sections.cc (Input_section::Input_section_list): Change
6574 type to list of Output_section::Input_section/
6575 (Input_section_info::Input_section_info): Change parameter type of
6576 INPUT_SECTION to Output_section::Input_section.
6577 (Input_section_info::input_section): Change return type.
6578 (Input_section_info::input_section_): Change type to
6579 Output_section::Input_section.
6580 (Output_section_element_input::set_section_addresses): Adjust code
6581 to use Output_section::Input_section instead of
6582 Output_section::Simple_input_section. Adjust code for renaming
6583 of Output_section::add_simple_input_section.
6584 (Orphan_output_section::set_section_addresses): Ditto.
6585
e1e82ea4
RW
65862010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6587
6588 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6589 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6590
91e75c8a
RÁE
65912010-05-18 Rafael Espindola <espindola@google.com>
6592
6593 * options.cc (General_options::finalize): Handle -nostdlib.
6594 * options.h (nostdlib): New option.
6595 * script.cc (script_add_search_dir): Handle -nostdlib.
6596
da59ad79
DK
65972010-05-12 Doug Kwan <dougkwan@google.com>
6598
6599 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6600 attributes section only if there no attributes section after merging.
6601 (Target_arm::merge_object_attributes): Move value of
e1df38aa 6602 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
6603 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6604 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6605 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6606 and arm_attr_merge_7.stdout.
6607 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6608 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6609 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6610 arm_attr_merge_7b.o): New rules.
6611 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6612 arm_attr_merge_7
6613 * testsuite/Makefile.in: Regenerate.
6614 * testsuite/arm_attr_merge.sh: New file.
6615 * testsuite/arm_attr_merge_[67][ab].s: Same.
6616
3e01a7fd
NC
66172010-05-05 Nick Clifton <nickc@redhat.com>
6618
6619 * po/es.po: Updated Spanish translation.
6620
7ad2014a
L
66212010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6622
6623 * Makefile.am (install-exec-local): Properly install gold as
6624 default cross linker.
6625 * Makefile.in: Regenerated.
6626
4fda8867
NC
66272010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6628 Nick Clifton <nickc@redhat.com>
6629
6630 * configure.ac (install_as_default): Define and set to false
6631 unless --enable-gold or --enable-gold=both/gold has been
6632 specified.
6633 * configure: Regenerate.
6634
6635 * Makefile.am (install-exec-local): Install the executable as
6636 'ld.gold'. If install_as_default is true then also install it as
6637 'ld'.
6638 * Makefile.in: Regenerated.
6639
bd288ea2
ILT
66402010-04-24 Ian Lance Taylor <iant@google.com>
6641
6642 * layout.cc (Layout::layout_reloc): In relocatable link don't
6643 combine reloc sections for grouped sections.
6644
ef38fd8a
ST
66452010-04-23 Sriraman Tallam <tmsriram@google.com>
6646
6647 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6648 sections that are not ordinary to icf.
6649 * icf.cc (get_section_contents): Handle relocation pointing to section
6650 with no object or shndx information.
6651 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6652 * testsuite/Makefile.in: Regenerate.
6653 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6654 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6655
f6973bdc
ILT
66562010-04-22 Ian Lance Taylor <iant@google.com>
6657
6658 * expression.cc (Expression::Expression_eval_info): Add
6659 result_alignment_pointer field.
6660 (Expression::eval_with_dot): Add result_alignment_pointer
6661 parameter. Change all callers.
6662 (Expression::eval_maybe_dot): Likewise.
6663 (class Binary_expression): Add alignment_pointer parameter to
6664 left_value and right_value. Change all callers.
6665 (BINARY_EXPRESSION): Set result alignment.
6666 (class Trinary_expression): Add alignment_pointer parameter to
6667 arg2_value and arg3_value. Change all callers.
6668 (Trinary_cond::value): Set result alignment.
6669 (Max_expression::value, Min_expression::value): Likewise.
6670 (Align_expression::value): Likewise.
6671 * script-sections.cc (class Sections_element): Add dot_alignment
6672 parameter to set_section_addresses virtual function. Update
6673 instantiations.
6674 (class Output_section_element): Likewise.
6675 (Script_sections::create_segments): Add dot_alignment parameter.
6676 Change all callers.
6677 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6678 (Script_sections::set_phdrs_clause_addresses): Likewise.
6679 * script-sections.h: Update declarations.
6680 * script.h: Update declarations.
6681 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6682 min_p_align.
6683 * testsuite/script_test_3.t: Set large alignment.
6684 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6685 segment has expected alignment.
6686
9c9c98a5
NC
66872010-04-22 Nick Clifton <nickc@redhat.com>
6688
6689 * po/gold.pot: Updated by the Translation project.
6690 * po/vi.po: Updated Vietnamese translation.
6691
2253bfba
L
66922010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6693
6694 * testsuite/Makefile.am (check_PROGRAMS): Add
6695 icf_virtual_function_folding_test.
6696 * testsuite/Makefile.in: Regenerated.
6697
85fdf906
AH
66982010-04-15 Andrew Haley <aph@redhat.com>
6699
6700 * options.h (merge_exidx_entries): New option.
6701 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6702 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6703 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6704 (Target_arm::merge_exidx_entries): New function.
6705 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6706 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6707 to Arm_exidx_fixup constructor.
6708 Add new arg, merge_exidx_entries.
6709 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6710 Arm_output_section::fix_exidx_coverage.
6711
ce97fa81
ST
67122010-04-18 Sriraman Tallam <tmsriram@google.com>
6713
6714 * icf.cc (get_section_contents): Check for preemptible functions.
6715 Ignore addend when appropriate.
6716 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6717 section folded.
6718 (add_from_relobj): Check for section folded.
6719 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6720 * symtab.h (should_add_dynsym_entry): Add new parameter.
6721 * target-reloc.h (scan_relocs): Check for section folded.
6722 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6723 Check reloc types for function pointers in shared objects.
6724 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6725 case.
6726 (icf_preemptible_functions_test): New test case.
6727 (icf_string_merge_test): New test case.
6728 * testsuite.Makefile.in: Regenerate.
6729 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6730 bar_glob. Refactor code.
6731 * testsuite/icf_preemptible_functions_test.cc: New file.
6732 * testsuite/icf_preemptible_functions_test.sh: New file.
6733 * testsuite/icf_string_merge_test.cc: New file.
6734 * testsuite/icf_string_merge_test.sh: New file.
6735 * testsuite/icf_virtual_function_folding_test.cc: New file.
6736 * testsuite/icf_virtual_function_folding_test.sh: New file.
6737
04ceb17c
DK
67382010-04-14 Doug Kwan <dougkwan@google.com>
6739
6740 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6741 for local symbol recounting if we remove a section due to ICF.
6742 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6743 there are no regular objects in input.
6744
153e7da4
DK
67452010-04-13 Doug Kwan <dougkwan@google.com>
6746
6747 * arm.cc (Arm_input_section::set_final_data_size): Compute
6748 accurate final data size instead of using current data size.
6749
4dbd9faf
DK
67502010-04-09 Doug Kwan <dougkwan@google.com>
6751
6752 * layout.cc (Layout::choose_output_section): Handle script section
6753 types.
6754 (Layout::make_output_section_for_script): Add section type parameter.
6755 Handle script section types.
6756 * layout.h (Layout::make_output_section_for_script): Add section
6757 type parameter.
6758 * output.cc (Output_section::Output_section): Initialize data member
6759 is_noload_.
6760 (Output_section::do_reset_address_and_file_offset): Do not set address
6761 to 0 if section is a NOLOAD section.
6762 * output.h (Output_section::is_noload): New method.
6763 (Output_section::set_is_noload): Ditto.
6764 (Output_section::is_noload_): New data member.
6765 * script-c.h (Script_section_type): New enum type.
6766 (struct Parser_output_section_header): Add new file section_type.
6767 * script-sections.cc (Sections_element::output_section_name): Add
6768 parameter for returning script section type.
6769 (Output_section_definition::output_section_name): Ditto.
6770 (Output_section_definition::section_type)P; New method.
6771 (Output_section_definiton::script_section_type_name): Ditto.
6772 (Output_section_definition::script_section_type_): New data member.
6773 (Output_section_definition::Output_section_definition): Initialize
6774 data member Output_section_definition::script_section_type_.
6775 (Output_section_definition::create_sections): Pass script section type
6776 to Layout::make_output_section_for_script.
6777 (Output_section_definition::output_section_name): Return script
6778 section type to caller.
6779 (Output_section_definition::set_section_address): Do not advance
6780 dot value and load address if section type is NOLOAD. Set address
6781 of NOLOAD sections regardless of section flags.
6782 (Output_section_definition::print): Print section type if it is
6783 not SCRIPT_SECTION_TYPE_NONE.
6784 (Output_section_definition::section_type): New method.
6785 (Output_section_definition::script_section_type_name): Ditto.
6786 (Script_sections::output_section_name): Add new parameter
6787 PSECTION_TYPE for returning script section type. Pass it to
6788 section elements. Handle discard sections.
6789 (Sort_output_sections::operator()): Handle NOLOAD sections.
6790 * script-sections.h (Script_sections::Section_type): New enum type.
2e702c99 6791 (Script_sections::output_section_name): Add a new parameter for
4dbd9faf
DK
6792 returning script section type.
6793 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6794 INFO and NOLOAD.
6795 * yyscript.y (union): Add new field SECTION_TYPE.
6796 (COPY, DSECT, INFO, NOLOAD): New tokens.
6797 (opt_address_and_section_type): Change type to output_section_header.
6798 (section_type): New non-terminal
6799 (section_header): Handle section type.
2253bfba 6800 (opt_address_and_section_type): Return section type value.
4dbd9faf 6801
721ea635
L
68022010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6803
6804 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6805 * testsuite/plugin_common_test_2.c (foo): Likewise.
6806
6bf924b0
DK
68072010-04-08 Doug Kwan <dougkwan@google.com>
6808
6809 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6810 Output_merge_data.
6811 * output.cc (Output_section::add_merge_input_section): Simplify
6812 code and return status of Output_merge_base::add_input_section.
e1df38aa 6813 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
6814 returns true.
6815
24af6f92
DK
68162010-04-07 Doug Kwan <dougkwan@google.com>
6817
6818 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6819 if section is marked as containing instructions but has no mapping
6820 symbols.
6821 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6822 correct section index.
6823 (Arm_relobj::find_linked_text_section): Ditto.
6824
00698fc5
CC
68252010-04-07 Cary Coutant <ccoutant@google.com>
6826
6827 * archive.cc (include_member): Destroy Read_symbols_data object before
6828 releasing file.
6829 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6830 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6831 (Read_symbols_data::~Read_symbols_data) New destructor.
6832 (Section_relocs::Section_relocs) New constructor.
6833 (Section_relocs::~Section_relocs) New destructor.
6834 (Read_relocs_data::Read_relocs_data) New constructor.
6835 (Read_relocs_data::~Read_relocs_data) New destructor.
6836 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6837 pointers to NULL after deleting.
6838
7296d933
DK
68392010-04-07 Doug Kwan <dougkwan@google.com>
6840
6841 * arm.cc: Replace "endianity" with "endianness" in comments.
6842 (Arm_exidx_cantunwind): Ditto.
6843 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6844 (Arm_relobj::merge_flags_and_attributes): New method.
6845 (Arm_relobj::merge_flags_and_attributes_): New data member.
6846 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6847 (Arm_relobj::scan_sections_for_stubs): Ditto.
6848 (Arm_relobj::do_read_symbols): Check to see if we really want to
6849 merge processor-specific flags and attributes. Exit early if
6850 an object is empty except for section names and the undefined symbol.
6851 (Target_arm::do_finalize_sections): Move check for ELF format to
6852 Arm_relobj::do_read_symbols. Merge processor specific flags and
6853 attributes from a regular object only when we have determined that
6854 it is aapropriate. Do not create an .ARM.attributes section in
6855 output if there is no regular input object.
6856 (Target_arm::merge_processor_specific_flags): Check
6857 --warn-mismatch before printing any error.
6858 (Target_arm::merge_object_attributes): Ditto.
6859 * gold.cc (queue_middle_tasks): Handle the case in which there is
6860 no regular object in input.
6861 * options.cc (General_options::parse_EB): New method.
6862 (General_options::parse_EL): Same.
6863 (General_options::General_options): Initialize endianness_.
6864 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6865 New options.
6866 (General_options::Endianness): New enum.
6867 (General_options::endianness): New method.
6868 (General_options::endianness_): New data member.
6869 * parameters.cc (Parameters::set_options): Check target endianness.
6870 (Parameters::set_target_once): Ditto.
6871 (Parameters::check_target_endianness): New method.
6872 (parameters_force_valid_target): If either -EL or -EB is specified,
6873 use it to define endianness of default target.
6874 * parameters.h (Parameters::check_target_endianness): New method
6875 declaration.
6876 * target.h (class Target): Change "endianity" to "endianness"
6877 in comments.
6878
efc8d4f2
RW
68792010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6880
6881 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6882 * configure: Regenerate.
6883 * Makefile.in: Regenerate.
6884 * testsuite/Makefile.in: Regenerate.
6885
be234d88
CC
68862010-04-06 Cary Coutant <ccoutant@google.com>
6887
6888 gcc PR lto/42757
6889 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6890 prevailing definitions of common symbols.
6891 * testsuite/plugin_test_6.sh: New test case.
6892 * testsuite/plugin_common_test_1.c: New test case.
6893 * testsuite/plugin_common_test_2.c: New test case.
6894 * testsuite/Makefile.am (plugin_test_6): New test case.
6895 * testsuite/Makefile.in: Regenerate.
6896
bd32c6bd
NC
68972010-04-06 Nick Clifton <nickc@redhat.com>
6898
6899 * po/vi.po: New Vietnamese translation.
6900
323c532f
DK
69012010-03-30 Doug Kwan <dougkwan@google.com>
6902
6903 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6904
4fcd97eb
DK
69052010-03-25 Doug Kwan <dougkwan@google.com>
6906
6907 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6908 to avoid a conversion warning on a 32-bit host.
6909
4ebf39db
ILT
69102010-03-24 Ian Lance Taylor <iant@google.com>
6911
6912 * testsuite/script_test_3.t: Add a TLS segment.
6913 * testsuite/Makefile.am (check_PROGRAMS): Add
6914 tls_phdrs_script_test.
6915 (tls_phdrs_script_test_SOURCES): Define.
6916 (tls_phdrs_script_test_DEPENDENCIES): Define.
6917 (tls_phdrs_script_test_LDFLAGS): Define.
6918 (tls_phdrs_script_test_LDADD): Define.
6919 * testsuite/Makefile.in: Rebuild.
6920
4a599bdd
CC
69212010-03-23 Cary Coutant <ccoutant@google.com>
6922
6923 * fileread.cc (find_or_make_view): Fix comment.
6924
6c93b22c
ILT
69252010-03-23 Ian Lance Taylor <iant@google.com>
6926
6927 * script-sections.cc (class Orphan_section_placement): Define
6928 PLACE_TLS and PLACE_TLS_BSS.
6929 (Orphan_section_placement::Orphan_section_placement): Initialize
6930 new places.
6931 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6932 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6933 (tls_script_test_SOURCES): Define.
6934 (tls_script_test_DEPENDENCIES): Define.
6935 (tls_script_test_LDFLAGS): Define.
6936 (tls_script_test_LDADD): Define.
6937 * testsuite/Makefile.in: Rebuild.
6938
a2c7281b
DK
69392010-03-22 Doug Kwan <dougkwan@google.com>
6940
6941 * arm.cc (Arm_relocate_functions::abs8,
6942 Arm_relocate_functions::abs16): Use correct check for overflow
6943 specified in the ARM ELF specs.
6944 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6945 target of a BLX instruction specially.
6946 (Reloc_stub::stub_type_for_reloc): Ditto.
6947 (Relocate::relocate): Use symbolic names instead of numeric relocation
6948 codes to report error.
6949 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6950 workaround.
6951 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6952 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6953 thumb2_blx_out_of_range.stdout
6954 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6955 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6956 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6957 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6958 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6959 thumb2_blx_in_range, thumb2_blx_in_range.o,
6960 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6961 thumb2_blx_out_of_range.o): New rules.
2e702c99 6962 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
a2c7281b
DK
6963 thumb2_blx_in_range and thumb2_blx_out_of_range.
6964 * testsuite/Makefile.in: Regenerate.
6965 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6966 * testsuite/thumb_blx_in_range.s: New file.
6967 * testsuite/thumb_blx_out_of_range.s: New file.
6968
b0193076
RÁE
69692010-03-22 Rafael Espindola <espindola@google.com>
6970
6971 * archive.cc (Should_include): Move to archive.h.
6972 (should_include_member): Make it a member of Archive.
6973 (Lib_group): New.
6974 (Add_lib_group_symbols): New.
6975 * archive.h: Include options.h.
6976 (Archive_member): Moved from Archive.
6977 (Should_include): Moved from archive.cc.
6978 (Lib_group): New.
6979 (Add_lib_group_symbols): New.
6980 * dynobj.cc (do_should_include_member): New.
6981 * dynobj.h (do_should_include_member): New.
6982 * gold.cc (queue_initial_tasks): Update call to queue.
6983 * main.cc (main): Print lib group stats.
6984 * object.cc (do_should_include_member): New.
6985 * object.h: Include archive.h.
6986 (Object::should_include_member): New.
6987 (Object::do_should_include_member): New.
6988 (Sized_relobj::do_should_include_member): New.
6989 * options.cc (General_options::parse_start_lib): New.
6990 (General_options::parse_end_lib): New.
6991 (Input_arguments::add_file): Handle lib groups.
6992 (Input_arguments::start_group): Check we are not in a lib.
6993 (Input_arguments::start_lib): New.
6994 (Input_arguments::end_lib): New.
6995 * options.h (General_options): Add start_lib and end_lib.
6996 (Input_argument::lib_): New.
6997 (Input_argument::lib): New.
6998 (Input_argument::is_lib): New.
6999 (Input_file_lib): New.
7000 (Input_arguments::in_lib_): New.
7001 (Input_arguments::in_lib): New.
7002 (Input_arguments::start_lib): New.
7003 (Input_arguments::end_lib_): New.
7004 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7005 in unused members as preempted.
7006 (Sized_pluginobj::do_should_include_member): New.
7007 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7008 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7009 return the blocker.
7010 (Read_symbols::do_whole_lib_group): New.
7011 (Read_symbols::do_lib_group): New.
7012 (Read_symbols::do_read_symbols): Handle lib groups.
7013 (Read_symbols::get_name): Handle lib groups.
7014 * readsyms.h (Read_symbols): Add an archive member pointer.
7015 (Read_symbols::do_whole_lib_group): New.
7016 (Read_symbols::do_lib_group): New.
7017 (Read_symbols::member_): New.
7018 * script.cc (read_input_script): Update call to queue_soon.
7019
d099120c
DK
70202010-03-19 Doug Kwan <dougkwan@google.com>
7021
7022 * arm.cc (Stub_table::Stub_table): Initialize new data members
7023 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7024 (Stub_table::add_reloc_stub): Assign stub offset and update
7025 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7026 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7027 New data members.
2e702c99 7028 (Stub_table::update_data_size_and_addralign): Use
d099120c
DK
7029 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7030 instead of going over all reloc stubs.
2e702c99 7031 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
d099120c
DK
7032 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7033 Stringpool_template::offset_ to size of Stringpool_char.
2e702c99 7034 (Stringpool_template::new_key_offset): Remove code to initialize
d099120c
DK
7035 Stringpool_template::offset_.
7036 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7037 Stringpool_template::offset_ to zero.
7038
1aa37384
DK
70392010-03-15 Doug Kwan <dougkwan@google.com>
7040
7041 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7042 offset_.
7043 (Stringpool_template::new_key_offset): New method.
7044 (Stringpool_template::add_string): Assign offsets when adding new
7045 strings.
7046 (Stringpool_template::set_string_offsets): Do not set string offsets
7047 when not optimizing.
7048 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7049 member size_.
2e702c99
RM
7050 (Chunked_vector::clear): Clear size_.
7051 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7052 (Chunked_vector::size): Return size_.
7053 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 7054 (Chunked_vector::size_): New data member.
1aa37384
DK
7055 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7056 (Stringpool_template::new_key_offset): New method declaration.
7057 (Stringpool_template::offset_): New data member.
7058
b672b057
RÁE
70592010-03-15 Rafael Espindola <espindola@google.com>
7060
7061 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7062 Add_symbols' constructor.
7063 * readsyms.h (Add_symbols): Remove the input_group member.
7064
b6848d3c
ILT
70652010-03-10 Ian Lance Taylor <iant@google.com>
7066
7067 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7068 target to ask whether a reference to a symbol requires a stack
7069 split.
7070 * target.h (Target::is_call_to_non_split): New function.
7071 (Target::do_is_call_to_non_split): Declare virtual function.
7072 * target.cc: Include "symtab.h".
7073 (Target::do_is_call_to_non_split): New function.
7074 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7075
a2a5469e
CC
70762010-03-10 Cary Coutant <ccoutant@google.com>
7077
7078 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7079 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7080 (File_read::open[2]): Add whole_file_view_ to list of views.
7081 (File_read::make_view): Remove test of whole_file_view_.
7082 (File_read::find_or_make_view): Create whole_file_view_ if
7083 necessary.
7084 (File_read::clear_views): Replace bool parameter with enum;
7085 adjust all callers. Don't delete views with permanent data;
7086 do delete cached views and views from archives if
7087 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7088 if clearing the corresponding view.
7089 * fileread.h (File_read::Clear_views_mode): New enum.
7090 (File_read::View::is_permanent_view): New method.
7091 (File_read::clear_views): Replace bool parameter
7092 with enum; adjust all callers.
7093 * options.h (General_options): Change keep_files_mapped option;
7094 add map_whole_files.
7095 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7096 releasing the file.
7097 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7098 the file.
7099
8861f32b
DM
71002010-03-10 David S. Miller <davem@davemloft.net>
7101
7102 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7103
d62d0f5f
ST
71042010-03-09 Sriraman Tallam <tmsriram@google.com>
7105
7106 * icf.cc (get_section_contents): Add '@' marker after processing the
7107 merge reloc.
7108
9177756d
DK
71092010-03-08 Doug Kwan <dougkwan@google.com>
7110
7111 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7112 due to a conversion warning.
7113 (Arm_relobj::update_output_local_symbol_count): Check for local
7114 symbol with unset output index.
7115
9e9e071b
ILT
71162010-03-05 Ian Lance Taylor <iant@google.com>
7117
7118 * options.h (class General_options): Add --spare-dynamic-tags.
7119 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7120 --spare-dynamic-tags.
7121
a81ee015
ILT
71222010-03-05 Ian Lance Taylor <iant@google.com>
7123
7124 * incremental.cc: Include "libiberty.h".
7125
44ec90b9
RO
71262010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7127
7128 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7129 function, is_info_ member.
7130 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7131 (Versions::Versions): Update caller.
7132 (Versions::define_base_version): Likewise.
7133 (Versions::add_def): Likewise.
7134
0897ed3b
ST
71352010-03-03 Sriraman Tallam <tmsriram@google.com>
7136
7137 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7138 (Scan::possible_function_pointer_reloc): New function.
7139 (Scan::local_reloc_may_be_function_pointer): Change to call
7140 possible_function_pointer_reloc.
7141 (Scan::global_reloc_may_be_function_pointer): Ditto.
7142 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7143 relocations in ".data.rel.ro._ZTV" section.
7144 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7145 * testsuite/icf_safe_so_test.cc: Ditto.
7146 * testsuite/icf_safe_test.cc: Ditto.
7147 * testsuite/icf_safe_test.sh: Ditto.
7148
d3bbad62
ILT
71492010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7150 Ian Lance Taylor <iant@google.com>
7151
7152 * target-reloc.h (relocate_section): Check the symbol table index
7153 for -1U before setting the local symbol index.
7154 (scan_relocatable_relocs): If copying the relocation, record that
7155 the local symbol is required.
7156 * object.h (Symbol_value::is_output_symtab_index_set): New
7157 function.
7158 (Symbol_value::may_be_discarded_from_output_symtab): New
7159 function.
7160 (Symbol_value::has_output_symtab_entry): New function.
7161 (Symbol_value::needs_output_symtab_entry): Remove.
7162 (Symbol_value::output_symtab_index): Make sure the symbol index is
7163 set.
7164 (Symbol_value::set_output_symtab_index): Make sure the symbol
7165 index is not set. Make sure the new index is valid.
7166 (Symbol_value::set_must_have_output_symtab_entry): New function.
7167 (Symbol_value::has_output_dynsym_entry): New function.
7168 (Symbol_value::set_output_dynsym_index): Make sure the new index
7169 is valid.
7170 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7171 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7172 local symbol if permitted.
7173 (Sized_relobj::do_finalize_local_symbols): Call
7174 is_output_symtab_index_set rather than needs_output_symtab_entry.
7175 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7176 rather than needs_output_symtab_entry. Call
7177 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7178 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7179 is_output_symtab_index_set rather than needs_output_symtab_entry.
7180 * testsuite/discard_locals_relocatable_test.c: New file.
7181 * testsuite/discard_locals_test.sh: Test -r.
7182 * testsuite/Makefile.am (check_DATA): Add
7183 discard_locals_relocatable_test1.syms,
7184 discard_local_relocatable_test2.syms.
7185 (MOSTLYCLEANFILES): Likewise. Also add
7186 discard_locals_relocatable_test1.lout and
7187 discard_locals_relocatable_test2.out.
7188 (discard_locals_relocatable_test1.syms): New target.
7189 (discard_locals_relocatable_test.o): New target.
7190 (discard_locals_relocatable_test1.out): New target.
7191 (discard_locals_relocatable_test2.syms): New target.
7192 (discard_locals_relocatable_test2.out): New target.
7193 (various): Add missing ../ld-new dependencies.
7194 * testsuite/Makefile.in: Rebuild.
7195
7e8ccf26
NC
71962010-03-03 Nick Clifton <nickc@redhat.com>
7197
7198 * po/fi.po: New Finnish translation.
7199
2a0ff005
DK
72002010-03-01 Doug Kwan <dougkwan@google.com>
7201
7202 * layout.cc (Layout::Layout): Force section types of .init_array*,
7203 .preinit_array* and .fini_array* sections.
7204 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7205 Fix check of return value of std::string::find.().
7206 (Output_section::Input_section_sort_compare::operator()): Remove
7207 comment about .init_array.
7208 (Output_section::Input_section_sort_init_fini_compare::operator()):
7209 New method.
7210 (Output_section::sort_attached_input_sections): Handle .init_array
7211 and .fini_array specially.
7212 * output.h (Output_section::Inut_section_sort_compare): Update
7213 comment.
7214 (Output_section::Input_section_sort_init_fini_compare): New struct.
7215
c3e4ae29
DK
72162010-02-26 Doug Kwan <dougkwan@google.com>
7217
7218 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7219 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7220 * testsuite/debug_msg.sh: Avoid matching source line number for
7221 use of global variable undef_int.
7222
2fd9ae7a
DK
72232010-02-26 Doug Kwan <dougkwan@google.com>
7224
7225 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7226 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7227 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7228 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7229 * options.cc (General_options::General_options): Initialize member
7230 fix_v4bx_.
7231 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7232 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7233 and rm_no_fix_v4bx.stdout
7234 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7235 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7236 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7237 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7238 and arm_no_fix_v4bx.
7239 * Makefile.in: Regenerate.
7240 * testsuite/arm_fix_v4bx.s: New file.
7241 * testsuite/arm_fix_v4bx.sh: Ditto.
7242
67ec7d0b
DK
72432010-02-24 Doug Kwan <dougkwan@google.com>
7244
7245 * arm.cc (Target_arm::got_section): Make the .got section the first
7246 non RELRO section in the data segment.
7247 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7248 suffixes of section names.
7249
10165461
DK
72502010-02-24 Doug Kwan <dougkwan@google.com>
7251
7252 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7253 flags and attributes merging if an input file is a binary file.
7254 * fileread.cc (Input_file::open): Record format of original file.
7255 * fileread.h (Input_file::Format): New enum type.
2e702c99 7256 (Input_file::Input_file): Initialize data member format_.
10165461
DK
7257 (Input_file::format): New method definition.
7258 (Input_file::format_):: New data member.
7259
4a54abbb
DK
72602010-02-24 Doug Kwan <dougkwan@google.com>
7261
7262 * arm.cc (Arm_output_data_got): New class.
7263 (ARM_TCB_SIZE): New constant
7264 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7265 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7266 If user uses a script with a SECTIONS clause, issue only a warning
7267 for a misplaced EXIDX input section. Otherwise, issue an error.
2e702c99 7268 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4a54abbb
DK
7269 garbage collection.
7270 (Target_arm::got_mode_index_entry): Handle static linking.
7271 (Target_arm::Scan::local): Ditto.
7272 (Target_arm::Scan::global): Ditto.
7273 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7274 all incorrectly implemented relocations.
e1df38aa 7275 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
7276 Arm_output_section::fix_exidx_coverage.
7277 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7278 from ".ARM.exidx." and ".ARM.extab.".
7279
ca419a6f
ILT
72802010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7281
7282 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7283 section if it does not already exist.
7284 * attributes.cc (Attributes_section_data::Attributes_section_data):
7285 Don't crash if size is zero.
7286
135b9c78
ILT
72872010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7288 Ian Lance Taylor <iant@google.com>
7289
7290 * gold.cc (queue_middle_tasks): If no input files were opened,
7291 exit.
7292 * workqueue.h (Task_function::Task_function): Assert that there is
7293 a blocker.
7294
bb0bfe4f
DK
72952010-02-22 Doug Kwan <dougkwan@google.com>
7296
7297 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7298 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7299 types to avoid warnings due to different uint64_t implementations
7300 on different hosts.
7301
2a2b6d42
DK
73022010-02-21 Doug Kwan <dougkwan@google.com>
7303
7304 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7305 handling of the maximum backward branch offset.
2e702c99 7306 (Arm_relocate_functions::thumb_branch_common): Ditto.
2a2b6d42
DK
7307 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7308 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 7309 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
7310 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7311 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7312 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7313 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7314 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7315 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7316 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7317 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7318 thumb2_bl_out_of_range.o): New rules.
7319 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7320 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7321 thumb2_bl_out_of_range
7322 * testsuite/Makefile.in: Regenerate.
7323 * testsuite/arm_bl_in_range.s: New file.
7324 * testsuite/arm_bl_out_of_range.s: Ditto.
7325 * testsuite/arm_branch_in_range.sh: Ditto.
7326 * testsuite/arm_branch_range.t: Ditto.
7327 * testsuite/thumb2_branch_range.t: Ditto.
7328 * testsuite/thumb_bl_in_range.s: Ditto.
7329 * testsuite/thumb_bl_out_of_range.s: Ditto.
7330 * testsuite/thumb_branch_range.t: Ditto.
7331
b487ad64
ST
73322010-02-20 Sriraman Tallam <tmsriram@google.com>
7333
7334 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7335 Add reloc offset information.
7336 * icf.cc (get_section_contents): Change iterators to point to the new
7337 vectors. Add reloc offset information to the contents.
7338 * icf.h (Icf::Sections_reachable_info): New typedef.
7339 (Icf::Sections_reachable_list): New typedef.
7340 (Icf::Offset_info): New typedef.
7341 (Icf::Reloc_info): New struct typedef.
7342 (Icf::Reloc_info_list): New typedef.
7343 (Icf::symbol_reloc_list): Delete method.
7344 (Icf::addend_reloc_list): Delete method.
7345 (Icf::section_reloc_list): Delete method.
7346 (Icf::reloc_info_list): New method.
7347 (Icf::reloc_info_list_): New member.
7348
f96accdf
DK
73492010-02-19 Doug Kwan <dougkwan@google.com>
7350
7351 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7352 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7353 * arm.cc (Arm_relocation_functions): New forward declaration.
7354 (Target_arm::Target_arm): Initialize new data members
7355 got_mod_index_offset_ and tls_base_symbol_defined_.
7356 (Target_arm::Relocate::relocate_tls): New method.
7357 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7358 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7359 New methods.
2e702c99 7360 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
f96accdf
DK
7361 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7362 (Target_arm::got_mod_index_offset_,
7363 Target_arm::tls_base_symbol_defined_): New data members.
7364 (Target_arm::Scan::local, Target::Scan::global,
7365 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7366 relocations.
7367
c8761b9a
DK
73682010-02-18 Doug Kwan <dougkwan@google.com>
7369
7370 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7371 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7372 text section as a parameter becuase some broken tools may not set
7373 the link in section header.
7374 (Target_arm::has_got_section): New method.
7375 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7376 without any mapping symbol as data only. Remove warning.
7377 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7378 link in its section header, try to discover the link by inspecting the
7379 REL31 relocation at the beginning of the section.
7380 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7381 in error message.
7382 (Target_arm::Scan::global): Treat any reference to the symbol
7383 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7384
21bb3914
ST
73852010-02-12 Sriraman Tallam <tmsriram@google.com>
7386
7387 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7388 (Scan::global_reloc_may_be_function_pointer): New function.
7389 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7390 (Scan::global_reloc_may_be_function_pointer): New function.
7391 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7392 (Scan::global_reloc_may_be_function_pointer): New function.
7393 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7394 (Scan::global_reloc_may_be_function_pointer): New function.
7395 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7396 (Scan::global_reloc_may_be_function_pointer): New function.
7397 (Scan::possible_function_pointer_reloc): New function.
7398 (Target_x86_64::can_check_for_function_pointers): New function.
7399 * gc.h (gc_process_relocs): Scan relocation types to determine if
7400 function pointers were taken for targets that support it.
7401 * icf.cc (Icf::find_identical_sections): Include functions for
7402 folding in safe ICF whose pointer is not taken.
7403 * icf.h (Secn_fptr_taken_set): New typedef.
7404 (fptr_section_id_): New member.
7405 (section_has_function_pointers): New function.
7406 (set_section_has_function_pointers): New function.
7407 (check_section_for_function_pointers): New function.
7408 * options.h: Fix comment for safe ICF option.
7409 * target.h (can_check_for_function_pointers): New function.
7410 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7411 Modify icf_safe_test for X86-64.
7412 * testsuite/Makefile.in: Regenerate.
7413 * testsuite/icf_safe_so_test.cc: New file.
7414 * testsuite/icf_safe_so_test.sh: New file.
7415 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7416 (main): Change to take pointer to function kept_func_3.
7417 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7418 folding is done correctly for X86-64.
7419
0da6fa6c
DM
74202010-02-12 David S. Miller <davem@davemloft.net>
7421
7422 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7423 is_symbolless parameter.
7424 (Output_reloc<SHT_REL>::is_symbolless): New.
7425 (Output_reloc<SHT_REL>::is_symbolless_): New.
7426 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7427 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7428 (Output_reloc<SHT_RELA>::is_symbolless): New.
7429 (Output_data_reloc::add_global): Handle is_symbolless.
7430 (Output_data_reloc::add_global_relative): Likewise.
7431 (Output_data_reloc::add_local): Likewise.
7432 (Output_data_reloc::add_local_relative): Likewise.
7433 (Output_data_reloc::add_symbolless_global_addend): New.
7434 (Output_data_reloc::add_symbolless_local_addend): New.
7435 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7436 is_symbolless.
7437 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7438 instead of ->is_relative_
7439 (Output_reloc::write): Likewise.
7440 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7441 (Output_reloc::write_rel): Simplify.
7442
7443 * sparc.cc (Target_sparc::Scan::local): Use
7444 ->add_symbolless_local_addend as needed.
7445 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7446 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7447 based upon relocation offset.
7448
e4782e83
DK
74492010-02-11 Doug Kwan <dougkwan@google.com>
7450
7451 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7452 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7453 beginning of function.
7454 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7455 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7456 parameter is_32bit in calls to should_apply_static_reloc.
7457 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7458 (check_DATA): Add arm_abs_global.stdout.
7459 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7460 arm_abs_global.stdout): New rules.
7461 (MOSTLLYCLEANFILES): Add arm_abs_global
7462 * Makefile.in: Regenerate.
7463 * testsuite/arm_abs_global.s: New file.
7464 * testsuite/arm_abs_global.sh: Ditto.
7465 * testsuite/arm_abs_lib.s: Ditto.
7466
93ceb764
ILT
74672010-02-11 Ian Lance Taylor <iant@google.com>
7468
7469 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7470 Read_relocs task.
7471 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7472 Allocate_commons_task first.
7473 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7474 task, rather than symtab_lock_.
7475 (Gc_process_relocs::~Gc_process_relocs): New function.
7476 (Gc_process_relocs::is_runnable): Check this_blocker_.
7477 (Gc_process_relocs::locks): Use next_blocker_ rather than
7478 blocker_.
7479 (Scan_relocs::~Scan_relocs): New function.
7480 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7481 symtab_lock_.
7482 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7483 next_blocker_.
7484 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7485 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7486 constructor accordingly.
7487 (class Gc_process_relocs): Likewise.
7488 (class Scan_relocs): Likewise.
7489 * common.h (class Allocate_commons_task): Remove symtab_lock_
7490 field, and corresponding constructor parameter.
7491 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7492 symtab_lock_.
7493 (Allocate_commons_task::locks): Likewise.
7494
114dfbe1
ILT
74952010-02-11 Ian Lance Taylor <iant@google.com>
7496
7497 * gold-threads.h (class Once): Define.
7498 (class Initialize_lock): Rewrite as child of Once.
7499 * gold-threads.cc (class Once_initialize): Define.
7500 (once_pointer_control): New static variable.
7501 (once_pointer, once_arg): New static variables.
7502 (c_run_once): New static function.
7503 (Once::Once, Once::run_once, Once::internal_run): New functions.
7504 (class Initialize_lock_once): Remove.
7505 (initialize_lock_control): Remove.
7506 (initialize_lock_pointer): Remove.
7507 (initialize_lock_once): Remove.
7508 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7509 (Initialize_lock::initialize): Rewrite.
7510 (Initialize_lock::do_run_once): New function.
7511 * archive.cc (Archive::interpret_header): Only clear name if it is
7512 not already empty.
7513 * fileread.cc: Include "gold-threads.h"
7514 (file_counts_lock): New static variable.
7515 (file_counts_initialize_lock): Likewise.
7516 (File_read::release): Only increment counts when using --stats.
7517 Use a lock around the increment.
7518 * parameters.cc (class Set_parameters_target_once): Define.
7519 (set_parameters_target_once): New static variable.
7520 (Parameters::Parameters): Move here from parameters.h.
7521 (Parameters::set_target): Rewrite.
7522 (Parameters::set_target_once): New function.
7523 (Parameters::clear_target): Move here and rewrite.
7524 * parameters.h (class Parameters): Update declarations. Add
7525 set_parameters_target_once_ field.
7526 (Parameters::Parameters): Move to parameters.cc.
7527 (Parameters::clear_target): Likewise.
7528 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7529 task.
7530 (Start_group::~Start_group): New function.
7531 (Start_group::is_runnable): New function.
7532 (Start_group::locks, Start_group::run): New functions.
7533 (Finish_group::run): Change saw_undefined to size_t.
7534 * readsyms.h (class Start_group): Define.
7535 (class Finish_group): Change saw_undefined_ field to size_t.
7536 (Finish_group::Finish_group): Remove saw_undefined and
7537 this_blocker parameters. Change all callers.
7538 (Finish_group::set_saw_undefined): New function.
7539 (Finish_group::set_blocker): New function.
7540 * symtab.h (class Symbol_table): Change saw_undefined to return
7541 size_t. Change saw_undefined_ field to size_t.
7542 * target-select.cc (Set_target_once::do_run_once): New function.
7543 (Target_selector::Target_selector): Initialize set_target_once_
7544 field. Don't initialize lock_ and initialize_lock_ fields.
7545 (Target_selector::instantiate_target): Rewrite.
7546 (Target_selector::set_target): New function.
7547 * target-select.h (class Set_target_once): Define.
7548 (class Target_selector): Update declarations. Make
7549 Set_target_once a friend. Remove lock_ and initialize_lock_
7550 fields. Add set_target_once_ field.
7551
fa17a3f4
ILT
75522010-02-10 Ian Lance Taylor <iant@google.com>
7553
7554 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7555 queueing any tasks.
7556 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7557 (queue_middle_tasks): Add all blockers before queueing any tasks.
7558 (queue_final_tasks): Likewise.
7559 * token.h (Task_token::add_blockers): New function.
7560 * object.h (Input_objects::number_of_relobjs): New function.
7561
c7177d31
ILT
75622010-02-10 Ian Lance Taylor <iant@google.com>
7563
5de0e392
ILT
7564 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7565 shared, not if not position independent.
7566 * x86_64.cc (Relocate::relocate_tls): Likewise.
7567 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7568 (tls_pie_pic_test): New target.
7569 * testsuite/Makefile.in: Rebuild.
7570
c7177d31
ILT
7571 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7572 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7573 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7574 * testsuite/Makefile.in: Rebuild.
7575
684b268a
DM
75762010-02-09 David S. Miller <davem@davemloft.net>
7577
7578 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7579 R_SPARC_RELATIVE using ->add_local_relative().
7580 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7581
612a8d3d
DM
7582 * output.h (Output_data_dynamic::add_section_size): New method
7583 that takes two Output_data objects.
7584 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7585 entry param. Handle it in initializers.
7586 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7587 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7588 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7589 arg.
7590 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7591 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7592 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7593 for dynrel_includes_plt.
7594 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7595 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7596 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7597 before .rela.plt
7598 (Target_sparc::do_finalize_sections): Update to pass true for
7599 dynrel_includes_plt.
7600 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7601 output before .rela.plt
7602 (Target_powerpc::do_finalize_sections): Update to pass true for
7603 dynrel_includes_plt when 32-bit.
7604
cb1be87e
DK
76052010-02-08 Doug Kwan <dougkwan@google.com>
7606
7607 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7608 method.
7609 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7610 Arm_relobj::scan_section_for_cortex_a8_stubs,
7611 Arm_relobj::do_relocation_section): Instead of calling
7612 Output_section::output_address, use faster
7613 Arm_relobj::simple_input_section_output_address.
7614
705b5121
DM
76152010-02-08 David S. Miller <davem@davemloft.net>
7616
7617 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7618 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7619 relocation helper function.
7620
024c4466
DM
7621 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7622 just like R_SPARC_GOT{10,13,22}.
7623 (Target_sparc::Scan::local): Likewise.
7624 (Target_sparc::Relocate:relocate): Likewise.
7625
9109c078
ILT
76262010-02-06 Ian Lance Taylor <iant@google.com>
7627
7628 * configure.ac: Rewrite targetobjs duplicate removal code to use
7629 only shell constructs.
7630 * configure: Rebuild.
7631
cf846138
DK
76322010-02-05 Doug Kwan <dougkwan@google.com>
7633
7634 PR 11247
7635 * arm.cc (Arm_relobj::section_is_scannable): New method.
7636 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7637 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7638
6cfaf60b
DK
76392010-02-04 Doug Kwan <dougkwan@google.com>
7640
7641 PR 11247
7642 * arm-reloc-property.cc (cstdio): Include.
7643 * configure.ac (targetobjs): Remove duplicates.
7644 * configure: Regenerate.
7645 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7646 big and little endian version for a given address size.
7647
5c57f1be
DK
76482010-02-03 Doug Kwan <dougkwan@google.com>
7649
7650 * arm-reloc-property.cc
7651 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7652 definition.
7653 * arm-reloc-property.h
7654 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7655 New method definition.
7656 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7657 declaration.
7658 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7659 overflow to N.
7660 (GOT_PREL): Change implemented to Y.
7661 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7662 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7663 (Arm_relocate_functions::movw_abs_nc): Remove method.
7664 (Arm_relocate_functions::movt_abs): Ditto.
7665 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7666 (Arm_relocate_functions::thm_movt_abs): Ditto.
7667 (Arm_relocate_functions::movw_rel_nc): Ditto.
7668 (Arm_relocate_functions::movw_rel): Ditto.
7669 (Arm_relocate_functions::movt_rel): Ditto.
7670 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7671 (Arm_relocate_functions:thm_movw_rel): Ditto.
7672 (Arm_relocate_functions:thm_movt_rel): Ditto.
7673 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7674 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7675 New method definitions.
7676 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7677 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7678 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7679 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7680 (Target_arm::Relocate::relocate): Check for non-static or
7681 unimplemented relocation code and exit early. Change calls to
7682 Target_arm::reloc_uses_thumb_bit and
7683 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7684 instead. Refactor code to handle similar relocations to increase
7685 code sharing. Remove check for unsupported relocation code in switch
7686 statement.
7687 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7688 relocation property table to find out size. Change error message to
7689 print out the name of a relocation code instead of the numeric value.
7690 (Target_arm::scan_reloc_for_stub): Use relocation property table
7691 instead of calling Target_arm::reloc_uses_thumb_bit().
7692
218c5831
DK
76932010-02-02 Doug Kwan <dougkwan@google.com>
7694
7695 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7696 types of relaxed input section.
7697
0d31c79d
DK
76982010-02-02 Doug Kwan <dougkwan@google.com>
7699
7700 * Makefile.am (HFILES): Add arm-reloc-property.h.
7701 (DEFFILES): New.
2e702c99
RM
7702 (TARGETSOURCES): Add arm-reloc-property.cc
7703 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
0d31c79d
DK
7704 (libgold_a_SOURCES): $(DEFFILES)
7705 * Makefile.in: Regenerate.
7706 * arm-reloc-property.cc: New file.
7707 * arm-reloc-property.h: New file.
7708 * arm-reloc.def: New file.
7709 * arm.cc: Update comments.
7710 (arm-reloc-property.h): New included header.
7711 (arm_reloc_property_table): New global variable.
7712 (Target_arm::do_select_as_default_target): New method definition.
7713 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7714 arm-reloc-property to targ_extra_obj.
7715 * parameters.cc (set_parameters_target): Call
7716 Target::select_as_default_target().
7717 * target.h (Target::select_as_default_target): New method definition.
7718 (Target::do_select_as_default_target): Same.
7719
546c7457
DK
77202010-02-01 Doug Kwan <dougkwan@google.com>
7721
7722 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7723 first_output_text_section_.
7724 (Arm_exidx_fixup::first_output_text_section): New method definition.
7725 (Arm_exidx_fixup::first_output_text_section_): New data member.
7726 (Arm_exidx_fixup::process_exidx_section): Record the first text
7727 output section seen.
7728 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7729 and entsize in output section header.
7730
11b861d5
DK
77312010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7732
7733 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7734 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7735 (Arm_relocate_functions::thm_alu11): New Method.
7736 (Arm_relocate_functions::thm_pc8): New Method.
7737 (Arm_relocate_functions::thm_pc12): New Method.
7738 (Target_arm::Scan::local): Handle the relocations.
7739 (Target_arm::Scan::global): Likewise.
7740 (Target_arm::Relocate::relocate): Likewise.
7741 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7742
c9a2c125
DK
77432010-01-29 Doug Kwan <dougkwan@google.com>
7744
7745 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7746 of relocation types as ld.
7747
1521477a
DK
77482010-01-29 Doug Kwan <dougkwan@google.com>
7749
7750 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7751 to public.
7752 (Arm_relocate_functions::thumb_branch_common): Ditto.
7753 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7754 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7755 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7756 Arm_relocate_functions::jump24): Remove.
7757 (Target_arm::Relocate::relocate): Adjust code to call
7758 Arm_relocation_functions::arm_branch_common and
7759 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 7760 wrappers. Merge switch-cases together to reduce source code size.
1521477a 7761
e7eca48c
DK
77622010-01-29 Doug Kwan <dougkwan@google.com>
7763
7764 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7765 output_local_symbol_count_needs_update_.
7766 (Arm_relobj::output_local_symbol_count_needs_update,
7767 Arm_relobj::set_output_local_symbol_count_needs_update,
7768 Arm_relobj::update_output_local_symbol_count): New methods.
7769 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7770 member.
7771 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7772 of pointed function as in a R_ARM_PREL31 relocation.
7773 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7774 for output local symbol count updating.
7775 (Target_arm::do_relax): Update output local symbol counts in objects
7776 if necessary.
7777 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7778
02961d7e
ILT
77792010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7780
7781 * arm.cc: Added support for the ARM relocations:
7782 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7783 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7784 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7785 movw_prel_nc).
7786 (Arm_relocate_functions::movw_rel): New method.
7787 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7788 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7789 thm_movw_prel_nc).
7790 (Arm_relocate_functions::thm_movw_rel): New method.
7791 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7792 thm_movt_prel).
7793 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7794 relocations.
7795 (Target_arm::Scan::global): Likewise.
7796 (Target_arm::Relocate::relocate): Likewise.
7797 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7798 Likewise.
7799
b10d2873
ILT
78002010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7801
7802 * arm.cc: Added support for ARM group relocations.
7803 (Target_arm::reloc_needs_sym_origin): New method.
7804 (Arm_relocate_functions::calc_grp_kn): New method.
7805 (Arm_relocate_functions::calc_grp_residual): New method.
7806 (Arm_relocate_functions::calc_grp_gn): New method.
7807 (Arm_relocate_functions::arm_grp_alu): New Method.
7808 (Arm_relocate_functions::arm_grp_ldr): New Method.
7809 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7810 (Arm_relocate_functions::arm_grp_ldc): New Method.
7811 (Target_arm::Scan::local): Handle the ARM group relocations.
7812 (Target_arm::Scan::global): Likewise.
7813 (Target_arm::Relocate::relocate): Likewise.
7814 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7815 Likewise.
7816
2b328d4e
DK
78172010-01-26 Doug Kwan <dougkwan@google.com>
7818
7819 * arm.cc (set): Include.
7820 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7821 pointer type.
2e702c99 7822 (Arm_output_section::Text_section_list): New type.
2b328d4e
DK
7823 (Arm_output_section::append_text_sections_to_list): New method.
7824 (Arm_output_section::fix_exidx_coverage): Ditto.
7825 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2e702c99 7826 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2b328d4e
DK
7827 Relobj::set_section_offset() instead of
7828 Sized_relobj::invalidate_section_offset().
2e702c99 7829 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2b328d4e
DK
7830 parameter for section headers. Ignore relocation sections for
7831 unallocated sections and EXIDX sections.
7832 (Target_arm::fix_exidx_coverage): New method.
7833 (Target_arm::output_section_address_less_than): New type.
7834 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7835 linked text section instead of the EXIDX section.
7836 (Arm_output_section::create_stub_group): Add an assertion to check
7837 that this is not an EXIDX output section.
7838 (Arm_output_section::append_text_sections_to_list): New method.
7839 (Arm_output_section::fix_exidx_coverage): Ditto.
7840 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2e702c99 7841 Arm_relobj::section_needs_reloc_stub_scanning.
2b328d4e
DK
7842 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7843 first pass.
7844 (Target_arm::fix_exidx_coverage): New method.
7845 * object.h (Relobj::set_output_section): New method.
7846 (Sized_relobj::invalidate_section_offset): Remove method.
7847 (Sized_relobj::do_invalidate_section_offset): Remove method.
7848 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7849
c7f3c371
DK
78502010-01-25 Doug Kwan <dougkwan@google.com>
7851
7852 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7853 Fix warning due to signed and unsigned comparison on a 32-bit host.
7854
8923b24c
DK
78552010-01-22 Doug Kwan <dougkwan@google.com>
7856
7857 * arm.cc (Target_arm::do_relax): Record an output section for section
7858 offset adjustment it contains any stub table that has changed.
7859 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7860 offsets in an output section if necessary.
7861 * output.cc (Output_section::Output_section): Initialize
7862 section_offsets_need_adjustments_.
7863 (Output_section::add_input_section_for_script): Renamed to
7864 Output_section::add_simple_input_section.
7865 (Output_section::save_states): Add a comment.
7866 (Output_section::discard_states): New method defintion.
7867 (Output_section::adjust_section_offsets): Same.
7868 * output.h (Output_section::add_input_section_for_script): Renamed to
7869 Output_section::add_simple_input_section.
7870 (Output_section::discard_states): New method declaration.
7871 (Output_section::adjust_section_offsets): Same.
7872 (Output_section::section_offsets_need_adjustment,
7873 Output_section::set_section_offsets_need_adjustment): New method
7874 definitions.
7875 (Output_section::section_offsets_need_adjustment_): New data member.
7876 * script-sections.cc
7877 (Output_section_element_input::set_section_address): Adjust code for
7878 renaming of Output_section::add_input_section_for_script.
7879 (Orphan_output_section::set_section_address): Same.
7880
9b2fd367
DK
78812010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7882
7883 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7884 Fix_v4bx enum values .
7885 * gold/options.h (General_options): New option definitions.
7886 (General_options::fix_v4bx): New method.
7887 (General_options::Fix_v4bx): New enum.
7888 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7889 (General_options::parse_fix_v4bx_interworking): New method.
7890
80d0d023
DK
78912010-01-22 Doug Kwan <dougkwan@google.com>
7892
7893 * arm.cc (Arm_exidx_fixup): New class.
7894
af2cdeae
DK
78952010-01-21 Doug Kwan <dougkwan@google.com>
7896
7897 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7898 classes.
7899 (Arm_exidx_section_offset_map): New type.
7900
993d07c1
DK
79012010-01-21 Doug Kwan <dougkwan@google.com>
7902
7903 * arm.cc (Arm_exidx_input_section): New class.
7904 (Arm_relobj::exidx_input_section_by_link,
7905 Arm_relobj::exidx_input_section_by_shndx,
7906 Arm_relobj::make_exidx_input_section): New methods.
7907 (read_arm_attributes_section): Remove.
7908 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7909 information about them.
7910 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7911 to here.
7912
5ac169d4
DK
79132010-01-20 Doug Kwan <dougkwan@google.com>
7914
7915 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7916 Input_section_specifier to Section_id.
7917 (Target_arm::new_arm_input_section: Adjust code for change of key
7918 type.
7919 (Target_arm::find_arm_input_section): Ditto.
7920 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7921 (Section_id): Remove.
7922 (Garbage_collection::Section_id_hash): Remove.
7923 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7924 (Section_id): Remove.
7925 (Icf::Section_id_hash): Remove.
7926 * object.h (Section_id, Const_section_id, Section_id_hash,
7927 Const_section_id_hash): New type definitions.
7928 * output.cc (Output_section::add_relaxed_input_section): Change to
7929 use Const_section_id instead of Input_section_specifier as key type.
7930 (Output_section::add_merge_input_section): Ditto.
7931 (Output_section::build_relaxation_map): Change to use Section_id
7932 instead of Input_section_specifier as key type.
2e702c99 7933 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5ac169d4
DK
7934 Ditto.
7935 (Output_section::convert_input_sections_to_relaxed_sections): Change
7936 to use Const_section_id instead of Input_section_specifier as key type.
2e702c99 7937 (Output_section::find_merge_section): Ditto.
5ac169d4
DK
7938 (Output_section::find_relaxed_input_section): Ditto.
7939 * output.h (Input_section_specifier): Remove class.
7940 (Output_section::Output_section_data_by_input_section_map): Change
7941 key type to Const_section_id.
7942 (Output_section::Output_relaxed_input_section_by_input_section_map):
7943 Ditto.
7944 (Output_section::Relaxation_map): Change key type to Section_id.
7945
a2162063
ILT
79462010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7947
7948 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7949 (class Arm_v4bx_stub): New class.
7950 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7951 (Stub_factory::make_arm_v4bx_stub): New method.
7952 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7953 (Stub_table::empty): Handle v4bx stubs.
7954 (Stub_table::add_arm_v4bx_stub): New method.
7955 (Stub_table::find_arm_v4bx_stub): New method.
7956 (Arm_relocate_functions::v4bx): New method.
7957 (Target_arm::fix_v4bx): New method.
7958 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7959 (Stub_table::relocate_stubs): Likewise.
7960 (Stub_table::do_write): Likewise.
7961 (Stub_table::update_data_size_and_addralign): Likewise.
7962 (Stub_table::finalize_stubs): Likewise.
7963 (Target_arm::Scan::local): Likewise.
7964 (Target_arm::Scan::global): Likewise.
7965 (Target_arm::do_finalize_sections): Likewise.
7966 (Target_arm::Relocate::relocate): Likewise.
7967 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7968 Likewise.
7969 (Target_arm::scan_reloc_for_stub): Likewise.
7970 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7971
5696ab0b
ILT
79722010-01-19 Ian Lance Taylor <iant@google.com>
7973
7974 * output.cc (Output_section_headers::do_sized_write): Write large
7975 segment count to sh_info field.
7976 (Output_file_header::do_sized_write): For large segment count,
7977 write PN_XNUM to e_phnum field.
7978
800d0f56
ILT
79792010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7980
7981 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7982 (Arm_relocate_functions::thm_jump8): New function.
7983 (Arm_relocate_functions::thm_jump11): New function.
7984 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7985 R_ARM_THM_JUMP11.
7986 (Target_arm::Scan::global): Likewise.
7987 (Target_arm::Relocate::relocate): Likewise.
7988 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7989 Likewise.
7990
41263c05
DK
79912010-01-14 Doug Kwan <dougkwan@google.com>
7992
7993 * arm.cc (map, utility): Include headers.
7994 (Target_arm::apply_cortex_a8_workaround): New method.
7995 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7996 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7997 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7998 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7999 the --[no-]fix-cortex-a8 command line options.
8000 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8001 (Target_arm::relocate_stub): Use addend in instruction template.
8002 * options.h (DEFINE_bool): Set the user-set flag.
8003 (General_options): Add --[no-]-fix-cortex options.
8004 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 8005 : Update fast look-up map after conversion.
41263c05 8006
459e9b03
ST
80072010-01-14 Sriraman Tallam <tmsriram@google.com>
8008
8009 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8010 in the first pass of do_layout.
8011
b521dfe4
DK
80122010-01-13 Doug Kwan <dougkwan@google.com>
8013
8014 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8015 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8016 apparent compiler problem of not folding static constant integral
8017 data members of elfcpp::Elf_sizes<32>.
8018
44272192
DK
80192010-01-13 Doug Kwan <dougkwan@google.com>
8020
8021 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8022 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8023 Arm_relobj::scan_section_for_cortex_a8_erratum,
8024 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8025 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8026 sections to scan for relocation stubs into a new method
8027 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8028 relocation and Cortex-A8 stub scanning.
8029 (Target_arm::do_relax): Force stubs to be after stubbed sections
8030 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 8031 the beginning of a new relaxation pass. Update a comment.
44272192
DK
8032 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8033
44b71ece
ILT
80342010-01-12 Ian Lance Taylor <iant@google.com>
8035
8036 * target-reloc.h (visibility_error): New inline function.
8037 (relocate_section): Call visibility_error.
8038 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8039 (MOSTLYCLEANFILES): Likewise.
8040 (protected_4_pic.o, protected_3.err): New targets.
8041 * testsuite/protected_4.cc: New file.
8042
a120bc7f
DK
80432010-01-12 Doug Kwan <dougkwan@google.com>
8044
8045 * arm.cc (Cortex_a8_reloc): New class.
8046 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8047 and cortex_a8_relocs_info_.
8048 (Target_arm::fix_cortex_a8): New method definition.
8049 (Target_arm::Cortex_a8_relocs_info): New type.
8050 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8051 New data member declarations.
8052 (Target_arm::scan_reloc_for_stub): Record information about
8053 relocations for THUMB branches that might be exempted from the
8054 Cortex-A8 workaround.
8055 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8056 at the beginning of a relaxation pass.
8057
20138696
DK
80582010-01-12 Doug Kwan <dougkwan@google.com>
8059
8060 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8061 (Arm_relobj::Mapping_symbol_position,
8062 Arm_reloj::Mapping_symbol_position_less,
8063 Arm_relobj::Mapping_symbols_info): New types.
8064 (Target_arm::is_mapping_symbol_name): New method definition.
8065 (Arm_relobj::do_count_local_symbols): Save information about mapping
8066 symbols.
8067
089d69dc
DK
80682010-01-11 Doug Kwan <dougkwan@google.com>
8069
8070 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8071 Arm_relocate_functions::thumb32_branch_upper,
8072 Arm_relocate_functions::thumb32_branch_lower,
8073 Arm_relocate_functions::thumb32_cond_branch_offset,
8074 Arm_relocate_functions::thumb32_cond_branch_upper,
8075 Arm_relocate_functions::thumb32_cond_branch_lower,
8076 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8077 branch offset encoding.
8078 (Arm_relocate_functions::thumb_branch_common): Use new branch
8079 offset encoding methods to avoid code duplication.
8080 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8081 (Stub_addend_reader::operator()): Use new branch encoding method
8082 to avoid code duplication.
8083
99e5bff2
DK
80842010-01-11 Doug Kwan <dougkwan@google.com>
8085
8086 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8087 (Target_arm::do_finalize_sections): Define special EXIDX section
8088 symbols only if referenced.
8089 * gc.h (Garbage_collection::add_reference): New method.
8090 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8091 code duplication.
8092
98e090bd
ILT
80932010-01-11 Ian Lance Taylor <iant@google.com>
8094
d0a91bd8
ILT
8095 * script.cc (Version_script_info::build_expression_list_lookup):
8096 Change complaing about duplicate wildcard match from error to
8097 warning.
8098
98e090bd
ILT
8099 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8100 of 2009-12-30.
8101 (Version_script_info::Version_script_info): Initialize globs_,
8102 default_version_, default_is_global_, and exact_. Don't
8103 initialize globals_ or locals_.
8104 (Version_script_info::build_lookup_tables): Build local symbols
8105 first.
8106 (Version_script_info::unquote): New function.
8107 (Version_script_info::add_exact_match): New function.
8108 (Version_script_info::build_expression_list_lookup): Remove lookup
8109 parameter. Add is_global parameter. Change all callers. Handle
8110 wildcard pattern specially. Unquote pattern. Call
8111 add_exact_match.
8112 (Version_script_info::get_name_to_match): New function.
8113 (Version_script_info::get_symbol_version): New function.
8114 (Version_script_info::get_symbol_version_helper): Remove.
8115 (Version_script_info::check_unmatched_names): Call unquote.
8116 * script.h (class Version_script_info): Change get_symbol_version
8117 to be non-inline and add is_global parameter; change all callers.
8118 Rewrite symbol_is_local. Update declarations. Define struct
8119 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8120 Remove globals_ and locals_ members. Add exact_, globs_,
8121 default_version_, is_global_.
8122 (Version_script_info::Glob): Remove pattern, add expression and
8123 is_global. Update constructor. Change all callers.
8124 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8125 default version.
8126 (Versions::symbol_section_contents): If a symbol is undefined, or
8127 defined in a dynamic object, set the version index to
8128 VER_NDX_LOCAL.
8129 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8130 symbol_is_local.
8131 (Symbol_table::add_from_pluginobj): Likewise.
8132 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8133
d56962d3
DK
81342010-01-11 Doug Kwan <dougkwan@google.com>
8135
8136 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8137 (incremental_dump_LDADD): Add linking option for libintl.
8138 * Makefile.in: Regenerate.
8139
94e6ee91
L
81402010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8141
8142 PR gold/11144
8143 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8144 instead of -Ds.
8145 * testsuite/Makefile.in: Regenerated.
8146
e96c574b
DK
81472010-01-10 Doug Kwan <dougkwan@google.com>
8148
8149 * options.h (DEFINE_var): Use parentheses around argument varname__
8150 in macro body to avoid any unintended subsequent substitutions.
8151
7198066b
ILT
81522010-01-10 Ian Lance Taylor <iant@google.com>
8153
ba4d53bf
ILT
8154 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8155 candidates before doing symbol resolution.
8156
7198066b
ILT
8157 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8158 ODR candidates if only one is weak.
8159
a2beed37
ILT
81602010-01-08 Ian Lance Taylor <iant@google.com>
8161
8162 * script.cc (Version_script_info::build_expression_list_lookup):
8163 Don't warn about ambiguous version, just record the ambiguity.
8164 (Version_script_info::get_symbol_version_helper): Give error if
8165 version is ambiguous.
8166
2fb7225c
DK
81672010-01-08 Doug Kwan <dougkwan@google.com>
8168
8169 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
703d02da
AM
8170 prev_data_size_ and prev_addralign_. Remove initializer for
8171 deleted data member has_been_changed_.
8172 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8173 to determine if the table is empty.
8174 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8175 Remove.
8176 (Stub_table::add_reloc_stub): Define method in class definition
8177 instead of just declaring it there.
8178 (Stub_table::add_cortex_a8_stub): New method definition.
8179 (Stub_table::update_data_size_and_addralign): Ditto.
8180 (Stub_table::finalize_stubs): Ditto.
8181 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8182 (Stub_table::do_addralign_): Return address alignment in the
8183 (Stub_table::do_reset_address_and_file_offset): Define method in
8184 class definition instead of declaring it there. Set current data
8185 size to be the data size of the previous pass.
8186 (Stub_table::set_final_data_size): Use current data size as the
8187 final data size.
8188 (Stub_table::relocate_stub): Change parameter type of stub from
8189 Reloc_stub pointer to Stub pointer.
8190 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8191 (Stub_table::Cortex_a8_stub_list): New typedef.
8192 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8193 Stub_table::prev_addralign_): New data member.
8194 (Arm_relobj::Arm_relobj): Initialize data member
8195 section_has_cortex_a8_workaround_.
8196 (Arm_relobj::section_has_cortex_a8_workaround,
8197 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8198 definitions.
8199 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8200 declarations.
8201 (Target_arm::relocate_stub): Change parameter type of stub from
8202 Reloc_stub pointer to Stub pointer.
8203 (Insn_template::size, Insn_template::alignment): Handle
8204 THUMB16_SPECIAL_TYPE.
8205 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8206 Stub_table::update_data_size_and_addralign,
8207 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8208 definitions.
8209 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8210 (Stub_table::do_write): Ditto.
8211 (Target_arm::do_relax): Adjust code for changes in Stub_table.
2fb7225c 8212
880cd20d
ILT
82132010-01-08 Ian Lance Taylor <iant@google.com>
8214
8215 PR 11108
8216 * symtab.h (class Symbol): Remove fields is_target_special_ and
8217 has_plt_offset_. Add field is_defined_in_discarded_section_.
8218 (Symbol::is_defined_in_discarded_section): New function.
8219 (Symbol::set_is_defined_in_discarded_section): New function.
8220 (Symbol::has_plt_offset): Rewrite.
8221 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8222 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8223 Don't initialize is_target_special_ or has_plt_offset_.
8224 Initialize is_defined_in_discarded_section_.
8225 (Symbol_table::add_from_relobj): If appropriate, set
8226 is_defined_in_discarded_section.
8227 * resolve.cc (Symbol::override_base_with_special): Don't test
8228 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8229 * target-reloc.h (relocate_section): Do special handling for
8230 symbols defined in discarded sections for global symbols as well
8231 as local symbols.
8232
2703e3eb
ILT
82332010-01-08 Ian Lance Taylor <iant@google.com>
8234
8235 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8236 the SHT_SYMTAB case.
8237
339d40a3
ILT
82382010-01-08 Ian Lance Taylor <iant@google.com>
8239
8240 * object.cc (Sized_relobj::do_layout): Don't get confused if
8241 layout_eh_frame returns NULL.
8242
abecea76
ILT
82432010-01-08 Ian Lance Taylor <iant@google.com>
8244
8245 PR 11084
8246 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8247 dynamic symbol table, use the normal symbol table.
8248 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8249 symbol table.
8250
6b7dd3f3
ILT
82512010-01-08 Ian Lance Taylor <iant@google.com>
8252
8253 PR 11072
8254 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8255 sections.
8256
36c50e63
L
82572010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8258
8259 * version.cc (print_version): Change to "Copyright 2010".
8260
e291e7b9
ILT
82612010-01-08 Ian Lance Taylor <iant@google.com>
8262
8263 PR 10287
8264 PR 11063
8265 * i386.cc (class Target_i386): Change return type of plt_section
8266 to be non-const.
8267 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8268 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8269 tls_desc_rel_ field.
8270 (Output_data_plt_i386::rel_tls_desc): New function.
8271 (Target_i386::rel_tls_desc_section): New function.
8272 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8273 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8274 R_386_TLS_DESC reloc in rel_tls_desc_section.
8275 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8276 Define struct Tlsdesc_info.
8277 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8278 (Target_x86_64::do_reloc_symbol_index): New function.
8279 (Target_x86_64::add_tlsdesc_info): New function.
8280 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8281 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8282 tlsdesc_rel_ field.
8283 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8284 all callers.
8285 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8286 (Target_x86_64::rela_tlsdesc_section): New function.
8287 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8288 handling.
8289 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8290 (Target_x86_64::do_reloc_addend): New function.
8291 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8292 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8293 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8294 (Output_reloc::type): New function.
8295 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8296 (Output_reloc::is_target_specific): New function.
8297 (Output_reloc::target_arg): New function.
8298 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8299 absolute relocs and target specific relocs.
8300 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8301 add_target_specific.
8302 (class Output_data_reloc) [SHT_RELA]: Likewise.
8303 * output.cc (Output_reloc::Output_reloc): Add four new versions
8304 for absolute relocs and target specific relocs.
8305 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8306 (Output_reloc::get_symbol_index): Likewise.
8307 (Output_reloc::local_section_offset): Check that local_sym_index_
8308 is not TARGET_CODE or 0.
8309 (Output_reloc::symbol_value): Likewise.
8310 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8311 reloc.
8312 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8313 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8314 functions.
8315 * layout.cc (add_target_dynamic_tags): Use output section for
8316 DT_PLTRELSZ and DT_JMPREL.
8317
3a44184e
ILT
83182010-01-07 Ian Lance Taylor <iant@google.com>
8319
8320 PR 11061
8321 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8322 function.
8323 (class Output_data_reloc_generic): Define.
8324 (class Output_data_reloc_base): Change base class to
8325 Output_data_reloc_generic. Change add() method to call
8326 bump_relative_reloc_count for a relative reloc. Remove
8327 sort_relocs_ field.
8328 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8329 to sort_relocs().
8330 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8331 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8332 appropriate.
8333 * layout.h (class Layout): Update declaration.
8334
ea715a34
ILT
83352010-01-07 Ian Lance Taylor <iant@google.com>
8336
8337 * output.h (class Output_data): Add const version of
8338 output_section and do_output_section.
8339 (class Output_section_data): Add const version of
8340 do_output_section.
8341 (class Output_section): Likewise.
8342 * layout.cc (Layout::add_target_dynamic_tags): New function.
8343 * layout.h (class Layout): Update declarations.
8344 * arm.cc (Target_arm::do_finalize_sections): Use
8345 add_target_dynamic_tags.
8346 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8347 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8348 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8349 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8350
659948a4
ILT
83512010-01-07 Ian Lance Taylor <iant@google.com>
8352
8353 PR 11042
8354 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8355 object as needed.
8356
9d3b86f6
ILT
83572010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8358 Ian Lance Taylor <iant@google.com>
8359
8360 PR 11019
8361 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8362 Xindex::read_symtab_xindex.
8363
bb0d3eb0
DK
83642010-01-07 Doug Kwan <dougkwan@google.com>
8365
8366 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8367 (Insn_template::thumb16_bcond_insn): New method declaration.
8368 (Insn_template): Fix spelling.
8369 (Stub::thumb16_special): New method declaration.
8370 (Stub::do_write): Define virtual method which was previously pure
8371 virtual.
8372 (Stub::do_thumb16_special): New method declaration.
8373 (Stub::do_fixed_endian_write): New template member.
8374 (Reloc_stub::do_write): Remove.
8375 (Reloc_stub::do_fixed_endian_write): Remove.
8376 (Cortex_a8_stub): New class definition.
8377 (Stub_factory::make_cortex_a8_stub): New method definition.
8378 (Stub_factory::Stub_factory): Add missing static storage class
8379 qualifier for elf32_arm_stub_a8_veneer_blx.
8380
ffeef7df
ILT
83812010-01-07 Ian Lance Taylor <iant@google.com>
8382
dc3f80fe
ILT
8383 PR 10980
8384 * options.h (class General_options): Add --warn-unresolved-symbols
8385 and --error-unresolved-symbols.
8386 * errors.cc (Errors::undefined_symbol): Implement
8387 --warn-unresolved-symbols.
8388
ffeef7df
ILT
8389 * options.h (class General_options): Add -z text and -z textoff.
8390 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8391
f1ec9ded
ST
83922010-01-06 Sriraman Tallam <tmsriram@google.com>
8393
8394 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8395 (Garbage_collection::cident_sections): New function.
8396 (Garbage_collection::add_cident_section): New function.
8397 (Garbage_collection::cident_sections_): New member.
8398 (gc_process_relocs): Add references to sections whose names are C
8399 identifiers.
8400 * gold.h (cident_section_start_prefix): New constant.
8401 (cident_section_stop_prefix): New constant.
8402 (is_cident): New function.
8403 * layout.cc (Layout::define_section_symbols): Replace string constants
8404 with the newly defined constants.
8405 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8406 C identifiers.
8407 * testsuite/Makefile.am: Add gc_orphan_section_test.
8408 * testsuite/Makefile.in: Regenerate.
8409 * testsuite/gc_orphan_section_test.cc: New file.
8410 * testsuite/gc_orphan_section_test.sh: New file.
8411
6eda8c29
ILT
84122010-01-06 Ian Lance Taylor <iant@google.com>
8413
b9674e17
ILT
8414 PR 10980
8415 * options.h (class General_options): Add --warn-shared-textrel.
8416 * layout.cc (Layout::finish_dynamic_section): Implement
8417 --warn-shared-textrel.
8418
6eda8c29
ILT
8419 PR 10980
8420 * options.h (class General_options): Add --warn-multiple-gp.
8421
32dcd44e
ILT
84222010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8423
8424 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8425 $(THREADSLIB) and $(LIBDL).
8426 * Makefile.in: Rebuild.
8427
a192ba05
ILT
84282010-01-06 Ian Lance Taylor <iant@google.com>
8429
8430 PR 10980
8431 * options.cc (General_options::parse_section_start): New function.
8432 (General_options::section_start): New function.
8433 (General_options::General_options): Initialize all members.
8434 * options.h: Include <map>
8435 (class General_options): Add --section-start. Add section_starts_
8436 member.
8437 * layout.cc (Layout::attach_allocated_section_to_segment): If
8438 --section-start was used, set the address of the segment. Remove
8439 local sort_sections.
8440 (Layout::relaxation_loop_body): If the address of the load segment
8441 has been set by --section-start, don't use it.
8442 * output.h (Output_segment::update_flags_for_output_section): New
8443 function.
8444 * output.cc (Output_segment::add_output_section): Call
8445 update_flags_for_output_section.
8446
dde3f402
ILT
84472010-01-05 Ian Lance Taylor <iant@google.com>
8448
62dfdd4d
ILT
8449 PR 10980
8450 * options.h (class General_options): Add --undefined-version.
8451 * script.cc (struct Version_expression): Add was_matched_by_symbol
8452 field.
8453 (Version_script_info::matched_symbol): New function.
8454 (Version_script_info::get_symbol_version_helper): Call
8455 matched_symbol.
8456 (Version_script_info::check_unmatched_names): New function.
8457 * script.h (class Version_script_info): Update declarations.
8458 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8459
9c4ae156
ILT
8460 * options.h (class General_options): Use DEFINE_bool_alias for
8461 allow_multiple_definition.
8462 * resolve.cc (Symbol_table::should_override): Don't test
8463 allow_multiple_definition.
8464
dde3f402
ILT
8465 PR 10980
8466 * options.h (class General_options): Add --cref.
8467 * main.cc (main): Print cref table if --cref. Don't close mapfile
8468 until after printing cref table.
8469 * cref.cc: Include "symtab.h".
8470 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8471 (Cref_table_compare::operator()): New function.
8472 (Cref_inputs::gather_cref): New function.
8473 (filecol): New static const.
8474 (Cref_inputs::print_cref): New function.
8475 (Cref::print_cref): New function.
8476 * cref.h: Include <cstdio>.
8477 (class Cref): Update declarations.
8478 * mapfile.h (Mapfile::file): New function.
8479 * object.h (class Object): Define Symbols. Declare virtual
8480 do_get_global_symbols.
8481 (Object::get_global_symbols): New function.
8482 * object.cc (Input_objects::add_object): Pass object to cref_ if
8483 --cref.
8484 (Input_objects::archive_start): Likewise.
8485 (Input_objects::archive_stop): Likewise.
8486 (Input_objects::print_cref): New function.
8487 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8488 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8489 --cref.
8490 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8491 function.
8492 * plugin.h (class Sized_pluginobj): Update declarations.
8493
8781f709
ILT
84942010-01-05 Ian Lance Taylor <iant@google.com>
8495
8496 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8497 to is_default_version. Rename insdef to insdefault.
8498 (Symbol_table::add_from_relobj): Rename def to is_default_version
8499 and local to is_forced_local.
8500 (Symbol_table::add_from_pluginobj): Likewise.
8501 (Symbol_table::add_from_dynobj): Likewise.
8502 (Symbol_table::define_special_symbol): Rename insdef to
8503 insdefault.
8504
fe35d28d
ILT
85052010-01-04 Ian Lance Taylor <iant@google.com>
8506
30bc8c46
ILT
8507 PR 10980
8508 * options.h (class General_options): Add
8509 --allow-multiple-definition and -z muldefs.
8510 * resolve.cc (Symbol_table::should_override): Don't warn about a
8511 multiple symbol definition if --allow-multiple-definition or -z
8512 muldefs.
8513
7eaea549
ILT
8514 PR 10980
8515 * options.h (class General_options): Add --add-needed and
8516 --copy-dt-needed-entries. Tweak --as-needed help entry.
8517 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8518 error if --copy-dt-needed-entries aka --add-needed is used and
8519 would cause a change in behaviour.
8520
fe35d28d
ILT
8521 PR 10980
8522 * options.h (class General_options): Add -G as a short version of
8523 --shared. Add no-op options -assert, -g, and -i.
8524
55a2bb35
ST
85252010-01-04 Sriraman Tallam <tmsriram@google.com>
8526
8527 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8528 check for .text or .gnu.linkonce.t sections.
8529 * icf.cc (Icf::find_identical_sections): Ditto.
8530 Change the detection for mangled function name within the section
8531 name.
8532 * icf.h (is_section_foldable_candidate): New function.
8533
719328e1
ILT
85342009-12-30 Ian Lance Taylor <iant@google.com>
8535
8536 PR 10980
8537 * options.h (class General_options): Permit two dashes with
8538 --retain-symbols-file.
8539
d7bb5745
ILT
85402009-12-30 Ian Lance Taylor <iant@google.com>
8541
403a15dd
ILT
8542 PR 10979
8543 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8544 don't put the file header and segment headers in the text
8545 segment.
8546
eda294df
ILT
8547 PR 10979
8548 * common.cc (Sort_commons::operator()): Stabilize sort when both
8549 entries are NULL.
8550 (Symbol_table::do_allocate_commons_list): When allocating common
8551 symbols, skip a symbol which is no longer common.
8552 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8553 an object before checking its type.
8554 * testsuite/common_test_2.c: New file.
8555 * testsuite/common_test_3.c: New file.
8556 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8557 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8558 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8559 (common_test_2_pic.o, common_test_2.so): New targets.
8560 (common_test_3_pic.o, common_test_3.so): New targets.
8561 * testsuite/Makefile.in: Rebuild.
8562
d7bb5745
ILT
8563 PR 10979
8564 * script.cc (read_input_script): If we see a new SECTIONS clause,
8565 and we have added an input section, give an error.
8566 * layout.h (class Layout): Add have_added_input_section function.
8567 Add have_added_input_section_ field.
8568 * layout.cc (Layout::Layout): Initialize
8569 have_added_input_section_.
8570 (Layout::layout): Set have_added_input_section_.
8571 (Layout::layout_eh_frame): Likewise.
8572
fc59c572
ILT
85732009-12-30 Ian Lance Taylor <iant@google.com>
8574
8575 PR 10931
8576 * options.h (class General_options): Add --sort-common option.
8577 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8578 * common.cc (Sort_common): Add sort_order parameter to
8579 constructor. Add sort_order_ field.
8580 (Sort_commons::operator): Check sort_order_.
8581 (Symbol_table::allocate_commons): Determine the sort order.
8582 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8583 Change all callers.
8584 (Symbol_table::do_allocate_commons_list): Likewise.
8585
1c74fab0
ILT
85862009-12-30 Ian Lance Taylor <iant@google.com>
8587
8588 PR 10916
8589 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8590 symbols from this object, don't change the visibility of an
8591 undefined symbol.
8592 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8593
6affe781
ILT
85942009-12-30 Ian Lance Taylor <iant@google.com>
8595
8596 PR 10861
8597 * script.h (class Version_script_info): Define Language enum.
8598 Update declarations. Define Glob, Exact, and Lookup types. Add
8599 new fields globals_, locals_, and is_finalized_.
8600 * script.cc: Various formatting fixes.
8601 (class Parser_closure): Change language_stack_ from a vector of
8602 std::string to one of Version_script_info::Language. Adjust all
8603 uses accordingly.
8604 (class Lazy_demangler): Remove.
8605 (struct Version_expression): Change language from std::string to
8606 Version_script_info::Language.
8607 (Version_script_info::Version_script_info): New function.
8608 (Version_script_info::~Version_script_info): Don't call clear.
8609 (Version_script_info::finalize): New function.
8610 (Version_script_info::build_lookup_tables): New function.
8611 (Version_script_info::build_expression_list_lookup): New
8612 function.
8613 (Version_script_info::get_symbol_version_helper): Rewrite to use
8614 lookup tables.
8615 (Version_script_info::print_expression_list): Adjust to use
8616 Version_script_info::Language.
8617 (script_push_lex_into_version_mode): Check that the version script
8618 has not been finalized.
8619 (version_script_push_lang): Change language string to
8620 Version_script_info::Language.
8621 * options.cc (Command_line::version_script): New function.
8622 * options.h (class General_options): Add finalize_dynamic_list
8623 function. Change version_script from declaration to definition.
8624 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8625 * testsuite/version_script.map: Remove duplicate def of foo.
8626 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8627 version_script.map.
8628 * testsuite/Makefile.in: Rebuild.
8629
818bf354
ILT
86302009-12-30 Ian Lance Taylor <iant@google.com>
8631
8632 PR 10843
8633 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8634 if the input symbol index is 0, make the output symbol index 0.
8635
ebcc8304
ILT
86362009-12-30 Ian Lance Taylor <iant@google.com>
8637
8638 PR 10670
8639 * options.h (class General_options): Add -x/--discard-all.
8640 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8641 --discard-all. If the local symbol needs a dynamic entry, check
8642 that before handling --discard-locals.
8643
176fe33f
ILT
86442009-12-30 Ian Lance Taylor <iant@google.com>
8645
bb321bb1
ILT
8646 PR 10450
8647 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8648 flags to PF_R.
8649 (Output_segment::add_output_section): Don't change the flags if
8650 the type is PT_TLS.
8651
176fe33f
ILT
8652 PR 10450
8653 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8654 GNU hash table if they need a dynamic value. Otherwise, don't add
8655 them if they are defined in a dynamic object or are forced local.
8656
e8cd95c7
ILT
86572009-12-29 Ian Lance Taylor <iant@google.com>
8658
1b81fb71
ILT
8659 PR 10450
8660 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8661 .gnu.hash table for a 32-bit target.
8662
8d6d383d
ILT
8663 PR 10450
8664 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8665 regular and a dynamic object only needs a dynamic symbol table
8666 entry if it is externally visible.
8667
e785ec03
ILT
8668 PR 10450
8669 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8670 constructor. Add global_offset_table_ field.
8671 (Target_i386::got_section): Set global_offset_table_.
8672 (Target_i386::do_finalize_sections): Set global_offset_table_
8673 size.
8674 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8675 in constructor. Add global_offset_table_ field.
8676 (Target_x86_64::got_section): Set global_offset_table_.
8677 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8678 size.
8679
1a2dff53
ILT
8680 * layout.cc (Layout::Layout): Initialize increase_relro_.
8681 (Layout::get_output_section): Add is_relro, is_last_relro, and
8682 is_first_non_relro parameters. Change all callers.
8683 (Layout::choose_output_section): Likewise.
8684 (Layout::add_output_section_data): Likewise.
8685 (Layout::make_output_section): Likewise.
8686 (Layout::set_segment_offsets): Clear increase_relro when using a
8687 linker script.
8688 * layout.h (class Layout): Add increase_relro method. Add
8689 increase_relro_ field. Update declarations.
8690 * output.cc (Output_section::Output_section): Initialize
8691 is_last_relro_ and is_first_non_relro_.
8692 (Output_segment::add_output_section): Group relro sections is
8693 do_sort is true. Handle is_last_relro and is_first_non_relro.
8694 (Output_segment::maximum_alignment): Remove relro handling.
8695 (Output_segment::set_section_addresses): Add increase_relro
8696 parameter. Change all callers. Add initial alignment to align
8697 relro sections on separate page. Remove old relro handling.
8698 (Output_segment::set_section_list_addresses): Remove in_relro
8699 parameter. Change all callers.
8700 (Output_segment::set_offset): Add increase parameter. Change all
8701 callers. Remove old relro handling.
8702 * output.h (class Output_section): Add new methods: is_last_relro,
8703 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8704 Add is_last_relro_ and is_first_non_relro_ fields.
8705 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8706 Create separate .got.plt section. Call increase_relro.
8707 * x86_64.cc (Target_x86_64::got_section): Likewise.
8708 * testsuite/relro_script_test.t: Add .got.plt.
8709
f0ba79e2
ILT
8710 PR 10450
8711 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8712 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8713 (Layout::finalize): Call set_dynamic_symbol_size.
8714 (Layout::set_dynamic_symbol_size): New function.
8715 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8716 set_dynamic_symbol_size.
8717
e8cd95c7
ILT
8718 PR 10450
8719 * output.h (class Output_section): Add is_entsize_zero_ field.
8720 * output.cc (Output_section::Output_section): Initialize
8721 is_entsize_zero_.
8722 (Output_section::set_entsize): If two different entsizes are
8723 requested, force it to zero.
8724 (Output_section::add_input_section): Set flags for .debug_str
8725 before updating section flags. Set entsize.
8726 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8727 and SHF_STRING if all input sections have those flags.
8728
3e1b9a8a
RÁE
87292009-12-29 Rafael Espindola <espindola@google.com>
8730
8731 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
8732 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8733 reporting.
3e1b9a8a 8734
3dcad376
ST
87352009-12-29 Sriraman Tallam <tmsriram@google.com>
8736
8737 * options.cc (General_options::parse_version): Allow -v to exit
8738 without an error if there is nothing to link.
8739
084e2665
ILT
87402009-12-29 Ian Lance Taylor <iant@google.com>
8741
8742 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8743 using a version of gcc before 4.1.
8744 * configure: Rebuild.
8745
250acde3
CD
87462009-12-28 Chris Demetriou <cgd@google.com>
8747
8748 * attributes.cc (Output_attributes_section_data::do_write): Use
8749 std::vector::front rather than std::vector::data.
8750
99fff23b
ILT
87512009-12-28 Ian Lance Taylor <iant@google.com>
8752
8753 * symtab.h (class Symbol_table): Add enum Defined.
8754 * resolve.cc (Symbol_table::should_override): Add defined
8755 parameter. Change all callers. Test whether object is NULL
8756 before calling a method on it.
8757 (Symbol_table::report_resolve_problem): Add defined parameter.
8758 Change all callers.
8759 (Symbol_table::should_override_with_special): Likewise.
8760 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8761 parameter. Change all callers.
8762 (Symbol_table::do_define_in_output_data): Likewise.
8763 (Symbol_table::define_in_output_segment): Likewise.
8764 (Symbol_table::do_define_in_output_segment): Likewise.
8765 (Symbol_table::define_as_constant): Likewise.
8766 (Symbol_table::do_define_as_constant): Likewise.
8767 * script.h (class Symbol_assignment): Add is_defsym parameter to
8768 constructor; change all callers.
8769 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8770 parameter. Change all callers. Add is_defsym_ field.
8771 (class Parser_closure): Add parsing_defsym parameter to
8772 constructor; change all callers. Add parsing_defsym accessor
8773 function. Add parsing_defsym_ field.
8774
556bd683
ILT
87752009-12-28 Ian Lance Taylor <iant@google.com>
8776
8777 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 8778 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 8779
1782c879
ILT
87802009-12-23 Ian Lance Taylor <iant@google.com>
8781
8782 * i386.cc (Target_i386::do_calls_non_split): Recognize
8783 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
8784 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8785 -fsplit-stack prologue when using %r11.
1782c879 8786
329ca2b1
ST
87872009-12-21 Sriraman Tallam <tmsriram@google.com>
8788
8789 * options.cc (General_options::parse_version): Make -v continue and do
8790 the link like GNU ld does.
8791
d675ff46
RÁE
87922009-12-17 Rafael Avila de Espindola <espindola@google.com>
8793
8794 * Makefile.am (CCFILES): Add timer.cc.
8795 (HFILES): Add timer.h.
8796 * configure.ac: Check for sysconf and times.
8797 * main.cc: include timer.h.
8798 (main): Use Timer instead of get_run_time.
8799 * timer.cc: New.
8800 * timer.h: New.
8801 * workqueue.cc: include timer.h.
8802 (Workqueue::find_and_run_task):
8803 Report user, sys and wall time.
8804 * Makefile.in: Regenerate.
8805 * config.in: Regenerate.
8806 * configure: Regenerate.
8807
d6344fb5
DK
88082009-12-16 Doug Kwan <dougkwan@google.com>
8809
8810 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8811 sections.
8812 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8813 relaxed input sections.
8814 * output.cc (Output_section::find_relaxed_input_section): Change
8815 return type to Output_relaxed_input_section pointer. Adjust code
8816 for new type of relaxed_input_section_map_.
8817 * output.h (Output_section::find_relaxed_input_section): Change
8818 return type to Output_relaxed_input_section pointer.
8819 (Output_section::Output_relaxed_input_section_by_input_section_map):
8820 New type.
8821 (Output_section::relaxed_input_section_map_): Change type to
8822 Output_section::Output_relaxed_input_section_by_input_section_map.
8823 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8824 input section.
8825
0e0d5469
ILT
88262009-12-15 Ian Lance Taylor <iant@google.com>
8827
8828 * layout.cc (Layout::create_shstrtab): Only write out after input
8829 sections if we are compressing debug sections.
8830
0649a889
ILT
88312009-12-15 Ian Lance Taylor <iant@google.com>
8832
8833 * archive.cc (Archive::add_symbols): Only look up a symbol without
8834 a version if there is, in fact, a version.
8835
2ea97941
ILT
88362009-12-14 Ian Lance Taylor <iant@google.com>
8837
8838 Revert -Wshadow changes, all changes from:
8839 2009-12-11 Doug Kwan <dougkwan@google.com>
8840 2009-12-11 Nick Clifton <nickc@redhat.com>
8841 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8842
b0eec2cc
DK
88432009-12-11 Doug Kwan <dougkwan@google.com>
8844
8845 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8846 due to -Wshadow.
8847 * attributes.cc (Object_attribute::size): Ditto.
8848 (Attributes_section_data::size): Ditto.
8849 (Attributes_section_data::Attributes_section_data): Ditto.
8850 (Output_attributes_section_data::do_write): Ditto.
8851 * attributes.h (Object_attribute::set_type): Ditto.
8852 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8853
91d6fa6a
NC
88542009-12-11 Nick Clifton <nickc@redhat.com>
8855
8856 * archive.cc: Fix shadowed variable warnings.
8857 * arm.cc: Likewise.
8858 * compressed_output.cc: Likewise.
8859 * compressed_output.h: Likewise.
8860 * configure: Likewise.
8861 * dwarf_reader.cc: Likewise.
8862 * dynobj.cc: Likewise.
8863 * dynobj.h: Likewise.
8864 * ehframe.cc: Likewise.
8865 * ehframe.h: Likewise.
8866 * errors.cc: Likewise.
8867 * expression.cc: Likewise.
8868 * fileread.cc: Likewise.
8869 * fileread.h: Likewise.
8870 * freebsd.h: Likewise.
8871 * i386.cc: Likewise.
8872 * icf.cc: Likewise.
8873 * incremental.h: Likewise.
8874 * layout.cc: Likewise.
8875 * layout.h: Likewise.
8876 * mapfile.cc: Likewise.
8877 * merge.cc: Likewise.
8878 * merge.h: Likewise.
8879 * object.cc: Likewise.
8880 * object.h: Likewise.
8881 * options.h: Likewise.
8882 * output.cc: Likewise.
8883 * output.h: Likewise.
8884 * parameters.cc: Likewise.
8885 * plugin.cc: Likewise.
8886 * powerpc.cc: Likewise.
8887 * reduced_debug_output.cc: Likewise.
8888 * reduced_debug_output.h: Likewise.
8889 * reloc.cc: Likewise.
8890 * reloc.h: Likewise.
8891 * resolve.cc: Likewise.
8892 * script-sections.cc: Likewise.
8893 * script.cc: Likewise.
8894 * script.h: Likewise.
8895 * sparc.cc: Likewise.
8896 * symtab.cc: Likewise.
8897 * symtab.h: Likewise.
8898 * target-select.cc: Likewise.
8899 * target-select.h: Likewise.
8900 * token.h: Likewise.
8901 * workqueue.cc: Likewise.
8902 * workqueue.h: Likewise.
8903 * x86_64.cc: Likewise.
8904
a0351a69
DK
89052009-12-10 Doug Kwan <dougkwan@google.com>
8906
8907 * arm.cc (attributes.h): New include.
8908 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8909 (Arm_relobj::~Arm_relobj): Delete object pointed by
8910 attributes_section_data_.
8911 (Arm_relobj::attributes_section_data): New method definition.
8912 (Arm_relobj::attributes_section_data_): New data member declaration.
8913 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8914 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8915 attributes_section_data_.
8916 (Arm_dynobj::attributes_section_data): New method definition.
8917 (Arm_dynobj::attributes_section_data_): New data member declaration.
8918 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8919 initialization value of may_use_blx_ to false.
2e702c99 8920 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
a0351a69
DK
8921 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8922 object attributes to compute results instead of hard-coding.
8923 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8924 Target_arm::get_secondary_compatible_arch,
8925 Target_arm::set_secondary_compatible_arch
8926 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8927 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8928 New method declarations.
8929 (Target_arm::get_aeabi_object_attribute): New method definition.
8930 (Target_arm::attributes_section_data_): New data member declaration.
8931 (read_arm_attributes_section): New template definition.
8932 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8933 (Arm_dynobj::do_read_symbols): Ditto.
8934 (Target_arm::do_finalize_sections): Merge attributes sections from
8935 input. Check for BLX use after attributes section merging.
8936 Fix __exidx_start and __exidx_end visibility. Create an
8937 .ARM.attributes section if necessary.
8938 (Target_arm::get_secondary_compatible_arch,
8939 Target_arm::set_secondary_compatible_arch,
8940 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8941 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 8942 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
8943 New method definitions.
8944
b59befec
ILT
89452009-12-09 Ian Lance Taylor <iant@google.com>
8946
8947 * plugin.cc (Plugin::load): Don't cast from void* to a function
8948 pointer.
8949
1276bc89
ILT
89502009-12-09 Ian Lance Taylor <iant@google.com>
8951
8952 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8953 information fields.
8954
2f2de248
L
89552009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8956
8957 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8958 Replace two_file_shared_1.so with two_file_shared_2.so.
8959 * testsuite/Makefile.in: Regenerated.
8960
4f787271
DK
89612009-12-08 Doug Kwan <dougkwan@google.com>
8962
8963 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8964 (HFILES): Add attributes.h and int_encoding.h.
8965 * Makefile.in: Regenerate.
8966 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8967 function definitions to int_encoding.cc
8968 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8969 prototypes to int_encoding.h
8970 * reduced_debug_output.cc (int_encoding.h): New include.
8971 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8972 function definitions to int_encoding.cc
8973 (insert_into_vector, read_from_pointer): Move template definitions to
8974 int_encoding.h
8975 * attributes.cc: New file.
8976 * attributes.h: New file.
8977 * int_encoding.cc: New file.
8978 * int_encoding.h: New file.
8979
20b52f1a
RÁE
89802009-12-07 Rafael Avila de Espindola <espindola@google.com>
8981
8982 PR gold/11055
8983 * incremental-dump.cc (dump_incremental_inputs): New.
8984 (main): Use dump_incremental_inputs.
8985
53d7974c
L
89862009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8987
8988 PR gold/10893
8989 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8990 checking elfcpp::STT_FUNC.
8991 (Target_i386::Relocate::relocate): Likewise.
8992 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8993
8994 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8995 symbols from shared libraries into normal FUNC symbols.
8996
8997 * symtab.h (Symbol): Add is_func and use it.
8998
05a352e6
DK
89992009-12-05 Doug Kwan <dougkwan@google.com>
9000
9001 * arm.cc (Target_arm::arm_info): Initialize new fields
9002 attributes_section and attributes_vendor.
9003 * i386.cc (Target_i386::i386_info): Same.
9004 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9005 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9006 fields attributes_section and attributes_vendor.
53d7974c 9007 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
9008 * target.h (Target::attributes_section, Target::attributes_vendor,
9009 Target::is_attributes_section, Target::attribute_arg_type,
9010 Target::attributes_order): New method definitions.
9011 (Target::Target_info::attributes_section,
9012 Target::Target_info::attributes_vendor): New fields.
9013 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9014 virtual method definitions.
9015 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9016 attributes_section and attributes_vendor.
9017 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9018
f4e5969c
DK
90192009-12-05 Doug Kwan <dougkwan@google.com>
9020
9021 * arm.cc: Update comments about interworking and stub generation.
9022 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9023 considered as non-PIC.
9024 (Arm_relocate_functions::base_abs): Fix formatting.
9025 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9026 of function to use GOT entry address instead of offset.
9027 (Target_arm::Scan::global): Issue an error if a symbol would need a
9028 PLT does not get one because it is untyped. Remove code to create
9029 dynamic symbols for relative branches.
9030 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9031 takes unsigned integer instead of boolean.
9032
1abce4a6
L
90332009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9034
9035 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9036 (two_file_test_LDADD): Likewise.
9037 (common_test_1_LDADD): Likewise.
9038 (exception_test_LDADD) Likewise.
9039 (weak_test_LDADD): Likewise.
9040 (many_sections_test_LDADD): Likewise.
9041 (initpri1_LDADD): Likewise.
9042 (script_test_1_LDADD): Likewise.
9043 (script_test_2_LDADD): Likewise.
9044 (justsyms_LDADD): Likewise.
9045 (binary_test_LDADD): Likewise.
9046 (large_LDADD): Likewise.
9047 * testsuite/Makefile.in: Regenerated.
9048
adcf2816 90492009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 9050
adcf2816
L
9051 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9052 (Symbol_table::override_with_special): Likewise.
9053 (Symbol_table::add_from_object): Likewise.
9054
28e67f5d
RÁE
90552009-12-04 Rafael Avila de Espindola <espindola@google.com>
9056
9057 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9058 Don't set the data_offset twice.
9059
ae10a101
RÁE
90602009-12-04 Rafael Avila de Espindola <espindola@google.com>
9061
9062 * testsuite/Makefile.in: Regenerate.
9063
f59f41f3
DK
90642009-12-03 Doug Kwan <dougkwan@google.com>
9065
9066 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9067 (Target_arm::do_finalize_sections): Add parameter for symbol table
9068 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9069 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9070 parameter for symbol table pointer.
9071 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9072 an additional parameter for a pointer to symbol table.
9073 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9074 parameter for a symbol table pointer.
9075 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9076 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9077 Ditto.
9078 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9079 parameter for a symbol table pointer.
9080
ca55d848
RÁE
90812009-12-03 Rafael Avila de Espindola <espindola@google.com>
9082
9083 * incremental.cc (Incremental_inputs_header)
9084 (Incremental_inputs_header_write, Incremental_inputs_entry)
9085 (Incremental_inputs_entry_write): Move ...
9086 * incremental.h (Incremental_inputs_header)
9087 (Incremental_inputs_header_write, Incremental_inputs_entry)
9088 (Incremental_inputs_entry_write): here.
9089
3aec4f9c
RÁE
90902009-12-02 Rafael Avila de Espindola <espindola@google.com>
9091
9092 * incremental.cc (make_sized_incremental_binary): Set the target.
9093 Error if it is incompatible.
9094 * output.h (Output_file): Add filename method.
9095
9c0ae74d
RÁE
90962009-12-02 Rafael Avila de Espindola <espindola@google.com>
9097
9098 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9099 from the get_* methods.
9100
a45500ae
RÁE
91012009-12-02 Rafael Avila de Espindola <espindola@google.com>
9102
9103 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9104 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9105 Write 0 for the data_offset of scripts.
9106
325e6408
RÁE
91072009-12-02 Rafael Avila de Espindola <espindola@google.com>
9108
9109 * testsuite/Makefile.am: Add the incremental_test.sh test.
9110 * testsuite/incremental_test.sh: New.
9111 * testsuite/incremental_test_1.c: New.
9112 * testsuite/incremental_test_2.c: New.
9113
954c3e2e
RÁE
91142009-12-01 Rafael Avila de Espindola <espindola@google.com>
9115
703d02da 9116 * incremental-dump.cc (main): Fix typos.
954c3e2e 9117
f8086623
RÁE
91182009-11-27 Rafael Avila de Espindola <espindola@google.com>
9119
9120 PR gold/11025
9121 * incremental-dump.cc (main): Use llu to print 64 bit values.
9122
3b0dd6ac
L
91232009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9124 H.J. Lu <hongjiu.lu@intel.com>
9125
9126 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9127 $(LIBDL).
9128 (incremental_dump_LDADD): Likewise.
9129 * Makefile.in: Regenerated.
9130
a6d1ef57 91312009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 9132
a6d1ef57
DK
9133 Revert:
9134
9135 2009-11-25 Doug Kwan <dougkwan@google.com>
9136
9137 * arm.cc (Target_arm::Target_arm): Move method definition
9138 outside of class definition. Add code to handle
9139 --target1-rel, --target1-abs and --target2= options.
9140 (Target_arm::get_reloc_reloc_type): Change method to be
9141 non-static and const.
9142 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9143 New data member declaration.
9144 (Target_arm::Scan::local, Target_arm::Scan::global,
9145 Target_arm::Relocate::relocate,
9146 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9147 Adjust call to Target_arm::get_real_reloc_type.
9148 (Target_arm::get_real_reloc_type): Use command line options
9149 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9150 * options.h (--target1-rel, --target1-abs, --target2): New
9151 ARM-only options.
9152
50aeb7d4
DK
91532009-11-25 Doug Kwan <dougkwan@google.com>
9154
9155 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9156 class definition. Add code to handle --target1-rel, --target1-abs
9157 and --target2= options.
9158 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9159 and const.
9160 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9161 member declaration.
9162 (Target_arm::Scan::local, Target_arm::Scan::global,
9163 Target_arm::Relocate::relocate,
9164 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9165 call to Target_arm::get_real_reloc_type.
9166 (Target_arm::get_real_reloc_type): Use command line options to
9167 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9168 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9169 options.
9170
51938283
DK
91712009-11-25 Doug Kwan <dougkwan@google.com>
9172
9173 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9174 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9175 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9176 formatting.
9177 (Arm_relocate_functions::thm_call): Replace body with a call to
9178 Arm_relocate_functions::thumb_branch_common.
9179 (Arm_relocate_functions::thm_jump24,
9180 Arm_relocate_functions::thm_xpc22): New method definitions.
9181 (Arm_relocate_functions::thumb_branch_common): New method definition.
9182 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9183 operator.
9184 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9185 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9186
e2b8f3c4
RÁE
91872009-11-24 Rafael Avila de Espindola <espindola@google.com>
9188
9189 * Makefile.am: Build incremental-dump
9190 * Makefile.in: Regenerate.
9191 * incremental-dump.cc: New.
9192 * incremental.cc (Incremental_inputs_header_data,
9193 Incremental_inputs_entry_data): Move to incremental.h
9194 * incremental.h: (Incremental_inputs_header_data,
9195 Incremental_inputs_entry_data): Move from incremental.cc
9196
bcba9aec
RÁE
91972009-11-24 Rafael Avila de Espindola <espindola@google.com>
9198
9199 * incremental.cc (Incremental_inputs_header,
9200 Incremental_inputs_header_write, Incremental_inputs_entry,
9201 Incremental_inputs_entry_write): Add a typedef with the data type.
9202
7c3afe08
RÁE
92032009-11-24 Rafael Avila de Espindola <espindola@google.com>
9204
9205 * incremental.cc (Incremental_inputs_header,
9206 Incremental_inputs_header_write, Incremental_inputs_entry,
9207 Incremental_inputs_entry_write): Update comment about which
9208 type has the filed descriptions.
9209
d204b6e9
DK
92102009-11-15 Doug Kwan <dougkwan@google.com>
9211
9212 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9213 (Arm_relocate_functions::arm_branch_common): Change method defintion
9214 in class definition to a method declaration and update list of formal
9215 parameters.
9216 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9217 Arm_relocation_functions::jump24): Adjust call to
9218 Arm_relocate_functions::arm_branch_common. Update list of formal
9219 parameters.
9220 (Arm_relocate_functions::xpc25): New method definition.
9221 (Arm_relocate_functions::arm_branch_common): Move method defintion
9222 out from class definition. Use stubs for mode-switching and extending
9223 branch ranges.
9224 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9225 specially. Change code to enable use of stubs in ARM branches.
9226
43d12afe
DK
92272009-11-10 Doug Kwan <dougkwan@google.com>
9228
9229 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9230 in method declaration.
9231 (Target_arm::relocate_stub): New method declaration.
9232 (Target_arm::default_target): Change to return a pointer instead of
9233 a const reference.
9234 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9235 Target_arm::default_target.
9236 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9237 method definition.
9238 (Target_arm::relocate_section): Adjust view.
9239 (Target_arm::relocate_stub): New method definition.
9240
ac33a407
DK
92412009-11-10 Doug Kwan <dougkwan@google.com>
9242
9243 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9244 a format warning.
9245 * incremental.cc (open_incremental_binary): Initialized local
9246 variables to avoid warnings.
9247 * object.cc (make_elf_object): Ditto.
9248 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9249 a format warning.
e1df38aa 9250
88ee28e9
L
9251009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9252
9253 PR gold/10930
9254 * testsuite/plugin_test.c: Include "config.h".
9255
2daedcd6
DK
92562009-11-09 Doug Kwan <dougkwan@google.com>
9257
9258 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9259 (arm_symbol_value): Remove.
9260 (Arm_relocate_functions::arm_branch_common,
9261 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9262 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9263 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9264 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9265 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9266 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9267 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9268 Arm_relocate_functions::thm_mobw_abs_nc,
9269 Arm_relocate_functions::thm_mov_abs,
9270 Arm_relocate_functions::movw_prel_nc,
9271 Arm_relocate_functions::thm_movt_abs,
9272 Arm_relocate_functions::movt_prel,
9273 Arm_relocate_functions::thm_movw_prel_nc,
9274 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9275 (Target_arm::Relocate::relocate): Only decompose address into two
9276 parts if relocation type uses the thumb-bit and pass the actual
9277 bit instead of a flag indicating that the thumb-bit is used. Adjust
9278 calls to methods in Arm_relocate_functions for this change.
9279
1276bc89 92802009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
9281
9282 PR 10925
9283 * reloc.cc: Instantiate
9284 Sized_relobj::initialize_input_to_output_maps and
9285 Sized_relobj:free_input_to_output_maps.
9286
e53ad1b5
ILT
92872009-11-06 Ian Lance Taylor <iant@google.com>
9288
9289 PR 10876
9290 * defstd.cc (in_segment): Set only_if_ref true for "end".
9291
eb44217c
DK
92922009-11-06 Doug Kwan <dougkwan@google.com>
9293
9294 * arm.cc (class Reloc_stub): Correct a comment.
9295 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9296 (Target_arm::scan_section_for_stubs): New method declaration.
9297 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9298 Change methods from private to protected.
9299 (Target_arm::do_may_relax): New method definition.
9300 (Target_arm::do_relax, Target_arm::group_sections,
9301 Target_arm::scan_reloc_for_stub,
9302 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9303 (Target_arm::arm_input_section_map_): New data member declaration.
9304 (Target_arm::scan_reloc_for_stub,
9305 Target_arm::scan_reloc_section_for_stubs,
9306 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9307 Target_arm::do_relax): New method definitions.
9308
5d329b7d
ILT
93092009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9310
9311 * configure.ac: Check for (struct stat)::st_mtim
9312 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9313 * config.in: Regenerate.
9314 * configure: Regenerate.
9315
96a0d71b
ILT
93162009-11-05 Ian Lance Taylor <iant@google.com>
9317
9318 PR 10910
9319 * output.cc (Output_segment::add_output_section): Add missing
9320 return statement.
9321
594c8e5e
ILT
93222009-11-04 Ian Lance Taylor <iant@google.com>
9323
9324 PR 10880
9325 * object.h (class Object): Add is_needed and set_is_needed
9326 methods. Add is_needed_ field. Make bool fields into bitfields.
9327 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9328 defined in a dynamic object and referenced by a regular object,
9329 set is_needed for the dynamic object.
9330 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9331 if the file is marked with as_needed and it is not needed.
9332
22b127cc
ILT
93332009-11-04 Ian Lance Taylor <iant@google.com>
9334
9335 PR 10887
9336 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9337 tags if data is discarded by linker script.
9338 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9339 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9340 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9341 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9342
f5c870d2
ILT
93432009-11-04 Ian Lance Taylor <iant@google.com>
9344
9345 * layout.cc (Layout::get_output_section): Add is_interp and
9346 is_dynamic_linker_section parameters. Change all callers.
9347 (Layout::choose_output_section): Likewise.
9348 (Layout::make_output_section): Likewise.
9349 (Layout::add_output_section_data): Add is_dynamic_linker_section
9350 parameter. Change all callers.
9351 * layout.h (class Layout): Update declarations.
9352 * output.h (class Output_section): Add is_interp, set_is_interp,
9353 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9354 Add is_interp_, is_dynamic_linker_section_ fields. Change
9355 generate_code_fills_at_write_ to a bitfield.
9356 * output.cc (Output_section::Output_sections): Initialize new
9357 fields.
9358 (Output_segment::add_output_section): Add do_sort parameter.
9359 Change all callers.
9360
1ae4d23b
ILT
93612009-11-03 Ian Lance Taylor <iant@google.com>
9362
9363 PR 10860
9364 * options.h (class General_options): Add --warn-common.
9365 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9366 merging two common symbols.
9367 (Symbol_table::should_override): Handle --warn-common when merging
9368 a common symbol with a defined symbol. Use report_resolve_problem
9369 for multiple definitions.
9370 (Symbol_table::report_resolve_problem): New function.
9371 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9372
55da9579
DK
93732009-11-03 Doug Kwan <dougkwan@google.com>
9374
9375 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9376 stub_factory_.
9377 (Target_arm::stub_factory): New method definition.
9378 (Target_arm::new_arm_input_section,
9379 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9380 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 9381 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
9382 New type definitions.
9383 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9384 member declarations.
9385 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9386 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9387 New method definitions.
9388
37a9ac43
ILT
93892009-11-03 Ian Lance Taylor <iant@google.com>
9390
9391 * options.h (class General_options): Add --warn_constructors.
9392
b3d6a3d4
ILT
93932009-11-03 Ian Lance Taylor <iant@google.com>
9394
9395 PR 10893
9396 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9397 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9398
934b01dd
ILT
93992009-11-03 Ian Lance Taylor <iant@google.com>
9400
9401 PR 10895
9402 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9403 --msgid-bugs-address.
9404 (install-pdf): New target.
9405 (install-data_yes): Look up one directory to find mkinstalldirs.
9406
03c1939b
L
94072009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9408
9409 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9410 tree.
9411
ebd95253
DK
94122009-10-30 Doug Kwan <dougkwan@google.com>
9413
9414 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9415
e9bbb538
DK
94162009-10-30 Doug Kwan <dougkwan@google.com>
9417
9418 * arm.cc (Stub_addend_reader): New struct template definition
9419 and partial specializations.
9420 (Stub_addend_reader::operator()): New method definition for a
9421 partially specialized template.
9422
d5b40221
DK
94232009-10-30 Doug Kwan <dougkwan@google.com>
9424
9425 * arm.cc (Arm_relobj::processor_specific_flags): New method
9426 definition.
9427 (Arm_relobj::do_read_symbols): New method declaration.
9428 (Arm_relobj::processor_specific_flags_): New data member declaration.
9429 (Arm_dynobj): New class definition.
9430 (Target_arm::do_finalize_sections): Add input_objects parameter.
9431 (Target_arm::do_adjust_elf_header): New method declaration.
9432 (Target_arm::are_eabi_versions_compatible,
9433 (Target_arm::merge_processor_specific_flags): New method declaration.
9434 (Target_arm::do_make_elf_object): New overloaded method definitions
9435 and declaration.
9436 (Arm_relobj::do_read_symbols): New method definition.
9437 (Arm_dynobj::do_read_symbols): Ditto.
9438 (Target_arm::do_finalize_sections): Add input_objects parameters.
9439 Merge processor-specific flags from all input objects.
9440 (Target_arm::are_eabi_versions_compatible,
9441 Target_arm::merge_processor_specific_flags,
9442 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9443 New method definitions.
9444 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9445 Input_objects pointer type parameter.
9446 * layout.cc (Layout::finalize): Pass input objects to target's.
9447 finalize_sections function.
9448 * output.cc (Output_file_header::do_sized_write): Set ELF file
9449 header's processor-specific flags.
9450 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9451 Input_objects pointer type parameter.
9452 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9453 * target.h (Input_objects): New forward class declaration.
9454 (Target::processor_specific_flags,
9455 Target::are_processor_specific_flags_sect): New method definitions.
9456 (Target::finalize_sections): Add input_objects parameter.
9457 (Target::Target): Initialize processor_specific_flags_ and
9458 are_processor_specific_flags_set_.
9459 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9460 parameter.
9461 (Target::set_processor_specific_flags): New method definition.
9462 (Target::processor_specific_flags_,
9463 Target::are_processor_specific_flags_set_): New data member
9464 declarations.
9465 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9466 Input_objects pointer type parameter.
9467
ebabffbd
DK
94682009-10-30 Doug Kwan <dougkwan@google.com>
9469
9470 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9471
ad0f2072
ILT
94722009-10-28 Ian Lance Taylor <iant@google.com>
9473
9474 * object.h (class Relobj): Drop options parameter from
9475 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9476 do_scan_relocs, do_relocate. Change all callers.
9477 (class Sized_relobj): Drop options parameters from
9478 do_gc_process_relocs, do_scan_relocs, do_relocate,
9479 do_relocate_sections, relocate_sections, emit_relocs_scan,
9480 emit_relocs_scan_reltype. Change all callers.
9481 (struct Relocate_info): Remove options field and all references to
9482 it.
9483 * reloc.h (class Read_relocs): Remove options constructor
9484 parameter and options_ field. Change all callers.
9485 (class Gc_process_relocs, class Scan_relocs): Likewise.
9486 (class Relocate_task): Likewise.
9487 * target-reloc.h (scan_relocs): Remove options parameter. Change
9488 all callers.
9489 (scan_relocatable_relocs): Likewise.
9490 * target.h (class Sized_target): Remove options parameter from
9491 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9492 all callers.
9493 * gc.h (gc_process_relocs): Remove options parameter. Change all
9494 callers.
9495 * arm.cc: Update functions to remove options parameters.
9496 * i386.cc: Likewise.
9497 * powerpc.cc: Likewise.
9498 * sparc.cc: Likewise.
9499 * x86_64.cc: Likewise.
9500 * testsuite/testfile.cc: Likewise.
9501
8ffa3667
DK
95022009-10-28 Doug Kwan <dougkwan@google.com>
9503
9504 * arm.cc (Arm_relobj): New class definition.
e1df38aa 9505 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
9506 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9507 New method definitions.
9508
40f36857
CC
95092009-10-28 Cary Coutant <ccoutant@google.com>
9510
9511 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9512 (Plugin::cleanup_done_): New member.
9513 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9514 (Plugin_manager::cleanup_done_): Remove.
9515 (Plugin_manager::add_input_file): Edit error message.
9516 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9517 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9518
2c849493
ILT
95192009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9520
9521 * fileread.cc: (File_read::View::~View): Use the new
9522 data_ownership_ filed.
9523 (File_read::~File_read): Dispose the new whole_file_view_.
9524 (File_read::open): Mmap the whole file if needed.
9525 (File_read::open): Use whole_file_view_ instead of contents_.
9526 (File_read::find_view): Use whole_file_view_ if applicable.
9527 (File_read::do_read): Use whole_file_view_ instead of contents_.
9528 (File_read::make_view): Use whole_file_view_ instead of contents_,
9529 update File_read::View::View call.
9530 (File_read::find_or_make_view): Update File_read::View::View
9531 call.
9532 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9533 remove contents_
9534 (File_read::View::Data_ownership): New enum.
9535 (File_read::View::View): Replace bool mapped_ with Data_ownership
9536 argument.
9537 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9538 (File_read::View::data_ownership_): New field.
9539 (File_read::contents_): Remove (replaced by whole_file_view_).
9540 (File_read::whole_file_view_): New field.
9541 * options.h (class General_options): Add --keep-files-mapped.
9542
24998053
CC
95432009-10-27 Cary Coutant <ccoutant@google.com>
9544
9545 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9546 * testsuite/Makefile.am (plugin_test_5): New test case.
9547 * testsuite/Makefile.in: Regenerate.
9548
72adc4fa
DK
95492009-10-25 Doug Kwan <dougkwan@google.com>
9550
9551 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9552 from private to protected to allow access by child class.
9553 (Sized_relobj::do_relocate_sections): New method declaration.
9554 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 9555 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
9556 Sized_relobj::relocate_sections. Instantiate template explicitly
9557 for different target sizes and endianity.
9558
07f508a2
DK
95592009-10-24 Doug Kwan <dougkwan@google.com>
9560
9561 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9562 (Arm_input_section::as_arm_input_section): New method.
9563 (Arm_output_section): New class definition.
9564 (Arm_output_section::create_stub_group,
9565 Arm_output_section::group_sections): New method definitions.
9566
10ad9fe5
DK
95672009-10-22 Doug Kwan <dougkwan@google.com>
9568
9569 * arm.cc (Arm_input_section): New class definition.
9570 (Arm_input_section::init, Arm_input_section:do_write,
9571 Arm_input_section::set_final_data_size,
9572 Arm_input_section::do_reset_address_and_file_offset): New method
9573 definitions.
9574
56ee5e00
DK
95752009-10-21 Doug Kwan <dougkwan@google.com>
9576
9577 * arm.cc (Stub_table, Arm_input_section): New forward class
9578 declarations.
9579 (Stub_table): New class defintion.
9580 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9581 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9582 New method definition.
9583
b569affa
DK
95842009-10-21 Doug Kwan <dougkwan@google.com>
9585
9586 * arm.cc: Update copyright comments.
9587 (Target_arm): New forward class template declaration.
9588 (Arm_address): New type.
9589 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9590 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9591 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9592 constants.
9593 (Insn_template): Same.
9594 (DEF_STUBS): New macro.
9595 (Stub_type): New enum type.
9596 (Stub_template): New class definition.
9597 (Stub): Same.
9598 (Reloc_stub): Same.
9599 (Stub_factory): Same.
9600 (Target_arm::Target_arm): Initialize may_use_blx_ and
9601 should_force_pic_veneer_.
9602 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9603 Target_arm::should_force_pic_veneer,
9604 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9605 Target_arm::using_thumb_only, Target_arm:;default_target): New
9606 method defintions.
9607 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9608 New data member declarations.
9609 (Insn_template::size, Insn_template::alignment): New method defintions.
9610 (Stub_template::Stub_template): New method definition.
9611 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9612 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9613 (Stub_factory::Stub_factory): New method definition.
9614 * gold.h (string_hash): New template.
9615 * output.h (Input_section_specifier::hash_value): Use
9616 gold::string_hash.
9617 (Input_section_specifier::string_hash): Remove.
9618 * stringpool.cc (Stringpool_template::string_hash): Use
9619 gold::string_hash.
9620
6c172549
DK
96212009-10-20 Doug Kwan <dougkwan@google.com>
9622
9623 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9624 symbols of relaxed input sections.
9625 * output.h (Output_section::find_relaxed_input_section): Make
9626 method public.
9627
c5617f2f
DK
96282009-10-16 Doug Kwan <dougkwan@google.com>
9629
9630 * dynobj.cc (Versions::Versions): Initialize version_script_.
9631 Only insert base version symbol definition for a shared object
9632 if version script defines any version versions.
9633 (Versions::define_base_version): New method definition.
9634 (Versions::add_def): Check that base version is not needed.
9635 (Versions::add_need): Define base version lazily.
9636 * dynobj.h (Versions::define_base_version): New method declaration.
9637 (Versions::needs_base_version_): New data member declaration.
9638 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9639 (check_DATA): Add no_version_test.stdout.
9640 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9641 New make rules.
9642 * testsuite/Makefile.in: Regenerate.
9643 * testsuite/no_version_test.c: New file.
9644 * testsuite/no_version_test.sh: Ditto.
9645
3c12dcdb
DK
96462009-10-16 Doug Kwan <dougkwan@google.com>
9647
9648 * expression.cc (class Segment_start_expression): New class definition.
9649 (Segment_start_expression::value): New method definition.
9650 (script_exp_function_segment_start): Return a new
9651 Segment_start_expression.
9652 * gold/script-c.h (script_saw_segment_start_expression): New function
9653 prototype.
9654 * script-sections.cc (Script_sections::Script_sections): Initialize
9655 SAW_SEGMENT_START_EXPRESSION_ to false.
9656 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9657 and -Tbbs options to specify section addresses if given in
9658 command line and no SEGMENT_START expression is seen in a script.
9659 * script-sections.h (Script_sections::saw_segment_start_expression,
9660 Script_sections::set_saw_segment_start_expression): New method
9661 definition.
9662 (Script_sections::saw_segment_start_expression_): New data member
9663 declaration.
9664 * script.cc (script_saw_segment_start_expression): New function.
9665 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9666 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9667 script_test_7.sh and script_test_8.sh.
9668 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9669 script_test_8.stdout.
9670 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9671 (script_test_6, script_test_6.stdout, script_test_7,
9672 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9673 * Makefile.in: Regenerate.
9674 * testsuite/script_test_6.sh: New file.
9675 * testsuite/script_test_6.t: Same.
9676 * testsuite/script_test_7.sh: Same.
9677 * testsuite/script_test_7.t: Same.
9678 * testsuite/script_test_8.sh: Same.
9679
64b1ae37
DK
96802009-10-16 Doug Kwan <dougkwan@google.com>
9681
9682 * output.cc (Output_segment::set_section_list_address): Cast
9683 expressions to unsigned long long type to avoid format warnings.
9684
661be1e2
ILT
96852009-10-15 Ian Lance Taylor <iant@google.com>
9686
12edd763 9687 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 9688 dot assignment to script_sections_.
12edd763
ILT
9689 * script-sections.cc (Script_sections::add_dot_assignment):
9690 Initialize if necessary.
9691
68b6574b
ILT
9692 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9693 program headers with no load segment if there is a linker script.
9694
661be1e2
ILT
9695 * layout.cc (Layout::set_segment_offsets): Align the file offset
9696 to the segment aligment for -N or -n with no load segment.
9697 * output.cc (Output_segment::add_output_section): Don't crash if
9698 the first section is a TLS section.
9699 (Output_segment::set_section_list_addresses): Print an error
9700 message if the address moves backward in a linker script.
9701 * script-sections.cc
9702 (Output_section_element_input::set_section_addresses): Don't
9703 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9704 (Orphan_output_section::set_section_addresses): Likewise.
9705
f15f61a7
DK
97062009-10-15 Doug Kwan <dougkwan@google.com>
9707
9708 * layout.cc (Layout::finish_dynamic_section): Generate tags
9709 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9710 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9711 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9712
82bb573a
ILT
97132009-10-14 Ian Lance Taylor <iant@google.com>
9714
9715 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9716 fields.
9717 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9718 data_shdr fields of relinfo.
9719 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9720 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9721 R_386_TLS_LDO_32, adjust based on section flags.
9722 (Target_i386::Relocate::fix_up_ldo): Remove.
9723
374ad285
ILT
97242009-10-13 Ian Lance Taylor <iant@google.com>
9725
9726 Add support for -pie.
9727 * options.h (class General_options): Add -pie and
9728 --pic-executable.
9729 (General_options::output_is_position_independent): Test -pie.
9730 (General_options::output_is_executable): Return true if not shared
9731 and not relocatable.
9732 (General_options::output_is_pie): Remove.
9733 * options.cc (General_options::finalize): Reject incompatible uses
9734 of -pie.
9735 * gold.cc (queue_middle_tasks): A -pie link is not static.
9736 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9737 * symtab.cc (Symbol::final_value_is_known): Return false if
9738 output_is_position_independent.
9739 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9740 output_is_position_independent.
9741 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9742 output_is_position_independent.
9743 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9744 output_is_position_independent.
9745 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9746 two_file_pie_test.
9747 (basic_pie_test.o, basic_pie_test): New targets.
9748 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9749 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9750 (two_file_pie_test): New target.
9751 * testsuite/Makefile.in: Rebuild.
9752 * README: Remove note saying that -pie is not supported.
9753
c6585162
ILT
97542009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9755
9756 * options.h (class General_options): Add -init and -fini.
9757 * layout.cc (Layout::finish_dynamic_section): Emit
9758 given init and fini functions.
9759
032ce4e9
ST
97602009-10-13 Sriraman Tallam <tmsriram@google.com>
9761
9762 * gc.h (gc_process_relocs): Check if icf is enabled using new
9763 function.
9764 * gold.cc (queue_initial_tasks): Likewise.
9765 (queue_middle_tasks): Likewise.
9766 * object.cc (do_layout): Likewise.
9767 * symtab.cc (is_section_folded): Likewise.
9768 * main.cc (main): Likewise.
9769 * reloc.cc (Read_relocs::run): Likewise.
9770 (Sized_relobj::do_scan_relocs): Likewise.
9771 * icf.cc (is_function_ctor_or_dtor): New function.
9772 (Icf::find_identical_sections): Check if function is ctor or dtor when
9773 safe icf is chosen.
9774 * options.h (General_options::icf): Change option to be an enum.
9775 (Icf_status): New enum.
9776 (icf_enabled): New method.
9777 (icf_safe_folding): New method.
9778 (set_icf_status): New method.
9779 (icf_status_): New variable.
9780 * (options.cc) (General_options::finalize): Set icf_status_.
9781 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9782 icf_test and icf_keep_unique_test to use the --icf enum flag.
9783 * testsuite/icf_safe_test.sh: New file.
e1df38aa 9784 * testsuite/icf_safe_test.cc: New file.
032ce4e9 9785
f345227a
ST
97862009-10-12 Sriraman Tallam <tmsriram@google.com>
9787
9788 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9789 includes to gc.h and icf.h.
9790 * arm.cc: Include gc.h.
9791 * gold.cc: Likewise.
9792 * i386.cc: Likewise.
9793 * powerpc.cc: Likewise.
9794 * sparc.cc: Likewise.
9795 * x86_64.cc: Likewise.
9796 * gc.h: Include icf.h.
9797
1c7814ed
ILT
97982009-10-11 Ian Lance Taylor <iant@google.com>
9799
9800 * plugin.cc: Include "gold.h" before other header files.
9801
ae3b5189
CD
98022009-10-10 Chris Demetriou <cgd@google.com>
9803
9804 * options.h (Input_file_argument::Input_file_type): New enum.
9805 (Input_file_argument::is_lib_): Replace with...
9806 (Input_file_argument::type_): New member.
9807 (Input_file_argument::Input_file_argument): Take Input_file_type
9808 'type' rather than boolean 'is_lib' as second argument.
9809 (Input_file_argument::is_lib): Use type_.
9810 (Input_file_argument::is_searched_file): New function.
9811 (Input_file_argument::may_need_search): Handle is_searched_file.
9812 * options.cc (General_options::parse_library): Support -l:filename.
9813 (General_options::parse_just_symbols): Update for Input_file_argument
9814 changes.
9815 (Command_line::process): Likewise.
9816 * archive.cc (Archive::get_file_and_offset): Likewise.
9817 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9818 * script.cc (read_script_file, script_add_file): Likewise.
9819 * fileread.cc (Input_file::Input_file): Likewise.
9820 (Input_file::will_search_for): Handle is_searched_file.
9821 (Input_file::open): Likewise.
9822 * readsyms.cc (Read_symbols::get_name): Likewise.
9823 * testsuite/Makefile.am (searched_file_test): New test.
9824 * testsuite/Makefile.in: Regenerate.
9825 * testsuite/searched_file_test.cc: New file.
9826 * testsuite/searched_file_test_lib.cc: New file.
9827
f3048a1d
ILT
98282009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9829 Ian Lance Taylor <iant@google.com>
9830
9831 * descriptor.cc: Include <cstdio> and "binary-io.h".
9832 (Descriptors::open): Open the files in binary mode always.
9833 * script.cc (Lex::get_token): Treat \r as whitespace.
9834
d4780e57
ILT
98352009-10-09 Ian Lance Taylor <iant@google.com>
9836
9837 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9838
d9a893b8
ILT
98392009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9840 Ian Lance Taylor <iant@google.com>
9841
9842 * configure.ac: Check for readv function also.
9843 * fileread.cc (readv): Define if not HAVE_READV.
9844 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9845 does not exist.
9846 * config.in: Regenerate.
9847 * configure: Regenerate.
9848
c0a62865
DK
98492009-10-09 Doug Kwan <dougkwan@google.com>
9850
9851 * layout.cc (Layout::make_output_section): Call target hook to make
9852 ordinary output section.
9853 (Layout::finalize): Adjust parameter list of call the
9854 Target::may_relax().
9855 * layout.h (class Layout::section_list): New method.
9856 * merge.h (Output_merge_base::entsize): Change visibility to public.
9857 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9858 New methods.
9859 (Output_merge_string::do_is_string): New method.
9860 * object.cc (Sized_relobj::do_setup): renamed from
9861 Sized_relobj::set_up.
9862 * object.h (Sized_relobj::adjust_shndx,
9863 Sized_relobj::initializ_input_to_output_maps,
9864 Sized_relobj::free_input_to_output_maps): Change visibilities to
9865 protected.
9866 (Sized_relobj::setup): Virtualize.
9867 (Sized_relobj::do_setup): New method declaration.
9868 (Sized_relobj::invalidate_section_offset,
9869 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9870 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9871 * options.cc (parse_int): New function.
9872 * options.h (parse_int): New declaration.
9873 (DEFINE_int): New macro.
9874 (stub_group_size): New option.
9875 * output.cc (Output_section::Output_section): Initialize memebers
9876 merge_section_map_, merge_section_by_properties_map_,
9877 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9878 (Output_section::add_input_section): Handled deferred code-fill
9879 generation and remove an old comment.
9880 (Output_section::add_relaxed_input_section): New method definition.
9881 (Output_section::add_merge_input_section): Use merge section by
9882 properties map to speed to search. Update merge section maps
9883 as appropriate.
9884 (Output_section::build_relaxation_map): New method definition.
9885 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9886 Same.
9887 (Output_section::relax_input_section): Renamed to
9888 Output_section::convert_input_sections_to_relaxed_sections and change
9889 interface to take a vector of pointers to relaxed sections.
9890 (Output_section::find_merge_section,
9891 Output_section::find_relaxed_input_section): New method definitions.
9892 (Output_section::is_input_address_mapped,
9893 Output_section::output_offset, Output_section::output_address):
9894 Use output section data maps to speed up searching.
9895 (Output_section::find_starting_output_address): Add comments.
9896 (Output_section::do_write,
9897 Output_section::write_to_postprocessing_buffer): Do code-fill
9898 generation as appropriate.
9899 (Output_section::get_input_sections): Invalidate relaxed input section
9900 map.
9901 (Output_section::restore_states): Adjust type of checkpoint .
9902 Invalidate relaxed input section map.
9903 * output.h (Output_merge_base): New class declaration.
9904 (Input_section_specifier): New class defintion.
9905 (class Output_relaxed_input_section) Change base class to
9906 Output_section_data_build.
9907 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9908 base class initializer.
9909 (Output_section::add_relaxed_input_section): New method declaration.
9910 (Output_section::Input_section): Change visibility to protected.
2e702c99 9911 (Output_section::Input_section::relobj,
c0a62865
DK
9912 Output_section::Input_section::shndx): Handle relaxed input sections.
9913 Output_section::input_sections) Change visibility to protected. Also
9914 define overload to return a non-const pointer.
9915 (Output_section::Merge_section_properties): New class defintion.
9916 (Output_section::Merge_section_by_properties_map,
9917 Output_section::Output_section_data_by_input_section_map,
9918 Output_section::Relaxation_map): New types.
9919 (Output_section::relax_input_section): Rename method to
9920 Output_section::convert_input_sections_to_relaxed_sections and change
9921 interface to take a vector of relaxed section pointers.
9922 (Output_section::find_merge_section,
9923 Output_section::find_relaxed_input_section,
9924 Output_section::build_relaxation_map,
9925 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9926 New method declarations.
9927 (Output_section::merge_section_map_
9928 Output_section::merge_section_by_properties_map_,
9929 Output_section::relaxed_input_section_map_,
9930 Output_section::is_relaxed_input_section_map_valid_,
9931 Output_section::generate_code_fills_at_write_): New data members.
9932 * script-sections.cc
9933 (Output_section_element_input::set_section_addresses): Call
9934 current_data_size and addralign methods of relaxed input sections.
9935 (Orphan_output_section::set_section_addresses): Call current_data_size
9936 and addralign methods of relaxed input sections.
9937 * symtab.cc (Symbol_table::compute_final_value): Extract template
9938 from the body of Symbol_table::sized_finalize_symbol.
9939 (Symbol_table::sized_finalized_symbol): Call
9940 Symbol_table::compute_final_value.
9941 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9942 (Symbol_table::compute_final_value): New templated method declaration.
9943 * target.cc (Target::do_make_output_section): New method defintion.
9944 * target.h (Target::make_output_section): New method declaration.
9945 (Target::relax): Add more parameters for input objects, symbol table
9946 and layout. Adjust call to do_relax.
9947 (Target::do_make_output_section): New method declaration.
9948 (Target::do_relax): Add parameters for input objects, symbol table
9949 and layout.
9950
d446d6c4
ILT
99512009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9952
9953 * pread.c: Include stdio.h.
9954
bc06c745
ILT
99552009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9956
9957 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9958 defined.
9959
75aea3d0
ILT
99602009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9961
9962 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9963 Change read_shndx type to unsigned int.
9964 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9965 int.
9966 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9967 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9968 Change read_shndx type to unsigned int.
9969 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9970 int.
9971 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9972 * layout.cc (Layout::create_symtab_sections): Cast the result of
9973 local_symcount * symsize to off_t in the gold_assert.
9974
be8fcb75
ILT
99752009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9976
9977 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9978 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9979 R_ARM_BASE_ABS.
9980 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9981 (Arm_relocate_functions::thm_abs5): New function.
9982 (Arm_relocate_functions::abs12): New function.
9983 (Arm_relocate_functions::abs16): New function.
9984 (Arm_relocate_functions::base_abs): New function.
9985 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9986 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9987 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9988 R_ARM_BASE_ABS.
9989 (Scan::global): Likewise.
9990 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9991 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9992 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9993 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9994 R_ARM_BASE_ABS.
9995
c2a122b6
ILT
99962009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9997
9998 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9999 (Arm_relocate_functions::movt_prel): New function.
10000 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10001 (Arm_relocate_functions::thm_movt_prel): New function.
10002 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10003 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10004 (Scan::global, Relocate::relocate): Likewise.
10005 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10006
c4aa1e2d
ILT
100072009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10008
10009 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10010 Incremental_checker.
10011 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10012 unsigned int.
10013 (class Incremental_inputs_header): New class.
10014 (Incremental_inputs_header_writer): Edit comment.
10015 (Incremental_inputs_entry): New class.
10016 (Incremental_inputs_entry_writer): Edit comment.
10017 (Sized_incremental_binary::do_find_incremental_inputs_section):
10018 Add *strtab_shndx parameter, fill it.
10019 (Sized_incremental_binary::do_check_inputs): New method.
10020 (Incremental_checker::can_incrementally_link_output_file): Use
10021 Sized_incremental_binary::check_inputs.
10022 (Incremental_inputs::report_command_line): Save command line in
10023 command_line_.
10024 * incremental.h:
10025 (Incremental_binary::find_incremental_inputs_section): New
10026 method.
10027 (Incremental_binary::do_find_incremental_inputs_section): Add
10028 strtab_shndx parameter.
10029 (Incremental_binary::do_check_inputs): New pure virtual method.
10030 (Sized_incremental_binary::do_check_inputs): Declare.
10031 (Incremental_checker::Incremental_checker): Add incremental_inputs
10032 parameter, use it to initialize incremental_inputs_.
10033 (Incremental_checker::incremental_inputs_): New field.
10034 (Incremental_checker::command_line): New method.
10035 (Incremental_checker::inputs): New method.
10036 (Incremental_checker::command_line_): New field.
10037
c549a694
ILT
100382009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10039
10040 * incremental.cc: Include <cstdarg> and "target-select.h".
10041 (vexplain_no_incremental): New function.
10042 (explain_no_incremental): New function.
10043 (Incremental_binary::error): New method.
10044 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10045 method.
10046 (make_sized_incremental_binary): New function.
10047 (open_incremental_binary): New function.
10048 (can_incrementally_link_file): Add checks if output is ELF and has
10049 inputs section.
10050 * incremental.h: Include "elfcpp_file.h" and "output.h".
10051 (Incremental_binary): New class.
10052 (Sized_incremental_binary): New class.
10053 (open_incremental_binary): Declare.
10054 * object.cc (is_elf_object): Use
10055 elfcpp::Elf_recognizer::is_elf_file.
10056 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10057 * output.h (Output_file::filesize): New method.
10058
fd3c5f0b
ILT
100592009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10060
10061 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10062 New function.
10063 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10064 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10065 function.
10066 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10067 function.
10068 (Arm_relocate_functions::movw_abs_nc): New function.
10069 (Arm_relocate_functions::movt_abs): New function.
10070 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10071 (Arm_relocate_functions::thm_movt_abs): New function.
10072 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10073 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10074 (Scan::global): Likewise.
10075 (Relocate::relocate): Likewise.
10076 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10077
7f5309a5
ILT
100782009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10079
10080 * arm.cc (Arm_relocate_functions::got_prel) New function.
10081 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10082 (Relocate::relocate): Likewise.
10083 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10084
364c7fa5
ILT
100852009-10-06 Ian Lance Taylor <iant@google.com>
10086
10087 * options.h (class General_options): Define
10088 split_stack_adjust_size parameter.
10089 * object.h (class Object): Add uses_split_stack_ and
10090 has_no_split_stack_ fields. Add uses_split_stack and
10091 has_no_split_stack accessor functions. Declare
10092 handle_split_stack_section.
10093 (class Reloc_symbol_changes): Define.
10094 (class Sized_relobj): Define Function_offsets. Declare
10095 split_stack_adjust, split_stack_adjust_reltype, and
10096 find_functions.
10097 * object.cc (Object::handle_split_stack_section): New function.
10098 (Sized_relobj::do_layout): Call handle_split_stack_section.
10099 * dynobj.cc (Sized_dynobj::do_layout): Call
10100 handle_split_stack_section.
10101 * reloc.cc (Sized_relobj::relocate_sections): Call
10102 split_stack_adjust for executable sections in split_stack
10103 objects. Pass reloc_map to relocate_section.
10104 (Sized_relobj::split_stack_adjust): New function.
10105 (Sized_relobj::split_stack_adjust_reltype): New function.
10106 (Sized_relobj::find_functions): New function.
10107 * target-reloc.h: Include "object.h".
10108 (relocate_section): Add reloc_symbol_changes parameter. Change
10109 all callers.
10110 * target.h (class Target): Add calls_non_split method. Declare
10111 do_calls_non_split virtual method. Declare match_view and
10112 set_view_to_nop.
10113 * target.cc: Include "elfcpp.h".
10114 (Target::do_calls_non_split): New function.
10115 (Target::match_view): New function.
10116 (Target::set_view_to_nop): New function.
10117 * gold.cc (queue_middle_tasks): Give an error if mixing
10118 split-stack and non-split-stack objects with -r.
10119 * i386.cc (Target_i386::relocate_section): Add
10120 reloc_symbol_changes parameter.
10121 (Target_i386::do_calls_non_split): New function.
10122 * x86_64.cc (Target_x86_64::relocate_section): Add
10123 reloc_symbol_changes parameter.
10124 (Target_x86_64::do_calls_non_split): New function.
10125 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10126 parameter.
10127 * powerpc.cc (Target_powerpc::relocate_section): Add
10128 reloc_symbol_changes parameter.
10129 * sparc.cc (Target_sparc::relocate_section): Add
10130 reloc_symbol_changes parameter.
10131 * configure.ac: Call AM_CONDITIONAL for the default target.
10132 * configure: Rebuild.
10133 * testsuite/Makefile.am (TEST_AS): New variable.
10134 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10135 (check_DATA): Add split_i386 and split_x86_64 files.
10136 (SPLIT_DEFSYMS): Define.
10137 (split_i386_[1234n].o): New targets.
10138 (split_i386_[124]): New targets.
10139 (split_i386_[1234r].stdout): New targets.
10140 (split_x86_64_[1234n].o): New targets.
10141 (split_x86_64_[124]): New targets.
10142 (split_x86_64_[1234r].stdout): New targets.
10143 (MOSTLYCLEANFILES): Add new executables.
10144 * testsuite/split_i386.sh: New file.
10145 * testsuite/split_x86_64.sh: New file.
10146 * testsuite/split_i386_1.s: New file.
10147 * testsuite/split_i386_2.s: New file.
10148 * testsuite/split_i386_3.s: New file.
10149 * testsuite/split_i386_4.s: New file.
10150 * testsuite/split_i386_n.s: New file.
10151 * testsuite/split_x86_64_1.s: New file.
10152 * testsuite/split_x86_64_2.s: New file.
10153 * testsuite/split_x86_64_3.s: New file.
10154 * testsuite/split_x86_64_4.s: New file.
10155 * testsuite/split_x86_64_n.s: New file.
10156 * testsuite/testfile.cc (Target_test): Update relocation_section
10157 function.
10158 * testsuite/Makefile.in: Rebuild.
10159
e8a9fcda
ILT
101602009-10-06 Ian Lance Taylor <iant@google.com>
10161
10162 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10163 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10164 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10165 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10166 the address on ldo_addrs_.
10167 (Target_i386::Relocate::fix_up_ldo): New function.
10168
e99daf92
ILT
101692009-10-06 Rafael Espindola <espindola@google.com>
10170
10171 * plugin.cc (add_input_library): New.
10172 (Plugin::load): Add add_input_library to tv.
10173 (Plugin_manager::add_input_file): Add the is_lib argument.
10174 (add_input_file): Update call to Plugin_manager::add_input_file.
10175 (add_input_library): New.
10176 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10177
966d4097
DK
101782009-09-30 Doug Kwan <dougkwan@google.com>
10179
10180 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10181 symbol and call Symbol::may_need_copy_reloc to determine if
10182 a copy reloc is needed.
10183 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10184 nocopyreloc is given in command line.
10185 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10186 given in command line.
10187 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10188 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10189 of the removed Target_i386::may_need_copy_reloc.
10190 * options.h (copyreloc): New option with default value false.
10191 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10192 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10193 instead of the removed Target_powerpc::may_need_copy_reloc.
10194 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10195 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10196 instead of the removed Target_sparc::may_need_copy_reloc.
10197 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10198 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10199 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10200 instead of the removed Target_x86_64::may_need_copy_reloc.
10201
029ba973
ILT
102022009-09-30 Ian Lance Taylor <iant@google.com>
10203
10204 * object.h (class Object): Remove target_ field, and target,
10205 sized_target, and set_target methods.
10206 (Object::sized_target): Remove.
10207 (class Sized_relobj): Update declarations. Remove sized_target.
10208 * object.cc (Sized_relobj::setup): Remove target parameter.
10209 Change all callers.
10210 (Input_objects::add_object): Don't do anything with the target.
10211 (make_elf_sized_object): Add punconfigured parameter. Change all
10212 callers. Set or test parameter target.
10213 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10214 Change all callers.
10215 * parameters.cc (Parameters::set_target): Change parameter type to
10216 be non-const.
10217 (Parameters::default_target): Remove.
10218 (set_parameters_target): Change parameter type to be non-const.
10219 (parameters_force_valid_target): New function.
10220 (parameters_clear_target): New function.
10221 * parameters.h (class Parameters): Update declarations. Remove
10222 default_target method. Add sized_target and clear_target
10223 methods. Change target_ to be non-const.
10224 (set_parameters_target): Update declaration.
10225 (parameters_force_valid_target): Declare.
10226 (parameters_clear_target): Declare.
10227 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10228 as NULL if we aren't searching.
10229 (Add_symbols::run): Don't check for compatible target.
10230 * fileread.cc (Input_file::open_binary): Call
10231 parameters_force_valid_target.
10232 * gold.cc (queue_middle_tasks): Likewise.
10233 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10234 set_target on object.
10235 * dynobj.h (class Sized_dynobj): Update declarations.
10236 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10237 make_elf_object returns NULL.
10238 (Archive::include_member): Don't check whether object target is
10239 compatible.
10240 * output.cc (Output_section::add_input_section): Get target from
10241 parameters.
10242 (Output_section::relax_input_section): Likewise.
10243 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10244 parameters.
10245 (Sized_relobj::do_scan_relocs): Likewise.
10246 (Sized_relobj::relocate_sections): Likewise.
10247 * resolve.cc (Symbol_table::resolve): Likewise.
10248 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10249 parameter. Change all callers.
10250 (Symbol_table::add_from_object): Get target from parameters.
10251 (Symbol_table::add_from_relobj): Don't check object target.
10252 (Symbol_table::add_from_dynobj): Likewise.
10253 (Symbol_table::define_special_symbol): Get target from
10254 parameters.
10255 * symtab.h (class Symbol_table): Update declaration.
10256 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10257 parameter. Change all callers. Clear parameter target.
10258 (Binary_test): Test target here.
10259 * testsuite/object_unittest.cc (gold_testsuite): Remove
10260 target_test_pointer parameter. Change all callers.
10261 (Object_test): Test target here.
10262
a6a22b83
ILT
102632009-09-26 Ian Lance Taylor <iant@google.com>
10264
10265 * testsuite/initpri1.c: Don't try to use constructor priorities if
10266 compiling with gcc before 4.3.
10267
6a8f49fe
ILT
102682009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10269
10270 * testsuite/retain_symbols_file_test.sh (check_present): Change
10271 output file name to retain_symbols_file_test.stdout.
10272 (check_absent): Likewise.
10273
8c604651
CS
102742009-09-18 Craig Silverstein <csilvers@google.com>
10275
10276 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10277 * options.cc: Include <cerrno> and <fstream>.
10278 (General_options::finalize): Parse -retain-symbols-file tag.
10279 * options.h: New flag.
10280 (General_options): New method should_retain_symbol, new
10281 variable symbols_to_retain.
10282 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10283 should_retain_symbol map.
10284 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10285 * testsuite/Makefile.in: Regenerate.
10286 * testsuite/retain_symbols_file_test.sh: New file.
10287
ca58b19f
NC
102882009-09-18 Nick Clifton <nickc@redhat.com>
10289
10290 * po/es.po: Updated Spanish translation.
10291
20e6d0d6
DK
102922009-09-17 Doug Kwan <dougkwan@google.com>
10293
10294 * debug.h (DEBUG_RELAXATION): New constant.
10295 (DEBUG_ALL): Add DEBUG_RELAXATION.
10296 (debug_string_to_enum): Add relaxation debug option.
10297 * layout.cc
10298 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10299 Layout::Relaxation_debug_check::read_sections,
10300 Layout::Relaxation_debug_check::read_sections): New method definitions.
10301 (Layout::Layout): Initialize data members
10302 record_output_section_data_from_scrips_,
10303 script_output_section_data_list_ and relaxation_debug_check_.
10304 (Layout::save_segments, Layout::restore_segments,
10305 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10306 Layout::relaxation_loop_body): New method definitions.
10307 (Layout::finalize): Support relaxation. Move section layout code to
10308 Layout::relaxation_loop_body.
10309 (Layout::set_asection_address_from_script): Move code for orphan
10310 section placement out.
10311 (Layout::place_orphan_sections_in_script): New method definition.
10312 * layout.h (Output_segment_headers, Output_file_header):
10313 New forward class declarations.
10314 (Layout::~Layout): Define.
10315 (Layout::new_output_section_data_from_script): New method definition.
10316 (Layout::place_orphan_sections_in_script): New method declaration.
10317 (Layout::Segment_states): New type declaration.
10318 (Layout::save_segments, Layout::restore_segments,
10319 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10320 Layout::relaxation_loop_body): New method declarations.
10321 (Layout::Output_section_data_list): New type declaration.
10322 (Layout::Relaxation_debug_check): New class definition.
10323 (Layout::record_output_section_data_from_script_,
10324 Layout::script_output_section_data_list_, Layout::segment_states_,
10325 Layout::relaxation_debug_check_): New data members.
10326 * output.cc: (Output_section_headers::do_size): New method definition.
10327 (Output_section_headers::Output_section_headers): Move size
10328 computation to Output_section_headers::do_size.
10329 (Output_segment_headers::do_size): New method definition.
e1df38aa 10330 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
10331 Output_file_header::do_size and call it.
10332 (Output_file_header::do_size): New method definition.
10333 (Output_data_group::Output_data_group): Adjust call to
10334 Output_section_data.
10335 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10336 (Output_symtab_xindex::do_write): Add array bound check.
2e702c99 10337 (Output_section::Input_section::print_to_mapfile): Handle
20e6d0d6
DK
10338 RELAXED_INPUT_SECTION_CODE.
10339 (Output_section::Output_section): Initialize data member checkpoint_.
10340 (Output_section::~Output_section): Delete checkpoint object pointed
10341 by checkpoint_.
10342 (Output_section::add_input_section): Always add an Input_section if
10343 relaxing.
10344 (Output_section::add_merge_input_section): Add assert.
10345 (Output_section::relax_input_section): New method definition.
10346 (Output_section::set_final_data_size): Set load address to zero for
10347 an unallocated section.
10348 (Output_section::do_address_and_file_offset_have_reset_values):
10349 New method definition.
10350 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10351 Handle relaxed input section.
10352 (Output_section::sort_attached_input_sections): Checkpoint input
10353 section list lazily.
10354 (Output_section::get_input_sections): Change type of input_sections to
10355 list of Simple_input_section pointers. Checkpoint input section list
10356 lazily. Also handle relaxed input sections.
10357 (Output_section::add_input_section_for_script): Take a reference to
10358 a Simple_input_section object instead of Relobj pointer and section
10359 index as parameter. Handle relaxed input sections.
10360 (Output_section::save_states, Output_section::restore_states): New
10361 method definitions.
10362 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10363 (Output_data::is_data_size_fixed): New method definition.
10364 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10365 if it is fixed.
10366 (Output_data::address_and_file_offset_have_reset_values): New method
10367 definition.
10368 (Output_data::do_address_and_file_offset_have_reset_values): New method
10369 definition.
10370 (Output_data::set_data_size): Check that data size is not fixed.
10371 (Output_data::fix_data_size): New method definition.
10372 (Output_data::is_data_size_fixed_): New data member.
10373 (Output_section_headers::set_final_data_size): New method definition.
10374 (Output_section_headers::do_size): New method declaration.
10375 (Output_segment_headers::set_final_data_size): New method definition.
10376 (Output_segment_headers::do_size): New method declaration.
10377 (Output_file_header::set_final_data_size)::New method definition.
10378 (Output_file_header::do_size)::New method declaration.
10379 (Output_section_data::Output_section_data): Add new parameter
10380 is_data_size_fixed and use it to fix data size.
10381 (Output_data_const::Output_data_const): Adjust call to base class
10382 constructor and fix data size.
10383 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10384 base class constructor and fix data size.
10385 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10386 base class constructor and fix data size.
10387 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10388 class constructor and fix data size.
10389 (Output_data_group::set_final_data_size): New method definition.
10390 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10391 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10392 class constructor and fix data size.
10393 (Output_relaxed_input_section): New class definition.
10394 (Output_section::Simple_input_section): New class definition.
10395 (Output_section::get_input_sections): Adjust parameter list.
10396 (Output_section::add_input_section_for_script): Same.
10397 (Output_section::save_states, Output_section::restore_states,
10398 Output_section::do_address_and_file_offset_have_reset_values,
10399 (Output_section::Input_section::Input_section): Handle
10400 RELAXED_INPUT_SECTION_CODE. Add new overload for
10401 Output_relaxed_input_section.
10402 (Output_section::Input_section::is_input_section,
10403 Output_section::Input_section::set_output_section): Handle relaxed
10404 input section.
10405 (Output_section::Input_section::is_relaxed_input_section,
10406 Output_section::Input_section::output_section_data,
10407 Output_section::Input_section::relaxed_input_section): New method
10408 definitions.
10409 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10410 value.
10411 (Output_section::Input_section::u1_): Update comments.
10412 (Output_section::Input_section::u2_): Add new union member poris.
10413 (Output_section::Checkpoint_output_section): New classs definition.
10414 (Output_section::relax_input_section): New method declaration.
10415 (Output_section::checkpoint_): New data member.
10416 (Output_segment): Update comments.
10417 (Output_segment::Output_segment): Un-privatize copy constructor.
10418 (Output_segment::operator=): Un-privatize.
10419 * script-sections.cc (Output_section_element::Input_section_list):
10420 Change element type to Output_section::Simple_input_section.
10421 (Output_section_element_dot_assignment::set_section_addresses):
10422 Register output section data for relaxation clean up.
10423 (Output_data_exression::Output_data_expression): Adjust call to base
10424 constructor to fix data size.
10425 (Output_section_element_data::set_section_addresses): Register
10426 Output_data_expression object for relaxation clean up.
10427 (struct Input_section_info): Replace Relobj pointer and section index
10428 pair with Output_section::Simple_input_section and Convert struct to a
10429 class.
10430 (Input_section_sorter::operator()): Adjust access to
e1df38aa 10431 Input_section_info data member to use accessors.
20e6d0d6
DK
10432 (Output_section_element_input::set_section_addresses): Use layout
10433 parameter. Adjust code to use Output_section::Simple_input_section
10434 and Input_secction_info classes. Register filler for relaxation
10435 clean up.
10436 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10437 and section index pair with Output_section::Simple_input_section
10438 class. Adjust code accordingly.
10439 (Phdrs_element::release_segment): New method definition.
10440 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10441 segment list.
10442 (Script_sections::release_segments): New method definition.
10443 * gold/script-sections.h (Script_sections::release_segments): New
10444 method declaration.
10445 * gold/target.h (Target::may_relax, Target::relax,
10446 Target::do_may_relax, Target::do_relax): New method definitions.
10447
5e445df6
ILT
104482009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10449
10450 * arm.cc (has_signed_unsigned_overflow): New function.
10451 (Arm_relocate_functions::abs8): New function.
10452 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10453 (Target_arm::Scan::global): Likewise.
10454 (Target_arm::relocate::relocate): Likewise.
10455 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10456 Likewise.
10457
8c604651 104582009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
10459
10460 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10461 * testsuite/Makefile.in: Regenerate.
10462
1e9cc1c2
NC
104632009-09-11 Nick Clifton <nickc@redhat.com>
10464
10465 * po/gold.pot: Updated by the Translation project.
10466
6a89f575
CC
104672009-09-08 Cary Coutant <ccoutant@google.com>
10468
10469 * output.cc (Output_file::open): Add execute permission to empty file.
10470 * testsuite/Makefile.am (permission_test): New test.
10471 * testsuite/Makefile.in: Regenerate.
10472
fdcac5af
ILT
104732009-09-02 Ian Lance Taylor <iant@google.com>
10474
10475 * output.cc (Output_file::resize): Call map_no_anonymous rather
10476 than map.
10477
44453f85
ILT
104782009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10479
10480 * gold.cc: Include "incremental.h".
10481 (queue_initial_tasks): Call Incremental_checker methods.
10482 * incremental.cc: Include "output.h".
10483 (Incremental_checker::can_incrementally_link_output_file): New
10484 method.
10485 * incremental.h (Incremental_checker): New class.
10486
10487 * output.cc (Output_file::open_for_modification): New method.
10488 (Output_file::map_anonymous): Changed return type to bool. Record
10489 map in base_ field.
10490 (Output_file::map_no_anonymous): New method, broken out of map.
10491 (Output_file::map): Use map_no_anonymous and map_anonymous.
10492 * output.h (class Output_file): Update declarations.
10493
293c1386
CC
104942009-08-24 Cary Coutant <ccoutant@google.com>
10495
10496 * options.h (Command_line::Pre_options): New class.
10497 (Command_line::pre_options): New member.
10498 * options.cc (gold::options::ready_to_register): New variable.
10499 (One_option::register_option): Do nothing if not registering options.
10500 Assert if same short option registered twice.
10501 (General_options::General_options): Turn off option registration when
10502 done constructing.
10503 (Command_line::Pre_options::Pre_options): New constructor.
10504
f773f3d2
CC
105052009-08-24 Cary Coutant <ccoutant@google.com>
10506
06a73cfe
CC
10507 * options.h (General_options::no_keep_memory): Remove incorrect
10508 short option.
f773f3d2 10509
a15af8e2
RW
105102009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10511
10512 * Makefile.am (am__skiplex, am__skipyacc): New.
10513 * Makefile.in: Regenerate.
10514
c462b41b
RW
105152009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10516
14ec8efd
RW
10517 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10518 (INCLUDES): ... this.
10519 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10520 (AM_CPPFLAGS): Renamed from ...
10521 (INCLUDE): ... this.
10522 * Makefile.in, testsuite/Makefile.in: Regenerate.
10523
81ecdfbb
RW
10524 * Makefile.in: Regenerate.
10525 * aclocal.m4: Likewise.
10526 * config.in: Likewise.
10527 * configure: Likewise.
10528 * testsuite/Makefile.in: Likewise.
10529
c462b41b
RW
10530 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10531 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10532 * Makefile.in: Regenerate.
10533 * testsuite/Makefile.in: Regenerate.
10534
2da73f13
CC
105352009-08-19 Cary Coutant <ccoutant@google.com>
10536
10537 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10538 symbols in shared libraries overridden by hidden or internal symbols
10539 in the main program.
10540
2db70501
CD
105412009-08-19 Chris Demetriou <cgd@google.com>
10542
10543 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10544 checking source file names in error messages.
10545
f733487b
DK
105462009-08-18 Doug Kwan <dougkwan@google.com>
10547
10548 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10549 an elcpp::Ehdr as parameter. Adjust call to set_target.
10550 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10551 an elfcpp::Ehdr as parameter.
10552 * object.cc (Object::set_target): Remove the version that looks up
10553 a target and sets it.
10554 (Sized_relobj::setup): Take a Target object instead of
10555 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10556 (make_elf_sized_object): Find target and ask target to
10557 make an ELF object.
10558 * object.h: (Object::set_target): Remove the version that looks up
10559 a target and sets it.
10560 (Sized_relobj::setup): Take a Target object instead of
10561 an elfcpp:Ehdr as parameter.
10562 * target.cc: Include dynobj.h.
10563 (Target::do_make_elf_object_implementation): New.
2e702c99 10564 (Target::do_make_elf_object): New.
f733487b
DK
10565 * target.h (Target::make_elf_object): New template declaration.
10566 (Target::do_make_elf_object): New method declarations.
10567 (Target::do_make_elf_object_implementation): New template declaration.
10568
cc70f101
ILT
105692009-08-14 Ian Lance Taylor <iant@google.com>
10570
10571 * gold.h (FUNCTION_NAME): Define.
10572 (gold_unreachable): Use FUNCTION_NAME.
10573
ef5e0cb1
ST
105742009-08-12 Sriraman Tallam <tmsriram@google.com>
10575
10576 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10577 symbol in the --keep-unique list is not found.
10578
48c187ce
ST
105792009-08-12 Sriraman Tallam <tmsriram@google.com>
10580
10581 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10582 been maked as --keep-unique.
10583 (Icf::unfold_section): New function.
10584 * icf.h (Icf::unfold_section): New function.
10585 * options.h (General_options::keep_unique): New option.
10586 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10587 * testsuite/Makefile.in: Regenerate.
10588 * testsuite/icf_keep_unique_test.sh: New file.
10589 * testsuite/icf_keep_unique_test.cc: New file.
10590
645afe0c
CC
105912009-08-12 Cary Coutant <ccoutant@google.com>
10592
10593 PR 10471
10594 * resolve.cc (Symbol_table::resolve): Check for references from
10595 dynamic objects to hidden and internal symbols.
10596 * testsuite/Makefile.am (hidden_test.sh): New test.
10597 * testsuite/Makefile.in: Regenerate.
10598 * testsuite/hidden_test.sh: New script.
10599 * testsuite/hidden_test_1.c: New test source.
10600 * testsuite/hidden_test_main.c: New test source.
10601
11af873f
DK
106022009-08-11 Doug Kwan <dougkwan@google.com>
10603
10604 * arm.cc: Update comments.
10605 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10606 segment to locate the .ARM.exidx section if present.
10607
b9f7d72d
DK
106082009-08-09 Doug Kwan <dougkwan@google.com>
10609
10610 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10611 patch.
10612
ddd3c53c
ST
106132009-08-07 Sriraman Tallam <tmsriram@google.com>
10614 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10615 compiler warnings.
10616
27721062
ST
106172009-08-06 Sriraman Tallam <tmsriram@google.com>
10618
10619 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10620 valid tls_segment only for non-debug-section relocations.
10621 * testsuite/Makefile.am: Add gc_tls_test.
10622 * testsuite/Makefile.in: Regenerate.
10623 * testsuite/gc_tls_test.cc: New file.
10624 * testsuite/gc_tls_test.sh: New file.
10625
ef15dade 106262009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 10627
ef15dade
ST
10628 * icf.cc: New file.
10629 * icf.h: New file.
10630 * Makefile.am (CCFILES): Add icf.cc.
10631 (HFILES): Add icf.h
10632 * Makefile.in: Regenerate.
10633 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10634 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10635 section, symbol and addend information for the relocs.
10636 * gold.cc (queue_middle_tasks): Call identical code folding.
10637 * gold.h: Add defines for multimap.
10638 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10639 to the call of finalize_local_symbols.
10640 * main.cc (main): Create object of class Icf.
10641 * object.cc (Sized_relobj::do_layout): Allow this function to be
10642 called twice during icf.
10643 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10644 to sections marked as identical by icf.
10645 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10646 when available.
10647 (Sized_relobj::do_section_entsize): New function.
10648 * object.h (Object::section_entsize): New function.
10649 (Object::do_section_entsize): New pure virtual function.
10650 (Relobj::finalize_local_symbols): Add new parameter.
10651 (Relobj::do_section_entsize): New function.
10652 * options.h (General_options::icf): New option.
10653 (General_options::icf_iterations): New option.
10654 (General_options::print_icf_sections): New option.
10655 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10656 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10657 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10658 icf.
10659 * symtab.cc (Symbol_table::is_section_folded): New function.
10660 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10661 to sections marked as identical by icf.
10662 * symtab.h (Symbol_table::set_icf): New function.
10663 (Symbol_table::icf): New function.
10664 (Symbol_table::is_section_folded): New function.
10665 (Symbol_table::icf_): New data member.
10666 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10667 * testsuite/Makefile.am: Add commands to build icf_test.
10668 * testsuite/Makefile.in: Regenerate.
10669 * testsuite/icf_test.sh: New file.
10670 * testsuite/icf_test.cc: New file.
10671
c3b65ac4
CD
106722009-07-24 Chris Demetriou <cgd@google.com>
10673
10674 * layout.cc (is_compressible_debug_section): Fix incorrect
10675 comment about compressed section names.
10676
1caf2c51
ILT
106772009-07-20 Ian Lance Taylor <ian@airs.com>
10678
10679 PR 10419
10680 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10681
1ef4d87f
ILT
106822009-07-16 Ian Lance Taylor <iant@google.com>
10683
10684 PR 10400
10685 * layout.h: #include <map>.
10686 (class Kept_section): Change from struct to class. Add accessors
10687 and setters. Add section size to Comdat_group mapping. Change
10688 Comdat_group to std::map. Add is_comdat_ field. Add
10689 linkonce_size field in union.
10690 (class Layout): Update declaration of find_or_add_kept_section.
10691 Don't declare find_kept_object.
10692 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10693 parameter. Add object, shndx, is_comdat, and is_group_name
10694 parameters. Change all callers. Adjust for new Kept_section.
10695 (Layout::find_kept_object): Remove.
10696 * object.cc (Sized_relobj::include_section_group): Update use of
10697 Kept_section. Rename secnum to shndx. Only record
10698 Kept_comdat_section if sections are the same size.
10699 (Sized_relobj::include_linkonce_section): Update use of
10700 Kept_section. Only record Kept_comdat_section if sections are the
10701 same size. Set size of linkonce section.
10702 (Sized_relobj::map_to_kept_section): Update call to
10703 get_kept_comdat_section.
10704 * object.h (class Sized_relobj): Rename fields in
10705 Kept_comdat_section to drop trailing underscores; change object
10706 field to Relobj*. Change Kept_comdat_section_table to store
10707 struct rather than pointer.
10708 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10709 Add kept_object and kept_shndx parameters. Change all callers.
10710 (Sized_relobj::get_kept_comdat_section): Change return type to
10711 bool. Add kept_object and kept_shndx parameters. Change all
10712 callers.
10713 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10714 Layout::find_or_add_kept_section.
10715
37c3b7b0
ILT
107162009-07-09 Ian Lance Taylor <iant@google.com>
10717
10718 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10719 Reserve space in the hash table.
10720
98fa85cb
ILT
107212009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10722
10723 * fileread.cc (File_read::get_mtime): New method.
10724 * fileread.h (Timespec): New structure.
10725 (File_read::get_mtime): New method.
10726 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10727 Renamed from timestamp_nsec.
10728 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10729 Elf_Xword.
e1df38aa 10730 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 10731 timestamp_nsec.
e1df38aa 10732 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
10733 (Incremental_inputs::report_obejct): Save mtime; style fix.
10734 (Incremental_inputs::report_script): Save mtime; style fix.
10735 (Incremental_inputs::finalize_inputs): Style fix.
10736 (Incremental_inputs::finalize): Style fix.
10737 (Incremental_inputs::create_input_section_data): Store inputs
10738 mtime.
10739 * incremental.h (Incremental_inputs::report_script): Add mtime
10740 argument.
10741 (Incremental_inputs::Input_info::Input_info): Intialize only one
10742 union member.
10743 (Incremental_inputs::Input_info::archive): Move to nameless
10744 union.
10745 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10746 (Incremental_inputs::Input_info::script): Move to nameless union.
10747 (Incremental_inputs::mtime): New field.
10748 * script.cc (read_input_script): Pass file mtime to
10749 Incremental_input.
10750 * script.h (Script_info::inputs): Style fix.
10751
c9d70757
ILT
107522009-07-01 Ian Lance Taylor <ian@airs.com>
10753
10754 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10755 instead of 32.
10756
9c547ec3
ILT
107572009-06-24 Ian Lance Taylor <iant@google.com>
10758
10759 PR 10156
10760 * layout.cc (Layout::choose_output_section): If we find an
10761 existing section, update the flags.
10762 (Layout::create_notes): New function, broken out of
10763 Layout::finalize.
10764 (Layout::finalize): Don't create note sections.
10765 (Layout::create_note): Don't crash if linker script discards
10766 section.
10767 (Layout::create_gold_note): Likewise.
10768 (Layout::create_build_id): Likewise. Don't set
10769 after_input_sections on the section.
10770 (Layout::create_executable_stack_info): Remove target parameter.
10771 Change caller.
10772 * layout.h (class Layout): Declare create_notes. Update
10773 declaration of create_executable_stack_info.
10774 * gold.cc (queue_middle_tasks): Call create_notes.
10775 * output.cc (Output_section::update_flags_for_input_section): Move
10776 here from output.h. If SHF_ALLOC flag is newly set, mark address
10777 invalid.
10778 * output.h (Output_data::mark_address_invalid): New function.
10779 (class Output_section): Only declare, not define,
10780 update_flags_for_input_section. Remove set_flags.
10781
55458500
ILT
107822009-06-24 Ian Lance Taylor <iant@google.com>
10783
10784 * script-sections.cc (Output_section_definition::
10785 set_section_addresses): Rename shadowing local load_address to
10786 laddr.
10787
1307d6cd
ILT
107882009-06-24 Ian Lance Taylor <iant@google.com>
10789
10790 PR 10244
10791 * reloc.cc (relocate_sections): Skip empty relocation sections.
10792
ec3f783e
ILT
107932009-06-23 Ian Lance Taylor <iant@google.com>
10794
10795 PR 10156
10796 * layout.cc (Layout::create_note): Use choose_output_section
10797 rather than make_output_section.
10798
459c9f1c
ILT
107992009-06-23 Ian Lance Taylor <iant@google.com>
10800
10801 PR 10237
10802 * options.cc (General_options::parse_V): Set printed_version_.
10803 (General_options::General_options): Initialize printed_version_.
10804 * options.h (class General_options): Add printed_version_ field.
10805 * gold.cc (queue_initial_tasks): If there are no input files,
10806 don't give a fatal error if we printed the version information.
10807 (queue_middle_tasks): If using -r with a shared object, give a
10808 fatal error rather than an ordinary error.
10809
1518dc8f
ILT
108102009-06-23 Ian Lance Taylor <iant@google.com>
10811
10812 PR 10219
10813 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10814 (Layout::make_output_section): Set have_stabstr_section_ if we see
10815 a .stab*str section.
10816 (Layout::finalize): Call link_stabs_sections.
10817 (Layout::link_stabs_sections): New file.
10818 * layout.h (class Layout): Add have_stabstr_section_ field.
10819 Declare link_stabs_sections.
10820
3d857b98
DK
108212009-06-23 Doug Kwan <dougkwan@google.com>
10822
10823 * Makefile.am (libgold_a_LIBADD): New.
10824 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2e702c99 10825 * Makefile.in: Regenerate.
3d857b98
DK
10826 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10827 * configure: Regenerate.
10828 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10829 * fileread.cc: Include sys/state.h
10830 * gold.h: Declare memmem and strndup if found missing.
10831 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10832
0639a6f6
ILT
108332009-06-23 Ian Lance Taylor <iant@google.com>
10834
10835 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10836 * configure: Rebuild.
10837
8d63875c
ILT
108382009-06-23 Ian Lance Taylor <iant@google.com>
10839
10840 PR 10147
10841 * object.cc (Object::section_contents): Don't try to get a view if
10842 the section has length zero.
10843 (Object::handle_gnu_warning_section): If the section is empty, use
10844 the name of the section as the warning.
10845
f7c8a183
ILT
108462009-06-23 Ian Lance Taylor <iant@google.com>
10847
10848 PR 10133
10849 * stringpool.h (class Stringpool_template): Add optimize_ field.
10850 (Stringpool_template::set_optimize): New function.
10851 * stringpool.cc (Stringpool_template::Stringpool_template):
10852 Initialize optimize_ field.
10853 (Stringpool_template::set_string_offsets): Test local optimize
10854 fild rather than parameter.
10855 * layout.cc (Layout::Layout): Call set_optimize on the section
10856 name stringpool.
10857
e6a307ba
ILT
108582009-06-22 Ian Lance Taylor <iant@google.com>
10859
10860 PR 10030
10861 * yyscript.y: Parse TARGET.
10862 * script.cc (script_set_target): New function.
10863 * script-c.h (script_set_target): Declare.
10864 * options.cc (General_options::string_to_object_format): Rename
10865 from string_to_object_format in anonymous namespace. Change
10866 callers.
10867 * options.h (class General_options): Declare
10868 string_to_object_format.
10869
3ee173de
ILT
108702009-06-22 Ian Lance Taylor <iant@google.com>
10871
10872 * script-sections.cc (Script_sections::create_segments): Don't put
10873 program headers in a PT_LOAD segment if -n or -N.
10874
108752009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
10876
10877 PR 10141
10878 * options.h (class General_options): Add -z lazy and -z now. Sort
10879 -z options into alphabetical order.
10880 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10881
cd6739a1 108822009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
10883
10884 * layout.cc (Layout::make_output_section): Call
10885 Target::new_output_section.
10886 (Layout::attach_allocated_section_to_segment): Put large section
10887 sections in a separate load segment with the large segment flag
10888 set.
10889 (Layout::segment_precedes): Sort large data segments after other
10890 load segments.
10891 (align_file_offset): New static function.
10892 (Layout::set_segment_offsets): Use align_file_offset.
10893 * output.h (class Output_section): Add is_small_section_ and
10894 is_large_section_ fields.
10895 (Output_section::is_small_section): New function.
10896 (Output_section::set_is_small_section): New function.
10897 (Output_section::is_large_section): New function.
10898 (Output_section::set_is_large_section): New function.
10899 (Output_section::is_large_data_section): New function.
10900 (class Output_segment): Add is_large_data_segment_ field.
10901 (Output_segment::is_large_data_segment): New function.
10902 (Output_segment::set_is_large_data_segment): New function.
10903 * output.cc (Output_section::Output_section): Initialize new
10904 fields.
10905 (Output_segment::Output_segment): Likewise.
10906 (Output_segment::add_output_section): Add assertion that large
10907 data sections always go in large data segments. Force small data
10908 sections to the end of the list of data sections. Force small BSS
10909 sections to the start of the list of BSS sections. For large BSS
10910 sections to the end of the list of BSS sections.
10911 * symtab.h (class Symbol): Declare is_common_shndx.
10912 (Symbol::is_defined): Check Symbol::is_common_shndx.
10913 (Symbol::is_common): Likewise.
10914 (class Symbol_table): Define enum Commons_section_type. Update
10915 declarations. Add small_commons_ and large_commons_ fields.
10916 * symtab.cc (Symbol::is_common_shndx): New function.
10917 (Symbol_table::Symbol_table): Initialize new fields.
10918 (Symbol_table::add_from_object): Put small and large common
10919 symbols in the right list.
10920 (Symbol_table::sized_finalized_symbol): Check
10921 Symbol::is_common_shndx.
10922 (Symbol_table::sized_write_globals): Likewise.
10923 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10924 common symbol lists. Don't call do_allocate_commons_list if the
10925 list is empty.
10926 (Symbol_table::do_allocate_commons_list): Remove is_tls
10927 parameter. Add comons_section_type parameter. Change all
10928 callers. Handle small and large common symbols.
10929 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10930 Symbol::is_common_shndx.
10931 * resolve.cc (symbol_to_bits): Likewise.
10932 * target.h (Target::small_common_shndx): New function.
10933 (Target::small_common_section_flags): New function.
10934 (Target::large_common_shndx): New function.
10935 (Target::large_common_section_flags): New function.
10936 (Target::new_output_section): New function.
10937 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10938 small_common_section_flags, and large_common_section_flags
10939 fields.
10940 (Target::do_new_output_section): New virtual function.
10941 * arm.cc (Target_arm::arm_info): Initialize new fields.
10942 * i386.cc (Target_i386::i386_info): Likewise.
10943 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10944 Likewise.
10945 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10946 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10947 (Target_x86_64::do_new_output_section): New function.
10948 * configure.ac: Define conditional MCMODEL_MEDIUM.
10949 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10950 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10951 (large_LDFLAGS): Define.
10952 * testsuite/large.c: New file.
10953 * testsuite/testfile.cc (Target_test::test_target_info):
10954 Initialize new fields.
10955 * configure, testsuite/Makefile.in: Rebuild.
10956
bb04269c
DK
109572009-06-05 Doug Kwan <dougkwan@google.com>
10958
10959 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 10960 * Makefile.in: Regenerate.
bb04269c
DK
10961 * i386.cc (class Target_i386): Define new virtual method to
10962 override do_is_local_label_name in parent.
10963 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10964 local symbols if --discard-locals or -X is given.
10965 * options.h (class General_options): Declare new options
10966 '--discard-locals' and '-X' for discarding locals.
10967 * target.h (class Target): Define new methods is_local_label_name.
10968 Declare new virtual method do_is_local_label_name.
10969 * target.cc: New file.
10970 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10971 (check_SCRIPTS): Add discard_locals_test.sh.
10972 (check_DATA): Add discard_local_tests.syms.
10973 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10974 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10975 * testsuite/Makefile.in: Regenerate.
10976 * testsuite/discard_locals_test.c: New file.
10977 * testsuite/discard_locals_test.sh: Same.
10978
805bb01c
DK
109792009-06-05 Doug Kwan <dougkwan@google.com>
10980
10981 * object.cc (Sized_relobj::Sized_relobj): Initialize
10982 discarded_eh_frame_shndx_ to -1U.
10983 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10984 section.
10985 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10986 a discarded .eh_frame section.
10987 (Sized_relobj::do_finalize_local_symbols): Ditto.
10988 * object.h (class Sized_relobj): Declare new member
10989 discarded_eh_frame_shndx_.
10990 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10991 (local_labels_test.o, local_labels_test): New rules.
10992 * testsuite/Makefile.in: Regenerate.
10993
1dcd334d
DK
109942009-06-04 Doug Kwan <dougkwan@google.com>
10995
10996 * layout.cc (Layout::section_name_mapping): Add mapping for
10997 special ARM sections.
10998
96d49306
DK
109992009-06-03 Doug Kwan <dougkwan@google.com>
11000
11001 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11002 (utils::has_overflow): Same.
11003
dff16297
ILT
110042009-06-03 Ian Lance Taylor <iant@google.com>
11005
11006 * layout.cc (Layout::section_name_mapping): New array, replacing
11007 Layout::linkonce_mapping.
11008 (Layout::section_name_mapping_count): New variable, replacing
11009 Layout::linkonce_mapping_count.
11010 (Layout::linkonce_output_name): Remove.
11011 (Layout::output_section_name): Rewrite.
11012 * layout.h (class Layout): Rename Linkonce_mapping to
11013 Section_name_mapping, linkonce_mapping to section_name_mapping,
11014 linkonce_mapping_count to section_name_mapping_count. Don't
11015 declare linkonce_output_name.
11016
c121c671
DK
110172009-06-03 Doug Kwan <dougkwan@google.com>
11018
11019 * gold/arm.cc (namespace utils): New.
11020 (Target_arm::reloc_is_non_pic): Define new method.
11021 (class Arm_relocate_functions): New.
11022 (Target_arm::Relocate::relocate): Handle relocation types used by
11023 Android.
11024
07800fab
ILT
110252009-06-03 Ian Lance Taylor <iant@google.com>
11026
11027 * arm.cc (Target_arm::scan::global): Use || instead of |.
11028
c121c671
DK
110292009-06-02 Doug Kwan <dougkwan@google.com>
11030
11031 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11032 issued_non_pic_error_.
11033 (class Target_arm::Scan): Declare new method check_non_pic.
11034 Define new method symbol_needs_plt_entry.
11035 Declare new data member issued_non_pic_error_.
11036 (class Target_arm::Relocate): Declare new method
11037 should_apply_static_reloc.
11038 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11039 (Target_arm::Scan::check_non_pic): Define new method.
11040 (Target_arm::Scan::local): Handle a small subset of reloc types used
11041 by Android.
11042 (Target_arm::Scan::local): Same.
11043 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11044
b19b0c6d
ILT
110452009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11046
11047 * incremental.cc (Incremental_inputs::report_command_line): Filter
11048 out --incremental-* options.
11049
94cdfcff
DK
110502009-05-29 Doug Kwan <dougkwan@google.com>
11051
11052 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11053 template class.
11054 (class Target_arm): Update comment.
11055 (Target_arm::Target_arm): Initialize new data members GOT_,
11056 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11057 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11058 and Target_arm::rel_dyn_section.
11059 Declare new_enum Target_arm::Got_type.
11060 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11061 and DYNBSS_.
11062 Update commments for member do_dynsym_value.
11063 (Target_arm::got_size, Target_arm::plt_section,
11064 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11065 new methods inside class defintion.
11066 (Target_arm::got_section): Define new method.
11067 (Target_arm::rel_dyn_section): Same.
11068 (Output_data_plt_arm): New template class.
11069 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11070 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11071 (Output_data_plt_arm::add_entry): Same.
11072 (Output_data_plt_arm::first_plt_entry): Define new
11073 static data member for PLT instruction template.
11074 (Output_data_plt_arm::plt_entry): Same.
11075 (Output_data_plt_arm::do_write): Define new method.
11076 (Target_arm::make_plt_entry): Same.
11077 (Target_arm::do_finalize_sections): Same.
11078 (Target_arm::do_dynsym_value): Same.
11079
4a657b0d
DK
110802009-05-28 Doug Kwan <dougkwan@google.com>
11081
11082 * Makefile.am (TARGETSOURCES): Add arm.cc.
11083 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11084 * Makefile.in: Regenerate.
11085 * arm.cc: New file.
11086 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11087
e7ae8c36
DK
110882009-05-26 Doug Kwan <dougkwan@google.com>
11089
11090 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11091 (General_options::check_excluded_libs): Strip off directories in
11092 archive name before matching like GNU ld does.
11093 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11094 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11095 (exclude_libs_test_LDFLAGS): Add linker option
11096 -Wl,--exclude-libs,libexclude_libs_test_3
11097 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11098 an explicit archive without using -l.
11099 (alt/libexclude_libs_test_3.a): New make rule.
11100 * testsuite/Makefile.in: Regenerate.
11101 * testsuite/exclude_libs_test.c : Declare lib3_default().
11102 (main): Call it.
11103 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11104 * exclude_libs_test_3.c: New file.
11105
f12e7348
NC
111062009-05-26 Nick Clifton <nickc@redhat.com>
11107
11108 * po/id.po: New Indonesian translation.
11109 * po/gold.pot: Updated template file.
11110
4daadc0d
ST
111112009-05-22 Sriraman Tallam <tmsriram@google.com>
11112
e1df38aa 11113 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
11114 gc_comdat_test files. Add -Wl,--gc-sections to build
11115 gc_comdat_test.
11116 * testsuite/Makefile.in: Regenerate.
11117 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11118
531813ad
ST
111192009-05-21 Sriraman Tallam <tmsriram@google.com>
11120
11121 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11122 kept comdat section was garbage collected.
11123 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11124 * testsuite/Makefile.in: Regenerate.
11125 * testsuite/gc_comdat_test.sh: New file.
11126 * testsuite/gc_comdat_test_1.cc: New file.
11127 * testsuite/gc_comdat_test_2.cc: New file.
11128
65514900
CC
111292009-05-19 Doug Kwan <dougkwan@google.com>
11130
11131 * archive.cc (Archive::Archive): Move constructor from archive.h
11132 to here. Initialize no_export_.
11133 (Archive::get_elf_object_for_member): Set no_export flag of object.
11134 * archive.h (Archive::Archive): Move constructor body to
11135 archive.cc.
11136 (Archive::no_export): New method.
11137 (Archive::no_export_): New field.
11138 * object.h (Object::Object): Initialize no_export_ to false.
11139 (Object::no_export, Object::set_no_export): New methods.
11140 (Object::no_export_): New field.
11141 * options.cc (General_options::parse_exclude_libs): New method.
11142 (General_options::check_excluded_libs) Same.
11143 * options.h (exclude_libs): New option.
11144 (General_options::check_excluded_libs): New method declaration.
11145 (General_options::excluded_libs_): New field.
11146 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11147 default or protected visibility if an object has no-export flag set.
11148 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11149 (check_SCRIPTS): Add exclude_libs_test.sh.
11150 (check_DATA): Add exclude_libs_test.syms.
11151 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11152 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11153 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11154 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11155 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11156 libexclude_libs_test_2.a): New rules.
11157 * testsuite/Makefile.in: Regenerate.
11158 * testsuite/exclude_libs_test.c: New file.
11159 * testsuite/exclude_libs_test.sh: Ditto.
11160 * testsuite/exclude_libs_test_1.c: Ditto.
11161 * testsuite/exclude_libs_test_2.c: Ditto.
11162
1b77ea50
ILT
111632009-05-15 Ian Lance Taylor <iant@google.com>
11164
11165 * configure.ac: Check for declarations for cases where libiberty.h
11166 checks HAVE_DECL_xxx.
11167 * configure, config.in: Rebuild.
11168
072fe7ce
ILT
111692009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11170
11171 * gold.h (Incremental_argument_list): Remove (invalid) forward
11172 declaration.
11173 * incremental.cc (Incremental_inputs::report_achive): New method.
11174 (Incremental_inputs::report_object): New method.
11175 (Incremental_inputs::report_script): New method.
11176 (Incremental_inputs::finalize_inputs): New method.
11177 (Incremental_inputs::finalize): Call finalize_inputs().
11178 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11179 Create inputs entries.
11180 * incremental.h (Incremental_input_type): New enum.
11181 (Incremental_inputs::Incremental_input): Initialize new fields.
11182 (Incremental_inputs::report_inputs): New method.
11183 (Incremental_inputs::report_achive): New method.
11184 (Incremental_inputs::report_object): New method.
11185 (Incremental_inputs::report_script): New method.
11186 (Incremental_inputs::finalize_inputs): New method.
11187 (Incremental_inputs::Input_info): New struct.
11188 (Incremental_inputs::Input_info_map): New typedef.
11189 (Incremental_inputs::lock_): New field.
11190 (Incremental_inputs::Inputs_): New field.
11191 (Incremental_inputs::Inputs_map): New field.
11192 * main.cc (main): Call Incremental_input::report_inputs.
11193 * options.h (Input_argument_list): Typedef moved from
11194 Input_arguments.
11195 (Input_file_group::Files): Remove, use ::Input_argument_list.
11196 (Input_file_group::Input_argument_list): Remove, use
11197 ::Input_argument_list.
11198 * plugin.cc (Plugin_manager::add_input_file): Add error in
11199 incremental build.
11200 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11201 functions.
11202 * script.cc (read_input_script): Call
11203 Incremental_input::report_script.
11204 * script.h (Script_info): New class.
11205
b0481b0b
ILT
112062009-04-27 Ian Lance Taylor <iant@google.com>
11207
11208 * x86_64.cc (do_adjust_output_section): Set entsize to
11209 plt_entry_size.
11210
b22a5a41 112112009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
11212
11213 * output.cc (Output_file::close): After short writes, continue
11214 writing from the correct offset in the buffer being written.
11215
40fde488
CD
112162009-04-23 Chris Demetriou <cgd@google.com>
11217
11218 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11219 * configure: Regenerate.
11220 * config.in: Regenerate.
11221 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11222 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11223
3ce2c28e
ILT
112242009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11225
11226 * incremental.cc (Incremental_inputs_header_data): Renamed from
11227 Incremental_input_header_data.
11228 (Incremental_inputs_header_data::data_size): New field.
11229 (Incremental_inputs_header_data::put_input_file_count): Renamed
11230 from input_file_count.
11231 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11232 from command_line_offset.
11233 (Incremental_inputs_header_data::put_reserved): Renamed from
11234 put_reserved.
11235 (Incremental_inputs_entry_data): Renamed from
11236 Incremental_input_entry_data.
11237 (Incremental_inputs_entry_data::data_size): New field.
11238 (Incremental_inputs::report_command_line): New method.
11239 (Incremental_inputs::finalize): New method.
11240 (Incremental_inputs::create_incremental_inputs_data): New method.
11241 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11242 * incremental.h: New file.
11243 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
703d02da 11244 (Layout::finalize): Create incremental inputs section in
3ce2c28e 11245 incremental builds.
703d02da 11246 (Layout::create_incremental_info_sections): New method.
3ce2c28e 11247 * layout.h (Layout::incremental_inputs): New method.
703d02da
AM
11248 (Layout::create_incremental_info_sections): New method.
11249 (Layout::incremental_inputs_): New field.
3ce2c28e
ILT
11250 * main.cc (main): Notify Incremental_input of the command line.
11251
e55bde5e
ILT
112522009-04-01 Ian Lance Taylor <iant@google.com>
11253 Mikolaj Zalewski <mikolajz@google.com>
11254
11255 * gold.h (reserve_unordered_map): Define, three versions, one for
11256 each version of Unordered_map.
11257 * layout.cc (Layout::Layout): Remove options parameter. Add
11258 number_of_input_files parameter. Don't initialize options_.
11259 Initialize number_of_input_files_ and resized_signatures_. Move
11260 sections_are_attached_.
11261 (Layout::layout_group): Reserve space for group_signatures_.
11262 (Layout::find_or_add_kept_section): Change name parameter to be a
11263 reference. Resize signatures_ map when it gets large enough.
11264 (Layout::layout_eh_frame): Use parameters->options() instead of
11265 this->options_.
11266 (Layout::make_output_section): Likewise.
11267 (Layout::attach_allocated_section_to_segment): Likewise.
11268 (Layout::finalize, Layout::create_executable_stack): Likewise.
11269 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11270 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11271 * layout.h (class Layout): Update declarations. Remove options_
11272 field. Add number_of_input_files_ and resized_signatures_
11273 fields. Move sections_are_attached_ field.
11274 * main.cc (main): Pass number of input files to Layout
11275 constructor. Don't pass options.
11276
154b857c
ILT
112772009-03-30 Ian Lance Taylor <iant@google.com>
11278
11279 * ffsll.c (ffsll): Correct implementation.
11280
2f35ab9b
ILT
112812009-03-27 Ian Lance Taylor <iant@google.com>
11282
fd03461a
ILT
11283 * ffsll.c: New file.
11284 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11285 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11286 * ftruncate.c (ftruncate): Declare before definition.
11287 * mremap.c (mremap): Likewise.
11288 * pread.c (pread): Likewise.
11289 * configure, Makefile.in, config.in: Rebuild.
11290
2f35ab9b
ILT
11291 * mremap.c: New file.
11292 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11293 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11294 (mremap): Declare if HAVE_MREMAP is not defined.
11295 * configure, Makefile.in, config.in: Rebuild.
11296
33aea2fd
CC
112972009-03-27 Cary Coutant <ccoutant@google.com>
11298
11299 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11300 position independent.
11301 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11302 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11303
6d479619
CC
113042009-03-24 Cary Coutant <ccoutant@google.com>
11305
11306 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11307 an executable.
11308 (needs_dynamic_reloc): Likewise.
11309
afc06bb8
ILT
113102009-03-24 Ian Lance Taylor <iant@google.com>
11311
11312 * yyscript.y (file_cmd): Recognize EXTERN.
11313 (extern_name_list, extern_name_list_body): New nonterminals.
11314 * script.cc (script_add_extern): Define.
11315 * script-c.h (script_add_extern): Declare.
11316
f6060a4d
ILT
113172009-03-24 Rafael Avila de Espindola <espindola@google.com>
11318
11319 * object.cc (is_elf_object): Define.
11320 * object.h (is_elf_object): Declare.
11321 * archive.cc (Archive::get_elf_object_for_member): Call
11322 is_elf_object.
33aea2fd 11323 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 11324
26736d8e
ILT
113252009-03-24 Elliott Hughes <enh@google.com>
11326
11327 * output.cc (Output_file::map_anonymous): Define.
11328 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11329 try an anonymous one. Report the size if the mmap fails.
11330 * output.h (class Output_file): Declare map_anonymous.
11331
22fd9730
ILT
113322009-03-24 Ian Lance Taylor <iant@google.com>
11333
11334 * target-select.cc (instantiate_target): Don't acquire the lock if
11335 the instantiated_target_ field has already been set.
11336
cb010894
ILT
113372009-03-23 Ian Lance Taylor <iant@google.com>
11338
7f055c20
ILT
11339 * gold-threads.h (class Initialize_lock): Define.
11340 * gold-threads.cc (class Initialize_lock_once): Define.
11341 (initialize_lock_control): New static variable.
11342 (initialize_lock_pointer): New static variable.
11343 (initialize_lock_once): New static function.
11344 (Initialize_lock::Initialize_lock): Define.
11345 (Initialize_lock::initialize): Define.
11346 * target-select.h: Include "gold-threads.h".
11347 (class Target_selector): Add lock_ and initialize_lock_ fields.
11348 Don't define instantiate_target, just declare it.
11349 * target-select.cc (Target_selector::Target_selector): Initialize
11350 new fields.
11351 (Target_selector::instantiate_target): Define.
11352 * descriptors.h: Include "gold-threads.h".
11353 (class Descriptors): Add initialize_lock_ field.
11354 * descriptors.cc (Descriptors::Descriptors): Initialize new
11355 field.
11356 (Descriptors::open): Use initialize_lock_ field
11357 * errors.h (class Errors): Add initialize_lock_ field.
11358 * errors.cc (Errors::Errors): Initialize new field.
11359 (Errors::initialize_lock): Use initialize_lock_ field.
11360 * powerpc.cc (class Target_selector_powerpc): Remove
11361 instantiated_target_ field. In do_recognize call
11362 instantiate_target rather than do_instantiate_target. In
11363 do_instantiate_target just allocate a new target.
11364 * sparc.cc (class Target_selector_sparc): Likewise.
11365
36959681
ILT
11366 * freebsd.h: New file.
11367 * i386.cc: Include "freebsd.h".
11368 (Target_i386): Derive from Target_freebsd rather than
11369 Sized_target.
11370 (Target_selector_i386): Derive from Target_selector_freebsd rather
11371 than Target_selector.
11372 * x86_64.cc: Include "freebsd.h".
11373 (Target_x86_64): Derive from Target_freebsd rather than
11374 Sized_target.
11375 (Target_selector_x86_64): Derive from Target_selector_freebsd
11376 rather than Target_selector.
11377 * target.h (class Target): Add adjust_elf_header and
11378 do_adjust_elf_header.
11379 * output.cc (Output_file_header:: do_sized_write): Call target
11380 adjust_elf_header routine.
11381 * configure.tgt: Set targ_osabi.
11382 * configure.ac: Define GOLD_DEFAULT_OSABI.
11383 * parameters.cc (Parameters::default_target): Pass
11384 GOLD_DEFAULT_OSABI to select_target.
11385 * target-select.h (class Target_selector): Make instantiate_target
11386 protected rather than private.
11387 * Makefile.am (HFILES): Add freebsd.h.
11388 * configure, Makefile.in, config.in: Rebuild.
11389
cb010894
ILT
11390 * merge.cc (do_add_input_section): Correct pend value. Change
11391 message about last entry not being null terminated from error to
11392 warning.
11393
0e879927
ILT
113942009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11395
11396 * incremental.cc: New file.
11397 * Makefile.am (CCFILES): Add incremental.cc.
11398 * Makefile.in: Rebuild.
11399
41105937
PP
114002009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11401
11402 * layout.cc (Layout::output_section_name): Preserve names
11403 of '.note.' sections.
e1df38aa 11404
60439920
ILT
114052009-03-19 Ian Lance Taylor <iant@google.com>
11406
11407 * descriptors.cc (Descriptors::open): Check that the options are
11408 valid before using them.
11409
0d371ad3
ILT
114102009-03-18 Ian Lance Taylor <iant@google.com>
11411
11412 * script-sections.h: Include <list>.
11413 (class Script_sections): Change Sections_elements from std::vector
11414 to std::list. Typedef public Elements_iterator. Add
11415 orphan_section_placement_, data_segment_align_start_, and
11416 saw_data_segment_align_ fields. Remove data_segment_align_index_
11417 field.
11418 * script-sections.cc (class Orphan_section_placement): New class.
11419 (class Sections_element): Add virtual functions is_relro and
11420 orphan_section_init. Remove virtual function place_orphan_here.
11421 (class Output_section_definition): Add is_relro and
11422 orphan_section_init. Remove place_orphan_here.
11423 (class Orphan_output_section): Likewise.
11424 (Script_sections::Script_sections): Update for field changes.
11425 (Script_sections::data_segment_align): Set saw_data_segment_align_
11426 and data_segment_align_start_, not data_segment_align_index.
11427 (Script_sections::data_segment_relro_end): Check
11428 saw_data_segment_align_. Use data_segment_align_start_ rather
11429 than data_segment_align_index_.
11430 (Script_sections::place_orphan): Rewrite to use
11431 Orphan_section_placement.
11432
9201d894
ILT
114332009-03-17 Ian Lance Taylor <iant@google.com>
11434
9c5b8369
ILT
11435 * archive.cc (Archive::add_symbols): Check for a version attached
11436 to the symbol name in the archive map.
11437 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11438 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11439 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11440 (ver_test_11.a): New target.
11441 * testsuite/Makefile.in: Rebuild.
11442
9201d894
ILT
11443 * configure.ac: Check for chsize and posix_fallocate. Replace
11444 ftruncate.
11445 * ftruncate.c: New file, from gnulib.
11446 * output.cc (posix_fallocate): Define dummy version if not
11447 HAVE_POSIX_FALLOCATE.
11448 (Output_file::map): Call posix_fallocate rather than lseek and
11449 write.
11450 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11451 * configure, Makefile.in, config.in: Rebuild.
11452
ef4ab7a8 114532009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 11454
ef4ab7a8
PP
11455 * layout.h (Layout::create_note): Add section_name parameter.
11456 * layout.cc (Layout::create_note): Likewise.
11457 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 11458
8c500701
ILT
114592009-03-17 Ian Lance Taylor <iant@google.com>
11460
e85b18e1
ILT
11461 * descriptors.cc: Include "options.h".
11462 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11463 (Descriptors::open): Always use O_CLOEXEC when opening a new
11464 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11465 then set FD_CLOEXEC.
11466
9efe6174
ILT
11467 * sparc.cc (class Target_sparc): Add has_got_section.
11468 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11469 make sure we have a GOT section.
11470
11471 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11472 (Target_sparc::Scan::local): Likewise.
11473 (Target_sparc::Scan::global): Likewise.
11474 (Target_sparc::Relocate::relocate): Likewise.
11475 (Target_sparc::Relocate::relocate_tls): Likewise.
11476
8c500701
ILT
11477 * symtab.cc (Symbol_table::define_default_version): New function,
11478 broken out of add_from_object.
11479 (Symbol_table::add_from_object): Call define_default_version.
11480 (Symbol_table::define_special_symbol): Add resolve_oldsym
11481 parameter. Change all callers. If the version for a symbol comes
11482 from a version script, resolve it with the symbol with the same
11483 name with no version. Also add the symbol without a version if
11484 appropriate.
11485 (do_define_in_output_data): If resolving with oldsym, don't delete
11486 sym.
11487 (do_define_in_output_segment): Likewise.
11488 (do_define_as_constant): Likewise.
11489 * symtab.h (class Symbol_table): Update declarations.
11490
f1ed28fb
ILT
114912009-03-13 Ian Lance Taylor <iant@google.com>
11492
15f8229b
ILT
11493 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11494 (Read_symbols::requeue): New function.
11495 (Read_symbols::do_read_symbols): If make_elf_object fails because
11496 the target type is not configured, and the file was searched for,
11497 issue a warning and retry with the next directory.
11498 (Add_symbols::run): If the file has an incompatible format, and
11499 it was searched for, requeue the Read_symbols task. On error,
11500 release the object.
11501 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11502 dirindex parameter to constructor. Change all callers. Declare
11503 incompatible_warning and requeue.
11504 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11505 input_argument_ and input_group_ fields. Add them to
11506 constructor. Change all callers.
11507 (class Read_script): Add dirindex_ field. Add it to constructor.
11508 Change all callers.
11509 * archive.cc (Archive::setup): Remove input_objects parameter.
11510 Change all callers.
11511 (Archive::get_file_and_offset): Likewise.
11512 (Archive::read_all_symbols): Likewise.
11513 (Archive::read_symbols): Likewise.
11514 (Archive::get_elf_object_for_member): Remove input_objects
11515 parameter. Add punconfigured parameter. Change all callers.
11516 (Archive::add_symbols): Change return type to bool. Check return
11517 value of include_member.
11518 (Archive::include_all_members): Likewise.
11519 (Archive::include_member): Change return type to bool. Return
11520 false if first included object has incompatible target. Set
11521 included_member_ field.
11522 (Add_archive_symbols::run): If add_symbols returns false, requeue
11523 Read_symbols task.
11524 * archive.h (class Archive): Add included_member_ field.
11525 Initialize it in constructor. Add input_file and searched_for
11526 methods. Update declarations.
11527 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11528 input_argument_ fields. Add them to constructor. Change all
11529 callers.
11530 * script.cc: Include "target-select.h".
11531 (class Parser_closure): Add skip_on_incompatible_target_ and
11532 found_incompatible_target_ fields. Add
11533 skip_on_incompatible_target parameter to constructor. Change all
11534 callers. Add methods skip_on_incompatible_target,
11535 clear_skip_on_incompatible_target, found_incompatible_target, and
11536 set_found_incompatible_target.
11537 (read_input_script): Add dirindex parameter. Change all callers.
11538 If parser finds an incompatible target, requeue Read_symbols
11539 task.
11540 (script_set_symbol): Clear skip_on_incompatible_target in
11541 closure.
11542 (script_add_assertion, script_parse_option): Likewise.
11543 (script_start_sections, script_add_phdr): Likewise.
11544 (script_check_output_format): New function.
11545 * script.h (read_input_script): Update declaration.
11546 * script-c.h (script_check_output_format): Declare.
11547 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11548 (ignore_cmd): Remove OUTPUT_FORMAT.
11549 * fileread.cc (Input_file::Input_file): Add explicit this.
11550 (Input_file::will_search_for): New function.
11551 (Input_file::open): Add pindex parameter. Change all callers.
11552 * fileread.h (class Input_file): Add input_file_argument method.
11553 Declare will_search_for. Update declarations.
11554 * object.cc (make_elf_object): Add punconfigured parameter.
11555 Change all callers.
11556 * object.h (class Object): Make input_file public. Add
11557 searched_for method.
11558 (make_elf_object): Update declaration.
11559 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11560 restart search.
11561 * dirsearch.h (class Dirsearch): Update declaration.
11562 * options.h (class General_options): Add --warn-search-mismatch.
11563 * parameters.cc (Parameters::is_compatible_target): New function.
11564 * parameters.h (class Parameters): Declare is_compatible_target.
11565 * workqueue.cc (Workqueue::add_blocker): New function.
11566 * workqueue.h (class Workqueue): Declare add_blocker.
11567
f1ed28fb
ILT
11568 * fileread.cc (Input_file::open): Remove options parameter.
11569 Change all callers.
11570 (Input_file::open_binary): Likewise.
11571 * script.cc (read_input_script): Likewise.
11572 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11573 options parameter from constructor. Change all callers.
11574 (class Read_script): Likewise.
11575 * fileread.h (class Input_file): Update declarations.
11576 * script.h (read_input_script): Update declaration.
11577
34dd024a
NC
115782009-03-10 Nick Clifton <nickc@redhat.com>
11579
11580 * po/es.po: New Spanish translation.
11581
6d71b17c
CC
115822009-03-06 Cary Coutant <ccoutant@google.com>
11583
11584 * options.cc (parse_short_option): Keep dash_z from registering itself.
11585
031cdbed
ILT
115862009-03-03 Ian Lance Taylor <iant@google.com>
11587
11588 PR 9918
11589 * target-reloc.h (relocate_section): Pass output_section to
11590 relocate.
11591 * i386.cc (Target_i386::should_apply_static_reloc): Add
11592 output_section parameter. Change all callers.
11593 (Target_i386::Relocate::relocate): Add output_section parameter.
11594 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11595 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11596 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11597 * testsuite/two_file_shared.sh: New script.
11598 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11599 (check_DATA): Add two_file_shared.dbg.
11600 (two_file_shared.dbg): New target.
11601 * testsuite/Makefile.in: Rebuild.
11602
15d5fa16
ILT
116032009-03-01 Ian Lance Taylor <iant@google.com>
11604
11605 * configure.ac: Check for byteswap.h.
11606 * configure: Rebuild.
11607 * config.in: Rebuild.
11608
8a4c0b0d
ILT
116092009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11610
11611 * layout.cc (Layout::find_or_add_kept_section): New function.
11612 (Layout::add_comdat): Removed.
11613 * layout.h (struct Kept_section): Move out of class Layout.
11614 Remove trailing underscores from field names. Add group_sections
11615 field. Rename group_ field to is_group. Change all uses.
11616 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11617 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11618 comdat_groups_ field.
11619 (Sized_relobj::include_section_group): Use
11620 find_or_add_kept_section and Kept_section::group_sections.
11621 (Sized_relobj::include_linkonce_section): Likewise.
11622 * object.cc (class Sized_relobj): Don't define Comdat_group or
11623 Comdat_group_table. Remove find_comdat_group and
11624 add_comdat_group. Remove comdat_groups_ field.
11625 * plugin.cc (include_comdat_group): Use
11626 Layout::find_or_add_kept_section.
11627
b4ecf66b
ILT
116282009-02-28 Ian Lance Taylor <iant@google.com>
11629
14359ca0
ILT
11630 * README: --gc-sections and map files are now supported. Document
11631 some build requirements.
11632
b4ecf66b
ILT
11633 PR 6992
11634 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11635 relocatable link set the value of the section symbol to zero.
11636 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11637 relocatable link don't include the section address in the local
11638 symbol value.
11639
0602e05a
ILT
116402009-02-27 Ian Lance Taylor <iant@google.com>
11641
fd9d194f
ILT
11642 PR 6811
11643 * options.h (class Search_directory): Add is_system_directory.
11644 (class General_options): Declare is_in_system_directory.
11645 * options.cc (get_relative_sysroot): Make static.
11646 (get_default_sysroot): Make static.
11647 (General_optoins::is_in_system_directory): New function.
11648 * fileread.cc (Input_file::is_in_system_directory): New function.
11649 * fileread.h (class Input_file): Declare is_in_system_directory.
11650 * object.h (class Object): Add is_in_system_directory.
11651 (class Input_objects): Remove system_library_directory_ field.
11652 * object.cc (Input_objects::add_object): Don't set
11653 system_library_directory_.
11654 (input_objects::found_in_system_library_directory): Remove.
11655 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11656 parameter. Change all callers.
11657 (Symbol_table::sized_write_globals): Likewise.
11658 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11659 Call Object::is_in_system_directory.
11660 * symtab.h (class Symbol_table): Update declarations.
11661
61edd21f
ILT
11662 PR 5990
11663 * descriptors.h (Open_descriptor): Add is_on_stack field.
11664 * descriptors.cc (Descriptors::open): If the descriptor is on the
11665 top of the stack, remove it. Initialize is_on_stack field.
11666 (Descriptors::release): Only add pod to stack if it is not on the
11667 stack already.
11668 (Descriptors::close_some_descriptor): Clear stack_next and
11669 is_on_stack fields.
11670
e29e076a
ILT
11671 PR 7091
11672 * output.cc (Output_section::find_starting_output_address): Rename
11673 from starting_output_address; add PADDR parameter; change return
11674 type.
11675 * output.h (class Output_section): Declare
11676 find_starting_output_address instead of starting_output_address.
11677 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11678 section symbol for which we can't find a merge section.
11679
0602e05a
ILT
11680 PR 9836
11681 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11682 hidden or internal, force the symbol to be local.
11683 * resolve.cc (Symbol::override_visibility): Define.
11684 (Symbol::override_base): Use override_visibility.
11685 (Symbol_table::resolve): Likewise.
11686 (Symbol::override_base_with_special): Likewise.
11687 (Symbol_table::override_with_special): If the visibility is hidden
11688 or internal, force the symbol to be local.
11689 * symtab.h (class Symbol): Add set_visibility and
11690 override_visibility.
11691 * testsuite/ver_test_1.sh: New file.
11692 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11693 (check_DATA): Add ver_test_1.syms.
11694 (ver_test_1.syms): New target.
11695 * testsuite/Makefile.in: Rebuild.
11696
401a9a73
CC
116972009-02-25 Cary Coutant <ccoutant@google.com>
11698
11699 * layout.cc (Layout::choose_output_section): Don't rename sections
11700 when using a linker script that has a SECTIONS clause.
11701 * Makefile.in: Regenerate.
11702
11703 * testsuite/Makefile.am (script_test_5.sh): New test case.
11704 * testsuite/Makefile.in: Regenerate.
11705 * testsuite/script_test_5.cc: New file.
11706 * testsuite/script_test_5.sh: New file.
11707 * testsuite/script_test_5.t: New file.
11708
f488e4b0
CC
117092009-02-13 Rafael Avila de Espindola <espindola@google.com>
11710
11711 * archive.cc (Archive::include_member): Update calls to add_symbols.
11712 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11713 the Layout argument.
11714 * dynobj.h (do_add_symbols): Add the Layout argument.
11715 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11716 Layout argument.
11717 * object.h (Object::add_symbols): Add the Layout argument.
11718 (Object::do_add_symbols): Add the Layout argument.
11719 (Sized_relobj::do_add_symbols): Add the Layout argument.
11720 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11721 Unify the two versions.
11722 (Add_plugin_symbols): Remove.
11723 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11724 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11725 (Add_plugin_symbols): Remove.
11726 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11727 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11728 (Add_symbols::run): Make it work with Pulginobj.
11729
89dd1680
ILT
117302009-02-06 Ian Lance Taylor <iant@google.com>
11731
11732 * object.cc (Sized_relobj::do_layout): Make info message start
11733 with lower case letter.
11734
266d0a74
ILT
117352009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11736
602b464e
ILT
11737 * binary.cc: Fix file comment.
11738
266d0a74
ILT
11739 * options.h (enum Incremental_disposition): Define.
11740 (class General_options): Add new options: --incremental,
11741 --incremental_changed, --incremental_unchanged,
11742 --incremental_unknown. Add incremental_disposition_ and
11743 implicit_incremental_ fields.
11744 (General_options::incremental_disposition): New function.
11745 (class Position_dependent_options): Add incremental_disposition
11746 option.
11747 (Position_dependent_options::copy_from_options): Set incremental
11748 dispositions.
11749 * options.cc (General_options::parse_incremental_changed): New
11750 function.
2e702c99
RM
11751 (General_options::parse_incremental_unchanged): New function.
11752 (General_options::parse_incremental_unknown): New function.
11753 (General_options::General_options): Initialize new fields
266d0a74 11754 incremental_disposition_ and implicit_incremental_.
2e702c99 11755 (General_options::finalize): Check for uasge of --incremental-*
266d0a74
ILT
11756 without --incremental.
11757
f073bbf7
CD
117582009-02-06 Chris Demetriou <cgd@google.com>
11759
11760 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11761 pointer and to report location as the file name associated with
11762 the symbol.
11763 (gold_undefined_symbol_at_location): New function to replace the
11764 old gold_undefined_symbol functionality.
11765 * target-reloc.h (relocate_section): Update to use
11766 gold_undefined_symbol_at_location.
11767 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11768 Call gold_undefined_symbol function rather than gold_error.
11769 * errors.h (Errors::undefined_symbol): Take location as a
11770 string, rather than calculating it from a relocation.
11771 * errors.cc (Errors::fatal): Print "fatal error:" before the
11772 formatted message.
11773 (Errors::error, Errors::error_at_location): Print "error: "
11774 before the formatted message.
11775 (Errors::undefined_symbol): Take location as a string, rather
11776 than calculating it from a relocation.
11777 (gold_undefined_symbol_at_location): New function akin to
11778 old gold_undefined_symbol, calculates location from relocation.
11779 (gold_undefined_symbol): Change to take only a Symbol pointer
11780 and to report location as the file name associated with the symbol.
11781 * testsuite/debug_msg.sh: Update for changed error messages.
11782 * testsuite/undef_symbol.sh: Likewise.
11783
8e94a90c
ILT
117842009-02-04 Duncan Sands <baldrick@free.fr>
11785
11786 PR 9812
11787 * reduced_debug_output.h
11788 (Output_reduced_debug_abbrev_section::failed): Use format for
11789 gold_warning.
11790 (Output_reduced_debug_info_section::faild): Likewise.
11791
88a0e15b
ILT
117922009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11793
11794 * script.cc (Lazy_demangler): New class.
2e702c99 11795 (Version_script_info::get_symbol_version_helper): Demangle a
88a0e15b
ILT
11796 symbol only once.
11797
5efc7cd2
CC
117982009-01-29 Cary Coutant <ccoutant@google.com>
11799
11800 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11801 to __tls_get_addr.
11802 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11803
e0ebcf42
ILT
118042009-01-28 Ian Lance Taylor <iant@google.com>
11805
5efc7cd2 11806 * version.cc (version_string): Bump to 1.9.
75fe7426 11807
e0ebcf42
ILT
11808 * gold.h: Include <cstring> and <stdint.h>.
11809 * version.cc: Include <cstdio>.
11810 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11811 warning.
11812 * reduced_debug_output.cc (insert_into_vector): Rename from
11813 Insert_into_vector; change all callers. Use Swap_unaligned to
11814 avoid aliasing issue; remove union since it is unnecessary.
11815
8e2813be 118162009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
11817
11818 * Makefile.am (CCFILES): Add gc.cc.
11819 (HFILES): Add gc.h.
11820 * Makefile.in: Regenerate.
11821 * gold.cc (Gc_runner): New class.
11822 (queue_initial_tasks): Call garbage collection related tasks
11823 when corresponding options are invoked.
11824 (queue_middle_gc_tasks): New function.
11825 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11826 processed early before laying out sections during garbage collection.
11827 * gold.h (queue_middle_gc_tasks): New function.
11828 (is_prefix_of): Move from "layout.cc".
11829 * i386.cc (Target_i386::gc_process_relocs): New function.
11830 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11831 * main.cc (main): Create object of class "Garbage_collection".
11832 * object.cc (Relobj::copy_symbols_data): New function.
11833 (Relobj::is_section_name_included): New function.
e1df38aa
NC
11834 (Sized_relobj::do_layout): Allow this function to be called twice
11835 during garbage collection and defer layout of section during the
6d03d481
ST
11836 first call.
11837 * object.h (Relobj::get_symbols_data): New function.
11838 (Relobj::is_section_name_included): New function.
11839 (Relobj::copy_symbols_data): New function.
11840 (Relobj::set_symbols_data): New function.
11841 (Relobj::get_relocs_data): New function.
11842 (Relobj::set_relocs_data): New function.
11843 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11844 (Relobj::gc_process_relocs): New function.
11845 (Relobj::do_gc_process_relocs): New pure virtual function.
11846 (Relobj::sd_): New data member.
11847 (Sized_relobj::is_output_section_offset_invalid): New function.
11848 (Sized_relobj::do_gc_process_relocs): New function.
11849 * options.h (General_options::gc_sections): Modify to not be a no-op.
11850 (General_options::print_gc_sections): New option.
11851 * plugin.cc (Plugin_finish::run): Remove function call to
11852 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11853 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11854 * reloc.cc (Read_relocs::run): Add task to process relocs and
11855 determine unreferenced sections when doing garbage collection.
11856 (Gc_process_relocs): New class.
11857 (Sized_relobj::do_gc_process_relocs): New function.
11858 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11859 sections that are garbage collected.
11860 * reloc.h (Gc_process_relocs): New class.
11861 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11862 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11863 symbols whose corresponding sections are garbage collected.
11864 (Symbol_table::Symbol_table): Add new parameter for the garbage
11865 collection object.
11866 (Symbol_table::gc_mark_undef_symbols): New function.
11867 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11868 (Symbol_table::gc_mark_dyn_syms): New function.
11869 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11870 as garbage.
11871 (Symbol_table::add_from_object): Likewise.
11872 (Symbol_table::add_from_relobj): When building shared objects, do not
11873 treat externally visible symbols as garbage.
11874 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11875 table information for static and relocatable links.
11876 * symtab.h (Symbol_table::set_gc): New function.
11877 (Symbol_table::gc): New function.
11878 (Symbol_table::gc_mark_undef_symbols): New function.
11879 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11880 (Symbol_table::gc_mark_dyn_syms): New function.
11881 (Symbol_table::gc_): New data member.
e1df38aa 11882 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
11883 function.
11884 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11885 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11886
3b293544
CF
118872009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11888
11889 * options.h (General_options::gc_sections): Define as a no-op for now.
11890 (General_options::no_keep_memory): Ditto.
11891 (General_options::Bshareable): Define.
11892 * options.cc (General_options::finalize): Honor -Bshareable.
11893
83d22aa8
AS
118942009-01-20 Andreas Schwab <schwab@suse.de>
11895
11896 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11897 read the value in the contents, since we don't use it. Use the
11898 template endianness when writing.
11899 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11900
cd536b21
AS
119012009-01-19 Andreas Schwab <schwab@suse.de>
11902
11903 * configure.tgt (powerpc64-*): Fix targ_obj.
11904
99e9a495
ILT
119052009-01-15 Ian Lance Taylor <iant@google.com>
11906
11907 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11908 local symbols when stripping all symbols.
11909
bbbfea06
CC
119102009-01-14 Cary Coutant <ccoutant@google.com>
11911
99e9a495 11912 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 11913
0f7c0701
CC
119142009-01-14 Cary Coutant <ccoutant@google.com>
11915
11916 * archive.cc (Archive::get_elf_object_for_member): Remove call
11917 to File_read::claim_for_plugin.
11918 * descriptors.cc (Descriptors::open): Remove reference to
11919 is_claimed.
11920 (Descriptors::claim_for_plugin): Remove.
11921 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11922 (Descriptors::is_claimed): Remove.
11923 (claim_descriptor_for_plugin): Remove.
11924 * fileread.cc (File_read::claim_for_plugin): Remove.
11925 * fileread.h (File_read::claim_for_plugin): Remove.
11926 (File_read::descriptor): Reopen descriptor if necessary.
11927 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11928 (Plugin_manager::all_symbols_read): Add task parameter. Change
11929 all callers.
11930 (Plugin_manager::get_input_file): New function.
11931 (Plugin_manager::release_input_file): New function.
11932 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11933 corresponding data member.
11934 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11935 and pass to base constructor. Change all callers.
11936 (get_input_file, release_input_file): New functions.
11937 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11938 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11939 (Plugin_manager::all_symbols_read): Add task parameter.
11940 (Plugin_manager::get_input_file): New function.
11941 (Plugin_manager::release_input_file): New function.
11942 (Plugin_manager::task_): New data member.
11943 (Pluginobj::Pluginobj): Add filesize parameter.
11944 (Pluginobj::filename): New function.
11945 (Pluginobj::descriptor): New function.
11946 (Pluginobj::filesize): New function.
11947 (Pluginobj::filesize_): New data member.
11948 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11949 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11950 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11951
11952 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11953 with archive libraries.
11954 * testsuite/Makefile.in: Regenerate.
11955 * testsuite/plugin_test.c (struct sym_info): New type.
11956 (get_input_file, release_input_file): New static variables.
11957 (onload): Capture new transfer vector entries.
11958 (claim_file_hook): Stop reading at end of file according to filesize.
11959 Factor out parsing of readelf output into separate function.
11960 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11961 APIs and get the source file name from the symbol table. Convert
11962 source file name to corresponding object file name. Print info
11963 message when adding new input files.
11964 (parse_readelf_line): New function.
11965 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11966 * testsuite/plugin_test_2.sh: Likewise.
11967 * testsuite/plugin_test_3.sh: Likewise.
11968 * testsuite/plugin_test_4.sh: New test case.
11969
62a6d109
ILT
119702009-01-07 Ian Lance Taylor <iant@google.com>
11971
11972 * version.cc (version_string): Bump to 1.8.
11973
483620e8
CC
119742008-12-23 Cary Coutant <ccoutant@google.com>
11975
11976 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11977 * plugin.cc (Plugin_manager::finish): Rename as
11978 layout_deferred_objects. Move cleanup to separate function.
11979 (Plugin_manager::cleanup): New function.
11980 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11981 separately.
11982 * plugin.h (Plugin_manager::finish): Rename as
11983 layout_deferred_objects.
11984 (Plugin_manager::cleanup): New function.
11985 (Plugin_manager::cleanup_done): New field.
11986
d66a9eb3
CC
119872008-12-23 Cary Coutant <ccoutant@google.com>
11988
11989 * plugin.cc (is_visible_from_outside): New function.
11990 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11991 so we don't return "IR only" status for exported symbols or -r links.
11992
11993 * testsuite/Makefile.am (plugin_test_3): New test case.
11994 * testsuite/Makefile.in: Regenerate.
11995 * testsuite/plugin_test_3.sh: New file.
11996
5995b570
CC
119972008-12-22 Cary Coutant <ccoutant@google.com>
11998
11999 * object.cc (Sized_relobj::layout_section): New function.
12000 (Sized_relobj::do_layout): Defer layout of input sections until after
12001 plugin has provided replacement files.
12002 (Sized_relobj::do_layout_deferred_sections): New function.
12003 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12004 (Relobj::layout_deferred_sections): New function.
12005 (Relobj::do_layout_deferred_sections): New function.
12006 (Sized_relobj::do_layout_deferred_sections): New function.
12007 (Sized_relobj::layout_section): New function.
12008 (Sized_relobj::Deferred_layout): New structure.
12009 (Sized_relobj::deferred_layout_): New field.
12010 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12011 Change all callers. Layout deferred sections.
12012 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12013 references.
12014 (Plugin_hook::run): Move code from do_plugin_hook inline.
12015 (Plugin_hook::do_plugin_hook): Remove.
12016 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12017 (Plugin_manager::finish): Renamed, was cleanup.
12018 (Plugin_manager::should_defer_layout): New function.
12019 (Plugin_manager::add_deferred_layout_object): New function.
12020 (Plugin_manager::Deferred_layout_list): New type.
12021 (Plugin_manager::deferred_layout_objects_): New field.
12022 (Plugin_hook::do_plugin_hook): Remove.
12023
ee769c88
ILT
120242008-12-17 Ian Lance Taylor <iant@google.com>
12025
12026 * options.h (class General_options): Add --no case for
12027 --export-dynamic.
12028
abc8dcba
CC
120292008-12-16 Cary Coutant <ccoutant@google.com>
12030
12031 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12032 vector.
12033 (Plugin_manager::claim_file): Create plugin object even if
12034 plugin did not call the add_symbols callback.
12035 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12036 asking for more symbols than were added.
12037 * testsuite/Makefile.am (plugin_test_1): Add test case with
12038 no global symbols.
12039 (empty.syms): New target.
12040 * testsuite/Makefile.in: Regenerate.
12041 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12042 message. Don't call add_symbols if no globals.
12043 (all_symbols_read_hook): Don't provide replacement for empty
12044 claimed file.
12045
b0074644
ILT
120462008-12-12 Ian Lance Taylor <iant@google.com>
12047
68943102
ILT
12048 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12049 r_type == 0 for a local symbol with r_sym == 0.
12050 (scan_relocatable_relocs): Pass r_sym to
12051 local_non_section_strategy.
12052 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12053 r_sym parameter.
12054
b0074644
ILT
12055 * configure.ac: Update test for TLS descriptors: they are
12056 supported as of glibc 2.9.
12057 * configure: Rebuild.
12058
c2508178
ILT
120592008-12-11 Ian Lance Taylor <iant@google.com>
12060
12061 PR 7091
12062 * target-reloc.h (Default_scan_relocatable_relocs): For each
12063 function, map r_type == 0 to RELOC_DISCARD.
12064
2756a258
CC
120652008-12-10 Cary Coutant <ccoutant@google.com>
12066
12067 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12068 object to override a kept COMDAT group from a plugin object.
12069
bb6f53d3
ILT
120702008-12-09 Ian Lance Taylor <iant@google.com>
12071
fbc558e1
ILT
12072 PR 7088
12073 * yyscript.y (file_cmd): Handle INPUT.
12074
bb6f53d3
ILT
12075 * testsuite/initpri1.c: Change all declarations to be full
12076 prototypes by adding void, to avoid compiler warnings.
12077
4674ecfc
CC
120782008-12-05 Rafael Avila de Espindola <espindola@google.com>
12079
12080 * options.cc (General_options::parse_plugin_opt): New.
12081 (General_options::add_plugin): The argument now is just the filename.
12082 (General_options::add_plugin_option): New.
12083 * options.h (plugin_opt): New.
12084 (add_plugin): Change argument name.
12085 (add_plugin_option): New.
12086 * plugin.cc (Plugin::load): Don't parse the plugin option.
12087 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12088 (Plugin::add_option): New.
12089 (Plugin::args_): Change type.
12090 (Plugin::filename_): New.
12091 (Plugin_manager::add_plugin_option): New.
12092 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12093 * testsuite/Makefile.in: Regenerate.
12094
fd06b4aa
CC
120952008-12-05 Cary Coutant <ccoutant@google.com>
12096
12097 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12098 Handle --strip-lto-sections option.
12099 * options.h (strip_lto_sections): New option.
12100
6c52134c
CC
121012008-12-01 Cary Coutant <ccoutant@google.com>
12102
12103 * plugin.cc (ld_plugin_message): Change format parameter to const.
12104 Fix mismatch between new[] and delete.
12105
a45248e0
CC
121062008-11-14 Cary Coutant <ccoutant@google.com>
12107
12108 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12109 instead of -1U.
12110
c82fbeee
CS
121112008-11-05 Craig Silverstein <csilvers@google.com>
12112
12113 * options.cc (General_options::parse_dynamic_list): New function.
12114 * options.h (General_options): New flags dynamic_list,
12115 dynamic_list_data, dynamic_list_cpp_new, and
12116 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12117 (General_options::in_dynamic_list): New function.
12118 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12119 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12120 (Lex::can_continue_name): Likewise.
12121 (yylex): Likewise.
12122 (read_script_file): New parameter script_options.
12123 (read_dynamic_list): New function.
12124 (Script_options::define_dynamic_list): New function.
12125 (dynamic_list_keyword_parsecodes): New variable.
12126 (dynamic_list_keywords): New variable.
12127 * script.h (Script_options::define_dynamic_list): New function
12128 prototype.
12129 (read_dynamic_list): New function prototype.
12130 * symtab.cc (strprefix): New macro.
12131 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12132 dynamic_list_data, dynamic_list_cpp_new, and
12133 dynamic_list_cpp_typeinfo.
12134 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12135 (dynamic_list_expr): New rule.
12136 (dynamic_list_nodes): Likewise.
12137 (dynamic_list_node): Likewise.
12138 * testsuite/Makefile.am (dynamic_list): New test.
12139 * testsuite/Makefile.in: Regenerated.
12140 * testsuite/dynamic_list.t: New file.
12141 * testsuite/dynamic_list.sh: New file.
12142
e0bb29a5
CS
121432008-11-05 Craig Silverstein <csilvers@google.com>
12144
12145 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12146 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12147 (t11_last): Likewise.
12148 * testsuite/ver_test_6.c (main): Likewise.
12149
4e1e25e0
CC
121502008-10-07 Cary Coutant <ccoutant@google.com>
12151
12152 * options.c (General_options::finalize): Add check for -static and
12153 -shared.
12154 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12155 is not empty.
12156
92f03fcb
CC
121572008-10-02 Cary Coutant <ccoutant@google.com>
12158
12159 * plugin.cc (make_sized_plugin_object): Fix conditional
12160 compilation to work when not all targets are enabled.
12161
fbd8a257
CC
121622008-09-29 Cary Coutant <ccoutant@google.com>
12163
12164 * archive.cc (Archive::get_file_and_offset): Use filename instead
12165 of name to get library path.
12166 (Archive::include_member): Unlock external member of a thin archive.
12167
12168 * testsuite/Makefile.am (TEST_AR): New variable.
12169 (thin_archive_test_1): New test.
12170 (thin_archive_test_2): New test.
81636b3f
CC
12171 * testsuite/Makefile.in: Regenerate.
12172 * testsuite/thin_archive_main.cc: New file.
12173 * testsuite/thin_archive_test_1.cc: New file.
12174 * testsuite/thin_archive_test_2.cc: New file.
12175 * testsuite/thin_archive_test_3.cc: New file.
12176 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 12177
eff45813
CC
121782008-09-29 Cary Coutant <ccoutant@google.com>
12179
12180 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12181 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12182 instead of -1U.
12183 (Sized_relobj::do_finalize_local_symbols): Likewise.
12184 (Sized_relobj::map_to_kept_section): Likewise.
12185 * object.h (Sized_relobj::invalid_address): New constant.
12186 (Sized_relobj::do_output_section_offset): Check for invalid_address
12187 and return -1ULL.
12188 * output.cc (Output_reloc::local_section_offset): Use constant
12189 invalid_address instead of -1U.
12190 (Output_reloc::get_address): Likewise.
12191 (Output_section::output_address): Change -1U to -1ULL.
12192 * output.h (Output_reloc::invalid_address): New constant.
12193 * reloc.cc (Sized_relobj::write_sections): Use constant
12194 invalid_address instead of -1U.
12195 (Sized_relobj::relocate_sections): Likewise.
12196 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12197 values for merge sections.
12198 * target-reloc.h (relocate_for_relocatable): Use constant
12199 invalid_address instead of -1U.
12200
89fc3421
CC
122012008-09-19 Cary Coutant <ccoutant@google.com>
12202
12203 Add plugin functionality for link-time optimization (LTO).
12204 * configure.ac (plugins): Add --enable-plugins option.
12205 * configure: Regenerate.
12206 * config.in: Regenerate.
12207 * Makefile.am (LIBDL): New variable.
12208 (CCFILES): Add plugin.cc.
12209 (HFILES): Add plugin.h.
12210 (ldadd_var): Add LIBDL.
12211 * Makefile.in: Regenerate.
12212
12213 * archive.cc: Include "plugin.h".
12214 (Archive::setup): Don't preread archive symbols when using a plugin.
12215 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12216 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12217 files.
12218 (Archive::include_member): Add symbols from plugin objects.
12219 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12220 * descriptors.cc (Descriptors::open): Check for file descriptors
12221 abandoned by plugins.
12222 (Descriptors::claim_for_plugin): New function.
12223 * descriptors.h (Descriptors::claim_for_plugin): New function.
12224 (Open_descriptor::is_claimed): New field.
12225 (claim_descriptor_for_plugin): New function.
12226 * fileread.cc (File_read::claim_for_plugin): New function.
12227 * fileread.h (File_read::claim_for_plugin): New function.
12228 (File_read::descriptor): New function.
12229 * gold.cc: Include "plugin.h".
12230 (queue_initial_tasks): Add task to call plugin hooks for generating
12231 new object files.
12232 * main.cc: Include "plugin.h".
12233 (main): Load plugin libraries.
12234 * object.h (Pluginobj): Declare.
12235 (Object::pluginobj): New function.
12236 (Object::do_pluginobj): New function.
12237 (Object::set_target): New function.
12238 * options.cc: Include "plugin.h".
12239 (General_options::parse_plugin): New function.
12240 (General_options::General_options): Initialize plugins_ field.
12241 (General_options::add_plugin): New function.
12242 * options.h (Plugin_manager): Declare.
12243 (General_options): Add --plugin option.
12244 (General_options::has_plugins): New function.
12245 (General_options::plugins): New function.
12246 (General_options::add_plugin): New function.
12247 (General_options::plugins_): New field.
12248 * plugin.cc: New file.
12249 * plugin.h: New file.
12250 * readsyms.cc: Include "plugin.h".
12251 (Read_symbols::do_read_symbols): Check for archive before checking
12252 for ELF file. Call plugin hooks to claim files.
12253 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12254 from a real object file; force override when processing replacement
12255 files.
12256 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12257 (Symbol::init_base_object): Likewise.
12258 (Symbol::init_base_output_data): Likewise.
12259 (Symbol::init_base_output_segment): Likewise.
12260 (Symbol::init_base_constant): Likewise.
12261 (Symbol::init_base_undefined): Likewise.
12262 (Symbol::output_section): Assert that object is not a plugin.
12263 (Symbol_table::add_from_pluginobj): New function.
12264 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12265 undefined.
12266 (Symbol_table::sized_write_globals): Likewise.
12267 (Symbol_table::add_from_pluginobj): Instantiate template.
12268 * symtab.h (Sized_pluginobj): Declare.
12269 (Symbol::in_real_elf): New function.
12270 (Symbol::set_in_real_elf): New function.
12271 (Symbol::in_real_elf_): New field.
12272 (Symbol_table::add_from_pluginobj): New function.
12273
12274 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12275 (LIBDL): New variable.
12276 (LDADD): Add LIBDL.
12277 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12278 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12279 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12280 (MOSTLYCLEANFILES): Likewise.
12281 * testsuite/Makefile.in: Regenerate.
12282 * testsuite/plugin_test.c: New file.
12283 * testsuite/plugin_test_1.sh: New file.
12284 * testsuite/plugin_test_2.sh: New file.
12285
de31bda5
ILT
122862008-09-16 Ian Lance Taylor <iant@google.com>
12287
9c2d0ef9
ILT
12288 * target-reloc.h (relocate_section): Check whether a symbol is
12289 defined by the ABI before reporting an undefined symbol error.
12290 * target.h (Target::is_defined_by_abi): Make parameter const.
12291 (Target::do_is_defined_by_abi): Likewise.
12292 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12293 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12294 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12295 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12296 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12297 * testsuite/Makefile.in: Rebuild.
12298
de31bda5
ILT
12299 * fileread.cc (make_view): Add casts to avoid warning.
12300
9fa33bee
AO
123012008-09-16 Alexandre Oliva <aoliva@redhat.com>
12302
12303 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12304 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12305
183fd0e3
AO
123062008-09-16 Alexandre Oliva <aoliva@redhat.com>
12307
12308 * options.h (General_options::output_is_executable): New.
12309 (General_options::output_is_pie): New.
12310 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12311 for shared libraries.
12312 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12313
7be8330a
CD
123142008-09-11 Chris Demetriou <cgd@google.com>
12315
12316 * options.h (origin): New -z option.
12317 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12318 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12319 in DT_FLAGS_1.
12320
a9caad02
CC
123212008-09-05 Cary Coutant <ccoutant@google.com>
12322
12323 * fileread.cc (File_read::make_view): Add check for attempt to map
12324 beyond end of file.
12325
ae6dce4d
CC
123262008-09-05 Cary Coutant <ccoutant@google.com>
12327
12328 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12329 explicit instantiations.
12330
d7ab2a47
KVH
123312008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12332
12333 PR gold/6858
12334 * options.cc (General_options::finalize): Allow undefined symbols
12335 in shlibs if linking -shared.
12336
12337 PR gold/6859
12338 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12339 symbols as not needing a dynsym entry.
12340
1e52a9c1
CS
123412008-08-20 Craig Silverstein <csilvers@google.com>
12342
12343 * fileread.cc (File_read::open): Do not lock the file unless it
12344 was successfully opened.
12345
d85c80a3
CC
123462008-08-14 Cary Coutant <ccoutant@google.com>
12347
12348 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12349 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12350 * testsuite/tls_test.cc (struct int128): 128-bit struct
12351 for testing TLS relocs with non-zero addend.
12352 (v12): New TLS variable.
12353 (t12): New test.
12354 (t_last): Add check for v12.
12355 * testsuite/tls_test.h (t12): New function.
12356 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12357
2d924fd9
ILT
123582008-08-13 Ian Lance Taylor <iant@google.com>
12359
12360 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12361 set tls_segment_ or relro_segment_.
12362 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12363 when appropriate.
12364 * output.h (Output_section::clear_is_relro): New function.
12365 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12366 sections specially even when output_data_ is empty.
12367 (Output_segment::maximum_alignment): When first section is relro,
12368 only force alignment for PT_LOAD segments.
12369 * script.cc (script_data_segment_align): New function.
12370 (script_data_segment_relro_end): New function.
12371 * script-c.h (script_data_segment_align): Declare.
12372 (script_data_segment_relro_end): Declare.
12373 * script-sections.h (class Script_sections): Declare
12374 data_segment_align and data_segment_relro_end. Add fields
12375 segment_align_index_ and saw_relro_end_.
12376 * script-sections.cc (class Sections_element): Add set_is_relro
12377 virtual function. Add new bool* parameter to place_orphan_here.
12378 Add get_output_section virtual function.
12379 (class Output_section_definition): Add set_is_relro. Add new
12380 bool* parameter to place_orphan_here. Add get_output_section.
12381 Add is_relro_ field.
12382 (Output_section_definition::Output_section_definition): Initialize
12383 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12384 and is_relro_ fields.
12385 (Output_section_definition::place_orphan_here): Add is_relro
12386 parameter.
12387 (Output_section_definition::set_section_addresses): Set relro for
12388 output section.
12389 (Output_section_definition::alternate_constraint): Likewise.
12390 (class Orphan_output_section): Add new bool* parameter to
12391 place_orphan_here. Add get_output_section.
12392 (Orphan_output_section::place_orphan_here): Add is_relro
12393 parameter.
12394 (Script_sections::Script_sections): Initialize
12395 data_segment_align_index_ and saw_relro_end_.
12396 (Script_sections::data_segment_align): New function.
12397 (Script_sections::data_segment_relro_end): New function.
12398 (Script_sections::place_orphan): Set or clear is_relro.
12399 (Script_sections::set_section_addresses): Force alignment of first
12400 TLS section.
12401 * yyscript.y (exp): Call script_data_segment_align and
12402 script_data_segment_relro_end.
12403 * testsuite/relro_script_test.t: New file.
12404 * testsuite/relro_test.cc (using_script): Declare.
12405 (t1, t2): Test using_script.
12406 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12407 (relro_script_test_SOURCES): Define.
12408 (relro_script_test_DEPENDENCIES): Define.
12409 (relro_script_test_LDFLAGS): Define.
12410 (relro_script_test_LDADD): Define.
12411 (relro_script_test.so): New target.
12412 * testsuite/Makefile.in: Rebuild.
12413
f827c9a9
CC
124142008-08-06 Cary Coutant <ccoutant@google.com>
12415
12416 * archive.cc (Archive::total_archives, Archive::total_members)
12417 (Archive::total_members_loaded): New variables.
12418 (Archive::setup): Add parameter. Add option to preread
12419 archive symbols.
12420 (Archive::read_armap): Add counter.
12421 (Archive::get_file_and_offset): New function.
12422 (Archive::get_elf_object_for_member): New function.
12423 (Archive::read_all_symbols): New function.
12424 (Archive::read_symbols): New function.
12425 (Archive::add_symbols): Add counters.
12426 (Archive::include_all_members): Use armap to find members if it's
12427 already built.
12428 (Archive::include_member): Skip reading symbols if already read.
12429 Factored code into Archive::get_file_and_offset and
12430 Archive::get_elf_object_for_member. Changed call to
12431 Mapfile::report_include_archive_member.
12432 (Archive::print_stats): New function.
12433 * archive.h: Declare Object and Read_symbols_data classes.
12434 (Archive::Archive): Add initializers for new members.
12435 (Archive::setup): Add parameter.
12436 (Archive::print_stats): New function.
12437 (Archive::total_archives, Archive::total_members)
12438 (Archive::total_members_loaded): New variables.
12439 (Archive::get_file_and_offset): New function.
12440 (Archive::get_elf_object_for_member): New function.
12441 (Archive::read_all_symbols): New function.
12442 (Archive::read_symbols): New function.
12443 (Archive::Archive_member): New class.
12444 (Archive::members_): New member.
12445 (Archive::num_members_): New member.
12446 * main.cc: Include archive.h.
12447 (main): Call Archive::print_stats.
12448 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12449 archive parameter; member_name is now the fully-decorated name.
12450 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12451 * options.h: (General_options): Add --preread-archive-symbols option.
12452 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12453 Archive::setup.
12454
de4c45bd
ILT
124552008-08-04 Ian Lance Taylor <iant@google.com>
12456
12457 * symtab.h (Symbol::use_plt_offset): New function.
12458 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12459 * powerpc.cc (Relocate::relocate): Likewise.
12460 * sparc.cc (Relocate::relocate): Likewise.
12461 * x86_64.cc (Relocate::relocate): Likewise.
12462 * testsuite/weak_plt.sh: New test.
12463 * testsuite/weak_plt_main.cc: New test.
12464 * testsuite/weak_plt_shared.cc: New test.
12465 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12466 (check_PROGRAMS): Add weak_plt.
12467 (check_DATA): Add weak_plt_shared.so.
12468 (weak_plt_main_pic.o, weak_plt): New targets.
12469 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12470 * testsuite/Makefile.in: Rebuild.
12471
12472 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12473 gcctestdir/ld.
12474 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12475 * testsuite/Makefile.in: Rebuild.
12476
323ee3f4
AM
124772008-08-04 Alan Modra <amodra@bigpond.net.au>
12478
12479 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12480 * Makefile.in: Regenerate.
12481 * po/POTFILES.in: Regenerate.
12482
7c07ecec
ILT
124832008-07-29 Ian Lance Taylor <iant@google.com>
12484
12485 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12486 symbols before other symbols.
12487 * testsuite/script_test_2.cc (test_addr): Declare.
12488 (test_addr_alias): Declare.
12489 (main): Check that test_addr and test_addr_alias have the right
cd536b21 12490 values.
7c07ecec
ILT
12491 * testsuite/script_test_2.t: Define test_addr_alias and
12492 test_addr.
12493
5778530e
ILT
124942008-07-24 Ian Lance Taylor <iant@google.com>
12495
2a00e4fb
ILT
12496 PR 5990
12497 * descriptors.cc: New file.
12498 * descriptors.h: New file.
12499 * gold-threads.h (class Hold_optional_lock): New class.
12500 * fileread.cc: Include "descriptors.h".
12501 (File_read::~File_read): Release descriptor rather than closing
12502 it.
12503 (File_read::open) [file]: Call open_descriptor rather than open.
12504 Set is_descriptor_opened_.
12505 (File_read::open) [memory]: Assert that descriptor is not open.
12506 (File_read::reopen_descriptor): New function.
12507 (File_read::release): Release descriptor.
12508 (File_read::do_read): Make non-const. Reopen descriptor.
12509 (File_read::read): Make non-const.
12510 (File_read::make_view): Reopen descriptor.
12511 (File_read::do_readv): Likewise.
12512 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12513 Update declarations.
12514 * layout.cc: Include "descriptors.h".
12515 (Layout::create_build_id): Use open_descriptor rather than open.
12516 * output.cc: Include "descriptors.h".
12517 (Output_file::open): Use open_descriptor rather than open.
12518 * archive.cc (Archive::const_iterator): Change Archive to be
12519 non-const.
12520 (Archive::begin, Archive::end): Make non-const.
12521 (Archive::count_members): Likewise.
12522 * archive.h (class Archive): Update declarations.
12523 * object.h (Object::read): Make non-const.
12524 * Makefile.am (CCFILES): Add descriptors.cc.
12525 (HFILES): Add descriptors.h.
12526 * Makefile.in: Rebuild.
12527
801647d1
ILT
12528 PR 6716
12529 * gold.h: Always include <clocale>. Add Solaris workarounds
12530 following code in binutils/sysdep.h.
12531
5edd166e
ILT
12532 PR 6048
12533 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12534 this->eh_frame_hdr_ is NULL before using it.
12535
c89ad728
ILT
12536 * dynobj.cc (Versions::Versions): Update comment.
12537
aa86f06b
ILT
12538 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12539 the base version name.
12540
5778530e
ILT
12541 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12542 array size plus one.
12543 (Stringpool_template::set_string_offsets): Subtract one from key
12544 before using it as an array index.
12545 (Stringpool_template::get_offset_with_length): Likewise.
12546 (Stringpool_template::write_to_buffer): Likewise.
12547 * stringpool.h (Stringpool_template::get_offset_from_key):
12548 Likewise.
12549
057ead22
ILT
125502008-07-23 Ian Lance Taylor <iant@google.com>
12551
7f649c59
ILT
12552 PR 6658
12553 * object.h (Merged_symbol_value::value): Do our best to handle a
12554 negative addend.
12555
057ead22
ILT
12556 PR 6647
12557 * script.cc (Version_script_info::get_versions): Don't add empty
12558 version tag to return value.
12559 (Version_script_info::get_symbol_version_helper): Change return
12560 type to bool. Add pversion parameter. Change all callers.
12561 (script_register_vers_node): Don't require a non-NULL tag.
12562 * script.h (class Version_script_info): Update declarations.
12563 (Version_script_info::get_symbol_version): Change return type to
12564 bool. Add version parameter. Change all callers.
12565 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12566 handling. Handle an empty version from a version script.
12567 (Symbol_table::define_special_symbol): Likewise.
12568 * testsuite/ver_test_10.script: New file.
12569 * testsuite/ver_test_10.sh: New file.
12570 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12571 (check_DATA): Add ver_test_10.syms.
12572 (ver_test_10.syms, ver_test_10.so): New target.
12573 * testsuite/Makefile.in: Rebuild.
12574
58e54ac2
CD
125752008-07-23 Simon Baldwin <simonb@google.com>
12576
12577 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12578 to zero for undefined symbols from dynamic libraries.
12579
95d14cd3
ILT
125802008-07-23 Ian Lance Taylor <iant@google.com>
12581
12582 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12583 Change all callers.
12584 * symtab.h (class Symbol_table): Update declaration.
12585 * testsuite/ver_test_9.cc: New file.
12586 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12587 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12588 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12589 (ver_test_9.so, ver_test_9.o): New targets.
12590 * testsuite/Makefile.in: Rebuild.
12591
92de84a6
ILT
125922008-07-22 Ian Lance Taylor <iant@google.com>
12593
34810851
ILT
12594 * options.h (class General_options): Define --check-sections.
12595 * layout.cc (Layout::set_segment_offsets): Handle
12596 --check-sections.
12597
af6156ef
ILT
12598 * options.h (class General_options): Define -n/--nmagic and
12599 -N/--omagic.
12600 * options.cc (General_options::finalize): For -n/--nmagic or
12601 -N/--omagic, set -static.
12602 * layout.cc (Layout::attach_allocated_section_to_segment): If
12603 -N/--omagic, don't put read-only and read-write sections in
12604 different segments.
12605 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12606 finding a read-only segment.
12607 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12608 don't set the minimum segment alignment to the common page size,
12609 and don't set the file offset to the address modulo the page size.
12610 * script-sections.cc (Script_sections::create_segments): If
12611 -n/--omagic, don't put read-only and read-write sections in
12612 different segments.
12613
92de84a6
ILT
12614 * cref.cc: New file.
12615 * cref.h: New file.
12616 * options.h (class General_options): Add --print-symbol-counts.
12617 * main.cc (main): Issue defined symbol report if requested.
12618 * archive.cc (Archive::interpret_header): Make into a const member
12619 function.
12620 (Archive::add_symbols): Call Input_objects::archive_start and
12621 archive_stop.
12622 (Archive::const_iterator): Define new class.
12623 (Archive::begin, Archive::end): New functions.
12624 (Archive::include_all_members): Rewrite to use iterator.
12625 (Archive::count_members): New function.
12626 * archive.h (class Archive): Update declarations.
12627 (Archive::filename): New function.
12628 * object.cc: Include "cref.h".
12629 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12630 (Sized_relobj::do_get_global_symbol_counts): New function.
12631 (Input_objects::add_object): Add object to cross-referencer.
12632 (Input_objects::archive_start): New function.
12633 (Input_objects::archive_stop): New function.
12634 (Input_objects::print_symbol_counts): New function.
12635 * object.h: Declare Cref and Archive.
12636 (Object::get_global_symbol_counts): New function.
12637 (Object::do_get_global_symbol_counts): New pure virtual function.
12638 (class Sized_relobj): Add defined_count_ field. Update
12639 declarations.
12640 (class Input_objects): Add cref_ field. Update constructor.
12641 Update declarations.
12642 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12643 defined_count_.
12644 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12645 symbol counts.
12646 (Sized_dynobj::do_get_global_symbol_counts): New function.
12647 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12648 defined_count_. Update declarations. Define Symbols typedef.
12649 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12650 parameter. Change all callers.
12651 (Symbol_table::add_from_dynobj): Add sympointers and defined
12652 parameters. Change all callers.
12653 * symtab.h (class Symbol_table): Update declarations.
12654 * Makefile.am (CCFILES): Add cref.cc.
12655 (HFILES): Add cref.h.
12656 * Makefile.in: Rebuild.
12657
3f7c5e1d
CD
126582008-07-22 Simon Baldwin <simonb@google.com>
12659
12660 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12661 to zero when writing undefined symbols.
12662
e0b64032
ILT
126632008-07-22 Ian Lance Taylor <iant@google.com>
12664
12665 * output.cc (Output_section::add_input_section): Don't try to
12666 merge empty merge sections.
12667
096b02cf
CS
126682008-07-21 Craig Silverstein <csilvers@google.com>
12669
12670 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12671 Include symbol version in error message.
cd536b21 12672
1d1f116d
CD
126732008-07-20 Chris Demetriou <cgd@google.com>
12674
cd536b21 12675 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
12676 (RANDOM_SEED_CFLAGS): New substituted variable.
12677 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12678 * configure: Rebuild.
12679 * Makefile.in: Likewise.
12680 * testsuite/Makefile.in: Likewise.
12681
a18f591e
ILT
126822008-07-18 Ian Lance Taylor <iant@google.com>
12683
12684 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12685 where we see NAME/NULL and NAME/VERSION as separate symbols.
12686 * testsuite/ver_test_main.cc (main): Call t4.
12687 (t4, t4_2a): Define.
12688 * testsuite/ver_test_2.cc (t4_2): Define.
12689 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12690 * testsuite/ver_test_4.cc (t4_2a): Define.
12691 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12692 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12693
c6e3f6ed
ILT
126942008-07-17 Ian Lance Taylor <iant@google.com>
12695
12696 * dynobj.cc (Versions::add_def): If we give an error about a
12697 missing version, go ahead and create the version anyhow.
12698
ef9beddf
ILT
126992008-07-10 Ian Lance Taylor <iant@google.com>
12700
12701 Handle output sections with more than 0x7fffffff bytes.
12702 * object.h (class Relobj): Change map_to_output_ to
12703 output_sections_, and just keep a section pointer. Change all
12704 uses. Move comdat group support to Sized_relobj.
12705 (Relobj::is_section_specially_mapped): Remove.
12706 (Relobj::output_section): Remove poff parameter. Change all
12707 callers.
12708 (Relobj::output_section_offset): New function.
12709 (Relobj::set_section_offset): Rewrite.
12710 (Relobj::map_to_output): Remove.
12711 (Relobj::output_sections): New function.
12712 (Relobj::do_output_section_offset): New pure virtual function.
12713 (Relobj::do_set_section_offset): Likewise.
12714 (class Sized_relobj): Add section_offsets_ field. Add comdat
12715 group support from Relobj. Update declarations.
12716 (Sized_relobj::get_output_section_offset): New function.
12717 (Sized_relobj::do_output_section_offset): New function.
12718 (Sized_relobj::do_set_section_offset): New function.
12719 * object.cc (Relobj::output_section_address): Remove.
12720 (Sized_relobj::Sized_relobj): Initialize new fields.
12721 (Sized_relobj::include_section_group): Cast find_kept_object to
12722 Sized_relobj.
12723 (Sized_relobj::include_linkonce_section): Likewise.
12724 (Sized_relobj::do_layout): Use separate arrays for output section
12725 and output offset.
12726 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12727 output_sections.
12728 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12729 output_sections and section_offsets.
12730 (Sized_relobj::write_local_symbols): Likewise.
12731 (map_to_kept_section): Compute output address directly.
12732 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12733 output_sections and section_offsets.
12734 (Sized_relobj::write_sections): Likewise.
12735 (Sized_relobj::relocate_sections): Likewise.
12736 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12737 * output.h (class Output_reloc): Update declarations. Change
12738 u2_.relobj to Sized_relobj*.
12739 (class Output_data_reloc): Change add functions to use
12740 Sized_relobj*.
12741 * output.cc (Output_reloc::Output_reloc): Change relobj to
12742 Sized_relobj*.
12743 (Output_reloc::local_section_offset): Change return type to
12744 Elf_Addr. Use get_output_section_offset.
12745 (Output_reloc::get_address): Likewise.
12746 (Output_section::is_input_address_mapped): Don't call
12747 is_section_specially_mapped.
12748 (Output_section::output_offset): Likewise.
12749 (Output_section::output_address): Likewise.
12750 (Output_section::starting_output_address): Likewise.
12751 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12752 parameter to Sized_relobj*.
12753 (Copy_relocs::need_copy_reloc): Likewise.
12754 (Copy_relocs::save): Likewise.
12755 * copy-relocs.h (class Copy_relocs): Update declarations.
12756 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12757 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12758 * target-reloc.h (relocate_for_relocatable): Change
12759 offset_in_output_section type to Elf_Addr. Change code that uses
12760 it as well.
12761 * layout.cc (Layout::layout): Always set *off.
12762 * mapfile.cc (Mapfile::print_input_section): Use
12763 output_section_offset.
12764 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12765 Sized_relobj*.
12766 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12767 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12768 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12769
5cb66f97
ILT
127702008-07-03 Ian Lance Taylor <iant@google.com>
12771
12772 * layout.cc (Layout::include_section): Do not discard unrecognized
12773 SHT_STRTAB sections.
12774
afe47622
CS
127752008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12776
12777 * script.cc (Lex::can_continue_name): Make '?' allowable in
12778 version-script names.
12779 * testsuite/version_script.map: Change glob pattern to use '?'
12780
5adf9721
ILT
127812008-06-30 Manish Singh <yosh@gimp.org>
12782
12783 PR 6585
12784 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12785 Correct typo.
12786
e6fde208
ILT
127872008-06-30 Ian Lance Taylor <iant@google.com>
12788
12789 PR 6660
12790 PR 6682
12791 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12792 versions]: Don't try to read the value in the contents, since we
12793 don't use it. Use the template endianness when writing.
12794
3f2e6a2d
CC
127952008-06-25 Cary Coutant <ccoutant@google.com>
12796
12797 * fileread.cc (File_read::make_view): Assert on zero-length view.
12798 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12799 symbol table when there are no symbols to read.
12800
c43d3a48
CS
128012008-06-23 Craig Silverstein <csilvers@google.com>
12802
12803 * version.cc (version_string): Bump to 1.7
12804
5f494ea0
CS
128052008-06-18 Craig Silverstein <csilvers@google.com>
12806
12807 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12808 constant 0xFFFF to type Valtype.
12809 (Powerpc_relocate_functions::rel16_ha): Likewise.
12810
c42e122e
ILT
128112008-06-17 Ian Lance Taylor <iant@google.com>
12812
f34787f8
ILT
12813 * output.h (Output_section::Input_section): Initialize p2align_ to
12814 zero for Output_section_data constructors.
12815 (Output_section::Input_section::addralign): If not an input
12816 section, return the alignment of the Output_section_data.
12817 * testsuite/copy_test.cc: New file.
12818 * testsuite/copy_test_1.cc: New file.
12819 * testsuite/copy_test_2.cc: New file.
12820 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12821 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12822 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12823 (copy_test_1_pic.o, copy_test_1.so): New targets.
12824 (copy_test_2_pic.o, copy_test_2.so): New targets.
12825 * testsuite/Makefile.in: Rebuild.
12826
c42e122e
ILT
12827 * script-sections.cc (Script_sections::place_orphan): Initialize
12828 local variable exact.
12829
ce3ac18a
DE
128302008-06-13 David Edelsohn <edelsohn@gnu.org>
12831
12832 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12833
42cacb20
DE
128342008-06-12 David Edelsohn <edelsohn@gnu.org>
12835 David S. Miller <davem@davemloft.net>
12836
12837 * powerpc.cc: New file.
12838 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12839 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12840 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12841 * Makefile.in: Rebuild.
12842
7b308235
ILT
128432008-06-09 Ian Lance Taylor <iant@google.com>
12844
12845 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12846 <exception>.
12847 (throwing, orig_terminate): New static variables.
12848 (terminate_handler): New static function.
12849 (t2): Set terminate handler.
12850
f0b886e3
ILT
128512008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12852
12853 PR 6584
cd536b21 12854 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
12855 alignment.
12856
3e90f135
CC
128572008-05-30 Cary Coutant <ccoutant@google.com>
12858
12859 * archive.cc (Archive::include_all_members) Correct to step
12860 over symbol table and extended name table in thin archives.
12861
e09ad04a
ILT
128622008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12863
12864 PR 6407
12865 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12866 calculation.
12867
62b01cb5
ILT
128682008-05-28 Caleb Howe <cshowe@google.com>
12869
12870 * reduced_debug_output.cc: New file.
12871 * reduced_debug_output.h: New file.
92de84a6 12872 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
12873 * options.cc (General_options::finalize): Add strip_debug_non_line
12874 to the strip heirarchy.
12875 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12876 fields.
12877 * layout.cc: Include "reduced_debug_output.h".
12878 (Layout::Layout): Initialize new fields.
12879 (line_only_debug_sections): New static array.
12880 (is_lines_only_debug_sections): New static inline function.
12881 (Layout::include_section): Handle --strip-debug-non-line.
12882 (Layout::make_output_section): If --strip-debug-non-line, build
12883 new output sections for .debug_abbrev and .debug_info.
12884 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12885 gold. Warn about possible overflow.
12886 (read_signed_LEB_128): Likewise.
12887 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12888 (read_signed_LEB_128): Declare.
12889 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12890 (HFILES): Add reduced_debug_output.h.
12891 * Makefile.in: Rebuild.
12892
7d9e3d98
ILT
128932008-05-21 Ian Lance Taylor <iant@google.com>
12894
12895 * mapfile.cc: New file.
12896 * mapfile.h: New file.
12897 * options.h (class General_options): Add -M/--print-map and -Map.
12898 * options.cc (General_options::finalize): Make -M equivalent to
12899 -Map -.
12900 * main.cc: Include <cstdio> and "mapfile.h".
12901 (main): Open mapfile if requested.
12902 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12903 constructor. Change caller.
12904 (queue_initial_tasks): Add mapfile parameter. Change caller.
12905 (queue_middle_tasks): Likewise.
12906 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12907 declarations.
12908 * archive.cc: Include "mapfile.h".
12909 (Archive::add_symbols): Add mapfile parameter. Change all
12910 callers. Pass mapfile, symbol, and reason to include_member.
12911 (Archive::include_all_members): Add mapfile parameter. Change all
12912 callers.
12913 (Archive::include_member): Add mapfile, sym, and why parameters.
12914 Change all callers. Report inclusion to map file.
12915 * archive.h: Include "fileread.h".
12916 (class Archive): Update declarations.
12917 (Archive::file): New const method.
12918 (class Add_archive_symbols): Add mapfile_ field. Update
12919 constructor. Change all callers.
12920 * readsyms.h (class Read_symbols): Likewise.
12921 (class Finish_group): Likewise.
12922 (class Read_script): Likewise.
12923 * common.cc: Include "mapfile.h".
12924 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12925 all callers.
12926 (Symbol_table::do_allocate_commons): Likewise.
12927 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12928 symbol allocation to mapfile.
12929 * common.h (class Allocate_commons_task): Add mapfile_ field.
12930 Update constructor. Change all callers.
12931 * symtab.h (class Symbol_table): Update declarations.
12932 * layout.cc: Include "mapfile.h".
12933 (Layout_task_runner::run): Print information to mapfile.
12934 (Layout::create_gold_note): Change Output_data_fixed_space to
12935 Output_data_zero_fill.
12936 (Layout::create_build_id): Likewise.
12937 (Layout::print_to_mapfile): New function.
12938 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12939 constructor. Change caller.
12940 (class Layout): Declare print_to_mapfile.
12941 * output.cc (Output_section::Input_section::print_to_mapfile): New
12942 function.
12943 (Output_section::add_input_section): If producing a map, always
12944 add to input_sections_ list.
12945 (Output_section::do_print_to_mapfile): New function.
12946 (Output_segment::print_sections_to_mapfile): New function.
12947 (Output_segment::print_section_list_to_mapfile): New function.
12948 * output.h: Include "mapfile.h".
12949 (Output_data::print_to_mapfile): New function.
12950 (Output_data::do_print_to_mapfile): New virtual function.
12951 (Output_segment_headers::do_print_to_mapfile): New function.
12952 (Output_file_header::do_print_to_mapfile): New function.
12953 (Output_data_const::do_print_to_mapfile): New function.
12954 (class Output_data_const_buffer): Add map_name_ field. Update
12955 constructor. Change all callers. Add do_print_to_mapfile
12956 function.
12957 (class Output_data_fixed_space): Likewise.
12958 (class Output_data_space): Likewise.
12959 (class Output_data_zero_fill): New class.
12960 (Output_data_strtab::do_print_to_mapfile): New function.
12961 (Output_data_reloc_base::do_print_to_mapfile): New function.
12962 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12963 (Output_data_group::do_print_to_mapfile): New function.
12964 (Output_data_got::do_print_to_mapfile): New function.
12965 (Output_data_dynamic::do_print_to_mapfile): New function.
12966 (Output_symtab_xindex::do_print_to_mapfile): New function.
12967 (class Output_section): Declare do_print_to_mapflie. Declare
12968 print_to_mapfile in Input_section.
12969 (class Output_segment): Declare new functions.
12970 * object.h (Sized_relobj::symbol_count): New function.
12971 * script-sections.cc
12972 (Output_section_element_dot_assignment::set_section_addresses):
12973 Change Output_data_fixed_space to Output_data_zero_fill.
12974 (Output_data_expression::do_print_to_mapfile): New function.
12975 * script.cc (read_input_script): Add mapfile parameter. Change
12976 all callers.
12977 * script.h (read_input_script): Update declaration.
12978 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12979 (Eh_frame::do_print_to_mapfile): New function.
12980 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12981 (Output_merge_string::do_print_to_mapfile): New function.
12982 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12983 function.
12984 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12985 function.
12986 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12987 function.
12988 * Makefile.am (CCFILES): Add mapfile.cc.
12989 (HFILES): Add mapfile.h.
12990 * Makefile.in: Rebuild.
12991
9f1d377b
ILT
129922008-05-19 Ian Lance Taylor <iant@google.com>
12993
12994 * options.h (class General_options): Add -z relro.
12995 * layout.cc (Layout::Layout): Initialize relro_segment_.
12996 (Layout::add_output_section_data): Return the output section.
12997 (Layout::make_output_section): Rcognize relro sections and mark
12998 them appropriately.
12999 (Layout::attach_allocated_section_to_segment): Put relro sections
13000 in a PT_GNU_RELRO segment.
13001 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13002 section as relro.
13003 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13004 PT_TLS segments.
13005 (Layout::linkonce_mapping): Map d.rel.ro.local to
13006 .data.rel.ro.local.
13007 (Layout::output_section_name): Us .data.rel.ro.local for any
13008 section which begins with that.
13009 * layout.h (class Layout): Update add_output_section_data
13010 declaration. Add relro_segment_ field.
13011 * output.cc (Output_section::Output_section): Initialize is_relro_
13012 and is_relro_local_ fields.
13013 (Output_segment::add_output_section): Group relro sections.
13014 (Output_segment::is_first_section_relro): New function.
13015 (Output_segment::maximum_alignment): If there is a relro section,
13016 align the segment to the common page size.
13017 (Output_segment::set_section_addresses): Track whether we are
13018 looking at relro sections. If the last section is a relro
13019 section, align to the common page size.
13020 (Output_segment::set_section_list_addresses): Add in_relro
13021 parameter. Change all callers. Align to the page size when
13022 moving from relro to non-relro section.
13023 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13024 segment.
13025 * output.h (class Output_section): Add is_relro_ and
13026 is_relro_local_ fields.
13027 (Output_section::is_relro): New function.
13028 (Output_section::set_is_relro): New function.
13029 (Output_section::is_relro_local): New function.
13030 (Output_section::set_is_relro_local): New function.
13031 (class Output_segment): Update declarations.
13032 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13033 * sparc.cc (Target_sparc::got_section): Likewise.
13034 * x86_64.cc (Target_x86_64::got_section): Likewise.
13035 * testsuite/relro_test_main.cc: New file.
13036 * testsuite/relro_test.cc: New file.
13037 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13038 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13039 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13040 (relro_test.so, relro_test_pic.o): New targets.
13041 * testsuite/Makefile.in: Rebuild.
13042
a984ee1d
ILT
130432008-05-16 Ian Lance Taylor <iant@google.com>
13044
01676dcd
ILT
13045 * output.cc (Output_segment::add_output_section): Remove front
13046 parameter.
13047 * output.h (class Output_segment): Remove
13048 add_initial_output_section and overloaded add_output_section.
13049 Update declaration of remaining add_output_section.
13050 * layout.cc (Layout::create_interp): Call add_output_section
13051 rather than add_initial_output_section.
13052 (Layout::finish_dynamic_section): Likewise.
13053
497897f9
ILT
13054 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13055 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13056 know the dynamic type.
13057 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13058 field. Initialize it in constructor.
13059 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13060 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13061 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13062 reloc.
13063
a984ee1d
ILT
13064 * output.cc (Output_reloc::get_address): Change return type to
13065 Elf_Addr.
13066 * output.h (class Output_reloc): Update get_address declaration.
13067 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13068 for section addresses.
13069
55ba0940
ILT
130702008-05-09 Ian Lance Taylor <iant@google.com>
13071
13072 PR 6493
13073 * gold.cc (gold_nomem): Use return value of write.
13074
75517b77
ILT
130752008-05-08 Ian Lance Taylor <iant@google.com>
13076
13077 * symtab.c (Symbol::init_base_output_data): Add version
13078 parameter. Change all callers.
13079 (Symbol::init_base_output_segment): Likewise.
13080 (Symbol::init_base_constant): Likewise.
13081 (Symbol::init_base_undefined): Likewise.
13082 (Sized_symbol::init_output_data): Likewise.
13083 (Sized_symbol::init_output_segment): Likewise.
13084 (Sized_symbol::init_constant): Likewise.
13085 (Sized_symbol::init_undefined): Likewise.
13086 (Symbol_table::do_define_in_output_data): If the new symbol has a
13087 version, mark it as the default.
13088 (Symbol_table::do_define_in_output_segment): Likewise.
13089 (Symbol_table::do_define_as_constant): Likewise.
13090 * symtab.h (class Symbol): Update declarations.
13091 (class Sized_symbol): Likewise.
13092 * resolve.cc (Symbol::override_version): New function.
c42e122e 13093 (Symbol::override_base): Call override_version.
75517b77
ILT
13094 (Symbol::override_base_with_special): Likewise.
13095 * testsuite/ver_script_8.script: New file.
13096 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13097 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13098 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13099 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13100
f1f70eae
ILT
131012008-05-06 Ian Lance Taylor <iant@google.com>
13102
f3e9c5c5
ILT
13103 PR 6049
13104 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13105 functions.
13106 (class General_options): Remove existing --undefined, and add
13107 --no-undefined instead. Add new --undefined as synonym for -u.
13108 * archive.cc (Archive::add_symbols): Check whether symbol was
13109 named with -u.
13110 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13111 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13112 all uses. Add IS_UNDEFINED. Update declarations to split
13113 different versions of init_base. Declare init_base_undefined.
13114 (Symbol::is_defined): Handle IS_UNDEFINED.
13115 (Symbol::is_undefined): Likewise.
13116 (Symbol::is_weak_undefined): Call is_undefined.
13117 (Symbol::is_absolute): Handle IS_CONSTANT.
13118 (class Sized_symbol): Update declarations to split different
13119 versions of init. Declare init_undefined.
13120 (class Symbol_table): Declare new functions.
13121 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13122 Change all callers.
13123 (Symbol::init_base_output_data): Likewise.
13124 (Symbol::init_base_output_segment): Likewise.
13125 (Symbol::init_base_constant): Likewise.
13126 (Symbol::init_base_undefined): New function.
13127 (Sized_symbol::init_object): Rename from init. Change all
13128 callers.
13129 (Sized_symbol::init_output_data): Likewise.
13130 (Sized_symbol::init_output_segment): Likewise.
13131 (Sized_symbol::init_constant): Likewise.
13132 (Sized_symbol::init_undefined): New function.
13133 (Symbol_table::add_undefined_symbols_from_command_line): New
13134 function.
13135 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13136 function.
13137 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13138 (Symbol::output_section): Likewise.
13139 (Symbol::set_output_section): Likewise.
13140 (Symbol_table::sized_finalize_symbol): Likewise.
13141 (Symbol_table::sized_write_globals): Likewise.
13142 * resolve.cc (Symbol_table::should_override): Likewise.
13143 (Symbol::override_base_with_special): Likewise.
13144
8bdcdf2c
ILT
13145 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13146 symbol, change it to have default visibility.
13147 * testsuite/protected_1.cc: New file.
13148 * testsuite/protected_2.cc: New file.
13149 * testsuite/protected_3.cc: New file.
13150 * testsuite/protected_main_1.cc: New file.
13151 * testsuite/protected_main_2.cc: New file.
13152 * testsuite/protected_main_3.cc: New file.
13153 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13154 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13155 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13156 (protected_1.so): New target.
13157 (protected_1_pic.o, protected_2_pic.o): New targets.
13158 (protected_3_pic.o): New target.
13159 (check_PROGRAMS): Add protected_2.
13160 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13161 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13162 * testsuite/Makefile.in: Rebuild.
13163
2b706932
ILT
13164 * options.h (DEFINE_var): Add set_user_set_##varname__.
13165 (DEFINE_bool_alias): New macro.
13166 (class General_options): Define -Bstatic using DEFINE_bool_alias
13167 rather than DEFINE_special. Add --undefined as an alias for -z
13168 defs.
13169 * options.cc (General_options::parse_Bstatic): Remove.
13170
d82a5bcc
ILT
13171 * options.h (class General_options): Add --fatal-warnings.
13172 * main.cc (main): Implement --fatal-warnings.
13173 * errors.h (Errors::warning_count): New function.
13174
f1f70eae
ILT
13175 * options.h (class General_options): Add -Bsymbolic-functions.
13176 * symtab.h (Symbol::is_preemptible): Check for
13177 -Bsymbolic-functions.
13178
8825ac63
ILT
131792008-05-05 Ian Lance Taylor <iant@google.com>
13180
d98bc257
ILT
13181 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13182 as noVARNAME rather than no-VARNAME.
13183 (class General_options): Add option -z combreloc.
13184 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13185 get_address.
13186 (Output_reloc::sort_before) [SHT_REL]: New function.
13187 (Output_reloc::sort_before) [SHT_RELA]: New function.
13188 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13189 Sort_relocs_comparison.
13190 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13191 parameter. Change all callers.
13192 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13193 sort_relocs parameter. Change all callers.
13194 * output.cc (Output_reloc::get_address): New function, broken out
13195 of write_rel.
13196 (Output_reloc::write_rel): Call it.
13197 (Output_reloc::compare): New function.
13198 (Output_data_reloc_base::do_write): Optionally sort relocs.
13199
60b2b4e7
ILT
13200 * configure.ac: If targ_extra_obj is set, link it in.
13201 * configure.tgt: Initialize all variables.
13202 (x86_64*): Set targ_extra_obj and targ_extra_size.
13203 * configure: Rebuild.
13204
8825ac63
ILT
13205 * object.cc (Sized_relobj::include_section_group): Adjust section
13206 indexes read from group data. Build vector to pass to
13207 layout_group.
13208 * layout.cc (Layout::layout_group): Add flags and shndxes
13209 parameters. Remove contents parameter. Change caller. Update
13210 explicit instantiations.
13211 * layout.h (class Layout): Update layout_group declaration.
13212 * output.cc (Output_data_group::Output_data_group): Add flags and
13213 input_shndxes parameters. Remove contents parameter. Change
13214 caller.
13215 (Output_data_group::do_write): Change input_sections_ to
13216 input_shndxes_.
13217 * output.h (class Output_data_group): Update constructor
13218 declaration. Rename input_sections_ to input_shndxes_.
13219 * testsuite/many_sections_test.cc: Add template.
13220
e94cf127
CC
132212008-04-30 Cary Coutant <ccoutant@google.com>
13222
4418b2d5
CC
13223 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13224
e94cf127
CC
13225 * layout.cc (Layout::include_section): Refactored check for debug
13226 info section.
13227 (Layout::add_comdat): Add new parameters. Change type
13228 of signature parameter. Add object and shndx to signatures table.
13229 (Layout::find_kept_object): New function.
13230 * layout.h: Include <cstring>.
13231 (Layout::is_debug_info_section): New function.
13232 (Layout::add_comdat): Add new parameters.
13233 (Layout::find_kept_object): New function.
13234 (Layout::Kept_section): New struct.
13235 (Layout::Signatures): Change type of map range.
13236 * object.cc (Relobj::output_section_address): New function.
13237 (Sized_relobj::include_section_group): Add new parameters. Change
13238 calls to Layout::add_comdat. Change to build table of kept comdat
13239 groups and table mapping discarded sections to kept sections.
13240 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13241 (Sized_relobj::do_layout): Change calls to include_section_group and
13242 include_linkonce_section.
13243 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13244 value to zero when section is discarded.
13245 (Sized_relobj::map_to_kept_section): New function.
13246 * object.h (Relobj::output_section_address): New function.
13247 (Relobj::Comdat_group): New type.
13248 (Relobj::find_comdat_group): New function.
13249 (Relobj::Comdat_group_table): New type.
13250 (Relobj::Kept_comdat_section): New type.
13251 (Relobj::Kept_comdat_section_table): New type.
13252 (Relobj::add_comdat_group): New function.
13253 (Relobj::set_kept_comdat_section): New function.
13254 (Relobj::get_kept_comdat_section): New function.
13255 (Relobj::comdat_groups_): New field.
13256 (Relobj::kept_comdat_sections_): New field.
13257 (Symbol_value::input_value): Update comment.
13258 (Sized_relobj::map_to_kept_section) New function.
13259 (Sized_relobj::include_linkonce_section): Add new parameter.
13260 * target-reloc.h (Comdat_behavior): New type.
13261 (get_comdat_behavior): New function.
13262 (relocate_section): Add code to map a discarded section to the
13263 corresponding kept section when applying a relocation.
13264
e4e5049b
CS
132652008-04-30 Craig Silverstein <csilvers@google.com>
13266
13267 * dwarf_reader.cc (next_generation_count): New static var.
13268 (Addr2line_cache_entry): New struct.
13269 (addr2line_cache): New static var.
13270 (Dwarf_line_info::one_addr2line): Added caching.
13271 (Dwarf_line_info::clear_addr2line_cache): New function.
13272 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13273 cache-size parameter.
13274 (Dwarf_line_info::one_addr2line_cache): New function.
13275 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13276 new cache-size argument to one_addr2line(), and clear cache.
13277
d09e9154
CC
132782008-04-28 Cary Coutant <ccoutant@google.com>
13279
13280 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13281 R_386_PC8 relocations.
13282
7ef73768
ILT
132832008-04-23 Ian Lance Taylor <iant@google.com>
13284
55438702
ILT
13285 * object.cc (Sized_relobj::include_section_group): Check for
13286 invalid section group.
13287
c165fb93
ILT
13288 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13289 header size.
13290
7ef73768
ILT
13291 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13292 than read for file header.
13293 * archive.cc (Archive::include_member): Likewise.
13294
6194aaab
L
132952008-04-23 Paolo Bonzini <bonzini@gnu.org>
13296
13297 * aclocal.m4: Regenerate.
13298 * configure: Regenerate.
13299
d491d34e
ILT
133002008-04-19 Ian Lance Taylor <iant@google.com>
13301
5ea2bac6
ILT
13302 * version.cc (version_string): Bump to 1.6.
13303
7bc3e21a
ILT
13304 * testsuite/Makefile.am (many_sections_r_test): New target.
13305 (many_sections_r_test_SOURCES): Remove.
13306 (many_sections_r_test_DEPENDENCIES): Remove.
13307 (many_sections_r_test_LDFLAGS): Remove.
13308 (many_sections_r_test_LDADD): Remove.
13309
7fcd3aa9
ILT
13310 * object.cc (Sized_relobj::do_add_symbols): Always pass
13311 local_symbol_count_ to add_from_relobj.
13312
4c94d6ae
ILT
13313 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13314 every thousand variables.
13315 * testsuite/Makefile.in: Rebuild.
13316
d491d34e
ILT
13317 * object.cc (Xindex::initialize_symtab_xindex): New function.
13318 (Xindex::read_symtab_xindex): New function.
13319 (Xindex::sym_xindex_to_shndx): New function.
13320 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13321 available.
13322 (Sized_relobj::do_initialize_xindex): New function.
13323 (Sized_relobj::do_read_symbols): Adjust section links.
13324 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13325 parameter. Change all callers.
13326 (Sized_relobj::include_section_group): Adjust section links and
13327 symbol section indexes.
13328 (Sized_relobj::do_layout): Adjust section links.
13329 (Sized_relobj::do_count_local_symbols): Adjust section links and
13330 symbol section indexes.
13331 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13332 ordinary and special symbols.
13333 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13334 dynsym_xindex parameters. Change all callers. Adjust section
13335 links. Use SHN_XINDEX when needed.
13336 (Sized_relobj::get_symbol_location_info): Adjust section links.
13337 Don't get fooled by special symbols.
13338 * object.h (class Xindex): Define.
13339 (class Object): Add xindex_ parameter. Declare virtual functoin
13340 do_initialize_xindex.
13341 (Object::adjust_sym_shndx): New function.
13342 (Object::set_xindex): New protected function.
13343 (class Symbol_value): Add is_ordinary_shndx_ field.
13344 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13345 (Symbol_value::value): Assert ordinary section.
13346 (Symbol_value::initialize_input_to_output_map): Likewise.
13347 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13348 Change all callers.
13349 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13350 all callers.
13351 (class Sized_relobj): Update declarations.
13352 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13353 parameter. Change all callers.
13354 (Sized_relobj::adjust_shndx): New function.
13355 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13356 field.
13357 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13358 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13359 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13360 (Sized_dynobj::read_dynsym_section): Adjust section links.
13361 (Sized_dynobj::read_dynamic): Likewise.
13362 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13363 section links.
13364 (Sized_dynobj::do_initialize_xindex): New function.
13365 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13366 do_initialize_xindex.
13367 (Sized_dynobj::adjust_shndx): New function.
13368 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13369 dynsym_xindex_ fields.
13370 (Layout::finalize): Add a call to set_section_indexes before
13371 creating the symtab sections.
13372 (Layout::set_section_indexes): Don't do anything if the section
13373 already has a section index.
13374 (Layout::create_symtab_sections): Add shnum parameter. Change
13375 caller. Create .symtab_shndx section if needed.
13376 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13377 caller.
13378 (Layout::allocated_output_section_count): New function.
13379 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13380 needed.
13381 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13382 fields. Update declarations.
13383 (Layout::symtab_xindex): New function.
13384 (Layout::dynsym_xindex): New function.
13385 (class Write_symbols_task): Add layout_ field.
13386 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13387 Change caller.
13388 * output.cc (Output_section_headers::Output_section_headers): Add
13389 shstrtab_section parameter. Change all callers.
13390 (Output_section_headers::do_sized_write): Store overflow values
13391 for section count and section string table section index in
13392 section header zero.
13393 (Output_file_header::do_sized_write): Check for overflow of
13394 section count and section string table section index.
13395 (Output_symtab_xindex::do_write): New function.
13396 (Output_symtab_xindex::endian_do_write): New function.
13397 * output.h (class Output_section_headers): Add shstrtab_section_.
13398 Update declarations.
13399 (class Output_symtab_xindex): Define.
13400 (Output_section::has_out_shndx): New function.
13401 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13402 field.
13403 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13404 Change all callers.
13405 (Sized_symbol::init): Likewise.
13406 (Symbol::output_section): Check for ordinary symbol.
13407 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13408 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13409 callers.
13410 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13411 Change all callers. Simplify handling of symbols from sections
13412 not included in the link.
13413 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13414 distinction.
13415 (Weak_alias_sorter::operator()): Assert that symbols are
13416 ordinary.
13417 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13418 distinction.
13419 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13420 parameters. Change all callers.
13421 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13422 symbol distinction. Use SHN_XINDEX when needed.
13423 (Symbol_table::write_section_symbol): Add symtab_xindex
13424 parameter. Change all callers.
13425 (Symbol_table::sized_write_section_symbol): Likewise. Use
13426 SHN_XINDEX when needed.
13427 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13428 declarations.
13429 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13430 (Symbol::is_defined): Check is_ordinary.
13431 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13432 (Symbol::is_absolute, Symbol::is_common): Likewise.
13433 (class Sized_symbol): Update declarations.
13434 (class Symbol_table): Update declarations.
13435 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13436 parameters. Change all callers.
13437 (Sized_symbol::override): Likewise.
13438 (Symbol_table::override): Likewise.
13439 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13440 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13441 is_ordinary, and orig_st_shndx parameters. Change all callers.
13442 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13443 to be in an ordinary section.
13444 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13445 object and is_ordinary parameters. Change all callers.
13446 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13447 Change all callers. Don't add undefined or non-ordinary symbols
13448 to reloc_map_.
13449 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13450 Change all callers.
13451 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13452 declarations.
13453 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13454 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13455 (Sized_relobj::relocate_sections): Likewise.
13456 * target-reloc.h (scan_relocs): Adjust section symbol index.
13457 (scan_relocatable_relocs): Likewise.
13458 * i386.cc (Scan::local): Check for ordinary symbols.
13459 * sparc.cc (Scan::local): Likewise.
13460 * x86_64.cc (Scan::local): Likewise.
13461 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13462 to symbol_section_and_value.
13463 * testsuite/many_sections_test.cc: New file.
13464 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13465 (check_PROGRAMS): Add many_sections_test.
13466 (many_sections_test_SOURCES): Define.
13467 (many_sections_test_DEPENDENCIES): Define.
13468 (many_sections_test_LDFLAGS): Define.
13469 (BUILT_SOURCES): Add many_sections_define.h.
13470 (many_sections_define.h): New target.
13471 (BUILT_SOURCES): Add many_sections_check.h.
13472 (many_sections_check.h): New target.
13473 (check_PROGRAMS): Add many_sections_r_test.
13474 (many_sections_r_test_SOURCES): Define.
13475 (many_sections_r_test_DEPENDENCIES): Define.
13476 (many_sections_r_test_LDFLAGS): Define.
13477 (many_sections_r_test_LDADD): Define.
13478 (many_sections_r_test.o): New target.
13479 * testsuite/Makefile.in: Rebuild.
13480
c5818ff1
CC
134812008-04-17 Cary Coutant <ccoutant@google.com>
13482
13483 * errors.cc (Errors::info): New function.
13484 (gold_info): New function.
13485 * errors.h (Errors::info): New function.
13486 * gold.h (gold_info): New function.
13487 * object.cc (Input_objects::add_object): Print trace output.
13488 * options.cc (options::parse_set): New function.
13489 (General_options::parse_wrap): Deleted.
13490 (General_options::General_options): Deleted initializer.
13491 * options.h (options::String_set): New typedef.
13492 (options::parse_set): New function.
13493 (DEFINE_set): New macro.
13494 (General_options::wrap): Changed to use DEFINE_set. Changed
13495 callers of any_wrap_symbols and is_wrap_symbol.
13496 (General_options::trace, General_options::trace_symbol):
13497 New options.
13498 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13499 (General_options::wrap_symbols_): Deleted.
13500 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13501
b5be4a7c
DM
135022008-04-17 David S. Miller <davem@davemloft.net>
13503
13504 * options.cc (General_options::parse_V): New function.
13505 * options.h: Add entries for -V and -Qy.
13506
155a0dd7
ILT
135072008-04-17 Ian Lance Taylor <iant@google.com>
13508
13509 * common.cc (Symbol_table::allocate_commons): Remove options
13510 parameter. Change caller.
13511 (Symbol_table::do_allocate_commons): Remove options parameter.
13512 Change caller. Just call do_allocate_commons_list twice.
13513 (Symbol_table::do_allocate_commons_list): New function, broken out
13514 of do_allocate_commons.
13515 * common.h (class Allocate_commons_task): Remove options_ field.
13516 Update constructor.
13517 * symtab.cc (Symbol_table::Symbol_table): Initialize
13518 tls_commons_.
13519 (Symbol_table::add_from_object): Put TLS common symbols on
13520 tls_commons_ list.
13521 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13522 which are IN_OUTPUT_DATA.
13523 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13524 allocate_commons and do_allocate_commons declarations. Declare
13525 do_allocate_commons_list.
13526 * gold.cc (queue_middle_tasks): Update creation of
13527 Allocate_commons_task to not pass options.
13528 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13529 (TLS_TEST_C_FLAGS): New variable.
13530 (tls_test_c_pic.o): New target.
13531 (tls_test_shared.so): Link in tls_test_c_pic.o.
13532 (tls_test_c_pic_ie.o): New target.
13533 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13534 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13535 (tls_test_c.o): New target.
13536 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13537 (tls_pic_test_LDADD): Likewise.
13538 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13539 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13540 (tls_test_c_gnu2.o): New target.
13541 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13542 tls_test_c_gnu2.o.
13543 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13544 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13545 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13546 * testsuite/tls_test.cc: Include "config.h".
13547 (t_last): Call t11_last.
13548 * testsuite/tls_test.h (t11, t11_last): Declare.
13549 * testsuite/tls_test_c.c: New file.
13550 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13551 * configure.ac: Check for OpenMP support.
13552 * configure, config.in, Makefile.in: Rebuild.
13553 * testsuite/Makefile.in: Rebuild.
13554
edfbb029
CC
135552008-04-16 Cary Coutant <ccoutant@google.com>
13556
13557 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13558 (Target_i386::tls_base_symbol_defined_): New field.
13559 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13560 (Target_i386::Scan::global): Likewise.
13561 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13562 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13563 (Target_x86_64::tls_base_symbol_defined_): New field.
13564 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13565 (Target_x86_64::Scan::global): Likewise.
13566
f3c69fca
CC
135672008-04-16 Cary Coutant <ccoutant@google.com>
13568
13569 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13570 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13571 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13572 building shared libraries.
13573 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13574 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13575 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13576 * testsuite/Makefile.in: Rebuild.
13577 * testsuite/weak_undef.h: New file.
13578 * testsuite/weak_undef_file1.cc: Add extra test cases.
13579 * testsuite/weak_undef_file2.cc: Likewise.
13580 * testsuite/weak_undef_test.cc: Likewise.
13581
7c414435
DM
135822008-04-16 David S. Miller <davem@davemloft.net>
13583
32b769e1
DM
13584 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13585 Add issued_non_pic_error_ field. Declare check_non_pic.
13586 (Target_sparc::Scan::check_non_pic): New function.
13587 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13588 (Target_sparc::Scan::global): Likewise.
13589
11936fb1
DM
13590 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13591 * configure: Rebuild.
13592
7c414435
DM
13593 * options.h (DEFINE_enable): New macro.
13594 (new_dtags): New enable option.
13595 (initfirst, interpose, loadfltr, nodefaultlib,
13596 nodelete, nodlopen, nodump): New -z options.
13597 * layout.cc (Layout:finish_dynamic_section): If new
13598 dtags enabled, emit DT_RUNPATH. Also, emit a
13599 DT_FLAGS_1 containing any specified -z flags.
13600
85c7bf8b
ILT
136012008-04-16 Ian Lance Taylor <iant@google.com>
13602
12c0daef
ILT
13603 * copy-relocs.cc: New file.
13604 * copy-relocs.h: New file.
13605 * reloc.cc: Remove Copy_relocs code.
13606 * reloc.h: Likewise.
13607 * reloc-types.h (struct Reloc_types) [both versions]: Add
13608 get_reloc_addend_noerror.
13609 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13610 variants of add_global which take an addend which must be zero.
13611 * i386.cc: Include "copy-relocs.h".
13612 (class Target_i386): Change type of copy_relocs_ to variable,
13613 update initializer.
13614 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13615 Change all callers.
13616 (Target_i386::do_finalize_sections): Change handling of
13617 copy_relocs_.
13618 * sparc.cc: Include "copy-relocs.h".
13619 (class Target_sparc): Change type of copy_relocs_ to variable,
13620 update initializer.
13621 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13622 Change all callers.
13623 (Target_sparc::do_finalize_sections): Change handling of
13624 copy_relocs_.
13625 * x86_64.cc: Include "copy-relocs.h".
13626 (class Target_x86_64): Change type of copy_relocs_ to variable,
13627 update initializer.
13628 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13629 class. Change all callers.
13630 (Target_x86_64::do_finalize_sections): Change handling of
13631 copy_relocs_.
13632 * Makefile.am (CCFILES): Add copy-relocs.cc.
13633 (HFILES): Add copy-relocs.h.
13634
4f4995b6
ILT
13635 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13636
85c7bf8b
ILT
13637 * testsuite/script_test_4.sh: Permit leading zeroes.
13638
4f2a9edd
ILT
136392008-04-15 Ian Lance Taylor <iant@google.com>
13640
e6188289
ILT
13641 * script-sections.cc (Script_sections::create_segments): Use
13642 header_size_adjustment even when there is enough room for the
13643 headers.
13644 * testsuite/script_test_4.sh: New file.
13645 * testsuite/script_test_4.t: New file.
13646 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13647 (check_DATA): Add script_test_4.stdout.
13648 (MOSTLYCLEANFILES): Likewise.
13649 (script_test_4): New target.
13650 (script_test_4.stdout): New target.
13651 * testsuite/Makefile.in: Rebuild.
13652
4f2a9edd
ILT
13653 * sparc.cc: Add definitions for Output_data_plt_sparc class
13654 constants.
13655
f5314dd5
DM
136562008-04-14 David S. Miller <davem@davemloft.net>
13657
13658 * sparc.cc: New file.
13659 * Makefile.am (TARGETSOURCES): Add sparc.cc
13660 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13661 * configure.tgt: Document targ_extra_size and
13662 targ_extra_big_endian. Add entries for sparc-* and
13663 sparc64-*.
13664 * configure.ac: Handle targ_extra_size and
13665 targ_extra_big_endian.
13666 * Makefile.in: Rebuild.
13667 * configure: Likewise.
13668 * po/POTFILES.in: Likewise.
13669 * po/gold.pot: Likewise.
13670
154e0e9a
ILT
136712008-04-14 Ian Lance Taylor <iant@google.com>
13672
13673 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13674 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13675 in the name/type/flags to section mapping. Don't call
13676 allocate_output_section.
13677 (Layout::choose_output_section): Change parameter from adjust_name
13678 to is_input_section. Don't permit input sections after sections
13679 are attached to segments. Don't call allocate_output_section.
13680 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13681 not write_enable_output_section.
13682 (Layout::make_output_section): Don't push to
13683 unattached_section_list_ nor call attach_to_segment. Call
13684 attach_section_to_segment if sections are attached.
13685 (Layout::attach_sections_to_segments): New function.
13686 (Layout::attach_section_to_segment): New function.
13687 (Layout::attach_allocated_section_to_segment): Rename from
13688 attach_to_segment. Remove flags parameter.
13689 (Layout::allocate_output_section): Remove function.
13690 (Layout::write_enable_output_section): Remove function.
13691 * layout.h (class Layout): Update for above changes. Add new
13692 field sections_are_attached_.
13693 * output.h (Output_section::update_flags_for_input_section): New
13694 function.
13695 * output.cc (Output_section::add_input_section): Call
13696 update_flags_for_input_section.
13697 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13698
009a67a2
CC
136992008-04-11 Cary Coutant <ccoutant@google.com>
13700
13701 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13702 thought unnecessary.
13703 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13704
759b1a24
ILT
137052008-04-11 Ian Lance Taylor <iant@google.com>
13706
13707 * output.h (class Output_section_data): Remove inline definition
13708 of set_addralign.
13709 * output.cc (Output_section_data::set_addralign): New function.
13710
c2b45e22
CC
137112008-04-11 Cary Coutant <ccoutant@google.com>
13712
13713 Add support for TLS descriptors for i386 and x86_64.
13714 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13715 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13716 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13717 GOT_TYPE_TLS_DESC.
13718 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13719 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13720 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13721 relocations.
13722 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13723 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13724 Fix problem with initial-exec relocations.
13725 (Target_i386::Relocate::relocate_tls): Likewise.
13726 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13727 relaxation.
13728 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13729 support for section-plus-offset dynamic table entries.
13730 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13731 (Output_data_dynamic::Dynamic_entry): Add support for
13732 section-plus-offset dynamic table entries.
13733 (Output_data_dynamic::Classification): Likewise.
13734 (Output_data_dynamic::classification_): Renamed offset_.
13735 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13736 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13737 (Target_x86_64::make_plt_section): New function.
13738 (Target_x86_64::reserve_tlsdesc_entries): New function.
13739 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13740 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13741 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13742 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13743 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13744 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13745 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13746 add extra PLT entry for TLS descriptors.
13747 (Output_data_plt_x86_64::got_): New field.
13748 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13749 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13750 fields.
13751 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13752 descriptors.
13753 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13754 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13755 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13756 R_386_TLS_DESC_CALL relocations.
13757 (Target_x86_64::Scan::global): Likewise.
13758 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13759 for TLS descriptors.
13760 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13761 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13762 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13763 GD-to-IE relaxation.
13764 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13765 and TLS_DESCRIPTORS.
13766 * Makefile.in: Rebuild.
13767 * configure: Rebuild.
13768 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13769 (tls_test_shared2.so): New target.
13770 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13771 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13772 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13773 (tls_shared_gd_to_ie_test_LDADD): New variable.
13774 (tls_shared_gnu2_gd_to_ie_test): New target.
13775 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13776 New targets.
13777 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13778 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13779 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13780 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13781 (tls_shared_gnu2_test): New target.
13782 (tls_test_gnu2_shared.so): New target.
13783 (tls_shared_gnu2_test_SOURCES): New variable.
13784 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13785 (tls_shared_gnu2_test_LDFLAGS): New variable.
13786 (tls_shared_gnu2_test_LDADD): New variable.
13787 * testsuite/Makefile.in: Rebuild.
13788 * testsuite/Makefile.
13789
83bfb6b7
ILT
137902008-04-11 Ian Lance Taylor <iant@google.com>
13791
13792 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13793 justsyms.t.
13794 * testsuite/Makefile.in: Rebuild.
13795
13796 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13797 long.
13798 * testsuite/script_test_2.cc (main): Adjust test.
13799
706e1f5e
ILT
138002008-04-11 David S. Miller <davem@davemloft.net>
13801 Ian Lance Taylor <iant@google.com>
13802
13803 * options.h (General_options): Add entries for '-Y' and
13804 '-relax'.
13805 * options.cc (General_options:finalize): If -Y was used, add those
13806 entries to the library path instead of the default "/lib" and
13807 "/usr/lib".
13808
7c98e6bb
DM
138092008-04-11 David S. Miller <davem@davemloft.net>
13810
13811 * testsuite/justsyms.t: Start at 0x100.
13812 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
13813 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13814 long.
13815 * testsuite/script_test_2.cc: Adjust string and section length
13816 checks.
7c98e6bb 13817
99a37bfd
ILT
138182008-04-09 Ian Lance Taylor <iant@google.com>
13819
2cefc357
ILT
13820 PR gold/5996
13821 * script-sections.cc (Sections_element::allocate_to_segment): Add
13822 orphan parameter.
13823 (Output_section_definition::allocate_to_segment): Likewise.
13824 (Orphan_output_section::allocate_to_segment): Likewise.
13825 (Script_sections::attach_sections_using_phdrs_clause): Don't
13826 propagate non-PT_LOAD segments to orphan sections.
13827 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13828 readelf rather than objdump.
13829 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13830 .interp section and PT_INTERP segment are the same size.
13831 * testsuite/Makefile.in: Rebuild.
13832
99a37bfd
ILT
13833 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13834 aliases for symbols defined in the same object.
13835 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13836 (weak_alias_test_SOURCES): New variable.
13837 (weak_alias_test_DEPENDENCIES): New variable.
13838 (weak_alias_test_LDFLAGS): New variable.
13839 (weak_alias_test_LDADD): New variable.
13840 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13841 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13842 (weak_alias_test_3.o): New target.
13843 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13844 * testsuite/weak_alias_test_main.cc: New file.
13845 * testsuite/weak_alias_test_1.cc: New file.
13846 * testsuite/weak_alias_test_2.cc: New file.
13847 * testsuite/weak_alias_test_3.cc: New file.
13848
780e49c5
ILT
138492008-04-08 Ian Lance Taylor <iant@google.com>
13850
cdb0b8f5
ILT
13851 * options.h (class General_options): Add --noinhibit-exec option.
13852 * main.cc (main): Check --noinhibit-exec.
13853
0864d551
ILT
13854 * options.h (class General_options): Define --wrap as a special
13855 option. Add wrap_symbols_ field.
13856 (General_options::any_wrap_symbols): New function.
13857 (General_options::is_wrap_symbol): New function.
13858 * options.cc (General_options::parse_wrap): New function.
13859 (General_options::General_options): Initialize wrap_symbols_.
13860 * symtab.cc (Symbol_table::wrap_symbol): New function.
13861 (Symbol_table::add_from_object): Handle --wrap.
13862 * symtab.h (class Symbol_table): Declare wrap_symbol.
13863 * target.h (Target::wrap_char): New function.
13864 (Target::Target_info): Add wrap_char field.
13865 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13866 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13867 * testsuite/testfile.cc (Target_test::test_target_info):
13868 Likewise.
13869
789aa6de
ILT
13870 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13871 there is one.
13872
2c38906f
ILT
13873 * layout.h (class Layout): Add added_eh_frame_data_ field.
13874 * layout.cc (Layout::Layout): Initialize new field.
13875 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13876 output section until we find a section we merged successfully.
13877 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13878 that the size be non-zero.
13879
780e49c5
ILT
13880 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13881 qualifier.
13882
7fcd0256
ILT
138832008-04-08 Craig Silverstein <csilvers@google.com>
13884
13885 * configure.ac: Export new conditional variable HAVE_ZLIB.
13886 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13887 on HAVE_ZLIB.
13888 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13889 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13890
6835af53
ILT
138912008-04-07 Ian Lance Taylor <iant@google.com>
13892
e24f324c
ILT
13893 * version.cc (version_string): Set to "1.5".
13894
a036edd8
ILT
13895 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13896 Add issued_non_pic_error_ field. Declare check_non_pic.
13897 (Target_x86_64::Scan::check_non_pic): New function.
13898 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13899 (Target_x86_64::Scan::global): Likewise.
13900
624f8810
ILT
13901 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13902 addend parameter. Change caller. Handle merge sections.
13903 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13904 Address to Addend. Don't add in the result of
13905 local_section_offset, pass down the addend and use the returned
13906 value.
13907 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13908 Update declarations of local_section_offset and symbol_value.
13909 * testsuite/two_file_test_1.cc (t18): New function.
13910 * testsuite/two_file_test_2.cc (f18): New function.
13911 * testsuite/two_file_test_main.cc (main): Call t18.
13912 * testsuite/two_file_test.h (t18, f18): Declare.
13913
6835af53
ILT
13914 * configure.ac: Don't test for objdump, c++filt, or readelf.
13915 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13916 conditionals.
13917 (TEST_READELF): New variable.
13918 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13919 (check_PROGRAMS): Add two_file_strip_test.
13920 (two_file_strip_test): New target.
13921 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13922 (two_file_same_shared_strip_test_SOURCES): New variable.
13923 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13924 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13925 (two_file_same_shared_strip_test_LDADD): New variable.
13926 (two_file_shared_strip.so): New target.
13927 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13928 (ver_test_5.syms, ver_test_7.syms): Likewise.
13929 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13930 (strip_test_3.stdout): Use TEST_OBJDUMP.
13931 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13932
86925eef
CC
139332008-04-04 Cary Coutant <ccoutant@google.com>
13934
13935 * symtab.h (Symbol::is_weak_undefined): New function.
13936 (Symbol::is_strong_undefined): New function.
13937 (Symbol::is_absolute): New function.
13938 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13939 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13940 absolute symbols.
13941 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13942 (weak_undef_test): New target.
13943 * testsuite/Makefile.in: Rebuild.
13944 * testsuite/weak_undef_file1.cc: New file.
13945 * testsuite/weak_undef_file2.cc: New file.
13946 * testsuite/weak_undef_test.cc: New file.
13947
126f3ece
ILT
139482008-04-03 Craig Silverstein <csilvers@google.com>
13949
13950 * compressed_output.h (class Output_compressed_section): Use
13951 unsigned buffer.
13952 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13953 add zlib header.
13954 (zlib_compressed_suffix): Removed.
13955 (Output_compressed_section::set_final_data_size): Use unsigned
13956 buffers.
13957 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13958 Fix linker invocation.
13959 (flagstest_o_specialfile_and_compress_debug_sections):
13960 Likewise.
13961 * testsuite/Makefile.in: Regenerated.
13962
deae2a14
DM
139632008-04-02 David S. Miller <davem@davemloft.net>
13964
13965 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13966 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13967
70752818
ILT
139682008-04-02 Craig Silverstein <csilvers@google.com>
13969
13970 * TODO: New file.
13971
39d0cb0e
ILT
139722008-04-02 Ian Lance Taylor <iant@google.com>
13973
13974 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13975 parameters. Update for new key type to views_. Change all
13976 callers.
13977 (File_read::read): Adjust for byteshift in returned view.
13978 (File_read::add_view): New function, broken out of
13979 find_and_make_view.
13980 (File_read::make_view): New function, broken out of
13981 find_and_make_view.
13982 (File_read::find_or_make_view): Add offset and aligned
13983 parameters. Rewrite accordingly. Change all callers.
13984 (File_read::get_view): Add offset and aligned parameters. Adjust
13985 for byteshift in return value.
13986 (File_read::get_lasting_view): Likewise.
13987 * fileread.h (class File_read): Update declarations.
13988 (class File_read::View): Add byteshift_ field. Add byteshift to
13989 constructor. Add byteshift method.
13990 * archive.h (Archive::clear_uncached_views): New function.
13991 (Archive::get_view): Add aligned parameter. Change all callers.
13992 * object.h (Object::get_view): Add aligned parameter. Change all
13993 callers.
13994 (Object::get_lasting_view): Likewise.
13995
13996 * fileread.cc (File_read::release): Don't call clear_views if
13997 there are multiple objects.
13998 * fileread.h (File_read::clear_uncached_views): New function.
13999 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14000 on the archive.
14001
a1207466
CC
140022008-03-31 Cary Coutant <ccoutant@google.com>
14003
14004 Add thin archive support.
14005 * archive.cc (Archive::armagt): New const.
14006 (Archive::setup): Remove task parameter and calls to unlock.
14007 (Archive::unlock_nested_archives): New function.
14008 (Archive::read_header): Add nested_off parameter. Change
14009 all callers.
14010 (Archive::interpret_header): Likewise.
14011 (Archive::include_all_members): Change to handle thin
14012 archives.
14013 (Archive::include_member): Likewise.
14014 * archive.h (Archive::Archive): Add new parameters and
14015 initializers.
14016 (Archive::armagt): New const.
14017 (Archive::setup): Remove task parameter.
14018 (Archive::unlock_nested_archives): New function.
14019 (Archive::read_header): Add nested_off parameter.
14020 (Archive::interpret_header): Likewise.
14021 (Archive::Nested_archive_table): New typedef.
14022 (Archive::is_thin_archive_): New field.
14023 (Archive::nested_archives_): New field.
14024 (Archive::options_): New field.
14025 (Archive::dirpath_): New field.
14026 (Archive::task_): New field.
14027 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14028 for thin archives. Pass additional parameters to
14029 Archive::Archive. Unlock the archive file after calling
14030 Archive::setup.
cd536b21 14031
479f6503
ILT
140322008-03-29 Ian Lance Taylor <iant@google.com>
14033
686c8caf
ILT
14034 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14035 version symbol to be local.
14036 * testsuite/ver_test_4.sh: New file.
14037 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14038 (check_DATA): Add ver_test_4.syms.
14039 (ver_test_4.syms): New target.
14040 * testsuite/Makefile.in: Rebuild.
14041
ab794b6b
ILT
14042 * output.cc
14043 (Output_section::Input_section_sort_entry::has_priority): New
14044 function.
14045 (Output_section::Input_section_sort_entry::match_file_name): New
14046 function.
14047 (Output_section::Input_section_sort_entry::match_section_name):
14048 Remove.
14049 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14050 Remove.
14051 (Output_section::Input_section_sort_entry::match_section_file):
14052 Remove.
14053 (Output_section::Input_section_sort_compare::operator()): Rewrite
14054 using new Input_section_sort_entry functions. Sort crtbegin and
14055 crtend first. Sort sections with no priority before sections with
14056 a priority.
14057 * testsuite/initpri1.c (d3): Check j != 4.
14058 (cd5): New constructor/destructor function.
14059 (main): Check j != 2.
14060
479f6503
ILT
14061 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14062 new symbol when resolving, don't call set_is_default.
14063 * testsuite/ver_test_7.cc: New file.
14064 * testsuite/ver_test_7.sh: New file.
14065 * testsuite/Makefile.am (ver_test_7.so): New target.
14066 (ver_test_7.o): New target.
14067 (check_SCRIPTS): Add ver_test_7.sh.
14068 (check_DATA): Add ver_test_7.syms.
14069 (ver_test_7.syms): New target.
14070
2fd32231
ILT
140712008-03-28 Ian Lance Taylor <iant@google.com>
14072
14073 * layout.cc (Layout::layout): If we see an input section with a
14074 name that needs sorting, set the must_sort flag for the output
14075 section.
14076 (Layout::make_output_section): If the name of the output section
14077 indicates that it might require sorting, set the may_sort flag.
14078 * output.h (Output_section::may_sort_attached_input_sections): New
14079 function.
14080 (Output_section::set_may_sort_attached_input_sections): New
14081 function.
14082 (Output_section::must_sort_attached_input_sections): New
14083 function.
14084 (Output_section::set_must_sort_attached_input_sections): New
14085 function.
14086 (class Output_section): Declare Input_section_sort_entry. Define
14087 Input_section_sort_compare. Declare
14088 sort_attached_input_sections. Add new fields:
14089 may_sort_attached_input_sections_,
14090 must_sort_attached_input_sections_,
14091 attached_input_sections_are_sorted_.
14092 * output.cc (Output_section::Output_section): Initialize new
14093 fields.
14094 (Output_section::add_input_section): Add an entry to
14095 input_sections_ if may_sort or must_sort are true.
14096 (Output_section::set_final_data_size): Call
14097 sort_attached_input_sections if necessary.
14098 (Output_section::Input_section_sort_entry): Define new class.
14099 (Output_section::Input_section_sort_compare::operator()): New
14100 function.
14101 (Output_section::sort_attached_input_sections): New function.
14102 * configure.ac: Check whether the compiler supports constructor
14103 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14104 * testsuite/initpri1.c: New file.
14105 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14106 CONSTRUCTOR_PRIORITY.
14107 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14108 (initpri1_LDFLAGS): New variable.
14109 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14110
18e6b24e
ILT
141112008-03-27 Ian Lance Taylor <iant@google.com>
14112
49bdd526
ILT
14113 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14114 * testsuite/common_test_1.c: New file.
14115 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14116 (common_test_1_SOURCES): New variable.
14117 (common_test_1_DEPENDENCIES): New variable.
14118 (common_test_1_LDFLAGS): New variable.
14119
18e6b24e
ILT
14120 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14121 and commons_ correctly when NAME/VERSION does not override
14122 NAME/NULL.
14123 * testsuite/ver_test_6.c: New file.
14124 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14125 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14126 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14127
04bf7072
ILT
141282008-03-26 Ian Lance Taylor <iant@google.com>
14129
5871526f
ILT
14130 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14131 of an undefined symbol from a version script.
14132 * testsuite/Makefile.am (ver_test_5.so): New target.
14133 (ver_test_5.o): New target.
14134 (check_SCRIPTS): Add ver_test_5.sh.
14135 (check_DATA): Add ver_test_5.syms.
14136 (ver_test_5.syms): New target.
14137 * testsuite/ver_test_5.cc: New file.
14138 * testsuite/ver_test_5.script: New file.
14139 * testsuite/ver_test_5.sh: New file.
14140 * Makefile.in, testsuite/Makefile.in: Rebuild.
14141
04bf7072
ILT
14142 PR gold/5986
14143 Fix problems building gold with gcc 4.3.0.
14144 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14145 (gold_error_at_location, gold_warning_at_location): Use it.
14146 * configure.ac: Check whether we can compile and use a template
14147 function with a printf attribute.
14148 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14149 when jumping over bytes.
14150 * object.cc: Instantiate Object::read_section_data.
14151 * debug.h: Include <cstring>
14152 * dwarf_reader.cc: Include <algorithm>
14153 * main.cc: Include <cstring>.
14154 * options.cc: Include <cstring>.
14155 * output.cc: Include <cstring>.
14156 * script.cc: Include <cstring>.
14157 * script.h: Include <string>.
14158 * symtab.cc: Include <cstring> and <algorithm>.
14159 * target-select.cc: Include <cstring>.
14160 * version.cc: Include <string>.
14161 * testsuite/testmain.cc: Include <cstdlib>.
14162 * configure, config.in: Rebuild.
14163
874c5b28
ILT
141642008-03-25 Ian Lance Taylor <iant@google.com>
14165
819d6c3a
ILT
14166 * options.cc: Include "../bfd/bfdver.h".
14167 (options::help): Print bug reporting address.
14168
f4b2c6f5
ILT
14169 * version.cc (print_version): Adjust output for current value of
14170 BFD_VERSION_STRING.
14171
14172 * NEWS: New file.
14173
e96caa79
ILT
14174 * options.cc (options::help): Print list of supported targets.
14175 * target-select.h: Include <vector>.
14176 (class Target_selector): Make machine_, size_, and is_big_endian_
14177 fields const. Add bfd_name_ and instantiated_target_ fields.
14178 (Target_selector::Target_selector): Add bfd_name parameter.
14179 (Target_selector::recognize): Make non-virtual, call
14180 do_recognize.
14181 (Target_selector::recognize_by_name): Make non-virtual, call
14182 do_recognize_by_name.
14183 (Target_selector::supported_names): New function.
14184 (Target_selector::bfd_name): New function.
14185 (Target_selector::do_instantiate_target): New pure virtual
14186 function.
14187 (Target_selector::do_recognize): New virtual function.
14188 (Target_selector::do_recognize_by_name): New virtual function.
14189 (Target_selector::instantiate_target): New private function.
14190 (supported_target_names): Declare.
14191 * target-select.cc (Target_selector::Target_selector): Update for
14192 new parameter and fields.
14193 (select_target_by_name): Check that the name matches before
14194 calling recognize_by_name.
14195 (supported_target_names): New function.
14196 * i386.cc (class Target_selector_i386): Update Target_selector
14197 constructor call. Remove recognize and recognize_by_name. Add
14198 do_instantiate_target.
14199 * x86_64.cc (class Target_selector_x86_64): Likewise.
14200 * testsuite/testfile.cc (class Target_selector_test): Update for
14201 changes to Target_selector.
14202
874c5b28
ILT
14203 * README: Rewrite, with some notes on unsupported features.
14204
0a65a3a7
CC
142052008-03-24 Cary Coutant <ccoutant@google.com>
14206
14207 * i386.cc (Target_i386::Got_type): New enum declaration.
14208 (Target_i386::Scan::local): Updated callers of Output_data_got
14209 member functions.
14210 (Target_i386::Scan::global): Likewise.
14211 (Target_i386::Relocate::relocate): Likewise.
14212 (Target_i386::Relocate::relocate_tls): Likewise.
14213 * object.h (Got_offset_list): New class.
14214 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14215 (Sized_relobj::local_got_offset): Likewise.
14216 (Sized_relobj::set_local_got_offset): Likewise.
14217 (Sized_relobj::local_has_tls_got_offset): Removed.
14218 (Sized_relobj::local_tls_got_offset): Removed.
14219 (Sized_relobj::set_local_tls_got_offset): Removed.
14220 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14221 * output.cc (Output_data_got::add_global): Added got_type parameter.
14222 (Output_data_got::add_global_with_rel): Likewise.
14223 (Output_data_got::add_global_with_rela): Likewise.
14224 (Output_data_got::add_global_pair_with_rel): New function.
14225 (Output_data_got::add_global_pair_with_rela): New function.
14226 (Output_data_got::add_local): Added got_type parameter.
14227 (Output_data_got::add_local_with_rel): Likewise.
14228 (Output_data_got::add_local_with_rela): Likewise.
14229 (Output_data_got::add_local_pair_with_rel): New function.
14230 (Output_data_got::add_local_pair_with_rela): New function.
14231 (Output_data_got::add_global_tls): Removed.
14232 (Output_data_got::add_global_tls_with_rel): Removed.
14233 (Output_data_got::add_global_tls_with_rela): Removed.
14234 (Output_data_got::add_local_tls): Removed.
14235 (Output_data_got::add_local_tls_with_rel): Removed.
14236 (Output_data_got::add_local_tls_with_rela): Removed.
14237 * output.h (Output_data_got::add_global): Added got_type parameter.
14238 (Output_data_got::add_global_with_rel): Likewise.
14239 (Output_data_got::add_global_with_rela): Likewise.
14240 (Output_data_got::add_global_pair_with_rel): New function.
14241 (Output_data_got::add_global_pair_with_rela): New function.
14242 (Output_data_got::add_local): Added got_type parameter.
14243 (Output_data_got::add_local_with_rel): Likewise.
14244 (Output_data_got::add_local_with_rela): Likewise.
14245 (Output_data_got::add_local_pair_with_rel): New function.
14246 (Output_data_got::add_local_pair_with_rela): New function.
14247 (Output_data_got::add_global_tls): Removed.
14248 (Output_data_got::add_global_tls_with_rel): Removed.
14249 (Output_data_got::add_global_tls_with_rela): Removed.
14250 (Output_data_got::add_local_tls): Removed.
14251 (Output_data_got::add_local_tls_with_rel): Removed.
14252 (Output_data_got::add_local_tls_with_rela): Removed.
14253 * resolve.cc (Symbol::override_base_with_special): Removed
14254 reference to has_got_offset_ field.
14255 * symtab.cc (Symbol::init_fields): Replaced initialization
14256 of got_offset_ with got_offsets_. Removed initialization
14257 of has_got_offset_
53fcba31 14258 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
14259 (Symbol::got_offset): Likewise.
14260 (Symbol::set_got_offset): Likewise.
14261 (Symbol::has_tls_got_offset): Removed.
14262 (Symbol::tls_got_offset): Removed.
14263 (Symbol::set_tls_got_offset): Removed.
14264 (Symbol::got_offset_): Removed.
14265 (Symbol::tls_mod_got_offset_): Removed.
14266 (Symbol::tls_pair_got_offset_): Removed.
14267 (Symbol::got_offsets_): New field.
14268 (Symbol::has_got_offset): Removed.
14269 (Symbol::has_tls_mod_got_offset): Removed.
14270 (Symbol::has_tls_pair_got_offset): Removed.
14271 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14272 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14273 member functions.
14274 (Target_x86_64::Scan::global): Likewise.
14275 (Target_x86_64::Relocate::relocate): Likewise.
14276 (Target_x86_64::Relocate::relocate_tls): Likewise.
14277
bd52eafb
BE
142782008-03-25 Ben Elliston <bje@au.ibm.com>
14279
14280 * yyscript.y: Fix spelling error in comment.
14281
8b105e34
ILT
142822008-03-24 Ian Lance Taylor <iant@google.com>
14283
8ed814a9
ILT
14284 * options.h (class General_options): Define build_id option.
14285 * layout.h (class Layout): Declare write_build_id, create_note,
14286 create_build_id. Add build_id_note_ member.
14287 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14288 "libiberty.h", "md5.h", "sha1.h".
14289 (Layout::Layout): Initialize eh_frame_data_,
14290 eh_frame_hdr_section_, and build_id_note_.
14291 (Layout::finalize): Call create_build_id.
14292 (Layout::create_note): New function, broken out of
14293 Layout::create_gold_note.
14294 (Layout::create_gold_note): Call create_note.
14295 (Layout::create_build_id): New function.
14296 (Layout::write_build_id): New function.
14297 (Close_task_runner::run): Call write_build_id.
14298
8b105e34
ILT
14299 * x86_64.cc: Correct license to GPLv3.
14300
086a1841
ILT
143012008-03-23 Ian Lance Taylor <iant@google.com>
14302
14303 * options.cc: Include "demangle.h".
14304 (parse_optional_string): New function.
14305 (parse_long_option): Handle takes_optional_argument.
14306 (parse_short_option): Update dash_z initializer. Handle
14307 takes_optional_argument.
14308 (General_options::General_options): Initialize do_demangle_.
14309 (General_options::finalize): Set do_demangle_. Handle demangling
14310 style.
14311 * options.h (parse_optional_string): Declare.
14312 (struct One_option): Add optional_arg field. Update constructor.
14313 Update call constructor calls. Add takes_optional_argument
14314 function.
14315 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14316 (DEFINE_optional_string): Define.
14317 (General_options::demangle): Change from DEFINE_bool to
14318 DEFINE_optional_string.
14319 (General_options::no_demangle): New function.
14320 (General_options::do_demangle): New function.
14321 (General_options::set_do_demangle): New function.
14322 (General_options::execstack_status_): Move definition to end of
14323 class definition.
14324 (General_options::static_): Likewise.
14325 (General_options::do_demangle_): New field.
14326 * object.cc (big_endian>::get_symbol_location_info): Call
14327 Options::do_demangle, not Options::demangle.
14328 * symtab.cc (demangle): Likewise.
14329
cbb93e63
ILT
143302008-03-22 Ian Lance Taylor <iant@google.com>
14331
14332 * gold.h: Include <cstddef> and <sys/types.h>
14333 * options.h: Include <cstring>.
14334
ec531623
ILT
143352008-03-21 Ian Lance Taylor <iant@google.com>
14336
14337 * Added source code to GNU binutils.
752937aa
NC
14338\f
14339Copyright (C) 2008-2012 Free Software Foundation, Inc.
14340
14341Copying and distribution of this file, with or without modification,
14342are permitted in any medium without royalty provided the copyright
14343notice and this notice are preserved.
14344
14345Local Variables:
14346mode: change-log
14347left-margin: 8
14348fill-column: 74
14349version-control: never
14350End:
This page took 0.901435 seconds and 4 git commands to generate.